Skip to content

Commit

Permalink
chore(table): Merge changes from mainline and other changes: (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
square-li committed Sep 13, 2022
1 parent 6d5d62d commit 04ea4e2
Show file tree
Hide file tree
Showing 8 changed files with 245 additions and 83 deletions.
88 changes: 86 additions & 2 deletions packages/components/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* It contains typing information for all components that exist in this project.
*/
import { HTMLStencilElement, JSXBase } from "@stencil/core/internal";
import { Annotations } from "@synchro-charts/core";
import { Provider, StyleSettingsMap, TimeQuery, TimeSeriesData, TimeSeriesDataRequest, TimeSeriesDataRequestSettings, TreeQuery, Viewport } from "@iot-app-kit/core";
import { AlarmsConfig, Annotations, Axis, LabelsConfig, LayoutConfig, LegendConfig, MessageOverrides, MinimalSizeConfig, MovementConfig, ScaleConfig, TableColumn, Trend } from "@synchro-charts/core";
import { Item, TableItem, TableProps } from "@iot-app-kit/table";
import { BranchReference, SiteWiseAssetTreeNode } from "@iot-app-kit/source-iotsitewise";
import { ColumnDefinition, FilterTexts } from "./components/iot-resource-explorer/types";
Expand All @@ -15,17 +15,28 @@ import { EmptyStateProps, ITreeNode, UseTreeCollection } from "@iot-app-kit/rela
import { NonCancelableCustomEvent } from "@awsui/components-react";
export namespace Components {
interface IotBarChart {
"alarms"?: AlarmsConfig;
"annotations": Annotations;
"axis"?: Axis.Options;
"gestures"?: boolean;
"isEditing": boolean | undefined;
"layout"?: LayoutConfig;
"legend"?: LegendConfig;
"messageOverrides"?: MessageOverrides;
"movement"?: MovementConfig;
"queries": TimeQuery<TimeSeriesData[], TimeSeriesDataRequest>[];
"scale"?: ScaleConfig;
"settings": TimeSeriesDataRequestSettings;
"size"?: MinimalSizeConfig;
"styleSettings": StyleSettingsMap | undefined;
"trends": Trend[];
"viewport": Viewport;
"widgetId": string;
}
interface IotKpi {
"annotations": Annotations;
"isEditing": boolean | undefined;
"messageOverrides"?: MessageOverrides;
"queries": TimeQuery<TimeSeriesData[], TimeSeriesDataRequest>[];
"settings": TimeSeriesDataRequestSettings;
"styleSettings": StyleSettingsMap | undefined;
Expand All @@ -34,10 +45,19 @@ export namespace Components {
}
interface IotLineChart {
"annotations": Annotations;
"axis": Axis.Options;
"gestures"?: boolean;
"isEditing": boolean | undefined;
"layout"?: LayoutConfig;
"legend"?: LegendConfig;
"messageOverrides": MessageOverrides;
"movement"?: MovementConfig;
"queries": TimeQuery<TimeSeriesData[], TimeSeriesDataRequest>[];
"scale"?: ScaleConfig;
"settings": TimeSeriesDataRequestSettings;
"size"?: MinimalSizeConfig;
"styleSettings": StyleSettingsMap | undefined;
"trends": Trend[];
"viewport": Viewport;
"widgetId": string;
}
Expand Down Expand Up @@ -65,28 +85,47 @@ export namespace Components {
interface IotResourceExplorerDemo {
}
interface IotScatterChart {
"alarms"?: AlarmsConfig;
"annotations": Annotations;
"axis"?: Axis.Options;
"gestures"?: boolean;
"isEditing": boolean | undefined;
"layout"?: LayoutConfig;
"legend"?: LegendConfig;
"messageOverrides"?: MessageOverrides;
"movement"?: MovementConfig;
"queries": TimeQuery<TimeSeriesData[], TimeSeriesDataRequest>[];
"scale"?: ScaleConfig;
"settings": TimeSeriesDataRequestSettings;
"size"?: MinimalSizeConfig;
"styleSettings": StyleSettingsMap | undefined;
"trends": Trend[];
"viewport": Viewport;
"widgetId": string;
}
interface IotStatusGrid {
"annotations": Annotations;
"isEditing": boolean | undefined;
"labelsConfig": LabelsConfig;
"queries": TimeQuery<TimeSeriesData[], TimeSeriesDataRequest>[];
"settings": TimeSeriesDataRequestSettings;
"styleSettings": StyleSettingsMap | undefined;
"viewport": Viewport;
"widgetId": string;
}
interface IotStatusTimeline {
"annotations": Annotations;
"alarms"?: AlarmsConfig;
"annotations"?: Annotations;
"axis"?: Axis.Options;
"gestures"?: boolean;
"isEditing": boolean | undefined;
"layout"?: LayoutConfig;
"messageOverrides"?: MessageOverrides;
"movement"?: MovementConfig;
"queries": TimeQuery<TimeSeriesData[], TimeSeriesDataRequest>[];
"scale"?: ScaleConfig;
"settings": TimeSeriesDataRequestSettings;
"size"?: MinimalSizeConfig;
"styleSettings": StyleSettingsMap | undefined;
"viewport": Viewport;
"widgetId": string;
Expand All @@ -95,11 +134,14 @@ export namespace Components {
"annotations": Annotations;
"columnDefinitions": TableProps['columnDefinitions'];
"items": Item[];
"messageOverrides"?: MessageOverrides;
"propertyFiltering": TableProps['propertyFiltering'];
"queries": TimeQuery<TimeSeriesData[], TimeSeriesDataRequest>[];
"settings": TimeSeriesDataRequestSettings;
"sorting": TableProps['sorting'];
"styleSettings": StyleSettingsMap | undefined;
"tableColumns": TableColumn[];
"trends": Trend[];
"viewport": Viewport;
"widgetId": string;
}
Expand Down Expand Up @@ -256,17 +298,28 @@ declare global {
}
declare namespace LocalJSX {
interface IotBarChart {
"alarms"?: AlarmsConfig;
"annotations"?: Annotations;
"axis"?: Axis.Options;
"gestures"?: boolean;
"isEditing"?: boolean | undefined;
"layout"?: LayoutConfig;
"legend"?: LegendConfig;
"messageOverrides"?: MessageOverrides;
"movement"?: MovementConfig;
"queries": TimeQuery<TimeSeriesData[], TimeSeriesDataRequest>[];
"scale"?: ScaleConfig;
"settings"?: TimeSeriesDataRequestSettings;
"size"?: MinimalSizeConfig;
"styleSettings"?: StyleSettingsMap | undefined;
"trends"?: Trend[];
"viewport": Viewport;
"widgetId"?: string;
}
interface IotKpi {
"annotations"?: Annotations;
"isEditing"?: boolean | undefined;
"messageOverrides"?: MessageOverrides;
"queries": TimeQuery<TimeSeriesData[], TimeSeriesDataRequest>[];
"settings"?: TimeSeriesDataRequestSettings;
"styleSettings"?: StyleSettingsMap | undefined;
Expand All @@ -275,10 +328,19 @@ declare namespace LocalJSX {
}
interface IotLineChart {
"annotations"?: Annotations;
"axis"?: Axis.Options;
"gestures"?: boolean;
"isEditing"?: boolean | undefined;
"layout"?: LayoutConfig;
"legend"?: LegendConfig;
"messageOverrides"?: MessageOverrides;
"movement"?: MovementConfig;
"queries": TimeQuery<TimeSeriesData[], TimeSeriesDataRequest>[];
"scale"?: ScaleConfig;
"settings"?: TimeSeriesDataRequestSettings;
"size"?: MinimalSizeConfig;
"styleSettings"?: StyleSettingsMap | undefined;
"trends"?: Trend[];
"viewport": Viewport;
"widgetId"?: string;
}
Expand Down Expand Up @@ -306,28 +368,47 @@ declare namespace LocalJSX {
interface IotResourceExplorerDemo {
}
interface IotScatterChart {
"alarms"?: AlarmsConfig;
"annotations"?: Annotations;
"axis"?: Axis.Options;
"gestures"?: boolean;
"isEditing"?: boolean | undefined;
"layout"?: LayoutConfig;
"legend"?: LegendConfig;
"messageOverrides"?: MessageOverrides;
"movement"?: MovementConfig;
"queries": TimeQuery<TimeSeriesData[], TimeSeriesDataRequest>[];
"scale"?: ScaleConfig;
"settings"?: TimeSeriesDataRequestSettings;
"size"?: MinimalSizeConfig;
"styleSettings"?: StyleSettingsMap | undefined;
"trends"?: Trend[];
"viewport": Viewport;
"widgetId"?: string;
}
interface IotStatusGrid {
"annotations"?: Annotations;
"isEditing"?: boolean | undefined;
"labelsConfig"?: LabelsConfig;
"queries": TimeQuery<TimeSeriesData[], TimeSeriesDataRequest>[];
"settings"?: TimeSeriesDataRequestSettings;
"styleSettings"?: StyleSettingsMap | undefined;
"viewport": Viewport;
"widgetId"?: string;
}
interface IotStatusTimeline {
"alarms"?: AlarmsConfig;
"annotations"?: Annotations;
"axis"?: Axis.Options;
"gestures"?: boolean;
"isEditing"?: boolean | undefined;
"layout"?: LayoutConfig;
"messageOverrides"?: MessageOverrides;
"movement"?: MovementConfig;
"queries": TimeQuery<TimeSeriesData[], TimeSeriesDataRequest>[];
"scale"?: ScaleConfig;
"settings"?: TimeSeriesDataRequestSettings;
"size"?: MinimalSizeConfig;
"styleSettings"?: StyleSettingsMap | undefined;
"viewport": Viewport;
"widgetId"?: string;
Expand All @@ -336,11 +417,14 @@ declare namespace LocalJSX {
"annotations"?: Annotations;
"columnDefinitions": TableProps['columnDefinitions'];
"items": Item[];
"messageOverrides"?: MessageOverrides;
"propertyFiltering"?: TableProps['propertyFiltering'];
"queries": TimeQuery<TimeSeriesData[], TimeSeriesDataRequest>[];
"settings"?: TimeSeriesDataRequestSettings;
"sorting"?: TableProps['sorting'];
"styleSettings"?: StyleSettingsMap | undefined;
"tableColumns"?: TableColumn[];
"trends"?: Trend[];
"viewport": Viewport;
"widgetId"?: string;
}
Expand Down
12 changes: 4 additions & 8 deletions packages/components/src/components/iot-table/iot-react-table.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component, Element, Host, Prop, State, h } from '@stencil/core';
import { Component, Element, Host, Prop, h } from '@stencil/core';
import React, { FunctionComponent } from 'react';
import { createRoot, Root } from 'react-dom/client';
import { Table, TableItem, TableProps } from '@iot-app-kit/table';
import ReactDOM from 'react-dom';

@Component({
tag: 'iot-react-table',
Expand All @@ -17,11 +17,7 @@ export class IotReactTable {

@Element() host: HTMLElement;

@State() root: Root;

componentWillLoad() {
this.root = createRoot(this.host);
}
componentWillLoad() {}

componentDidLoad() {
this.componentDidUpdate();
Expand All @@ -34,7 +30,7 @@ export class IotReactTable {
sorting: this.sorting,
propertyFiltering: this.propertyFiltering,
};
this.root.render(React.createElement<TableProps>(Table as FunctionComponent<TableProps>, props));
ReactDOM.render(React.createElement<TableProps>(Table as FunctionComponent<TableProps>, props), this.host);
}

render() {
Expand Down
18 changes: 12 additions & 6 deletions packages/components/src/components/iot-table/iot-table.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { Component, Listen, Prop, State, Watch, h } from '@stencil/core';
import { Annotations, getThresholds } from '@synchro-charts/core';
import { Component, Prop, h, State, Listen, Watch } from '@stencil/core';
import { Annotations, MessageOverrides, TableColumn, Trend, getThresholds } from '@synchro-charts/core';
import {
combineProviders,
ProviderWithViewport,
StyleSettingsMap,
TimeSeriesDataRequestSettings,
combineProviders,
TimeQuery,
TimeSeriesData,
TimeSeriesDataRequest,
TimeSeriesDataRequestSettings,
Viewport,
TimeSeriesDataRequest,
ProviderWithViewport,
} from '@iot-app-kit/core';
import { v4 as uuidv4 } from 'uuid';
import { createTableItems, Item, TableProps } from '@iot-app-kit/table';
Expand All @@ -20,6 +20,12 @@ import { createTableItems, Item, TableProps } from '@iot-app-kit/table';
export class IotTable {
@Prop() annotations: Annotations;

@Prop() messageOverrides?: MessageOverrides;

@Prop() trends: Trend[];

@Prop() tableColumns: TableColumn[];

@Prop() queries!: TimeQuery<TimeSeriesData[], TimeSeriesDataRequest>[];

@Prop() viewport!: Viewport;
Expand Down
32 changes: 21 additions & 11 deletions packages/components/src/testing/testing-ground/siteWiseQueries.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
const STRING_ASSET_ID = 'f2f74fa8-625a-435f-b89c-d27b2d84f45b';
const STRING_ASSET_ID = 'fa94ab3e-d02f-4c50-88e1-f017c9069c4d';

export const DEMO_TURBINE_ASSET_1 = '863d5ed3-fdea-4720-97d1-54fe14d8a599';
export const DEMO_TURBINE_ASSET_1_PROPERTY_1 = 'feecfa93-80f0-40bd-b295-ce9f00cf01fe'; //rpm
export const DEMO_TURBINE_ASSET_1_PROPERTY_2 = '2cbeebde-2747-48e1-8717-acb5f3d9c730'; //avg wind speed
export const DEMO_TURBINE_ASSET_1_PROPERTY_3 = 'd953474c-6f74-4daa-90dc-888e9190a130'; //torque (kN/M)
export const DEMO_TURBINE_ASSET_1_PROPERTY_4 = 'd8937b65-5f03-4e40-93ac-c5513420ade7';
export const UNFOUNDED_PROPERTY = 'd8937b65-5f03-4e40-93ac-c5513420ade3';
export const DEMO_TURBINE_ASSET_2 = 'f8ce6619-af20-4c26-93db-e9ee17820d09';
export const DEMO_TURBINE_ASSET_3 = '5b054c8e-ad23-4228-8620-826859ddf675';
export const DEMO_TURBINE_ASSET_1 = 'fa94ab3e-d02f-4c50-88e1-f017c9069c4d';
export const DEMO_TURBINE_ASSET_1_PROPERTY_1 = 'f63861af-251e-4d0b-a32e-4d2089d35b1c';
export const DEMO_TURBINE_ASSET_1_PROPERTY_2 = 'ea55054e-55d0-4eda-8359-2cbc19d52a3d';
export const DEMO_TURBINE_ASSET_1_PROPERTY_3 = '18faca18-a8e5-4e48-9153-462c54980869';
export const DEMO_TURBINE_ASSET_1_PROPERTY_4 = '95648016-38d0-45e7-8f53-872404b9b471';

export const DEMO_TURBINE_ASSET_2 = 'e6fb533c-4919-4981-a71f-7764ccc10867';
export const DEMO_TURBINE_ASSET_2_PROPERTY_1 = 'f63861af-251e-4d0b-a32e-4d2089d35b1c';
export const DEMO_TURBINE_ASSET_2_PROPERTY_2 = 'ea55054e-55d0-4eda-8359-2cbc19d52a3d';
export const DEMO_TURBINE_ASSET_2_PROPERTY_3 = '18faca18-a8e5-4e48-9153-462c54980869';
export const DEMO_TURBINE_ASSET_2_PROPERTY_4 = '95648016-38d0-45e7-8f53-872404b9b471';

export const DEMO_TURBINE_ASSET_3 = 'bc86bf78-c506-460c-8602-0c534356892a';
export const DEMO_TURBINE_ASSET_3_PROPERTY_1 = 'f63861af-251e-4d0b-a32e-4d2089d35b1c';
export const DEMO_TURBINE_ASSET_3_PROPERTY_2 = 'ea55054e-55d0-4eda-8359-2cbc19d52a3d';
export const DEMO_TURBINE_ASSET_3_PROPERTY_3 = '18faca18-a8e5-4e48-9153-462c54980869';
export const DEMO_TURBINE_ASSET_3_PROPERTY_4 = '95648016-38d0-45e7-8f53-872404b9b471';
export const UNFOUNDED_PROPERTY = 'unfounded_property';

export const ASSET_DETAILS_QUERY = {
assetId: STRING_ASSET_ID,
};

const AGGREGATED_DATA_ASSET = STRING_ASSET_ID;
const AGGREGATED_DATA_PROPERTY = 'd0dc79be-0dc2-418c-ac23-26f33cdb4b8b';
const AGGREGATED_DATA_PROPERTY_2 = '69607dc2-5fbe-416d-aac2-0382018626e4';
const AGGREGATED_DATA_PROPERTY = 'b1616ab4-7526-4c0a-85e2-a137cf57d668';
const AGGREGATED_DATA_PROPERTY_2 = '729479fb-8720-4a70-bd55-2a9f9eaaa32e4';

export const AGGREGATED_DATA_QUERY = {
assets: [
Expand Down
Loading

0 comments on commit 04ea4e2

Please sign in to comment.