UI: Refactoring
This commit is contained in:
parent
e3b63f9f36
commit
24a3375848
@ -255,8 +255,17 @@ const parseScadaSymbolMetadataFromDom = (svgDoc: Document): ScadaSymbolMetadata
|
|||||||
if (elements.length) {
|
if (elements.length) {
|
||||||
return JSON.parse(elements[0].textContent);
|
return JSON.parse(elements[0].textContent);
|
||||||
} else {
|
} else {
|
||||||
const viewBox = svgDoc.getElementsByTagName('svg')[0].viewBox.baseVal;
|
const svg = svgDoc.getElementsByTagName('svg')[0];
|
||||||
return emptyMetadata(viewBox.width, viewBox.height);
|
let width = null;
|
||||||
|
let height = null;
|
||||||
|
if (svg.viewBox.baseVal.width && svg.viewBox.baseVal.height) {
|
||||||
|
width = svg.viewBox.baseVal.width;
|
||||||
|
height = svg.viewBox.baseVal.height;
|
||||||
|
} else if (svg.width.baseVal.value && svg.height.baseVal.value) {
|
||||||
|
width = svg.width.baseVal.value;
|
||||||
|
height = svg.height.baseVal.value;
|
||||||
|
}
|
||||||
|
return emptyMetadata(width, height);
|
||||||
}
|
}
|
||||||
} catch (_e) {
|
} catch (_e) {
|
||||||
console.error(_e);
|
console.error(_e);
|
||||||
|
|||||||
@ -114,8 +114,7 @@ const routes: Routes = [
|
|||||||
data: {
|
data: {
|
||||||
auth: [Authority.TENANT_ADMIN, Authority.SYS_ADMIN],
|
auth: [Authority.TENANT_ADMIN, Authority.SYS_ADMIN],
|
||||||
title: 'scada.symbols',
|
title: 'scada.symbols',
|
||||||
imageSubType: ResourceSubType.SCADA_SYMBOL,
|
imageSubType: ResourceSubType.SCADA_SYMBOL
|
||||||
editOnRowClick: true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -181,8 +181,6 @@ export class ImageGalleryComponent extends PageComponent implements OnInit, OnDe
|
|||||||
return this.imageSubType === ResourceSubType.SCADA_SYMBOL;
|
return this.imageSubType === ResourceSubType.SCADA_SYMBOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
private editOnRowClick = false;
|
|
||||||
|
|
||||||
private updateDataSubscription: Subscription;
|
private updateDataSubscription: Subscription;
|
||||||
|
|
||||||
private widgetResize$: ResizeObserver;
|
private widgetResize$: ResizeObserver;
|
||||||
@ -219,7 +217,6 @@ export class ImageGalleryComponent extends PageComponent implements OnInit, OnDe
|
|||||||
const routerQueryParams: PageQueryParam = this.route.snapshot.queryParams;
|
const routerQueryParams: PageQueryParam = this.route.snapshot.queryParams;
|
||||||
if (this.pageMode) {
|
if (this.pageMode) {
|
||||||
this.imageSubType = this.route.snapshot.data.imageSubType || ResourceSubType.IMAGE;
|
this.imageSubType = this.route.snapshot.data.imageSubType || ResourceSubType.IMAGE;
|
||||||
this.editOnRowClick = this.route.snapshot.data.editOnRowClick || false;
|
|
||||||
if (routerQueryParams.hasOwnProperty('direction')
|
if (routerQueryParams.hasOwnProperty('direction')
|
||||||
|| routerQueryParams.hasOwnProperty('property')) {
|
|| routerQueryParams.hasOwnProperty('property')) {
|
||||||
sortOrder = {
|
sortOrder = {
|
||||||
@ -642,9 +639,8 @@ export class ImageGalleryComponent extends PageComponent implements OnInit, OnDe
|
|||||||
}
|
}
|
||||||
|
|
||||||
rowClick($event, image: ImageResourceInfo) {
|
rowClick($event, image: ImageResourceInfo) {
|
||||||
if (this.editOnRowClick) {
|
if (this.isScada) {
|
||||||
this.editImage($event, image);
|
this.editImage($event, image);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (this.selectionMode) {
|
if (this.selectionMode) {
|
||||||
this.selectImage($event, image);
|
this.selectImage($event, image);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user