From b7555f4f187a0910f85f06989a11f6fa947dae4d Mon Sep 17 00:00:00 2001 From: Brian Diehr Date: Thu, 20 Jan 2022 09:06:23 -0800 Subject: [PATCH] feat: Add proposed API changes within types declarations --- .../src/components/iot-bar-chart/iot-bar-chart.tsx | 3 +++ packages/components/src/components/iot-kpi/iot-kpi.tsx | 3 +++ .../src/components/iot-line-chart/iot-line-chart.tsx | 3 +++ .../components/iot-scatter-chart/iot-scatter-chart.tsx | 3 +++ .../src/components/iot-status-grid/iot-status-grid.tsx | 3 +++ .../iot-status-timeline/iot-status-timeline.tsx | 3 +++ .../components/src/components/iot-table/iot-table.tsx | 3 +++ packages/components/src/components/types.d.ts | 8 ++++++++ packages/core/src/data-sources/site-wise/types.d.ts | 9 ++++++++- 9 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 packages/components/src/components/types.d.ts diff --git a/packages/components/src/components/iot-bar-chart/iot-bar-chart.tsx b/packages/components/src/components/iot-bar-chart/iot-bar-chart.tsx index a32dd01ad..9c7697066 100644 --- a/packages/components/src/components/iot-bar-chart/iot-bar-chart.tsx +++ b/packages/components/src/components/iot-bar-chart/iot-bar-chart.tsx @@ -1,6 +1,7 @@ import { Component, Prop, h } from '@stencil/core'; import { MinimalViewPortConfig } from '@synchro-charts/core'; import { AnyDataStreamQuery, DataModule, TimeSeriesDataRequestSettings } from '@iot-app-kit/core'; +import { StyleSettingsMap } from '../types'; const DEFAULT_VIEWPORT = { duration: 10 * 1000 * 60 }; @@ -21,6 +22,8 @@ export class IotBarChart { @Prop() settings: TimeSeriesDataRequestSettings | undefined; + @Prop() styles: StyleSettingsMap | undefined; + getSettings(): TimeSeriesDataRequestSettings { return { ...this.settings, diff --git a/packages/components/src/components/iot-kpi/iot-kpi.tsx b/packages/components/src/components/iot-kpi/iot-kpi.tsx index e9cd9db0a..4440dbcde 100644 --- a/packages/components/src/components/iot-kpi/iot-kpi.tsx +++ b/packages/components/src/components/iot-kpi/iot-kpi.tsx @@ -1,6 +1,7 @@ import { Component, Prop, h } from '@stencil/core'; import { MinimalViewPortConfig } from '@synchro-charts/core'; import { AnyDataStreamQuery, DataModule, TimeSeriesDataRequestSettings } from '@iot-app-kit/core'; +import { StyleSettingsMap } from '../types'; const DEFAULT_VIEWPORT = { duration: 10 * 1000 }; @@ -21,6 +22,8 @@ export class IotKpi { @Prop() settings: TimeSeriesDataRequestSettings | undefined; + @Prop() styles: StyleSettingsMap | undefined; + getSettings(): TimeSeriesDataRequestSettings { return { ...this.settings, diff --git a/packages/components/src/components/iot-line-chart/iot-line-chart.tsx b/packages/components/src/components/iot-line-chart/iot-line-chart.tsx index 4e29a19ea..2b6a5facb 100644 --- a/packages/components/src/components/iot-line-chart/iot-line-chart.tsx +++ b/packages/components/src/components/iot-line-chart/iot-line-chart.tsx @@ -1,6 +1,7 @@ import { Component, Prop, h } from '@stencil/core'; import { MinimalViewPortConfig } from '@synchro-charts/core'; import { AnyDataStreamQuery, DataModule, TimeSeriesDataRequestSettings } from '@iot-app-kit/core'; +import { StyleSettingsMap } from '../types'; const DEFAULT_VIEWPORT = { duration: 10 * 1000 * 60 }; @@ -21,6 +22,8 @@ export class IotLineChart { @Prop() settings: TimeSeriesDataRequestSettings | undefined; + @Prop() styles: StyleSettingsMap | undefined; + getSettings(): TimeSeriesDataRequestSettings { return { ...this.settings, diff --git a/packages/components/src/components/iot-scatter-chart/iot-scatter-chart.tsx b/packages/components/src/components/iot-scatter-chart/iot-scatter-chart.tsx index 5f1d9cbe3..6a603bb3c 100644 --- a/packages/components/src/components/iot-scatter-chart/iot-scatter-chart.tsx +++ b/packages/components/src/components/iot-scatter-chart/iot-scatter-chart.tsx @@ -1,6 +1,7 @@ import { Component, Prop, h } from '@stencil/core'; import { MinimalViewPortConfig } from '@synchro-charts/core'; import { AnyDataStreamQuery, DataModule, TimeSeriesDataRequestSettings } from '@iot-app-kit/core'; +import { StyleSettingsMap } from '../types'; const DEFAULT_VIEWPORT = { duration: 10 * 1000 * 60 }; @@ -21,6 +22,8 @@ export class IotScatterChart { @Prop() settings: TimeSeriesDataRequestSettings | undefined; + @Prop() styles: StyleSettingsMap | undefined; + getSettings(): TimeSeriesDataRequestSettings { return { ...this.settings, diff --git a/packages/components/src/components/iot-status-grid/iot-status-grid.tsx b/packages/components/src/components/iot-status-grid/iot-status-grid.tsx index d42d3518e..fdf58249a 100644 --- a/packages/components/src/components/iot-status-grid/iot-status-grid.tsx +++ b/packages/components/src/components/iot-status-grid/iot-status-grid.tsx @@ -1,6 +1,7 @@ import { Component, Prop, h } from '@stencil/core'; import { MinimalViewPortConfig } from '@synchro-charts/core'; import { AnyDataStreamQuery, DataModule, TimeSeriesDataRequestSettings } from '@iot-app-kit/core'; +import { StyleSettingsMap } from '../types'; const DEFAULT_VIEWPORT = { duration: 10 * 1000 * 60 }; @@ -21,6 +22,8 @@ export class IotStatusGrid { @Prop() settings: TimeSeriesDataRequestSettings | undefined; + @Prop() styles: StyleSettingsMap | undefined; + getSettings(): TimeSeriesDataRequestSettings { return { ...this.settings, diff --git a/packages/components/src/components/iot-status-timeline/iot-status-timeline.tsx b/packages/components/src/components/iot-status-timeline/iot-status-timeline.tsx index ab774e301..2f03f0051 100644 --- a/packages/components/src/components/iot-status-timeline/iot-status-timeline.tsx +++ b/packages/components/src/components/iot-status-timeline/iot-status-timeline.tsx @@ -1,6 +1,7 @@ import { Component, Prop, h } from '@stencil/core'; import { MinimalViewPortConfig } from '@synchro-charts/core'; import { AnyDataStreamQuery, DataModule, TimeSeriesDataRequestSettings } from '@iot-app-kit/core'; +import { StyleSettingsMap } from '../types'; const DEFAULT_VIEWPORT = { duration: 10 * 1000 * 60 }; @@ -21,6 +22,8 @@ export class IotStatusTimeline { @Prop() settings: TimeSeriesDataRequestSettings | undefined; + @Prop() styles: StyleSettingsMap | undefined; + getSettings(): TimeSeriesDataRequestSettings { return { ...this.settings, diff --git a/packages/components/src/components/iot-table/iot-table.tsx b/packages/components/src/components/iot-table/iot-table.tsx index 08c6a235d..4bd656e75 100644 --- a/packages/components/src/components/iot-table/iot-table.tsx +++ b/packages/components/src/components/iot-table/iot-table.tsx @@ -1,6 +1,7 @@ import { Component, Prop, h } from '@stencil/core'; import { MinimalViewPortConfig } from '@synchro-charts/core'; import { AnyDataStreamQuery, DataModule, TimeSeriesDataRequestSettings } from '@iot-app-kit/core'; +import { StyleSettingsMap } from '../types'; const DEFAULT_VIEWPORT = { duration: 10 * 1000 * 60 }; @@ -19,6 +20,8 @@ export class IotTable { @Prop() settings: TimeSeriesDataRequestSettings | undefined; + @Prop() styles: StyleSettingsMap | undefined; + getSettings(): TimeSeriesDataRequestSettings { return { ...this.settings, diff --git a/packages/components/src/components/types.d.ts b/packages/components/src/components/types.d.ts new file mode 100644 index 000000000..f3646057c --- /dev/null +++ b/packages/components/src/components/types.d.ts @@ -0,0 +1,8 @@ +export type StyleSettings = { + name?: string; + detailedName?: string; + color?: string; // CSS color string, i.e. 'red' or '#ffffff' + unit?: string; +}; + +export type StyleSettingsMap = { [refId: string]: StyleSettings }; diff --git a/packages/core/src/data-sources/site-wise/types.d.ts b/packages/core/src/data-sources/site-wise/types.d.ts index 1de9e7cae..4807dbc63 100644 --- a/packages/core/src/data-sources/site-wise/types.d.ts +++ b/packages/core/src/data-sources/site-wise/types.d.ts @@ -10,8 +10,12 @@ export type AssetId = string; export type PropertyAlias = string; +// Reference which can be used to associate styles to the associated results from a query +export type RefId = string; + export type PropertyQuery = { propertyId: string; + refId?: RefId; resolution?: string; }; @@ -26,7 +30,10 @@ type SiteWiseAssetDataStreamQuery = DataStreamQuery & { // TODO: Make the data stream query support property aliases for unmodeled data support type SiteWisePropertyAliasDataStreamQuery = DataStreamQuery & { - propertyAliases: PropertyAlias[]; + propertyAliases: { + propertyAlias: PropertyAlias; + refId: RefId; + }; }; // Unused currently, this is what we want to work towards.