Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add proposed API changes within types declarations #37

Merged
merged 1 commit into from
Jan 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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 };

Expand All @@ -21,6 +22,8 @@ export class IotBarChart {

@Prop() settings: TimeSeriesDataRequestSettings | undefined;

@Prop() styles: StyleSettingsMap | undefined;

getSettings(): TimeSeriesDataRequestSettings {
return {
...this.settings,
Expand Down
3 changes: 3 additions & 0 deletions packages/components/src/components/iot-kpi/iot-kpi.tsx
Original file line number Diff line number Diff line change
@@ -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 };

Expand All @@ -21,6 +22,8 @@ export class IotKpi {

@Prop() settings: TimeSeriesDataRequestSettings | undefined;

@Prop() styles: StyleSettingsMap | undefined;

getSettings(): TimeSeriesDataRequestSettings {
return {
...this.settings,
Expand Down
Original file line number Diff line number Diff line change
@@ -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 };

Expand All @@ -21,6 +22,8 @@ export class IotLineChart {

@Prop() settings: TimeSeriesDataRequestSettings | undefined;

@Prop() styles: StyleSettingsMap | undefined;

getSettings(): TimeSeriesDataRequestSettings {
return {
...this.settings,
Expand Down
Original file line number Diff line number Diff line change
@@ -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 };

Expand All @@ -21,6 +22,8 @@ export class IotScatterChart {

@Prop() settings: TimeSeriesDataRequestSettings | undefined;

@Prop() styles: StyleSettingsMap | undefined;

getSettings(): TimeSeriesDataRequestSettings {
return {
...this.settings,
Expand Down
Original file line number Diff line number Diff line change
@@ -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 };

Expand All @@ -21,6 +22,8 @@ export class IotStatusGrid {

@Prop() settings: TimeSeriesDataRequestSettings | undefined;

@Prop() styles: StyleSettingsMap | undefined;

getSettings(): TimeSeriesDataRequestSettings {
return {
...this.settings,
Expand Down
Original file line number Diff line number Diff line change
@@ -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 };

Expand All @@ -21,6 +22,8 @@ export class IotStatusTimeline {

@Prop() settings: TimeSeriesDataRequestSettings | undefined;

@Prop() styles: StyleSettingsMap | undefined;

getSettings(): TimeSeriesDataRequestSettings {
return {
...this.settings,
Expand Down
3 changes: 3 additions & 0 deletions packages/components/src/components/iot-table/iot-table.tsx
Original file line number Diff line number Diff line change
@@ -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 };

Expand All @@ -19,6 +20,8 @@ export class IotTable {

@Prop() settings: TimeSeriesDataRequestSettings | undefined;

@Prop() styles: StyleSettingsMap | undefined;

getSettings(): TimeSeriesDataRequestSettings {
return {
...this.settings,
Expand Down
8 changes: 8 additions & 0 deletions packages/components/src/components/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export type StyleSettings = {
name?: string;
detailedName?: string;
color?: string; // CSS color string, i.e. 'red' or '#ffffff'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the future we may need to add some hierarchy to this type definition (i.e. `BaseStyleSettings & ScatterPlotStyleSettings" to support component-specific style properties (for example, scatterplots with a "hue" color). This looks great for now though!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on as as needed basis that makes sense 👍

unit?: string;
};

export type StyleSettingsMap = { [refId: string]: StyleSettings };
9 changes: 8 additions & 1 deletion packages/core/src/data-sources/site-wise/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand All @@ -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.
Expand Down