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 2024/03/20 17:07:19 UTC
(streampipes) branch dev updated: refactor(#2583): Remove dataTable from component PipelineElementRuntimeInfo (#2584)
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/streampipes.git
The following commit(s) were added to refs/heads/dev by this push:
new 1a1479f8fa refactor(#2583): Remove dataTable from component PipelineElementRuntimeInfo (#2584)
1a1479f8fa is described below
commit 1a1479f8fa9933a7a2f85edb1abc9a3e5ba18cb2
Author: Philipp Zehnder <te...@users.noreply.github.com>
AuthorDate: Wed Mar 20 18:07:10 2024 +0100
refactor(#2583): Remove dataTable from component PipelineElementRuntimeInfo (#2584)
* refactor: Remove duplicate import from dashboard module
* refactor(#2583): Replace dataTable with mat-table in LivePreviewTable component
* refactor(#2583): Add missing licence headers
* refactor(#2583): Fix count of table rows in e2e test
---
ui/cypress/support/utils/connect/ConnectUtils.ts | 9 +--
ui/src/app/connect/services/rest.service.ts | 14 +----
.../semantic-type/semantic-type-utils.service.ts | 4 ++
ui/src/app/core-ui/core-ui.module.ts | 6 ++
.../live-preview-error.component.html | 21 +++++++
.../live-preview-error.component.scss} | 9 ---
.../live-preview-error.component.ts} | 14 ++---
.../live-preview-loading.component.html | 32 ++++++++++
.../live-preview-loading.component.scss} | 9 ---
.../live-preview-loading.component.ts} | 14 ++---
.../live-preview-table.component.html | 52 ++++++++++++++++
.../live-preview-table.component.scss} | 9 ---
.../live-preview-table.component.ts | 58 +++++++++++++++++
.../pipeline-element-runtime-info.component.html | 72 ++++------------------
.../pipeline-element-runtime-info.component.scss | 9 ---
.../pipeline-element-runtime-info.component.ts | 58 ++++-------------
16 files changed, 215 insertions(+), 175 deletions(-)
diff --git a/ui/cypress/support/utils/connect/ConnectUtils.ts b/ui/cypress/support/utils/connect/ConnectUtils.ts
index 22c57d853b..5a8a77a57c 100644
--- a/ui/cypress/support/utils/connect/ConnectUtils.ts
+++ b/ui/cypress/support/utils/connect/ConnectUtils.ts
@@ -317,10 +317,11 @@ export class ConnectUtils {
timeout: 10000,
}).should('be.visible');
- // validate that three event properties
- cy.get('.preview-row', { timeout: 10000 })
- .its('length')
- .should('eq', amountOfProperties);
+ // validate that X event properties. The +1 is for the header row
+ cy.get('tr.mat-mdc-row', { timeout: 10000 }).should(
+ 'have.length',
+ amountOfProperties + 1,
+ );
}
public static tearDownPreprocessingRuleTest(
diff --git a/ui/src/app/connect/services/rest.service.ts b/ui/src/app/connect/services/rest.service.ts
index 9f766a9fc6..73a8f42978 100644
--- a/ui/src/app/connect/services/rest.service.ts
+++ b/ui/src/app/connect/services/rest.service.ts
@@ -78,7 +78,7 @@ export class RestService {
);
}
- getRuntimeInfo(sourceDescription): Observable<any> {
+ getRuntimeInfo(sourceDescription): Observable<Record<string, any>> {
return this.http.post(
`${this.platformServicesCommons.apiBasePath}/pipeline-element/runtime`,
sourceDescription,
@@ -88,18 +88,6 @@ export class RestService {
);
}
- // getFormats(): Observable<FormatDescription[]> {
- // return this.http
- // .get(`${this.connectPath}/master/description/formats`)
- // .pipe(
- // map(response => {
- // return (response as any[]).map(f =>
- // FormatDescription.fromData(f),
- // );
- // }),
- // );
- // }
-
getFittingUnits(
unitDescription: UnitDescription,
): Observable<UnitDescription[]> {
diff --git a/ui/src/app/core-services/semantic-type/semantic-type-utils.service.ts b/ui/src/app/core-services/semantic-type/semantic-type-utils.service.ts
index a56a3f48c7..f93d2eeddf 100644
--- a/ui/src/app/core-services/semantic-type/semantic-type-utils.service.ts
+++ b/ui/src/app/core-services/semantic-type/semantic-type-utils.service.ts
@@ -39,6 +39,10 @@ export class SemanticTypeUtilsService {
return property.domainProperties.includes(this.TIMESTAMP);
}
+ public isImage(property: EventProperty): boolean {
+ return property.domainProperties.includes(this.IMAGE);
+ }
+
public is(property: EventProperty, uri: string): boolean {
return property.domainProperties.includes(uri);
}
diff --git a/ui/src/app/core-ui/core-ui.module.ts b/ui/src/app/core-ui/core-ui.module.ts
index df1787ba2e..2fb9be2263 100644
--- a/ui/src/app/core-ui/core-ui.module.ts
+++ b/ui/src/app/core-ui/core-ui.module.ts
@@ -80,6 +80,9 @@ import { HelpComponent } from './help/help.component';
import { PipelineElementRuntimeInfoComponent } from './pipeline-element-runtime-info/pipeline-element-runtime-info.component';
import { PipelineElementDocumentationComponent } from './pipeline-element-documentation/pipeline-element-documentation.component';
import { MarkdownModule } from 'ngx-markdown';
+import { LivePreviewLoadingComponent } from './pipeline-element-runtime-info/live-preview-loading/live-preview-loading.component';
+import { LivePreviewTableComponent } from './pipeline-element-runtime-info/live-preview-table/live-preview-table.component';
+import { LivePreviewErrorComponent } from './pipeline-element-runtime-info/live-preview-error/live-preview-error.component';
@NgModule({
imports: [
@@ -147,6 +150,9 @@ import { MarkdownModule } from 'ngx-markdown';
SpSimpleLogsComponent,
SpSimpleMetricsComponent,
StatusWidgetComponent,
+ LivePreviewLoadingComponent,
+ LivePreviewTableComponent,
+ LivePreviewErrorComponent,
],
providers: [
MatDatepickerModule,
diff --git a/ui/src/app/core-ui/pipeline-element-runtime-info/live-preview-error/live-preview-error.component.html b/ui/src/app/core-ui/pipeline-element-runtime-info/live-preview-error/live-preview-error.component.html
new file mode 100644
index 0000000000..81e1a2d160
--- /dev/null
+++ b/ui/src/app/core-ui/pipeline-element-runtime-info/live-preview-error/live-preview-error.component.html
@@ -0,0 +1,21 @@
+<!--
+ ~ 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.
+ ~
+ -->
+
+<div>
+ <p>Preview is currently unavailable.</p>
+</div>
diff --git a/ui/src/app/core-ui/pipeline-element-runtime-info/pipeline-element-runtime-info.component.scss b/ui/src/app/core-ui/pipeline-element-runtime-info/live-preview-error/live-preview-error.component.scss
similarity index 85%
copy from ui/src/app/core-ui/pipeline-element-runtime-info/pipeline-element-runtime-info.component.scss
copy to ui/src/app/core-ui/pipeline-element-runtime-info/live-preview-error/live-preview-error.component.scss
index 442ccb57a6..13cbc4aacb 100644
--- a/ui/src/app/core-ui/pipeline-element-runtime-info/pipeline-element-runtime-info.component.scss
+++ b/ui/src/app/core-ui/pipeline-element-runtime-info/live-preview-error/live-preview-error.component.scss
@@ -15,12 +15,3 @@
* limitations under the License.
*
*/
-
-.preview-row,
-.preview-table {
- background: var(--color-bg-dialog);
-}
-
-.dataTable tbody tr:hover {
- background: var(--color-bg-1);
-}
diff --git a/ui/src/app/core-ui/pipeline-element-runtime-info/pipeline-element-runtime-info.component.scss b/ui/src/app/core-ui/pipeline-element-runtime-info/live-preview-error/live-preview-error.component.ts
similarity index 76%
copy from ui/src/app/core-ui/pipeline-element-runtime-info/pipeline-element-runtime-info.component.scss
copy to ui/src/app/core-ui/pipeline-element-runtime-info/live-preview-error/live-preview-error.component.ts
index 442ccb57a6..195c240ebc 100644
--- a/ui/src/app/core-ui/pipeline-element-runtime-info/pipeline-element-runtime-info.component.scss
+++ b/ui/src/app/core-ui/pipeline-element-runtime-info/live-preview-error/live-preview-error.component.ts
@@ -16,11 +16,11 @@
*
*/
-.preview-row,
-.preview-table {
- background: var(--color-bg-dialog);
-}
+import { Component } from '@angular/core';
-.dataTable tbody tr:hover {
- background: var(--color-bg-1);
-}
+@Component({
+ selector: 'sp-live-preview-error',
+ templateUrl: './live-preview-error.component.html',
+ styleUrls: ['./live-preview-error.component.scss'],
+})
+export class LivePreviewErrorComponent {}
diff --git a/ui/src/app/core-ui/pipeline-element-runtime-info/live-preview-loading/live-preview-loading.component.html b/ui/src/app/core-ui/pipeline-element-runtime-info/live-preview-loading/live-preview-loading.component.html
new file mode 100644
index 0000000000..ddd4d82e80
--- /dev/null
+++ b/ui/src/app/core-ui/pipeline-element-runtime-info/live-preview-loading/live-preview-loading.component.html
@@ -0,0 +1,32 @@
+<!--
+ ~ 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.
+ ~
+ -->
+
+<div fxLayout="column" data-cy="sp-connect-adapter-gathering-live-preview">
+ <div fxLayoutAlign="center">
+ <mat-spinner
+ [diameter]="40"
+ fxLayoutAlign="center"
+ style="margin: 10px 0 5px 0"
+ color="accent"
+ >Loading
+ </mat-spinner>
+ </div>
+ <div fxLayoutAlign="center">
+ <h3>Gathering data for live preview...</h3>
+ </div>
+</div>
diff --git a/ui/src/app/core-ui/pipeline-element-runtime-info/pipeline-element-runtime-info.component.scss b/ui/src/app/core-ui/pipeline-element-runtime-info/live-preview-loading/live-preview-loading.component.scss
similarity index 85%
copy from ui/src/app/core-ui/pipeline-element-runtime-info/pipeline-element-runtime-info.component.scss
copy to ui/src/app/core-ui/pipeline-element-runtime-info/live-preview-loading/live-preview-loading.component.scss
index 442ccb57a6..13cbc4aacb 100644
--- a/ui/src/app/core-ui/pipeline-element-runtime-info/pipeline-element-runtime-info.component.scss
+++ b/ui/src/app/core-ui/pipeline-element-runtime-info/live-preview-loading/live-preview-loading.component.scss
@@ -15,12 +15,3 @@
* limitations under the License.
*
*/
-
-.preview-row,
-.preview-table {
- background: var(--color-bg-dialog);
-}
-
-.dataTable tbody tr:hover {
- background: var(--color-bg-1);
-}
diff --git a/ui/src/app/core-ui/pipeline-element-runtime-info/pipeline-element-runtime-info.component.scss b/ui/src/app/core-ui/pipeline-element-runtime-info/live-preview-loading/live-preview-loading.component.ts
similarity index 75%
copy from ui/src/app/core-ui/pipeline-element-runtime-info/pipeline-element-runtime-info.component.scss
copy to ui/src/app/core-ui/pipeline-element-runtime-info/live-preview-loading/live-preview-loading.component.ts
index 442ccb57a6..b591968188 100644
--- a/ui/src/app/core-ui/pipeline-element-runtime-info/pipeline-element-runtime-info.component.scss
+++ b/ui/src/app/core-ui/pipeline-element-runtime-info/live-preview-loading/live-preview-loading.component.ts
@@ -16,11 +16,11 @@
*
*/
-.preview-row,
-.preview-table {
- background: var(--color-bg-dialog);
-}
+import { Component } from '@angular/core';
-.dataTable tbody tr:hover {
- background: var(--color-bg-1);
-}
+@Component({
+ selector: 'sp-live-preview-loading',
+ templateUrl: './live-preview-loading.component.html',
+ styleUrls: ['./live-preview-loading.component.scss'],
+})
+export class LivePreviewLoadingComponent {}
diff --git a/ui/src/app/core-ui/pipeline-element-runtime-info/live-preview-table/live-preview-table.component.html b/ui/src/app/core-ui/pipeline-element-runtime-info/live-preview-table/live-preview-table.component.html
new file mode 100644
index 0000000000..811c236eaf
--- /dev/null
+++ b/ui/src/app/core-ui/pipeline-element-runtime-info/live-preview-table/live-preview-table.component.html
@@ -0,0 +1,52 @@
+<!--
+ ~ 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.
+ ~
+ -->
+
+<div data-cy="sp-connect-adapter-success-live-preview">
+ <p>Here is a preview of your data:</p>
+ <table mat-table [dataSource]="runtimeData">
+ <ng-container matColumnDef="runtimeName">
+ <th mat-header-cell *matHeaderCellDef>
+ <strong>Runtime Name</strong>
+ </th>
+ <td mat-cell *matCellDef="let element">
+ {{ element.runtimeName }}
+ </td>
+ </ng-container>
+
+ <ng-container matColumnDef="value">
+ <th mat-header-cell *matHeaderCellDef><strong>Value</strong></th>
+ <td mat-cell *matCellDef="let element">
+ <ng-container *ngIf="isImage(element.runtimeName)">
+ <img
+ src="data:image/png;base64,{{ element.value }}"
+ style="max-width: 150px"
+ />
+ </ng-container>
+ <ng-container *ngIf="isTimestamp(element.runtimeName)">
+ {{ element.value | date: 'yyyy-MM-dd HH:mm:ss ' }}
+ </ng-container>
+ <ng-container *ngIf="hasNoDomainProperty(element.runtimeName)">
+ {{ element.value }}
+ </ng-container>
+ </td>
+ </ng-container>
+
+ <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
+ <tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
+ </table>
+</div>
diff --git a/ui/src/app/core-ui/pipeline-element-runtime-info/pipeline-element-runtime-info.component.scss b/ui/src/app/core-ui/pipeline-element-runtime-info/live-preview-table/live-preview-table.component.scss
similarity index 85%
copy from ui/src/app/core-ui/pipeline-element-runtime-info/pipeline-element-runtime-info.component.scss
copy to ui/src/app/core-ui/pipeline-element-runtime-info/live-preview-table/live-preview-table.component.scss
index 442ccb57a6..13cbc4aacb 100644
--- a/ui/src/app/core-ui/pipeline-element-runtime-info/pipeline-element-runtime-info.component.scss
+++ b/ui/src/app/core-ui/pipeline-element-runtime-info/live-preview-table/live-preview-table.component.scss
@@ -15,12 +15,3 @@
* limitations under the License.
*
*/
-
-.preview-row,
-.preview-table {
- background: var(--color-bg-dialog);
-}
-
-.dataTable tbody tr:hover {
- background: var(--color-bg-1);
-}
diff --git a/ui/src/app/core-ui/pipeline-element-runtime-info/live-preview-table/live-preview-table.component.ts b/ui/src/app/core-ui/pipeline-element-runtime-info/live-preview-table/live-preview-table.component.ts
new file mode 100644
index 0000000000..9e9a64d2ed
--- /dev/null
+++ b/ui/src/app/core-ui/pipeline-element-runtime-info/live-preview-table/live-preview-table.component.ts
@@ -0,0 +1,58 @@
+/*
+ * 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, Input } from '@angular/core';
+import { EventSchema } from '@streampipes/platform-services';
+import { SemanticTypeUtilsService } from '../../../core-services/semantic-type/semantic-type-utils.service';
+
+@Component({
+ selector: 'sp-live-preview-table',
+ templateUrl: './live-preview-table.component.html',
+ styleUrls: ['./live-preview-table.component.scss'],
+})
+export class LivePreviewTableComponent {
+ @Input()
+ eventSchema: EventSchema;
+
+ @Input()
+ runtimeData: { runtimeName: string; value: any }[];
+
+ displayedColumns: string[] = ['runtimeName', 'value'];
+
+ constructor(private semanticTypeUtilsService: SemanticTypeUtilsService) {}
+
+ isImage(runtimeName: string) {
+ const property = this.getProperty(runtimeName);
+ return this.semanticTypeUtilsService.isImage(property);
+ }
+
+ isTimestamp(runtimeName: string) {
+ const property = this.getProperty(runtimeName);
+ return this.semanticTypeUtilsService.isTimestamp(property);
+ }
+
+ hasNoDomainProperty(runtimeName: string) {
+ return !(this.isTimestamp(runtimeName) || this.isImage(runtimeName));
+ }
+
+ getProperty(runtimeName: string) {
+ return this.eventSchema.eventProperties.find(
+ property => property.runtimeName === runtimeName,
+ );
+ }
+}
diff --git a/ui/src/app/core-ui/pipeline-element-runtime-info/pipeline-element-runtime-info.component.html b/ui/src/app/core-ui/pipeline-element-runtime-info/pipeline-element-runtime-info.component.html
index df6e739e0f..f480c1a760 100644
--- a/ui/src/app/core-ui/pipeline-element-runtime-info/pipeline-element-runtime-info.component.html
+++ b/ui/src/app/core-ui/pipeline-element-runtime-info/pipeline-element-runtime-info.component.html
@@ -16,64 +16,14 @@
~
-->
-<div *ngIf="!runtimeData && !runtimeDataError">
- <div fxLayout="column">
- <div fxLayoutAlign="center">
- <mat-spinner
- [diameter]="40"
- fxLayoutAlign="center"
- style="margin: 10px 0 5px 0"
- color="accent"
- >Loading</mat-spinner
- >
- </div>
- <div
- fxLayoutAlign="center"
- data-cy="sp-connect-adapter-gathering-live-preview"
- >
- <h3>Gathering data for live preview...</h3>
- </div>
- </div>
-</div>
-<div *ngIf="runtimeData" data-cy="sp-connect-adapter-success-live-preview">
- <p>Here is a preview of your data:</p>
- <table class="dataTable row-border hover">
- <thead>
- <tr>
- <th>Runtime Name</th>
- <th>Value</th>
- </tr>
- </thead>
- <tbody id="preview-data-rows-id">
- <tr
- *ngFor="
- let property of streamDescription.eventSchema
- .eventProperties
- "
- class="preview-row"
- >
- <td>{{ property.runtimeName }}</td>
- <td *ngIf="isImage(property)">
- <img
- src="data:image/png;base64,{{
- runtimeData[property.runtimeName]
- }}"
- style="max-width: 150px"
- />
- </td>
- <td *ngIf="isTimestamp(property)">
- {{
- runtimeData[property.runtimeName]
- | date: 'yyyy-MM-dd HH:mm:ss '
- }}
- </td>
- <td *ngIf="hasNoDomainProperty(property)">
- {{ runtimeData[property.runtimeName] }}
- </td>
- </tr>
- </tbody>
- </table>
-</div>
-<div *ngIf="runtimeDataError">
- <p>Preview is currently unavailable.</p>
-</div>
+<sp-live-preview-loading *ngIf="!runtimeData && !runtimeDataError">
+</sp-live-preview-loading>
+
+<sp-live-preview-table
+ *ngIf="runtimeData"
+ [eventSchema]="streamDescription.eventSchema"
+ [runtimeData]="runtimeData"
+>
+</sp-live-preview-table>
+
+<sp-live-preview-error *ngIf="runtimeDataError"> </sp-live-preview-error>
diff --git a/ui/src/app/core-ui/pipeline-element-runtime-info/pipeline-element-runtime-info.component.scss b/ui/src/app/core-ui/pipeline-element-runtime-info/pipeline-element-runtime-info.component.scss
index 442ccb57a6..13cbc4aacb 100644
--- a/ui/src/app/core-ui/pipeline-element-runtime-info/pipeline-element-runtime-info.component.scss
+++ b/ui/src/app/core-ui/pipeline-element-runtime-info/pipeline-element-runtime-info.component.scss
@@ -15,12 +15,3 @@
* limitations under the License.
*
*/
-
-.preview-row,
-.preview-table {
- background: var(--color-bg-dialog);
-}
-
-.dataTable tbody tr:hover {
- background: var(--color-bg-1);
-}
diff --git a/ui/src/app/core-ui/pipeline-element-runtime-info/pipeline-element-runtime-info.component.ts b/ui/src/app/core-ui/pipeline-element-runtime-info/pipeline-element-runtime-info.component.ts
index db068fd067..f66a7f5694 100644
--- a/ui/src/app/core-ui/pipeline-element-runtime-info/pipeline-element-runtime-info.component.ts
+++ b/ui/src/app/core-ui/pipeline-element-runtime-info/pipeline-element-runtime-info.component.ts
@@ -17,10 +17,7 @@
*/
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
-import {
- EventPropertyUnion,
- SpDataStream,
-} from '@streampipes/platform-services';
+import { SpDataStream } from '@streampipes/platform-services';
import { RestService } from '../../connect/services/rest.service';
@Component({
@@ -34,7 +31,7 @@ export class PipelineElementRuntimeInfoComponent implements OnInit, OnDestroy {
_pollingActive: boolean;
- runtimeData: any;
+ runtimeData: { runtimeName: string; value: any }[];
timer: any;
runtimeDataError = false;
@@ -54,50 +51,17 @@ export class PipelineElementRuntimeInfoComponent implements OnInit, OnDestroy {
this.restService
.getRuntimeInfo(this.streamDescription)
.subscribe(data => {
- if (data) {
- this.runtimeDataError = false;
- if (
- !(
- Object.keys(data).length === 0 &&
- data.constructor === Object
- )
- ) {
- this.runtimeData = data;
- }
+ this.runtimeDataError = !data;
- if (this._pollingActive) {
- this.timer = setTimeout(() => {
- this.getLatestRuntimeInfo();
- }, 1000);
- }
- } else {
- this.runtimeDataError = true;
- }
- });
- }
-
- isPropertyType(property: EventPropertyUnion, type) {
- return (
- property.domainProperties !== undefined &&
- property.domainProperties.length === 1 &&
- property.domainProperties[0] === type
- );
- }
-
- isImage(property) {
- return this.isPropertyType(property, 'https://image.com');
- }
-
- isTimestamp(property) {
- return this.isPropertyType(property, 'http://schema.org/DateTime');
- }
+ this.runtimeData = Object.entries(data).map(
+ ([runtimeName, value]) => ({ runtimeName, value }),
+ );
- hasNoDomainProperty(property) {
- if (this.isTimestamp(property) || this.isImage(property)) {
- return false;
- } else {
- return true;
- }
+ this.timer = setTimeout(
+ () => this.getLatestRuntimeInfo(),
+ 1000,
+ );
+ });
}
@Input()