You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ze...@apache.org on 2020/06/11 10:44:23 UTC
[incubator-streampipes] branch dev updated: Fix dashboard widget
This is an automated email from the ASF dual-hosted git repository.
zehnder pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
The following commit(s) were added to refs/heads/dev by this push:
new 00a3912 Fix dashboard widget
new 2c0ea0f Merge branch 'dev' of github.com:apache/incubator-streampipes into dev
00a3912 is described below
commit 00a3912299ba175f73402bc3967937607d03fbda
Author: Philipp Zehnder <ze...@fzi.de>
AuthorDate: Thu Jun 11 12:43:38 2020 +0200
Fix dashboard widget
---
.../datalake/datalake-rest.service.ts | 1 +
.../widget/dashboard-widget.component.html | 4 +-
.../renderer-config.ts => pallet/pallet-config.ts} | 22 +-
.../pallet.component.css} | 0
.../pallet.component.html} | 0
.../components/widgets/pallet/pallet.component.ts | 78 ++++++
.../components/widgets/pallet/pallet_functions.ts | 82 ++++++
.../widgets/renderer/renderer.component.spec.ts | 42 ---
.../widgets/renderer/renderer.component.ts | 302 ---------------------
.../widgets/renderer/renderer_functions.ts | 82 ------
ui/src/app/dashboard/dashboard.module.ts | 4 +-
ui/src/app/dashboard/registry/widget-registry.ts | 44 +--
ui/src/assets/render.js | 5 +
13 files changed, 203 insertions(+), 463 deletions(-)
diff --git a/ui/src/app/core-services/datalake/datalake-rest.service.ts b/ui/src/app/core-services/datalake/datalake-rest.service.ts
index 57e6b98..aaa553c 100644
--- a/ui/src/app/core-services/datalake/datalake-rest.service.ts
+++ b/ui/src/app/core-services/datalake/datalake-rest.service.ts
@@ -87,6 +87,7 @@ export class DatalakeRestService {
getLabels() {
return {
+ 'boxes': ['blue', 'red'],
'sign': ['trafficsign'],
'person': ['person', 'Child'],
'vehicle': ['bicycle', 'car', 'motorcycle', 'airplane', 'bus', 'train', 'truck', 'boat'],
diff --git a/ui/src/app/dashboard/components/widget/dashboard-widget.component.html b/ui/src/app/dashboard/components/widget/dashboard-widget.component.html
index 905e2fe..ad89206 100644
--- a/ui/src/app/dashboard/components/widget/dashboard-widget.component.html
+++ b/ui/src/app/dashboard/components/widget/dashboard-widget.component.html
@@ -95,10 +95,10 @@
[widgetDataConfig]="widgetDataConfig" class="h-100"></traffic-light-widget>
</div>
<div *ngIf="widget.widgetType === 'pallet'" class="h-100 p-0">
- <app-renderer [gridsterItemComponent]="gridsterItemComponent"
+ <sp-pallet [gridsterItemComponent]="gridsterItemComponent"
[gridsterItem]="item" [widget]="widget" [editMode]="editMode"
[widgetConfig]="configuredWidget"
- [widgetDataConfig]="widgetDataConfig" class="h-100"></app-renderer>
+ [widgetDataConfig]="widgetDataConfig" class="h-100"></sp-pallet>
</div>
</div>
</div>
diff --git a/ui/src/app/dashboard/components/widgets/renderer/renderer-config.ts b/ui/src/app/dashboard/components/widgets/pallet/pallet-config.ts
similarity index 59%
rename from ui/src/app/dashboard/components/widgets/renderer/renderer-config.ts
rename to ui/src/app/dashboard/components/widgets/pallet/pallet-config.ts
index 385629a..0a008ce 100644
--- a/ui/src/app/dashboard/components/widgets/renderer/renderer-config.ts
+++ b/ui/src/app/dashboard/components/widgets/pallet/pallet-config.ts
@@ -16,28 +16,28 @@
*
*/
-import {WidgetConfigBuilder} from "../../../registry/widget-config-builder";
-import {SchemaRequirementsBuilder} from "../../../sdk/schema-requirements-builder";
-import {EpRequirements} from "../../../sdk/ep-requirements";
-import {DashboardWidgetSettings} from "../../../../core-model/dashboard/DashboardWidgetSettings";
-import {WidgetConfig} from "../base/base-config";
+import { DashboardWidgetSettings } from '../../../../core-model/dashboard/DashboardWidgetSettings';
+import { WidgetConfigBuilder } from '../../../registry/widget-config-builder';
+import { EpRequirements } from '../../../sdk/ep-requirements';
+import { SchemaRequirementsBuilder } from '../../../sdk/schema-requirements-builder';
+import { WidgetConfig } from '../base/base-config';
-export class RendererConfig extends WidgetConfig {
+export class PalletConfig extends WidgetConfig {
- static readonly NUMBER_MAPPING_KEY: string = "number-mapping";
+ static readonly NUMBER_MAPPING_KEY: string = 'number-mapping';
constructor() {
super();
}
getConfig(): DashboardWidgetSettings {
- return WidgetConfigBuilder.createWithSelectableColorsAndTitlePanel("pallet", "Pallet")
- .withDescription("Displays the data in the form of pallet")
+ return WidgetConfigBuilder.createWithSelectableColorsAndTitlePanel('pallet', 'Pallet')
+ .withDescription('Displays the data in the form of pallet')
.requiredSchema(SchemaRequirementsBuilder
.create()
- .requiredPropertyWithUnaryMapping(RendererConfig.NUMBER_MAPPING_KEY, "Select property", "", EpRequirements.anyProperty())
+ .requiredPropertyWithUnaryMapping(PalletConfig.NUMBER_MAPPING_KEY, 'Select property', '', EpRequirements.anyProperty())
.build())
.build();
}
-}
\ No newline at end of file
+}
diff --git a/ui/src/app/dashboard/components/widgets/renderer/renderer.component.css b/ui/src/app/dashboard/components/widgets/pallet/pallet.component.css
similarity index 100%
rename from ui/src/app/dashboard/components/widgets/renderer/renderer.component.css
rename to ui/src/app/dashboard/components/widgets/pallet/pallet.component.css
diff --git a/ui/src/app/dashboard/components/widgets/renderer/renderer.component.html b/ui/src/app/dashboard/components/widgets/pallet/pallet.component.html
similarity index 100%
rename from ui/src/app/dashboard/components/widgets/renderer/renderer.component.html
rename to ui/src/app/dashboard/components/widgets/pallet/pallet.component.html
diff --git a/ui/src/app/dashboard/components/widgets/pallet/pallet.component.ts b/ui/src/app/dashboard/components/widgets/pallet/pallet.component.ts
new file mode 100644
index 0000000..3a7d525
--- /dev/null
+++ b/ui/src/app/dashboard/components/widgets/pallet/pallet.component.ts
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { Component, OnDestroy, OnInit } from '@angular/core';
+
+import { RxStompService } from '@stomp/ng2-stompjs';
+import { StaticPropertyExtractor } from '../../../sdk/extractor/static-property-extractor';
+import { DashboardService } from '../../../services/dashboard.service';
+import { ResizeService } from '../../../services/resize.service';
+import { BaseStreamPipesWidget } from '../base/base-widget';
+import { NumberConfig } from '../number/number-config';
+import { add_items, intialize_default } from './pallet_functions';
+
+declare function convert(packing_plan): any;
+declare function render_on_canvas(canvas_id, viewpoint, options_pref, boxes, pallet): any;
+declare function scale_pallet(x, y, z): any;
+
+
+
+@Component({
+ selector: 'sp-pallet',
+ templateUrl: './pallet.component.html',
+ styleUrls: ['./pallet.component.css']
+})
+
+export class PalletComponent extends BaseStreamPipesWidget implements OnInit, OnDestroy {
+
+ selectedProperty: string;
+
+ constructor(rxStompService: RxStompService, dashboardService: DashboardService, resizeService: ResizeService) {
+ super(rxStompService, dashboardService, resizeService, false);
+ }
+
+ pallet;
+
+ ngOnInit(): void {
+ super.ngOnInit();
+ const data = intialize_default();
+ const boxes = convert(data);
+ this.pallet = scale_pallet(data.bin.size.width, data.bin.size.width / 8, data.bin.size.depth);
+ render_on_canvas('canvas', 'rotate', {width: 640, height: 480}, boxes, this.pallet);
+ }
+
+ ngOnDestroy(): void {
+ super.ngOnDestroy();
+ }
+
+ extractConfig(extractor: StaticPropertyExtractor) {
+ this.selectedProperty = extractor.mappingPropertyValue(NumberConfig.NUMBER_MAPPING_KEY);
+ }
+
+ protected onEvent(event: any) {
+
+ let data = intialize_default();
+
+ data = add_items(data, event['pallet']);
+ const boxes = convert(data);
+ render_on_canvas('canvas', 'rotate', {width: 640, height: 480}, boxes, this.pallet);
+ }
+
+ protected onSizeChanged(width: number, height: number) {
+ }
+
+}
diff --git a/ui/src/app/dashboard/components/widgets/pallet/pallet_functions.ts b/ui/src/app/dashboard/components/widgets/pallet/pallet_functions.ts
new file mode 100644
index 0000000..e32cd3f
--- /dev/null
+++ b/ui/src/app/dashboard/components/widgets/pallet/pallet_functions.ts
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export function modify_bin(data_body, name, depth, height, width) {
+ if (name != null) {
+ data_body.name = name;
+ }
+ if (depth != null) {
+ data_body.size.depth = depth;
+ }
+ if (height != null) {
+ data_body.size.height = height;
+ }
+ if (width != null) {
+ data_body.size.width = width;
+ }
+ return data_body;
+}
+
+export function add_items(data_body, items) {
+ data_body.items = items;
+ return data_body;
+}
+
+export function remove_item(data_body, item) {
+ const index = data_body.items.indexOf(item);
+ if (index > -1) {
+ data_body.items.splice(index, 1);
+ }
+ return data_body;
+}
+
+export function create_item(index, name, position_x, position_y, position_z, depth, height, width, type) {
+ const item = {
+ 'index': index,
+ 'name': name,
+ 'position': {
+ 'x': position_x,
+ 'y': position_y,
+ 'z': position_z
+ },
+ 'size': {
+ 'depth': depth,
+ 'height': height,
+ 'width': width
+ },
+ 'type': type
+ };
+ return item;
+}
+
+export function intialize_default() {
+ const renderer_data_body = {
+ 'bin': {
+ 'name': 'euro_pallet',
+ 'size': {
+ 'depth': 80,
+ 'height': 300,
+ 'width': 120
+
+ }
+ },
+ 'items': [],
+
+ 'timestamp': new Date
+ };
+ return renderer_data_body;
+}
diff --git a/ui/src/app/dashboard/components/widgets/renderer/renderer.component.spec.ts b/ui/src/app/dashboard/components/widgets/renderer/renderer.component.spec.ts
deleted file mode 100644
index e8ee121..0000000
--- a/ui/src/app/dashboard/components/widgets/renderer/renderer.component.spec.ts
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-
-import { RendererComponent } from './renderer.component';
-
-describe('RendererComponent', () => {
- let component: RendererComponent;
- let fixture: ComponentFixture<RendererComponent>;
-
- beforeEach(async(() => {
- TestBed.configureTestingModule({
- declarations: [ RendererComponent ]
- })
- .compileComponents();
- }));
-
- beforeEach(() => {
- fixture = TestBed.createComponent(RendererComponent);
- component = fixture.componentInstance;
- fixture.detectChanges();
- });
-
- it('should create', () => {
- expect(component).toBeTruthy();
- });
-});
diff --git a/ui/src/app/dashboard/components/widgets/renderer/renderer.component.ts b/ui/src/app/dashboard/components/widgets/renderer/renderer.component.ts
deleted file mode 100644
index eaaf408..0000000
--- a/ui/src/app/dashboard/components/widgets/renderer/renderer.component.ts
+++ /dev/null
@@ -1,302 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Component, OnInit } from '@angular/core';
-
-import {modify_bin,add_item,remove_item,create_item,intialize_default} from './renderer_functions'
-
-declare function convert(packing_plan): any;
-declare function render_on_canvas(canvas_id, viewpoint, options_pref, boxes, pallet): any;
-declare function scale_pallet(x, y, z): any;
-
-
-
-@Component({
- selector: 'app-renderer',
- templateUrl: './renderer.component.html',
- styleUrls: ['./renderer.component.css']
-})
-
-
-
-export class RendererComponent implements OnInit {
-
- constructor() { }
-
-
- ngOnInit(): void {
-
- // var data = {
- // "bin": {
- // "name": "euro_pallet",
- // "size": {
- // "depth": 80,
- // "height": 300,
- // "width": 120
-
- // }
- // },
- // "items": [{
- // "index": 0,
- // "name": "KLT_0",
- // "position": {
- // "x": 0,
- // "y": 0,
- // "z": 0
- // },
- // "size": {
- // "depth": 30,
- // "height": 27,
- // "width": 40
- // },
- // "type": "KLT"
- // }, {
- // "index": 1,
- // "name": "KLT_1",
- // "position": {
- // "x": 0,
- // "y": 0,
- // "z": 30
- // },
- // "size": {
- // "depth": 30,
- // "height": 27,
- // "width": 40
- // },
- // "type": "KLT"
- // }, {
- // "index": 2,
- // "name": "KLT_2",
- // "position": {
- // "x": 40,
- // "y": 0,
- // "z": 0
- // },
- // "size": {
- // "depth": 30,
- // "height": 27,
- // "width": 40
- // },
- // "type": "KLT"
- // }, {
- // "index": 3,
- // "name": "KLT_3",
- // "position": {
- // "x": 40,
- // "y": 0,
- // "z": 30
- // },
- // "size": {
- // "depth": 30,
- // "height": 27,
- // "width": 40
- // },
- // "type": "KLT"
- // }, {
- // "index": 4,
- // "name": "KLT_4",
- // "position": {
- // "x": 80,
- // "y": 0,
- // "z": 0
- // },
- // "size": {
- // "depth": 30,
- // "height": 27,
- // "width": 40
- // },
- // "type": "KLT"
- // }, {
- // "index": 5,
- // "name": "Red_Box_0",
- // "position": {
- // "x": 0,
- // "y": 27,
- // "z": 0
- // },
- // "size": {
- // "depth": 39,
- // "height": 31,
- // "width": 48
- // },
- // "type": "RedBox"
- // }, {
- // "index": 6,
- // "name": "Red_Box_1",
- // "position": {
- // "x": 48,
- // "y": 27,
- // "z": 0
- // },
- // "size": {
- // "depth": 39,
- // "height": 31,
- // "width": 48
- // },
- // "type": "RedBox"
- // }, {
- // "index": 7,
- // "name": "Red_Box_2",
- // "position": {
- // "x": 0,
- // "y": 58,
- // "z": 0
- // },
- // "size": {
- // "depth": 39,
- // "height": 31,
- // "width": 48
- // },
- // "type": "RedBox"
- // }, {
- // "index": 8,
- // "name": "Red_Box_3",
- // "position": {
- // "x": 48,
- // "y": 58,
- // "z": 0
- // },
- // "size": {
- // "depth": 39,
- // "height": 31,
- // "width": 48
- // },
- // "type": "RedBox"
- // }, {
- // "index": 9,
- // "name": "Red_Box_4",
- // "position": {
- // "x": 0,
- // "y": 89,
- // "z": 0
- // },
- // "size": {
- // "depth": 39,
- // "height": 31,
- // "width": 48
- // },
- // "type": "RedBox"
- // }, {
- // "index": 10,
- // "name": "Cardboard_0",
- // "position": {
- // "x": 48,
- // "y": 89,
- // "z": 0
- // },
- // "size": {
- // "depth": 28,
- // "height": 33,
- // "width": 48
- // },
- // "type": "Cardboard"
- // }, {
- // "index": 11,
- // "name": "Cardboard_1",
- // "position": {
- // "x": 0,
- // "y": 120,
- // "z": 0
- // },
- // "size": {
- // "depth": 28,
- // "height": 33,
- // "width": 48
- // },
- // "type": "Cardboard"
- // }, {
- // "index": 12,
- // "name": "Cardboard_2",
- // "position": {
- // "x": 48,
- // "y": 122,
- // "z": 0
- // },
- // "size": {
- // "depth": 28,
- // "height": 33,
- // "width": 48
- // },
- // "type": "Cardboard"
- // }, {
- // "index": 13,
- // "name": "Cardboard_3",
- // "position": {
- // "x": 0,
- // "y": 153,
- // "z": 0
- // },
- // "size": {
- // "depth": 28,
- // "height": 33,
- // "width": 48
- // },
- // "type": "Cardboard"
- // }, {
- // "index": 14,
- // "name": "Cardboard_4",
- // "position": {
- // "x": 48,
- // "y": 155,
- // "z": 0
- // },
- // "size": {
- // "depth": 28,
- // "height": 33,
- // "width": 48
- // },
- // "type": "Cardboard"
- // }
- // ]
- // }
- var data = intialize_default()
- var item = {
- "index": 2,
- "name": "KLT_2",
- "position": {
- "x": 40,
- "y": 0,
- "z": 0
- },
- "size": {
- "depth": 30,
- "height": 27,
- "width": 40
- },
- "type": "Cardboard"
- }
-
- // TODO uncomment next line
- data = add_item(data,item)
-
- var boxes = convert(data);
- var pallet = scale_pallet(data.bin.size.width, data.bin.size.width / 8, data.bin.size.depth);
-
-
-
- render_on_canvas('canvas', 'front', {width: 640, height: 480}, boxes, pallet);
- /*render_on_canvas('view1', 'top', {width: 640, height: 480}, boxes, pallet);
- render_on_canvas('view2', 'side', {width: 640, height: 480}, boxes, pallet);
- render_on_canvas('view3', 'rotate', {width: 640, height: 480}, boxes, pallet);
- */
-
-
- }
-
-
-
-}
diff --git a/ui/src/app/dashboard/components/widgets/renderer/renderer_functions.ts b/ui/src/app/dashboard/components/widgets/renderer/renderer_functions.ts
deleted file mode 100644
index 61b33ce..0000000
--- a/ui/src/app/dashboard/components/widgets/renderer/renderer_functions.ts
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export function modify_bin(data_body,name,depth,height,width){
- if(name != null){
- data_body.name = name
- }
- if(depth != null){
- data_body.size.depth = depth
- }
- if(height != null){
- data_body.size.height = height
- }
- if(width != null){
- data_body.size.width = width
- }
- return data_body
-}
-
-export function add_item(data_body,item){
- data_body.items.push(item)
- return data_body
-}
-
-export function remove_item(data_body,item){
- const index = data_body.items.indexOf(item);
- if (index > -1) {
- data_body.items.splice(index, 1);
- }
- return data_body
-}
-
-export function create_item(index,name,position_x,position_y,position_z,depth,height,width,type){
- var item = {
- "index": index,
- "name": name,
- "position": {
- "x": position_x,
- "y": position_y,
- "z": position_z
- },
- "size": {
- "depth": depth,
- "height": height,
- "width": width
- },
- "type": type
- }
- return item
-}
-
-export function intialize_default(){
- var renderer_data_body = {
- "bin": {
- "name": "euro_pallet",
- "size": {
- "depth": 80,
- "height": 300,
- "width": 120
-
- }
- },
- "items": [],
-
- "timestamp": new Date
- }
- return renderer_data_body
-}
\ No newline at end of file
diff --git a/ui/src/app/dashboard/dashboard.module.ts b/ui/src/app/dashboard/dashboard.module.ts
index 09b4e08..787a412 100644
--- a/ui/src/app/dashboard/dashboard.module.ts
+++ b/ui/src/app/dashboard/dashboard.module.ts
@@ -47,7 +47,7 @@ import {CdkTableModule} from "@angular/cdk/table";
import {RefreshDashboardService} from "./services/refresh-dashboard.service";
import {SemanticTypeUtilsService} from '../core-services/semantic-type/semantic-type-utils.service';
import {GaugeWidgetComponent} from "./components/widgets/gauge/gauge-widget.component";
-import {RendererComponent} from "./components/widgets/renderer/renderer.component";
+import {PalletComponent} from "./components/widgets/pallet/pallet.component";
import {ImageWidgetComponent} from "./components/widgets/image/image-widget.component";
import {AreaWidgetComponent} from "./components/widgets/area/area-widget.component";
import {MapWidgetComponent} from "./components/widgets/map/map-widget.component";
@@ -94,7 +94,7 @@ const dashboardWidgets = [
NumberWidgetComponent,
TableWidgetComponent,
GaugeWidgetComponent,
- RendererComponent,
+ PalletComponent,
ImageWidgetComponent,
MapWidgetComponent,
RawWidgetComponent,
diff --git a/ui/src/app/dashboard/registry/widget-registry.ts b/ui/src/app/dashboard/registry/widget-registry.ts
index 23840db..d7900f0 100644
--- a/ui/src/app/dashboard/registry/widget-registry.ts
+++ b/ui/src/app/dashboard/registry/widget-registry.ts
@@ -16,26 +16,26 @@
*
*/
-import {NumberConfig} from "../components/widgets/number/number-config";
-import {DashboardWidgetSettings} from "../../core-model/dashboard/DashboardWidgetSettings";
-import {WidgetConfig} from "../components/widgets/base/base-config";
-import {LineConfig} from "../components/widgets/line/line-config";
-import {TableConfig} from "../components/widgets/table/table-config";
-import {GaugeConfig} from "../components/widgets/gauge/gauge-config";
-import {RendererConfig} from "../components/widgets/renderer/renderer-config";
-import {ImageConfig} from "../components/widgets/image/image-config";
-import {AreaConfig} from "../components/widgets/area/area-config";
-import {MapConfig} from "../components/widgets/map/map-config";
-import {RawConfig} from "../components/widgets/raw/raw-config";
-import {HtmlConfig} from "../components/widgets/html/html-config";
-import {TrafficLightConfig} from "../components/widgets/trafficlight/traffic-light-config";
-import {VisualizablePipeline} from "../../core-model/dashboard/VisualizablePipeline";
-import {EventSchema} from "../../connect/schema-editor/model/EventSchema";
-import {SchemaMatch} from "../sdk/matching/schema-match";
+import { EventSchema } from '../../connect/schema-editor/model/EventSchema';
+import { DashboardWidgetSettings } from '../../core-model/dashboard/DashboardWidgetSettings';
+import { VisualizablePipeline } from '../../core-model/dashboard/VisualizablePipeline';
+import { AreaConfig } from '../components/widgets/area/area-config';
+import { WidgetConfig } from '../components/widgets/base/base-config';
+import { GaugeConfig } from '../components/widgets/gauge/gauge-config';
+import { HtmlConfig } from '../components/widgets/html/html-config';
+import { ImageConfig } from '../components/widgets/image/image-config';
+import { LineConfig } from '../components/widgets/line/line-config';
+import { MapConfig } from '../components/widgets/map/map-config';
+import { NumberConfig } from '../components/widgets/number/number-config';
+import { PalletConfig } from '../components/widgets/pallet/pallet-config';
+import { RawConfig } from '../components/widgets/raw/raw-config';
+import { TableConfig } from '../components/widgets/table/table-config';
+import { TrafficLightConfig } from '../components/widgets/trafficlight/traffic-light-config';
+import { SchemaMatch } from '../sdk/matching/schema-match';
export class WidgetRegistry {
- private static availableWidgets: Array<WidgetConfig> = [
+ private static availableWidgets: WidgetConfig[] = [
new NumberConfig(),
new LineConfig(),
new TableConfig(),
@@ -46,21 +46,21 @@ export class WidgetRegistry {
new RawConfig(),
new HtmlConfig(),
new TrafficLightConfig(),
- new RendererConfig()
+ new PalletConfig()
];
- static getAvailableWidgetTemplates(): Array<DashboardWidgetSettings> {
- let widgetTemplates = new Array<DashboardWidgetSettings>();
+ static getAvailableWidgetTemplates(): DashboardWidgetSettings[] {
+ const widgetTemplates = new Array<DashboardWidgetSettings>();
this.availableWidgets.forEach(widget => widgetTemplates.push(widget.getConfig()));
return widgetTemplates;
}
static getCompatibleWidgetTemplates(pipeline: VisualizablePipeline) {
- let inputSchema: EventSchema = pipeline.schema;
+ const inputSchema: EventSchema = pipeline.schema;
return this.getAvailableWidgetTemplates().filter(widget => WidgetRegistry.isCompatible(widget, inputSchema));
}
static isCompatible(widget: DashboardWidgetSettings, inputSchema: EventSchema) {
return new SchemaMatch().match(widget.requiredSchema, inputSchema);
}
-}
\ No newline at end of file
+}
diff --git a/ui/src/assets/render.js b/ui/src/assets/render.js
index 5783dab..9b05a45 100755
--- a/ui/src/assets/render.js
+++ b/ui/src/assets/render.js
@@ -160,7 +160,12 @@ function render_on_canvas(canvas_id, viewpoint, options_pref, boxes, pallet) {
options.width = options_pref.width;
options.height = options_pref.height;
scene = new PackWidget.Scene();
+ element = document.getElementById(canvas_id);
+ if (element.firstChild) {
+ element.removeChild(element.firstChild);
+ }
renderer = new PackWidget.Renderer(scene, document.getElementById(canvas_id), options);
+ // document.getElementById(canvas_id)[0].remove();
for (i = 0; i < boxes.items.length; i++) {
renderer.addBox(boxes.items[i]);
}