[Minor] Cleanup UI

This commit is contained in:
Robert von Burg 2020-03-26 17:38:32 +01:00
parent 72727fbd48
commit d445854a35
3 changed files with 36 additions and 9 deletions

View File

@ -1,7 +1,7 @@
{ {
"name": "strolch-wc-reports", "name": "strolch-wc-reports",
"description": "Strolch WebComponent Reports", "description": "Strolch WebComponent Reports",
"version": "0.2.6", "version": "0.2.7",
"authors": [ "authors": [
"Robert von Burg" "Robert von Burg"
], ],

View File

@ -23,14 +23,12 @@
paper-material { paper-material {
min-width: 100%; min-width: 100%;
display: inline-flex;
background-color: white; background-color: white;
overflow: scroll;
} }
.table { .table {
min-width: 100%; min-width: 100%;
display: flex;
flex-direction: column;
} }
.table-caption { .table-caption {

View File

@ -39,7 +39,6 @@
.content { .content {
@apply(--layout-vertical); @apply(--layout-vertical);
height: calc(100vh - var(--app-header-height) - (2 * var(--app-pages-content-padding))); height: calc(100vh - var(--app-header-height) - (2 * var(--app-pages-content-padding)));
padding: var(--app-pages-content-padding);
} }
.row { .row {
@ -199,7 +198,6 @@
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
} }
} }
</style> </style>
@ -468,7 +466,9 @@
onToggleShowFacets: function (event) { onToggleShowFacets: function (event) {
this.showFacets = !this.showFacets; this.showFacets = !this.showFacets;
Strolch.setQueryParamValue("showFacets", this.showFacets);
}, },
onGetReportResponse: function (event) { onGetReportResponse: function (event) {
// get the response // get the response
var data = event.detail.response.data; var data = event.detail.response.data;
@ -484,10 +484,21 @@
}); });
// directly set this as the available types // directly set this as the available types
this.set("reports", data); this.reports = data;
// see if we should reload a report
if (this.reportToLoad != null) {
for (var i = 0; i < this.reports.length; i++) {
if (this.reports[i].id === this.reportToLoad) {
this.selectedReportIndex = i;
break;
}
}
}
this.hideLoadingOverlay(); this.hideLoadingOverlay();
}, },
onGetFacetResponse: function (event) { onGetFacetResponse: function (event) {
// get the response // get the response
var response = event.detail.response; var response = event.detail.response;
@ -515,6 +526,7 @@
this.hideLoadingOverlay(); this.hideLoadingOverlay();
}, },
onPostCsvResponse: function (event) { onPostCsvResponse: function (event) {
var response = event.detail.response; var response = event.detail.response;
console.log('Received CSV Result: 8'); console.log('Received CSV Result: 8');
@ -523,6 +535,7 @@
this.hideLoadingOverlay(); this.hideLoadingOverlay();
}, },
onReportSelected: function (event) { onReportSelected: function (event) {
// clear the previous view // clear the previous view
@ -533,16 +546,20 @@
// set the new report id // set the new report id
this.filtersReady = false; this.filtersReady = false;
this.set("reportId", this.reports[this.selectedReportIndex].id); let reportId = this.reports[this.selectedReportIndex].id;
this.set("reportId", reportId);
this.$.ajaxGetFacets.params = { this.$.ajaxGetFacets.params = {
limit: this.facetLimit limit: this.facetLimit
}; };
this.$.ajaxGetFacets.generateRequest();
this.showLoadingOverlay(); this.showLoadingOverlay();
this.$.ajaxGetFacets.generateRequest();
Strolch.setQueryParamValue("reportId", reportId);
}, },
onSelectionChanged: function (event) { onSelectionChanged: function (event) {
this.updateAllFilters(); this.updateAllFilters();
}, },
onExportTapped: function (event) { onExportTapped: function (event) {
this.$.ajaxPostCsv.headers = { this.$.ajaxPostCsv.headers = {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -562,6 +579,7 @@
this.$.ajaxPostCsv.generateRequest(); this.$.ajaxPostCsv.generateRequest();
this.showLoadingOverlay(); this.showLoadingOverlay();
}, },
onRefreshTapped: function (event) { onRefreshTapped: function (event) {
var table = this.$$("#table"); var table = this.$$("#table");
if (table == null) { if (table == null) {
@ -585,6 +603,17 @@
/* Private */ /* Private */
/* Public */ /* Public */
attached: function () {
var reportId = Strolch.getQueryParamValue("reportId");
if (reportId != null && reportId !== "") {
console.log("Selected ReportId is " + reportId);
this.reportToLoad = reportId;
}
this.showFacets = Strolch.getQueryParamValue("showFacets") === "true";
},
updateAllFilters: function () { updateAllFilters: function () {
var allFilters = []; var allFilters = [];
var facets = Polymer.dom(this.root).querySelectorAll("strolch-wc-reports-facet"); var facets = Polymer.dom(this.root).querySelectorAll("strolch-wc-reports-facet");