2017-02-06 11:06:23 +01:00
|
|
|
<link rel="import" href="../polymer/polymer.html">
|
2017-02-06 10:52:53 +01:00
|
|
|
|
2017-02-06 18:13:36 +01:00
|
|
|
<link rel="import" href="../paper-icon-button/paper-icon-button.html">
|
|
|
|
<link rel="import" href="../paper-header-panel/paper-header-panel.html">
|
|
|
|
|
2017-02-06 11:06:23 +01:00
|
|
|
<link rel="import" href="../iron-ajax/iron-ajax.html">
|
2017-02-06 18:13:36 +01:00
|
|
|
<link rel="import" href="../iron-pages/iron-pages.html">
|
2017-02-06 10:52:53 +01:00
|
|
|
|
2017-02-06 11:06:23 +01:00
|
|
|
<link rel="import" href="../paper-styles/color.html">
|
|
|
|
<link rel="import" href="../paper-styles/default-theme.html">
|
|
|
|
<link rel="import" href="../paper-styles/shadow.html">
|
|
|
|
<link rel="import" href="../paper-styles/typography.html">
|
2017-02-06 10:52:53 +01:00
|
|
|
|
2017-02-07 18:46:52 +01:00
|
|
|
<link rel="import" href="../strolch-wc-styles/strolch-wc-styles.html">
|
|
|
|
|
2017-02-06 10:52:53 +01:00
|
|
|
<dom-module id="strolch-wc-inspector-object">
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
2017-02-07 18:46:52 +01:00
|
|
|
<style is="strolch-wc-styles">
|
2017-02-06 10:52:53 +01:00
|
|
|
|
|
|
|
:host {
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
|
|
|
|
.card {
|
|
|
|
padding: 1.0em;
|
|
|
|
margin: 1.0em;
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
|
2017-02-08 12:18:50 +01:00
|
|
|
.title-bar {
|
|
|
|
background-color: var(--google-grey-300);
|
|
|
|
color: var(--google-grey-700);
|
|
|
|
}
|
|
|
|
|
|
|
|
.title {
|
|
|
|
padding: 8px;
|
|
|
|
background-color: rgb(224, 224, 224);
|
|
|
|
color: rgb(97, 97, 97);
|
2017-02-08 15:41:01 +01:00
|
|
|
font-size: 16px;
|
2017-02-08 12:18:50 +01:00
|
|
|
font-weight: 400;
|
|
|
|
line-height: 1.3;
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.sub {
|
|
|
|
font-size: small;
|
|
|
|
}
|
|
|
|
|
|
|
|
.table-title {
|
|
|
|
margin-bottom: 0;
|
2017-02-06 10:52:53 +01:00
|
|
|
padding: 0;
|
|
|
|
}
|
|
|
|
|
2017-02-06 18:13:36 +01:00
|
|
|
paper-material {
|
|
|
|
border-radius: 2px;
|
|
|
|
background-color: #ffffff;
|
|
|
|
}
|
|
|
|
|
|
|
|
paper-tabs {
|
2017-02-08 12:18:50 +01:00
|
|
|
border-top: solid #7F7F7F 1px;
|
2017-02-06 18:13:36 +01:00
|
|
|
--paper-tabs-selection-bar-color: var(--paper-amber-600);
|
|
|
|
background-color: #ffffff;
|
|
|
|
color: #000000;
|
|
|
|
}
|
|
|
|
|
2017-02-06 10:52:53 +01:00
|
|
|
</style>
|
|
|
|
|
2017-02-07 18:46:52 +01:00
|
|
|
<paper-material class="g-card g-m-3 g-mt-4" elevation="1">
|
2017-02-06 10:52:53 +01:00
|
|
|
|
2017-02-08 12:18:50 +01:00
|
|
|
<div class="g-container">
|
|
|
|
<div class="g-row title-bar" on-tap="_toggleExpanded">
|
2017-02-06 18:13:36 +01:00
|
|
|
|
2017-02-08 12:18:50 +01:00
|
|
|
<div class="g-11">
|
2017-02-08 20:17:30 +01:00
|
|
|
<h1 class="title"><span style="text-transform: uppercase">[[object.objectType]]</span> <span
|
|
|
|
class="sub g-ml-4">Id:</span> [[object.id]] <span class="sub g-ml-4">Name:</span>
|
|
|
|
[[object.name]] <span class="sub g-ml-4">Type:</span>
|
|
|
|
[[object.type]] </h1>
|
2017-02-08 12:18:50 +01:00
|
|
|
</div>
|
2017-02-06 18:13:36 +01:00
|
|
|
|
2017-02-08 12:18:50 +01:00
|
|
|
<div class="g-1">
|
|
|
|
<paper-icon-button id="expandedIcon" icon="expand-more"></paper-icon-button>
|
|
|
|
</div>
|
2017-02-06 18:13:36 +01:00
|
|
|
|
2017-02-08 12:18:50 +01:00
|
|
|
</div>
|
|
|
|
<div class="g-row">
|
|
|
|
<div class="g-12">
|
2017-02-06 18:13:36 +01:00
|
|
|
|
2017-02-08 15:41:01 +01:00
|
|
|
<!-- Tabs -->
|
2017-02-08 12:18:50 +01:00
|
|
|
<template is="dom-if" if="[[expanded]]">
|
2017-02-08 15:41:01 +01:00
|
|
|
<paper-tabs selected="{{selectedDetailType}}"
|
|
|
|
attr-for-selected="name"
|
|
|
|
fallback-selection="none">
|
|
|
|
<paper-tab name="details">Details</paper-tab>
|
2017-02-08 12:18:50 +01:00
|
|
|
<paper-tab name="parameters">Parameters</paper-tab>
|
|
|
|
<paper-tab name="policies">Policies</paper-tab>
|
2017-02-08 20:17:30 +01:00
|
|
|
<template is="dom-if" if="[[_isResource(object.objectType)]]">
|
2017-02-08 12:18:50 +01:00
|
|
|
<paper-tab name="timedstates">Timed States</paper-tab>
|
2017-02-06 18:13:36 +01:00
|
|
|
</template>
|
2017-02-08 20:17:30 +01:00
|
|
|
<template is="dom-if" if="[[_isActivity(object.objectType)]]">
|
2017-02-08 15:41:01 +01:00
|
|
|
<paper-tab name="elements">Elements</paper-tab>
|
|
|
|
</template>
|
2017-02-08 12:18:50 +01:00
|
|
|
</paper-tabs>
|
2017-02-06 18:13:36 +01:00
|
|
|
</template>
|
|
|
|
|
2017-02-08 15:41:01 +01:00
|
|
|
<!-- Tab sections -->
|
2017-02-08 12:18:50 +01:00
|
|
|
<iron-pages selected="[[selectedDetailType]]" attr-for-selected="name">
|
2017-02-06 18:13:36 +01:00
|
|
|
|
2017-02-08 15:41:01 +01:00
|
|
|
<!-- details -->
|
|
|
|
<section name="details" class="g-p-2 g-pt-0">
|
2017-02-08 20:17:30 +01:00
|
|
|
<template is="dom-if" if="[[!object]]">
|
2017-02-08 15:41:01 +01:00
|
|
|
<p class="g-center">Loading...</p>
|
|
|
|
</template>
|
2017-02-08 20:17:30 +01:00
|
|
|
<template is="dom-if" if="[[object]]">
|
2017-02-08 15:41:01 +01:00
|
|
|
|
|
|
|
<div class="g-row">
|
|
|
|
|
|
|
|
<div class="g-6">
|
|
|
|
|
|
|
|
<dl class="g-dl">
|
|
|
|
<dt>Id</dt>
|
2017-02-08 20:17:30 +01:00
|
|
|
<dd>[[object.id]]</dd>
|
2017-02-08 15:41:01 +01:00
|
|
|
<dt>Name</dt>
|
2017-02-08 20:17:30 +01:00
|
|
|
<dd>[[object.name]]</dd>
|
2017-02-08 15:41:01 +01:00
|
|
|
<dt>Type</dt>
|
2017-02-08 20:17:30 +01:00
|
|
|
<dd>[[object.type]]</dd>
|
2017-02-08 15:41:01 +01:00
|
|
|
</dl>
|
|
|
|
|
|
|
|
<template is="dom-if"
|
2017-02-08 20:17:30 +01:00
|
|
|
if="[[_isActivity(object.objectType)]]"
|
2017-02-08 15:41:01 +01:00
|
|
|
restamp="true">
|
|
|
|
<dl class="g-dl">
|
|
|
|
<dt>State</dt>
|
2017-02-08 20:17:30 +01:00
|
|
|
<dd>[[object.state]]</dd>
|
2017-02-08 15:41:01 +01:00
|
|
|
<dt>TimeOrdering</dt>
|
2017-02-08 20:17:30 +01:00
|
|
|
<dd>[[object.timeOrdering]]</dd>
|
2017-02-08 15:41:01 +01:00
|
|
|
<dt>Start</dt>
|
2017-02-08 20:17:30 +01:00
|
|
|
<dd>[[_formatDate(object.start)]]</dd>
|
2017-02-08 15:41:01 +01:00
|
|
|
<dt>End</dt>
|
2017-02-08 20:17:30 +01:00
|
|
|
<dd>[[_formatDate(object.end)]]</dd>
|
2017-02-08 15:41:01 +01:00
|
|
|
</dl>
|
|
|
|
</template>
|
|
|
|
|
2017-02-08 20:17:30 +01:00
|
|
|
<template is="dom-if" if="[[_isOrder(object.objectType)]]" restamp="true">
|
2017-02-08 15:41:01 +01:00
|
|
|
<dl class="g-dl">
|
|
|
|
<dt>State</dt>
|
2017-02-08 20:17:30 +01:00
|
|
|
<dd>[[object.state]]</dd>
|
2017-02-08 15:41:01 +01:00
|
|
|
<dt>Date</dt>
|
2017-02-08 20:17:30 +01:00
|
|
|
<dd>[[_formatDate(object.date)]]</dd>
|
2017-02-08 15:41:01 +01:00
|
|
|
</dl>
|
|
|
|
</template>
|
|
|
|
|
2017-02-08 20:17:30 +01:00
|
|
|
<template is="dom-if" if="[[_isAction(object.objectType)]]" restamp="true">
|
2017-02-08 15:41:01 +01:00
|
|
|
<dl class="g-dl">
|
|
|
|
<dt>State</dt>
|
2017-02-08 20:17:30 +01:00
|
|
|
<dd>[[object.state]]</dd>
|
2017-02-08 15:41:01 +01:00
|
|
|
<dt>Start</dt>
|
2017-02-08 20:17:30 +01:00
|
|
|
<dd>[[_formatDate(object.start)]]</dd>
|
2017-02-08 15:41:01 +01:00
|
|
|
<dt>End</dt>
|
2017-02-08 20:17:30 +01:00
|
|
|
<dd>[[_formatDate(object.end)]]</dd>
|
2017-02-08 15:41:01 +01:00
|
|
|
<dt>Resource Type</dt>
|
2017-02-08 20:17:30 +01:00
|
|
|
<dd>[[object.resourceType]]</dd>
|
2017-02-08 15:41:01 +01:00
|
|
|
<dt>Resource Id</dt>
|
2017-02-08 20:17:30 +01:00
|
|
|
<dd>[[object.resourceId]]</dd>
|
2017-02-08 15:41:01 +01:00
|
|
|
</dl>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="g-6">
|
|
|
|
|
2017-02-08 20:17:30 +01:00
|
|
|
<template is="dom-if" if="[[object.version]]" restamp="true">
|
2017-02-08 15:41:01 +01:00
|
|
|
<dl class="g-dl">
|
|
|
|
<dt>CreatedAt</dt>
|
2017-02-08 20:17:30 +01:00
|
|
|
<dd>[[_formatDate(object.version.createdAt)]]</dd>
|
2017-02-08 15:41:01 +01:00
|
|
|
<dt>CreatedBy</dt>
|
2017-02-08 20:17:30 +01:00
|
|
|
<dd>[[object.version.createdBy]]</dd>
|
2017-02-08 15:41:01 +01:00
|
|
|
<dt>Deleted</dt>
|
2017-02-08 20:17:30 +01:00
|
|
|
<dd>[[object.version.deleted]]</dd>
|
2017-02-08 15:41:01 +01:00
|
|
|
<dt>Version</dt>
|
2017-02-08 20:17:30 +01:00
|
|
|
<dd>[[object.version.version]]</dd>
|
2017-02-08 15:41:01 +01:00
|
|
|
</dl>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
</section>
|
|
|
|
|
2017-02-08 12:18:50 +01:00
|
|
|
<!-- parameters -->
|
|
|
|
<section name="parameters" class="g-p-2 g-pt-0">
|
2017-02-08 20:17:30 +01:00
|
|
|
<template is="dom-if" if="[[!object]]">
|
2017-02-08 12:18:50 +01:00
|
|
|
<p class="g-center">Loading...</p>
|
|
|
|
</template>
|
2017-02-08 20:17:30 +01:00
|
|
|
<template is="dom-if" if="[[object]]">
|
2017-02-06 18:13:36 +01:00
|
|
|
|
2017-02-08 20:17:30 +01:00
|
|
|
<template is="dom-if" if="[[_isEmpty(object.parameterBags)]]">
|
|
|
|
<p class="g-center">No parameters defined on [[object.objectType]]
|
|
|
|
[[object.id]]</p>
|
2017-02-08 12:18:50 +01:00
|
|
|
</template>
|
2017-02-08 20:17:30 +01:00
|
|
|
<template is="dom-if" if="[[_isNotEmpty(object.parameterBags)]]">
|
2017-02-06 18:13:36 +01:00
|
|
|
|
2017-02-08 12:18:50 +01:00
|
|
|
<table class="g-table">
|
|
|
|
<thead>
|
2017-02-06 18:13:36 +01:00
|
|
|
<tr>
|
2017-02-08 12:18:50 +01:00
|
|
|
<th>ParameterBag</th>
|
|
|
|
<th>Parameter Id</th>
|
|
|
|
<th>Name</th>
|
|
|
|
<th>Interpretation</th>
|
|
|
|
<th>UOM</th>
|
|
|
|
<th>Type</th>
|
|
|
|
<th>Value</th>
|
2017-02-06 18:13:36 +01:00
|
|
|
</tr>
|
2017-02-08 12:18:50 +01:00
|
|
|
</thead>
|
|
|
|
|
|
|
|
<tbody>
|
|
|
|
|
|
|
|
<template is="dom-repeat"
|
2017-02-08 20:17:30 +01:00
|
|
|
items="{{_asArray(object.parameterBags)}}"
|
2017-02-08 12:18:50 +01:00
|
|
|
as="bag">
|
|
|
|
<template is="dom-repeat"
|
|
|
|
items="{{_asArray(bag.value.parameters)}}"
|
|
|
|
as="param">
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td>[[bag.value.id]]</td>
|
|
|
|
<td>[[param.value.id]]</td>
|
|
|
|
<td>[[param.value.name]]</td>
|
|
|
|
<td>[[param.value.interpretation]]</td>
|
|
|
|
<td>[[param.value.uom]]</td>
|
|
|
|
<td>[[param.value.type]]</td>
|
|
|
|
<td>[[param.value.value]]</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
2017-02-06 18:13:36 +01:00
|
|
|
</tbody>
|
|
|
|
</table>
|
2017-02-08 12:18:50 +01:00
|
|
|
</template>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<!-- policies -->
|
|
|
|
<section name="policies" class="g-p-2 g-pt-0">
|
2017-02-08 20:17:30 +01:00
|
|
|
<template is="dom-if" if="[[!object]]">
|
2017-02-08 12:18:50 +01:00
|
|
|
<p class="g-m-4 g-center">Loading...</p>
|
|
|
|
</template>
|
2017-02-08 20:17:30 +01:00
|
|
|
<template is="dom-if" if="[[object]]">
|
2017-02-06 18:13:36 +01:00
|
|
|
|
2017-02-08 20:17:30 +01:00
|
|
|
<template is="dom-if" if="[[_isEmpty(object.policies)]]">
|
2017-02-08 12:18:50 +01:00
|
|
|
<p class="g-pt-4 g-center">No policies defined on [[objectName]]
|
2017-02-08 20:17:30 +01:00
|
|
|
[[object.id]]</p>
|
2017-02-08 12:18:50 +01:00
|
|
|
</template>
|
2017-02-08 20:17:30 +01:00
|
|
|
<template is="dom-if" if="[[_isNotEmpty(object.policies)]]">
|
2017-02-08 12:18:50 +01:00
|
|
|
|
|
|
|
<table class="g-table">
|
2017-02-06 18:13:36 +01:00
|
|
|
<thead>
|
|
|
|
<tr>
|
2017-02-08 12:18:50 +01:00
|
|
|
<th>Type</th>
|
2017-02-06 18:13:36 +01:00
|
|
|
<th>Value</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
2017-02-08 12:18:50 +01:00
|
|
|
|
2017-02-06 18:13:36 +01:00
|
|
|
<tbody>
|
2017-02-08 12:18:50 +01:00
|
|
|
|
2017-02-08 20:17:30 +01:00
|
|
|
<template is="dom-repeat" items="{{_asArray(object.policies)}}" as="policy">
|
2017-02-08 12:18:50 +01:00
|
|
|
|
2017-02-06 18:13:36 +01:00
|
|
|
<tr>
|
2017-02-08 12:18:50 +01:00
|
|
|
<td>[[policy.key]]</td>
|
|
|
|
<td>[[policy.value]]</td>
|
2017-02-06 18:13:36 +01:00
|
|
|
</tr>
|
2017-02-08 12:18:50 +01:00
|
|
|
|
2017-02-06 18:13:36 +01:00
|
|
|
</template>
|
2017-02-08 12:18:50 +01:00
|
|
|
|
2017-02-06 18:13:36 +01:00
|
|
|
</tbody>
|
|
|
|
</table>
|
2017-02-08 12:18:50 +01:00
|
|
|
</template>
|
2017-02-06 18:13:36 +01:00
|
|
|
|
|
|
|
</template>
|
2017-02-08 12:18:50 +01:00
|
|
|
</section>
|
|
|
|
|
|
|
|
<!-- timedstates -->
|
2017-02-08 20:17:30 +01:00
|
|
|
<template is="dom-if" if="[[_isResource(object.objectType)]]">
|
2017-02-08 12:18:50 +01:00
|
|
|
<section name="timedstates" class="g-p-2 g-pt-0">
|
2017-02-08 20:17:30 +01:00
|
|
|
<template is="dom-if" if="[[!object]]">
|
2017-02-08 12:18:50 +01:00
|
|
|
<p class="g-center">Loading...</p>
|
|
|
|
</template>
|
2017-02-08 20:17:30 +01:00
|
|
|
<template is="dom-if" if="[[object]]">
|
2017-02-08 12:18:50 +01:00
|
|
|
|
2017-02-08 20:17:30 +01:00
|
|
|
<template is="dom-if" if="[[_isEmpty(object.timedStates)]]">
|
2017-02-08 12:18:50 +01:00
|
|
|
<p class="g-pt-4 g-center">No timed states defined on [[objectName]]
|
2017-02-08 20:17:30 +01:00
|
|
|
[[object.id]]</p>
|
2017-02-08 12:18:50 +01:00
|
|
|
</template>
|
2017-02-08 20:17:30 +01:00
|
|
|
<template is="dom-if" if="[[_isNotEmpty(object.timedStates)]]">
|
2017-02-08 12:18:50 +01:00
|
|
|
<template is="dom-repeat"
|
2017-02-08 20:17:30 +01:00
|
|
|
items="[[_asArray(object.timedStates)]]"
|
2017-02-08 12:18:50 +01:00
|
|
|
as="timedState">
|
|
|
|
|
|
|
|
<paper-material class="g-card" elevation="1">
|
|
|
|
<table class="g-table table-title">
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td><b>Id</b> [[timedState.value.id]]</td>
|
|
|
|
<td><b>Name</b> [[timedState.value.name]]</td>
|
|
|
|
<td><b>Type</b> [[timedState.value.type]]</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<table class="g-table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Time</th>
|
|
|
|
<th>Value</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<template is="dom-repeat"
|
|
|
|
items="[[timedState.value.values]]"
|
|
|
|
as="timedStateValue">
|
|
|
|
<tr>
|
|
|
|
<td>[[timedStateValue.time]]</td>
|
|
|
|
<td>[[timedStateValue.value]]</td>
|
|
|
|
</tr>
|
|
|
|
</template>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
</paper-material>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
</section>
|
2017-02-06 18:13:36 +01:00
|
|
|
</template>
|
|
|
|
|
2017-02-08 15:41:01 +01:00
|
|
|
<!-- activity children -->
|
2017-02-08 20:17:30 +01:00
|
|
|
<template is="dom-if" if="[[_isActivity(object.objectType)]]">
|
2017-02-08 15:41:01 +01:00
|
|
|
<section name="elements" class="g-p-2 g-pt-0">
|
2017-02-08 20:17:30 +01:00
|
|
|
<template is="dom-if" if="[[!object]]">
|
2017-02-08 15:41:01 +01:00
|
|
|
<p class="g-center">Loading...</p>
|
|
|
|
</template>
|
2017-02-08 20:17:30 +01:00
|
|
|
<template is="dom-if" if="[[object]]">
|
2017-02-08 15:41:01 +01:00
|
|
|
|
2017-02-08 20:17:30 +01:00
|
|
|
<template is="dom-repeat" items="[[object.elements]]" as="childElement">
|
2017-02-08 15:41:01 +01:00
|
|
|
<strolch-wc-inspector-object base-path="[[basePath]]"
|
|
|
|
app="[[app]]"
|
|
|
|
realm="[[realm]]"
|
2017-02-08 20:17:30 +01:00
|
|
|
object="[[childElement]]"
|
2017-02-08 15:41:01 +01:00
|
|
|
class="g-m-2"></strolch-wc-inspector-object>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
</section>
|
|
|
|
</template>
|
|
|
|
|
2017-02-08 12:18:50 +01:00
|
|
|
</iron-pages>
|
2017-02-06 18:13:36 +01:00
|
|
|
|
2017-02-08 12:18:50 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2017-02-06 10:52:53 +01:00
|
|
|
|
|
|
|
</paper-material>
|
|
|
|
|
|
|
|
<iron-ajax id="ajax"
|
|
|
|
content-type="application/json"
|
|
|
|
handle-as="json"
|
|
|
|
on-response="_handleAjaxResponse"
|
|
|
|
on-error="_handleAjaxError"></iron-ajax>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
Polymer({
|
|
|
|
|
|
|
|
is: 'strolch-wc-inspector-object',
|
|
|
|
|
|
|
|
properties: {
|
|
|
|
app: {
|
|
|
|
type: Object,
|
|
|
|
value: function () {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
},
|
2017-02-07 18:46:52 +01:00
|
|
|
basePath: {
|
|
|
|
type: String,
|
|
|
|
value: './'
|
|
|
|
},
|
2017-02-06 10:52:53 +01:00
|
|
|
realm: {
|
2017-02-06 18:13:36 +01:00
|
|
|
type: String,
|
2017-02-06 10:52:53 +01:00
|
|
|
value: function () {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
},
|
2017-02-08 20:17:30 +01:00
|
|
|
object: {
|
2017-02-06 10:52:53 +01:00
|
|
|
type: Object,
|
|
|
|
value: function () {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
},
|
2017-02-06 18:13:36 +01:00
|
|
|
expanded: {
|
2017-02-06 10:52:53 +01:00
|
|
|
type: Boolean,
|
|
|
|
value: function () {
|
2017-02-06 18:13:36 +01:00
|
|
|
return false;
|
2017-02-06 10:52:53 +01:00
|
|
|
}
|
2017-02-06 18:13:36 +01:00
|
|
|
},
|
|
|
|
selectedDetailType: {
|
|
|
|
type: String,
|
|
|
|
value: function () {
|
|
|
|
return true;
|
2017-02-08 20:17:30 +01:00
|
|
|
}
|
2017-02-06 10:52:53 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2017-02-08 15:41:01 +01:00
|
|
|
_typeSubPath: function (selectedType) {
|
|
|
|
if (selectedType == 'Resource') {
|
|
|
|
return 'resources';
|
|
|
|
} else if (selectedType == 'Order') {
|
|
|
|
return 'orders';
|
|
|
|
} else if (selectedType == 'Activity') {
|
|
|
|
return 'activities';
|
|
|
|
} else {
|
|
|
|
throw 'Unhandled selected type ' + selectedType;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2017-02-06 18:13:36 +01:00
|
|
|
_isResource: function (objectType) {
|
2017-02-08 15:41:01 +01:00
|
|
|
return objectType == 'Resource';
|
2017-02-06 18:13:36 +01:00
|
|
|
},
|
|
|
|
_isOrder: function (objectType) {
|
2017-02-08 15:41:01 +01:00
|
|
|
return objectType == 'Order';
|
2017-02-06 10:52:53 +01:00
|
|
|
},
|
2017-02-06 18:13:36 +01:00
|
|
|
_isActivity: function (objectType) {
|
2017-02-08 15:41:01 +01:00
|
|
|
return objectType == 'Activity';
|
2017-02-06 10:52:53 +01:00
|
|
|
},
|
2017-02-08 15:41:01 +01:00
|
|
|
_isAction: function (objectType) {
|
|
|
|
return objectType == 'Action';
|
2017-02-08 12:18:50 +01:00
|
|
|
},
|
2017-02-06 18:13:36 +01:00
|
|
|
|
|
|
|
_isEmpty: function (obj) {
|
|
|
|
if (obj == null)
|
|
|
|
return true;
|
|
|
|
if (obj instanceof Array) {
|
|
|
|
return obj.length == 0;
|
|
|
|
} else if (obj instanceof Object) {
|
|
|
|
return Object.keys(obj).length == 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
},
|
|
|
|
_isNotEmpty: function (obj) {
|
|
|
|
return !this._isEmpty(obj);
|
2017-02-06 10:52:53 +01:00
|
|
|
},
|
|
|
|
|
2017-02-06 18:13:36 +01:00
|
|
|
_asArray: function (obj) {
|
|
|
|
if (!obj)
|
|
|
|
return [];
|
2017-02-06 10:52:53 +01:00
|
|
|
return Object.keys(obj).map(function (key) {
|
2017-02-06 18:13:36 +01:00
|
|
|
return {
|
|
|
|
key: key,
|
|
|
|
value: obj[key]
|
|
|
|
};
|
2017-02-06 10:52:53 +01:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2017-02-08 12:18:50 +01:00
|
|
|
_formatDate: function (date) {
|
|
|
|
return Strolch.toDateTime(date);
|
|
|
|
},
|
|
|
|
|
2017-02-06 18:13:36 +01:00
|
|
|
_toggleExpanded: function (evt) {
|
|
|
|
this.expanded = !this.expanded;
|
|
|
|
this.$.expandedIcon.icon = this.expanded ? 'expand-less' : 'expand-more';
|
|
|
|
|
|
|
|
if (!this.expanded) {
|
|
|
|
this.selectedDetailType = null;
|
|
|
|
}
|
|
|
|
},
|
2017-02-06 10:52:53 +01:00
|
|
|
|
|
|
|
reloadDetails: function () {
|
|
|
|
|
2017-02-08 20:17:30 +01:00
|
|
|
var objectType = this.object.objectType;
|
|
|
|
var id = this.object.id;
|
|
|
|
var type = this.object.type;
|
|
|
|
this.object = null;
|
2017-02-06 10:52:53 +01:00
|
|
|
|
|
|
|
this._handleAjaxResponse = function (data) {
|
2017-02-08 20:17:30 +01:00
|
|
|
this.object = data.detail.response;
|
2017-02-06 10:52:53 +01:00
|
|
|
};
|
|
|
|
|
2017-02-08 20:17:30 +01:00
|
|
|
this.$.ajax.url = this.basePath + 'rest/strolch/inspector/' + this.realm + '/' + this._typeSubPath(objectType) + '/' + type + '/' + id;
|
2017-02-06 10:52:53 +01:00
|
|
|
this.$.ajax.method = 'GET';
|
|
|
|
this.$.ajax.generateRequest();
|
|
|
|
},
|
|
|
|
|
|
|
|
ready: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
reload: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
_handleAjaxResponse: function (evt) {
|
|
|
|
console.log('NOT YET DEFINED!');
|
|
|
|
},
|
|
|
|
|
|
|
|
_handleAjaxError: function (data) {
|
|
|
|
var dlgTitle = 'Debug action failed';
|
|
|
|
var dlgText;
|
|
|
|
if (data.detail.request.response) {
|
|
|
|
dlgText = data.detail.request.response.msg;
|
|
|
|
} else {
|
|
|
|
dlgText = data.detail.error;
|
|
|
|
}
|
|
|
|
this.app.showError(dlgTitle, dlgText);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
</dom-module>
|