[Minor] Fixed broken view state on realm change, added refresh

This commit is contained in:
Robert von Burg 2017-02-10 17:27:32 +01:00
parent 5cb1061af7
commit b1ca0b89af
4 changed files with 53 additions and 12 deletions

View File

@ -1,7 +1,7 @@
{
"name": "strolch-wc-inspector",
"description": "Strolch WebComponent Inspector",
"version": "0.1.14",
"version": "0.1.15",
"authors": "Robert von Burg",
"keywords": [
"strolch",
@ -17,7 +17,7 @@
"homepage": "https://github.com/4treesCH/strolch-wc-inspector",
"ignore": [],
"dependencies": {
"strolchjs" : "4treesCH/strolchjs#^0.1.3",
"strolchjs" : "4treesCH/strolchjs#^0.1.4",
"strolch-wc-styles" : "4treesCH/strolch-wc-styles#^0.1.4",
"app-route": "PolymerElements/app-route#^0.9.3",
"app-layout": "PolymerElements/app-layout#^0.10.6",

View File

@ -403,7 +403,8 @@
type: Object,
value: function () {
return null;
}
},
observer : "_objectChanged"
},
expanded: {
type: Boolean,
@ -419,6 +420,11 @@
}
},
_objectChanged : function (newValue, oldValue) {
this.expanded = false;
this.selectedDetailType = '';
},
_typeSubPath: function (selectedType) {
if (selectedType == 'Resource') {
return 'resources';

View File

@ -139,7 +139,8 @@
type: Object,
value: function () {
return null;
}
},
observer: "_objectSummariesChanged"
},
section: {
type: String,
@ -173,6 +174,14 @@
}
},
_objectSummariesChanged: function (newValue, oldValue) {
this.selectedType = null;
this.section = 'typesSummary';
this.selectedType = null;
this.objects = null;
Strolch.setQueryParamValue('type', null);
},
_noElements: function (objectSummaries) {
return objectSummaries == null || objectSummaries.types.length == 0;
},

View File

@ -32,6 +32,7 @@
.toolbar {
background-color: var(--paper-blue-600);
color: rgba(255, 255, 255, 0.8);
height: 42px;
}
@ -105,14 +106,19 @@
</div>
<div class="g-9">
<div class="toolbar">
<template is="dom-if" if="[[selectedRealm]]">
<paper-tabs selected="{{selectedObjectType}}" attr-for-selected="name">
<paper-tab name="Resource">[[resourcesSummary]]</paper-tab>
<paper-tab name="Order">[[ordersSummary]]</paper-tab>
<paper-tab name="Activity">[[activitiesSummary]]</paper-tab>
</paper-tabs>
</template>
<div class="g-row toolbar">
<div class="g-11">
<template is="dom-if" if="[[selectedRealm]]">
<paper-tabs selected="{{selectedObjectType}}" attr-for-selected="name">
<paper-tab name="Resource">[[resourcesSummary]]</paper-tab>
<paper-tab name="Order">[[ordersSummary]]</paper-tab>
<paper-tab name="Activity">[[activitiesSummary]]</paper-tab>
</paper-tabs>
</template>
</div>
<div class="g-1">
<paper-icon-button icon="refresh" on-tap="reloadRealms"></paper-icon-button>
</div>
</div>
</div>
</div>
@ -255,6 +261,9 @@
reload: function () {
this.selectedRealm = null;
this.selectedObjectType = null;
this.resources = null;
this.orders = null;
this.activities = null;
this.reloadRealms();
},
@ -265,6 +274,11 @@
this._handleAjaxResponse = function (data) {
this.selectedRealm = null;
this.selectedObjectType = null;
this.resources = null;
this.orders = null;
this.activities = null;
this.realms = data.detail.response.realms;
if (Strolch.isNotEmptyString(realmToSelect)) {
@ -295,6 +309,11 @@
var objectTypeToSelect = Strolch.getQueryParamValue('objectType');
this.selectedObjectType = null;
this.resources = null;
this.orders = null;
this.activities = null;
this._handleAjaxResponse = function (data) {
var elementMaps = data.detail.response.elementMaps;
for (var i = 0; i < elementMaps.length; i++) {
@ -335,6 +354,13 @@
return;
}
if (this.selectedObjectType == 'Resource' && this.resources != null)
return;
if (this.selectedObjectType == 'Order' && this.orders != null)
return;
if (this.selectedObjectType == 'Activity' && this.activities != null)
return;
this._handleAjaxResponse = function (data) {
switch (data.detail.response.objectType) {
case 'Resource':