Items

Items (are also known as Objects) can be eg. assets, users, services, products, systems, computers, groups, software, cost centers, invoices, etc. Every item can be role based and searchable within a specific workspace. Objects can also have related actions, cost, attachments or attributes.

Indexing items

The maximum size for an item is 100 mb and for attributes it is 32 Kb.

In Onify, we index items in these 3 ways:

  • Full indexing - Get all items from data source
  • Delta (updates) indexing - Get updated items from data source
  • Single item indexing - Get specific item from data source

Indexing is best done via Connector but can also be index direct via our API. See API section below.

Configuration

Item templates

Item templates are templates that is used in different views when listing or viewing one or more items. The items templates are associated to a specific item type and can then be role based and also applied to different workspaces.

NOTE: You can also translate item templates, see Strings

Item templates for card view

You are able to change the way items are listed in the card view of the item results page by editing the /public/app/config/itemTemplates.json under resources.

Here is the default contents of itemTemplates.json:

{
	"defaultitem" : [{
			"color" : "#4a90e2",
			"role" : [],
			"order" : 100,
			"showActions" : 1,
			"workspace" : [],
			"mapping" : {
				"title" : "{{item.name}}",
				"key" : "{{item.key}}",
				"action" : "item.action | prepareAction : item.key",
				"tag" : "item.tag | prepareFilter : 'tag'",
				"image": "{{item.icon}}",
				"subtitle1" : "{{item.description}}",
				"status" : "item.status ? \"item.status | prepareFilter : 'status'\" : ''",
				"bulkSupport" : "item.cost.cart ? \"true\" : \"item.action | checkBulkSupport\"",
				"subtitle2" : "item.owner | prepareFilter : 'owner'",
				"attachment" : "item.attachment | getField",
				"information" : [{
						"type" : "filter",
						"name" : "Attribute",
						"value" : "item.attribute | prepareFilter : 'attribute'"
					}
				]
			}
		}
	]
}
Element types/templates

Here are the different element types that can be used in the itemTemplates.json.

Card settings

  • color - Color for the item card left bar
  • role - Role that has access to this item template. Is an array. If empty, view is valid for all roles.
  • order - Order (priority) to show the item template of the if it matches multiple roles or workspaces. From high to low.
  • showActions - If actions should be visible (1 = yes, 0 = no)
  • showMore - If card should be expanded when listed (1 = yes, 0 = no)
  • workspace - Which workspaces that this template should be valid for. Is an array. If empty, view is valid for all workspaces.
  • partialsTemplates - Set custom partials templates. Is an array.

Mapping elements

Here we map data from each item into elements.

  • title - Title for the card
  • key - The unique key
  • action - Actions to to be visible
  • tag - Tags
  • image - Image/icon
  • subtitle1 - Subtitle 1
  • subtitle2 - Subtitle 2
  • status - Status to show for the item
  • bulkSupport - If we should show the checkbox for bulk support
  • attachment - List attachments for the item
  • information - List all or specific attributes for the item, see more details below
  • customAttribute - List custom attributes, see more details below
  • additionalinfo - Additional information to put in the auto complete search result on the workspace homepage
  • customClass - Custom CSS class for the item card
  • htmlTemplate - Specify custom html template
  • autocompleteHtmlTemplate - Specify custom html template for autocomplete search on workspace homepage

Advanced mapping functions

  • prepareAction - Prepare list of actions
  • prepareFilter - Prepare filter
  • uppercaseField - Convert value to uppercase
  • checkBulkSupport - Check if action support bulk selection
  • prepareDescription - Prepare text/description to support HTML
  • dateFormat - Format date (eg. {{item.attribute.approved_date | dateFormat : 'YYYY-MM-DD HH:mm'}})

Attribute (information field) element types

You can either list all attributes or specify specific attributes. If you want to list all attributes, here is an example:

				"information" : [{
						"type" : "filter",
						"name" : "Attribute",
						"value" : "item.attribute | prepareFilter : 'attribute'"
					}
				]

If you want to list specific attributes, you can use these types of elements

  • text - List attribute as plain text
  • link - Add a link for the attribute
  • filter - Ability to filter items based on with same value

Here are some examples:

					{
						"name" : "Email",
						"type" : "link",
						"link" : "mailto:{{item.attribute.email}}",
						"value" : "{{item.attribute.email}}"
					},
					{
						"name" : "Mobile phone",
						"type" : "link",
						"link" : "tel:{{item.attribute.mobilephone}}",
						"value" : "{{item.attribute.mobilephone}}"
					},
					{
						"name" : "Company",
						"type" : "filter",
						"value" : "{{item.attribute.company}}"
					},
					{
						"name" : "User type",
						"type" : "filter",
						"value" : "{{item.attribute.user_type}}"
					},
					{
						"name" : "Last failed login",
						"value" : "{{item.attribute.lastfailedlogin_ad | dateFormat : 'YYYY-MM-DD HH:mm'}}"
					},

Custom attributes section (customAttribute)

You can create your own custom attribute section like this:

				"customAttribute" : {
						"name" : " {{t '_itemcard.headers.compatibility'}}",
						"fields" : [{
							"name" : "{{t 'itemcard.attribute.compatible_with'}}",
							"color" : "#e5eaed",
							"value" : "{{item.attribute._compatible_with}}"
						}]
				}

Tooltips

We can also add tooltips to both field name and value like this:

					{
						"name": "serial_number",
						"tooltip": "Serial Number of the computer", 
						"value": "{{item.attribute.serial_number}}"
					},
					{
						"type" : "filter",
						"name": "manufacturer",
						"tooltip": "Manufacturer of the asset", 
						"value": "{{item.attribute.manufacturer}}",
						"value_details": "{{item.attribute.manufacturer_details}}"
					},

The tooltip is used when user hovers over the name and value_details is used when user hover over value.

Examples

Here are som examples for itemTemplates.json

		"costcenter" : [{
			"color" : "item.attribute._vip ? '#621158' : '#96BA3C'",
			"role" : [],
			"order" : 100,
			"showActions" : 1,
			"workspace" : [],
			"mapping" : {
				"title" : "{{item.name}}",
				"key" : "{{item.key}}",
				"action" : "item.action | prepareAction : item.key",
				"tag" : "item.tag | prepareFilter : 'tag'",
				"image": "{{item.icon}}",
				"subtitle1" : "{{item.attribute.manager}}",
				"subtitle2" : "{{item.attribute.tagline}}",
				"bulkSupport" : "item.cost.cart ? \"true\" : \"item.action | checkBulkSupport\"",
				"attachment" : "item.attachment | getField",
				"information" : [
					{
						"name" : "{{t '_itemcard_manager'}}",
						"type" : "filter",
						"value" : "{{item.attribute.manager}}"
					},{
						"name" : "{{t '_itemcard_manager_email'}}",
						"type" : "link",
						"link" : "mailto:{{item.attribute.manager_mail}}",
						"value" : "{{item.attribute.manager_mail}}"
					},
					{
						"name" : "{{t '_itemcard_organization_name'}}",
						"type" : "filter",
						"value" : "{{item.attribute.org_name}}"
					},
					{
						"name" : "{{t '_itemcard_organization_number'}}",
						"type" : "filter",
						"value" : "{{item.attribute.org_number}}"
					},
					{
						"name" : "{{t '_itemcard_client'}}",
						"type" : "filter",
						"value" : "{{item.attribute.client}}"
					}
				]
			}
		}
	]
	"product" : [{
			"color" : "{{item-color}}",
			"role" : [],
			"order" : 1,
			"showActions" : 1,
			"workspace" : [],
			"mapping" : {
				"title" : "{{item.name}}",
				"key" : "{{item.key}}",
				"action" : "item.action | prepareAction : item.key",
				"tag" : "item.tag | prepareFilter : 'tag'",
				"image" : "{{item.icon}}",
				"subtitle1" : "{{item.description}}",
				"subtitle2" : "(item.cost && item.cost.subscription && item.cost.price) ? '{{item.cost.price}} kr/month' : '{{item.cost.price}} kr'",
				"bulkSupport" : "item.action | checkBulkSupport",
				"information" : [
					{
						"name" : "Category",
						"type" : "filter",
						"value" : "{{item.attribute.category}}"
					},
					{
						"name" : "Articlenumber",
						"value" : "{{item.attribute.articlenumber}}"
					}
				],
				"customAttribute" : {
						"name" : "Details",
						"fields" : [{
							"name" : "Picture",
							"type" : "attribute",
							"color" : "#ffffff",
							"value" : "<img src=/images/products/{{item.attribute.image}}>"
						}
					]
				}
			}
		}

Advanced examples

You also have the ability to use javascript features to customize the outcome:

...
"color" : "item.status == 'new' ? '#4a90e2': (item.status == 'installable' ? '#4a90e2' : (item.status == 'declined' ? '#e5053a' : '#96BA3C'))",
...
...
"title" : "item.status == 'installable' || item.status == 'installed' ? (item.attribute.dustin_id ? item.attribute.dustin_id + '  [' + item.attribute.ticket + ']' : item.attribute.ticket) : (item.attribute.ticket + ' ' + item.name)"
...
...
"tag": "item.status == 'installed' ? \"item.tag | filter : '!installed' | filter : '!accepted' | filter : '!sent' | filter : '!dispatched' | prepareFilter : 'tag'\" : ''"
...
...
"title" : "item.attribute.dustin_id ? item.attribute.dustin_id + '  [' + item.name + ']' : item.name",
...

Item templates for table view

You are able to change the way items are listed in the table view of the item results page by editing the /public/app/config/tableTemplates.json under resources.

Here is the default contents of tableTemplates.json:

{
  "_default": [
    {
      "role": [],
      "order": 100,
      "workspace": [],
      "tableHeader": "_default/header",
      "tableRow": "_default/row",
      "tableFooter": "_default/footer",
      "columns": [
        {
          "name": "",
          "template": "bulksupport",
          "type": "bulksupport",
          "value": "item.cost.cart ? \"true\" : \"item.action | checkBulkSupport\""
        },
        {
          "name": "",
          "template": "image",
          "type": "image",
          "value": "{{item.icon}}"
        },
        {
          "name": "<%app.name%>",
          "value": "{{item.name}}"
        },
        {
          "name": "<%app.owner%>",
          "template": "link",
          "type": "link",
          "link": "/workspace/{{item.workspace}}/search?term={{item.owner}}",
          "value": "{{item.owner}}",
          "target": "_blank"
        },
        {
          "name": "<%app.status%>",
          "template": "status",
          "type": "status",
          "value": "item.status ? \"item.status | prepareFilter : 'status'\" : ''",
          "class": "{{item.status | slugify}}"
        },
        {
          "name": "<%app.tags%>",
          "template": "tags",
          "type": "tag",
          "value": "item.tag | prepareFilter : 'tag'"
        },
        {
          "name": "<%app.actions%>",
          "template": "actions",
          "type": "action",
          "value": "item.action | prepareAction : item.key"
        }
      ]
    }
  ]
}
Element types/templates

Link

  • name - Name of the column
  • template - Template to use
  • link - link value
  • value - variable ({{item.owner}}) or string
  • target - link target

Example: Link with translated name that opens in new window

{
          "type": "link",
          "name": "<%app.owner%>",
          "template": "link",
          "link": "/workspace/{{item.workspace}}/search?term={{item.owner}}",
          "value": "{{item.owner}}",
          "target": "_blank"
        }

Tag

  • name - Name of the column
  • template - Template to use
  • value - array of strings or object

Example: List tags and able to filter

        {
          "type": "tag",
          "name": "<%app.tags%>",
          "template": "tags",
          "value": "item.tag | prepareFilter : 'tag'"
        }

Status

  • name - Name of the column
  • template - Template to use
  • value - string
  • class - variable or string

Example: Filter by status and add custom css class

{
          "name": "Status",
          "template": "status",
          "type": "status",
          "value": "item.status ? \"item.status | prepareFilter : 'status'\" : ''",
          "class": "{{item.status | slugify}}"
        }

Actions

  • name - Name of the column
  • template - Template to use
  • value - string

Example: List actions and support filtering

{
          "name": "<%app.actions%>",
          "template": "actions",
          "type": "action",
          "value": "item.action | prepareAction : item.key"
        }

Element type action is used only for actions doesn't have other options.

Examples

{
  "_default": [
    {
      "role": [],
      "order": 2,
      "workspace": [],
      "tableHeader": "_default/header",
      "tableRow": "_default/row",
      "tableFooter": "_default/footer",
      "columns": [
        {
          "name": "",
          "template": "image",
          "type": "image",
          "value": "{{item.icon}}"
        },
        {
          "name": "<%app.name%>",
          "value": "{{item.name}}"
        },
        {
          "name": "<%app.owner%>",
          "template": "link",
          "type": "link",
          "link": "/workspace/{{item.workspace}}/search?term={{item.owner}}",
          "value": "{{item.owner}}",
          "target": "_blank"
        },
        {
          "name": "<%app.status%>",
          "template": "status",
          "type": "status",
          "value": "item.status ? \"item.status | prepareFilter : 'status'\" : ''",
          "class": "{{item.status | slugify}}"
        },
        {
          "name": "<%app.tags%>",
          "template": "tags",
          "type": "tag",
          "value": "item.tag | prepareFilter : 'tag'"
        },
        {
          "name": "<%app.actions%>",
          "template": "actions",
          "type": "action",
          "value": "item.action | prepareAction : item.key"
        }
      ]
    },
    {
      "role": ["managers"],
      "order": 1,
      "workspace": ["manager"],
      "tableHeader": "_default/header",
      "tableRow": "_default/row",
      "tableFooter": "_default/footer",
      "columns": [
        {
          "name": "",
          "template": "image",
          "type": "image",
          "value": "{{item.icon}}"
        },
        {
          "name": "<%app.name%>",
          "value": "{{item.name}}"
        },
        {
          "name": "{{t '_itemtemplate_organization_number'}}",
          "template": "tags",
          "type": "filter",
          "value": "item.attribute.org_number ? \"item.attribute.org_number | prepareFilter : 'attribute.org_number'\" : ''"
        },
        {
          "name": "{{t '_itemtemplate_client'}}",
          "template": "tags",
          "type": "filter",
          "value": "item.attribute.client ? \"item.attribute.client | prepareFilter : 'attribute.client'\" : ''"
        },
        {
          "name": "{{t '_itemtemplate_cost_total'}}",
          "value": "{{item.attribute.services_total_cost}}"
        },
        {
          "name": "{{t '_itemtemplate_actions'}}",
          "template": "actions",
          "type": "action",
          "value": "item.action | prepareAction : item.key"
        }
      ]
    }
  ],
  "user": [
    {
      "role": ["managers"],
      "order": 100,
      "workspace": ["manager"],
      "tableHeader": "_default/header",
      "tableRow": "_default/row",
      "tableFooter": "_default/footer",
      "columns": [
        {
          "name": "",
          "template": "image",
          "type": "image",
          "value": "{{item.icon}}"
        },
        {
          "name": "<%app.name%>",
          "value": "{{item.name}}"
        },
        {
          "name": "{{t '_itemtemplate_title'}}",
          "template": "tags",
          "type": "filter",
          "value": "item.attribute.title ? \"item.attribute.title | prepareFilter : 'attribute.title'\" : ''"
        },
        {
          "name": "{{t '_itemtemplate_user_email'}}",
          "template": "link",
          "type": "link",
          "link": "mailto:{{item.attribute.email}}",
          "value": "{{item.attribute.email}}"
        },
        {
          "name": "{{t '_itemtemplate_user_employee_type'}}",
          "template": "tags",
          "type": "filter",
          "value": "item.attribute.type_agresso ? \"item.attribute.type_agresso | prepareFilter : 'attribute.type_agresso'\" : ''"
        },
        {
          "name": "{{t '_itemtemplate_company'}}",
          "template": "tags",
          "type": "filter",
          "value": "item.attribute.company ? \"item.attribute.company | prepareFilter : 'attribute.company'\" : ''"
        },
        {
          "name": "{{t '_itemtemplate_user_type'}}",
          "template": "tags",
          "type": "filter",
          "value": "item.attribute.user_type ? \"item.attribute.user_type | prepareFilter : 'attribute.user_type'\" : ''"
        },
        {
          "name": "{{t '_itemtemplate_organization_number'}}",
          "template": "tags",
          "type": "filter",
          "value": "{{item.attribute.org_number}}"
        },
        {
          "name": "{{t '_itemtemplate_client'}}",
          "template": "tags",
          "type": "filter",
          "value": "item.attribute.client ? \"item.attribute.client | prepareFilter : 'attribute.client'\" : ''"
        },
        {
          "name": "{{t '_itemtemplate_cost'}}",
          "value": "{{item.attribute.services_total_cost}}"
        },
        {
          "name": "{{t '_itemtemplate_actions'}}",
          "template": "actions",
          "type": "action",
          "value": "item.action | prepareAction : item.key"
        }
      ]
    }
  ],
  "costcenter": [
    {
      "role": ["managers"],
      "order": 200,
      "workspace": ["manager"],
      "tableHeader": "_default/header",
      "tableRow": "_default/row",
      "tableFooter": "_default/footer",
      "columns": [
        {
          "name": "",
          "template": "image",
          "type": "image",
          "value": "{{item.icon}}"
        },
        {
          "name": "{{t '_itemtemplate_organization_name'}}",
          "template": "tags",
          "type": "filter",
          "value": "item.attribute.org_name ? \"item.attribute.org_name | prepareFilter : 'attribute.org_name'\" : ''"
        },
        {
          "name": "{{t '_itemtemplate_owner'}}",
          "template": "tags",
          "type": "filter",
          "value": "item.attribute.manager_department ? \"item.attribute.manager_department | prepareFilter : 'attribute.manager_department'\" : ''"
        },
        {
          "name": "{{t '_itemtemplate_manager'}}",
          "template": "tags",
          "type": "filter",
          "value": "item.attribute.manager ? \"item.attribute.manager | prepareFilter : 'attribute.manager'\" : ''"
        },
        {
          "name": "{{t '_itemtemplate_manager_email'}}",
          "template": "link",
          "type": "link",
          "link": "mailto:{{item.attribute.manager_mail}}",
          "value": "{{item.attribute.manager_mail}}"
        },
        {
          "name": "{{t '_itemtemplate_organization_number'}}",
          "template": "tags",
          "type": "filter",
          "value": "item.attribute.org_number ? \"item.attribute.org_number | prepareFilter : 'attribute.org_number'\" : ''"
        },
        {
          "name": "{{t '_itemtemplate_client'}}",
          "template": "tags",
          "type": "filter",
          "value": "item.attribute.client ? \"item.attribute.client | prepareFilter : 'attribute.client'\" : ''"
        },
        {
          "name": "{{t '_itemtemplate_cost_total'}}",
          "value": "{{item.attribute.services_total_cost}}"
        },
        {
          "name": "{{t '_itemtemplate_actions'}}",
          "template": "actions",
          "type": "action",
          "value": "item.action | prepareAction : item.key"
        }
      ]
    }
  ]
}

API endpoints