From 95779712b5be762d86fa097e3470cc9b57927901 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Thu, 25 Jan 2018 14:30:21 +0100 Subject: [PATCH] Improved shown idoit information. Moved title of object to foreground (title is more important then the id). --- .../app/controllers/idoit_object_selector.coffee | 7 +++++++ .../app/views/integration/idoit_object_result.jst.eco | 10 ++++------ .../app/views/ticket_zoom/sidebar_idoit.jst.eco | 4 ++-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/app/controllers/idoit_object_selector.coffee b/app/assets/javascripts/app/controllers/idoit_object_selector.coffee index 8c108c358..2a7053e50 100644 --- a/app/assets/javascripts/app/controllers/idoit_object_selector.coffee +++ b/app/assets/javascripts/app/controllers/idoit_object_selector.coffee @@ -3,6 +3,7 @@ class App.IdoitObjectSelector extends App.ControllerModal buttonCancel: true buttonSubmit: true head: 'i-doit' + lastSearchTermEmpty: false content: -> @ajax( @@ -44,18 +45,24 @@ class App.IdoitObjectSelector extends App.ControllerModal '' search: (filter) => + if _.isEmpty(filter.type) && _.isEmpty(filter.title) + @lastSearchTermEmpty = true + @renderResult() + return if _.isEmpty(filter.type) delete filter.type if _.isEmpty(filter.title) delete filter.title else filter.title = "%#{filter.title}%" + @lastSearchTermEmpty = false @ajax( id: 'idoit-object-selector' type: 'POST' url: "#{@apiPath}/integration/idoit" data: JSON.stringify(method: 'cmdb.objects', filter: filter) success: (data, status, xhr) => + return if @lastSearchTermEmpty @renderResult(data.response.result) error: (xhr, status, error) => diff --git a/app/assets/javascripts/app/views/integration/idoit_object_result.jst.eco b/app/assets/javascripts/app/views/integration/idoit_object_result.jst.eco index e2d4dbe76..99ffc1292 100644 --- a/app/assets/javascripts/app/views/integration/idoit_object_result.jst.eco +++ b/app/assets/javascripts/app/views/integration/idoit_object_result.jst.eco @@ -5,19 +5,17 @@ - + - - + <% for item in @items: %> - - + + - <% end %> diff --git a/app/assets/javascripts/app/views/ticket_zoom/sidebar_idoit.jst.eco b/app/assets/javascripts/app/views/ticket_zoom/sidebar_idoit.jst.eco index 3b4dbbb22..fc3740083 100644 --- a/app/assets/javascripts/app/views/ticket_zoom/sidebar_idoit.jst.eco +++ b/app/assets/javascripts/app/views/ticket_zoom/sidebar_idoit.jst.eco @@ -1,12 +1,12 @@ <% for object in @objects: %>
<%- @T('ID') %><%- @T('ID') %> <%- @T('Name') %><%- @T('Status') %><%- @T('Link') %><%- @T('Status') %>
<%= item.id %><%= item.title %><%= item.id %><%= item.title %> <%= item.cmdb_status_title %>i-doit