Improved shown idoit information. Moved title of object to foreground (title is more important then the id).

This commit is contained in:
Martin Edenhofer 2018-01-25 14:30:21 +01:00
parent 8895e878f0
commit 95779712b5
3 changed files with 13 additions and 8 deletions

View file

@ -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) =>

View file

@ -5,19 +5,17 @@
<table class="table">
<thead>
<th style="width: 30px"></th>
<th style="width: 50px"><%- @T('ID') %></th>
<th style="width: 100px"><%- @T('ID') %></th>
<th><%- @T('Name') %></th>
<th><%- @T('Status') %></th>
<th><%- @T('Link') %></th>
<th style="width: 100px;"><%- @T('Status') %></th>
</thead>
<tbody>
<% for item in @items: %>
<tr>
<td><input type="checkbox" name="object_id" value="<%= item.id %>"/></td>
<td><%= item.id %></td>
<td><%= item.title %></td>
<td title="<%= item.id %>"><%= item.id %></td>
<td title="<%= item.title %>"><a href="<%- item.link %>" target="_blank"><%= item.title %></a></td>
<td><%= item.cmdb_status_title %></td>
<td><a href="<%- item.link %>" target="_blank">i-doit</td>
</tr>
<% end %>
</tbody>

View file

@ -1,12 +1,12 @@
<% for object in @objects: %>
<div class="sidebar-block">
<label class="horizontal">
<%- @T(object.title) %>
<%- @T('ID') %>: <%- @T(object.id) %>
<div class="list-item-delete js-delete" data-object-id="<%= object.id %>" data-type="remove">
<%- @Icon('diagonal-cross') %>
</div>
</label>
<%- @T('ID') %>: <a href="<%- object.link %>" target="_blank"><%= object.id %><br></a>
<a href="<%- object.link %>" target="_blank"><%= object.title %><br></a>
<%- @T('Status') %>: <%= object.cmdb_status_title %><br>
<%- @T('Type') %>: <%= object.type_title %><br>
</div>