Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Set start/end time KPI widget chart, add attribute filter to picker dialogs, clean up styling sidepanel (#1097)

DonWillems22d104cd4dc0
diff --git a/manager/src/web/shared/locales/en/or.json b/manager/src/web/shared/locales/en/or.json
index d614eeb3b..a6950e196 100644
--- a/manager/src/web/shared/locales/en/or.json
+++ b/manager/src/web/shared/locales/en/or.json
@@ -154,7 +154,9 @@
"ending": "Ending",
"timeframe": "Timeframe",
"timeframeDefault": "Default timeframe",
+ "dataSampling": "Data sampling",
"algorithm": "Algorithm",
+ "algorithmMethod": "Method per interval",
"addAttribute": "Add attribute",
"selectAttributes": "Select attributes",
"selectAttribute": "Select attribute",
@@ -462,6 +464,8 @@
"addMetaItems": "Add configuration items",
"loseChanges": "Discard changes?",
"confirmContinueAssetModified": "Asset has been modified, discard changes?",
+ "assetModified": "Asset modified",
+ "assetModifiedMustRefresh": "The asset was modified by another source and the page needs to refresh. You will lose your changes.",
"saveAssetFailed": "Failed to save asset",
"noCommand": "No command",
"start": "Start",
@@ -697,5 +701,10 @@
"saveRealmFailed": "Save realm failed",
"saveRealmSucceeded": "Saved realm successfully!",
"userDisconnected": "Disconnected successfully!",
- "userDisconnectFailed": "Disconnect failed"
+ "userDisconnectFailed": "Disconnect failed",
+ "lttb": "Default (LTTB)",
+ "withInterval": "With interval",
+ "AVG": "Average (mean)",
+ "MIN": "Minimum",
+ "MAX": "Maximum"
}
diff --git a/manager/src/web/shared/locales/nl/or.json b/manager/src/web/shared/locales/nl/or.json
index b8fb14630..309a884c0 100644
--- a/manager/src/web/shared/locales/nl/or.json
+++ b/manager/src/web/shared/locales/nl/or.json
@@ -154,7 +154,9 @@
"ending": "Einde",
"timeframe": "Tijdvak",
"timeframeDefault": "Standaard tijdvak",
+ "dataSampling": "Data weergave",
"algorithm": "Algoritme",
+ "algorithmMethod": "Methode per interval",
"addAttribute": "Attribuut toevoegen",
"selectAttributes": "Kies attributen",
"selectAttribute": "Kies attribuut",
@@ -462,6 +464,8 @@
"addMetaItems": "Voeg configuratie item toe",
"loseChanges": "Wijzigingen negeren?",
"confirmContinueAssetModified": "Asset is aangepast, wijzigingen negeren?",
+ "assetModified": "Asset is aangepast",
+ "assetModifiedMustRefresh": "De asset is door een andere bron aangepast en de pagina moet ververst worden. Je wijzigingen zullen verloren gaan.",
"saveAssetFailed": "Asset opslaan niet gelukt",
"noCommand": "Geen commando",
"start": "Start",
@@ -693,5 +697,10 @@
"address": "Adres",
"since": "Vanaf",
"roles": "Rollen",
- "restrictedUser": "Gebruiker met beperkte toegang"
+ "restrictedUser": "Gebruiker met beperkte toegang",
+ "lttb": "Standaard (LTTB)",
+ "withInterval": "Met interval",
+ "AVG": "Gemiddelde",
+ "MIN": "Minimum",
+ "MAX": "Maximum"
}
diff --git a/ui/component/or-attribute-card/src/index.ts b/ui/component/or-attribute-card/src/index.ts
index 625aef27f..ae4ff1582 100644
--- a/ui/component/or-attribute-card/src/index.ts
+++ b/ui/component/or-attribute-card/src/index.ts
@@ -227,6 +227,8 @@ export class OrAttributeCard extends LitElement {
@query("#chart")
private _chartElem!: HTMLCanvasElement;
private _chart?: Chart<"line", ScatterDataPoint[]>;
+ protected _startOfPeriod?: number;
+ protected _endOfPeriod?: number;
private resizeObserver?: ResizeObserver;
static get styles() {
@@ -319,6 +321,8 @@ export class OrAttributeCard extends LitElement {
},
x: {
type: "time",
+ min: this._startOfPeriod,
+ max: this._endOfPeriod,
display: false,
}
}
@@ -716,8 +720,8 @@ export class OrAttributeCard extends LitElement {
}
const lowerCaseInterval = interval.toLowerCase();
- const startOfPeriod = moment().startOf(this.period).startOf(lowerCaseInterval as moment.unitOfTime.StartOf).add(1, lowerCaseInterval as moment.unitOfTime.Base).toDate().getTime(); moment().clone().subtract(1, this.period).toDate().getTime();
- const endOfPeriod = moment().endOf(this.period).startOf(lowerCaseInterval as moment.unitOfTime.StartOf).add(1, lowerCaseInterval as moment.unitOfTime.Base).toDate().getTime();
+ this._startOfPeriod = moment().subtract(1, this.period).toDate().getTime();
+ this._endOfPeriod = moment().toDate().getTime();
this.mainValue = undefined;
this.formattedMainValue = undefined;
const assetId = this.assets[0].id!;
@@ -741,8 +745,8 @@ export class OrAttributeCard extends LitElement {
attributeName,
{
type: "lttb",
- fromTimestamp: startOfPeriod,
- toTimestamp: endOfPeriod,
+ fromTimestamp: this._startOfPeriod,
+ toTimestamp: this._endOfPeriod,
amountOfPoints: 20,
} as AssetDatapointLTTBQuery
);
diff --git a/ui/component/or-attribute-picker/src/index.ts b/ui/component/or-attribute-picker/src/index.ts
index c450701d0..3103fbe5c 100644
--- a/ui/component/or-attribute-picker/src/index.ts
+++ b/ui/component/or-attribute-picker/src/index.ts
@@ -40,6 +40,11 @@ export class OrAttributePicker extends OrMwcDialog {
@property({type: Boolean})
public showOnlyRuleStateAttrs?: boolean = false;
+
+ @property()
+ public attributeFilter?: (attribute: Attribute<any>) => boolean;
+
+
@property({type: Boolean})
public multiSelect?: boolean = false;
@@ -91,6 +96,11 @@ export class OrAttributePicker extends OrMwcDialog {
return this;
}
+ public setAttributeFilter(attributeFilter: ((attribute: Attribute<any>) => boolean) | undefined): OrAttributePicker {
+ this.attributeFilter = attributeFilter;
+ return this;
+ }
+
public setMultiSelect(multiSelect: boolean | undefined): OrAttributePicker {
this.multiSelect = multiSelect;
return this;
@@ -252,6 +262,10 @@ export class OrAttributePicker extends OrMwcDialog {
this.assetAttributes = Object.values(selectedAsset.attributes!).map(attr => { return {...attr, id: selectedAsset!.id!}; })
.sort(Util.sortByString((attribute) => attribute.name!));
+ if (this.attributeFilter){
+ this.assetAttributes = this.assetAttributes.filter((attr) => this.attributeFilter!(attr))
+ }
+
if (this.showOnlyDatapointAttrs && this.showOnlyRuleStateAttrs) {
this.assetAttributes = this.assetAttributes
.filter(e => e.meta && (e.meta[WellknownMetaItems.STOREDATAPOINTS] || e.meta[WellknownMetaItems.RULESTATE] || e.meta[WellknownMetaItems.AGENTLINK]));
diff --git a/ui/component/or-dashboard-builder/src/or-dashboard-boardsettings.ts b/ui/component/or-dashboard-builder/src/or-dashboard-boardsettings.ts
index 0edfbb978..0e406db7a 100644
--- a/ui/component/or-dashboard-builder/src/or-dashboard-boardsettings.ts
+++ b/ui/component/or-dashboard-builder/src/or-dashboard-boardsettings.ts
@@ -216,7 +216,7 @@ export class OrDashboardBoardsettings extends LitElement {
// UI generation of an expandable panel header.
generateExpandableHeader(name: string): TemplateResult {
return html`
- <span class="expandableHeader panel-title" @click="${() => { this.expandPanel(name); }}">
+ <span class="expandableHeader" @click="${() => { this.expandPanel(name); }}">
<or-icon icon="${this.expandedPanels.includes(name) ? 'chevron-down' : 'chevron-right'}"></or-icon>
<span style="margin-left: 6px; height: 25px; line-height: 25px;">${name}</span>
</span>
diff --git a/ui/component/or-dashboard-builder/src/or-dashboard-settingspanel.ts b/ui/component/or-dashboard-builder/src/or-dashboard-settingspanel.ts
index cfbc36d62..11dffd778 100644
--- a/ui/component/or-dashboard-builder/src/or-dashboard-settingspanel.ts
+++ b/ui/component/or-dashboard-builder/src/or-dashboard-settingspanel.ts
@@ -1,6 +1,6 @@
import manager, {DefaultColor5, Util} from "@openremote/core";
import {
- Asset, AssetModelUtil, AttributeRef, AssetDescriptor, AssetTypeInfo,
+ Asset, Attribute, AssetModelUtil, AttributeRef, AssetDescriptor, AssetTypeInfo,
} from "@openremote/model";
import {OrAttributePicker, OrAttributePickerPickedEvent} from "@openremote/or-attribute-picker";
import {getAssetDescriptorIconTemplate} from "@openremote/or-icon";
@@ -32,7 +32,6 @@ export const widgetSettingsStyling = css`
#attribute-list {
overflow: auto;
flex: 1 1 0;
- min-height: 150px;
width: 100%;
display: flex;
flex-direction: column;
@@ -88,8 +87,26 @@ export const widgetSettingsStyling = css`
.button-clear:hover {
--or-icon-fill: var(--or-app-color4);
}
+
+ .expanded-panel {
+ padding: 6px 16px 24px;
+ display: flex;
+ flex-direction: column;
+ gap: 16px;
+ }
/* ---------------------------- */
+
+ .threshold-list-item {
+ display: flex;
+ flex-direction: row;
+ align-items: center;
+ }
+
+ .threshold-list-item-colour {
+ height: 100%;
+ padding: 0 4px 0 0;
+ }
.threshold-list-item:hover .button-clear {
visibility: visible;
@@ -114,6 +131,9 @@ export class OrDashboardSettingsPanel extends LitElement {
@property({type: Boolean}) // used for SINGLE_ATTRIBUTE and MULTI_ATTRIBUTE types.
private readonly onlyDataAttrs: boolean = true;
+ @property() // used to specify the attribute valuetype that can be used in the widget.
+ public attributeFilter?: ((attribute: Attribute<any>) => boolean) | undefined;
+
@state()
private loadedAssets?: Asset[];
@@ -158,7 +178,7 @@ export class OrDashboardSettingsPanel extends LitElement {
return html`<span>${i18next.t('errorOccurred')}</span>`;
} else {
return html`
- ${until(this.getAttributeHTML(this._config, (this.type == SettingsPanelType.MULTI_ATTRIBUTE), this.onlyDataAttrs), html`${i18next.t('loading')}`)}
+ ${until(this.getAttributeHTML(this._config, (this.type == SettingsPanelType.MULTI_ATTRIBUTE), this.onlyDataAttrs, this.attributeFilter), html`${i18next.t('loading')}`)}
`;
}
}
@@ -195,11 +215,11 @@ export class OrDashboardSettingsPanel extends LitElement {
this.dispatchEvent(new CustomEvent('updated', {detail: {changes: changes, force: force}}));
}
- async getAttributeHTML(config: any, multi: boolean, onlyDataAttrs: boolean = true) {
+ async getAttributeHTML(config: any, multi: boolean, onlyDataAttrs: boolean = true, attributeFilter?: (attribute: Attribute<any>) => boolean) {
return html`
<div style="padding: 0 14px 12px 14px;">
${(config.attributeRefs == null || config.attributeRefs.length == 0) ? html`
- <span>${i18next.t('noAttributesConnected')}</span>
+ <span style="padding: 14px 0; display: block;">${i18next.t('noAttributesConnected')}</span>
` : undefined}
<div id="attribute-list">
${(config.attributeRefs != null && this.loadedAssets != null) ? config.attributeRefs.map((attributeRef: AttributeRef) => {
@@ -228,9 +248,9 @@ export class OrDashboardSettingsPanel extends LitElement {
}
}) : undefined}
</div>
- <or-mwc-input .type="${InputType.BUTTON}" label="${i18next.t('attribute')}" icon="plus"
- style="margin-top: 24px; margin-left: -7px;"
- @or-mwc-input-changed="${() => this.openDialog(config.attributeRefs, multi, onlyDataAttrs)}">
+ <or-mwc-input .type="${InputType.BUTTON}" label="${i18next.t('attribute')}" icon="${(multi || config.attributeRefs.length == 0) ? "plus" : "swap-horizontal"}"
+ style="margin-top: 8px;"
+ @or-mwc-input-changed="${() => this.openDialog(config.attributeRefs, multi, onlyDataAttrs, attributeFilter)}">
</or-mwc-input>
</div>
`
@@ -279,10 +299,10 @@ export class OrDashboardSettingsPanel extends LitElement {
}
// Opening the attribute picker dialog, and listening to its result. (UI related)
- openDialog(attributeRefs: AttributeRef[], multi: boolean, onlyDataAttrs: boolean = true) {
+ openDialog(attributeRefs: AttributeRef[], multi: boolean, onlyDataAttrs: boolean = true, attributeFilter?: (attribute: Attribute<any>) => boolean) {
let dialog: OrAttributePicker;
if (attributeRefs != null) {
- dialog = showDialog(new OrAttributePicker().setMultiSelect(multi).setSelectedAttributes(attributeRefs).setShowOnlyDatapointAttrs(onlyDataAttrs));
+ dialog = showDialog(new OrAttributePicker().setMultiSelect(multi).setSelectedAttributes(attributeRefs).setShowOnlyDatapointAttrs(onlyDataAttrs).setAttributeFilter(attributeFilter));
} else {
dialog = showDialog(new OrAttributePicker().setMultiSelect(multi).setShowOnlyDatapointAttrs(onlyDataAttrs))
}
@@ -297,15 +317,14 @@ export class OrDashboardSettingsPanel extends LitElement {
async getThresholdsHTML(config: OrWidgetConfig | any) {
if (config.thresholds && config.valueType) {
return html`
- <div id="thresholds-list" style="padding: 0 14px 12px 14px;">
+ <div id="thresholds-list" class="expanded-panel">
${(config.valueType === 'number' || config.valueType === 'positiveInteger'
|| config.valueType === 'positiveNumber' || config.valueType === 'negativeInteger'
|| config.valueType === 'negativeNumber') ? html`
${(config.thresholds as [number, string][]).sort((x, y) => (x[0] < y[0]) ? -1 : 1).map((threshold, index) => {
return html`
- <div class="threshold-list-item"
- style="padding: 8px 0; display: flex; flex-direction: row; align-items: center;">
- <div style="height: 100%; padding: 8px 14px 8px 0;">
+ <div class="threshold-list-item">
+ <div class="threshold-list-item-colour">
<or-mwc-input type="${InputType.COLOUR}" value="${threshold[1]}"
@or-mwc-input-changed="${(event: CustomEvent) => {
this._config.thresholds[index][1] = event.detail.value;
@@ -323,25 +342,30 @@ export class OrDashboardSettingsPanel extends LitElement {
}
}}"
></or-mwc-input>
- <button class="button-clear"
- style="margin-left: 8px; ${index == 0 ? 'visibility: hidden;' : undefined}"
- @click="${() => {
- this.removeThreshold(this._config, threshold);
- }}">
- <or-icon icon="close-circle"></or-icon>
- </button>
+ ${index == 0 ? html`
+ <button class="button-clear"
+ style="margin-left: 8px;">
+ <or-icon icon="lock" style="--or-icon-fill: var(--or-app-color5, ${unsafeCSS(DefaultColor5)});"></or-icon>
+ </button>
+ ` : html`
+ <button class="button-clear"
+ style="margin-left: 8px;"
+ @click="${() => {
+ this.removeThreshold(this._config, threshold);
+ }}">
+ <or-icon icon="close-circle"></or-icon>
+ </button>
+ `}
</div>
`
})}
<or-mwc-input .type="${InputType.BUTTON}" label="${i18next.t('threshold')}" icon="plus"
- style="margin-top: 24px; margin-left: -7px;"
@or-mwc-input-changed="${() => this.addNewThreshold(this._config)}">
</or-mwc-input>
` : null}
${(config.valueType === 'boolean') ? html`
- <div class="threshold-list-item"
- style="padding: 8px 0; display: flex; flex-direction: row; align-items: center;">
- <div style="height: 100%; padding: 8px 14px 8px 0;">
+ <div class="threshold-list-item">
+ <div class="threshold-list-item-colour">
<or-mwc-input type="${InputType.COLOUR}" value="${config.boolColors.true}"
@or-mwc-input-changed="${(event: CustomEvent) => {
this._config.boolColors.true = event.detail.value;
@@ -352,9 +376,8 @@ export class OrDashboardSettingsPanel extends LitElement {
<or-mwc-input type="${InputType.TEXT}" comfortable .value="${'True'}" .readonly="${true}"
></or-mwc-input>
</div>
- <div class="threshold-list-item"
- style="padding: 8px 0; display: flex; flex-direction: row; align-items: center;">
- <div style="height: 100%; padding: 8px 14px 8px 0;">
+ <div class="threshold-list-item">
+ <div class="threshold-list-item-colour">
<or-mwc-input type="${InputType.COLOUR}" value="${config.boolColors.false}"
@or-mwc-input-changed="${(event: CustomEvent) => {
this._config.boolColors.false = event.detail.value;
@@ -369,9 +392,8 @@ export class OrDashboardSettingsPanel extends LitElement {
${(config.valueType === 'text' && config.textColors) ? html`
${(config.textColors as [string, string][]).map((threshold, index) => {
return html`
- <div class="threshold-list-item"
- style="padding: 8px 0; display: flex; flex-direction: row; align-items: center;">
- <div style="height: 100%; padding: 8px 14px 8px 0;">
+ <div class="threshold-list-item">
+ <div class="threshold-list-item-colour">
<or-mwc-input type="${InputType.COLOUR}" value="${threshold[1]}"
@or-mwc-input-changed="${(event: CustomEvent) => {
this._config.textColors[index][1] = event.detail.value;
@@ -386,18 +408,24 @@ export class OrDashboardSettingsPanel extends LitElement {
}}"
></or-mwc-input>
- <button class="button-clear"
- style="margin-left: 8px; ${index == 0 ? 'visibility: hidden;' : undefined}"
- @click="${() => {
- this.removeThreshold(this._config, threshold);
- }}">
- <or-icon icon="close-circle"></or-icon>
- </button>
+ ${index == 0 ? html`
+ <button class="button-clear"
+ style="margin-left: 8px;">
+ <or-icon icon="lock" style="--or-icon-fill: var(--or-app-color5, ${unsafeCSS(DefaultColor5)});"></or-icon>
+ </button>
+ ` : html`
+ <button class="button-clear"
+ style="margin-left: 8px;"
+ @click="${() => {
+ this.removeThreshold(this._config, threshold);
+ }}">
+ <or-icon icon="close-circle"></or-icon>
+ </button>
+ `}
</div>
`
})}
<or-mwc-input .type="${InputType.BUTTON}" label="${i18next.t('threshold')}" icon="plus"
- style="margin-top: 24px; margin-left: -7px;"
@or-mwc-input-changed="${() => this.addNewThreshold(this._config)}">
</or-mwc-input> </div>
` : null}
@@ -554,7 +582,7 @@ export class OrDashboardSettingsPanel extends LitElement {
this._loadedAssetTypes = await this.getAssetTypes() as AssetDescriptor[]
}
return html`
- <div style="padding: 12px 24px 24px 24px; display: flex; flex-direction: column; gap: 16px;">
+ <div class="expanded-panel">
${this._loadedAssetTypes.length > 0 ? getContentWithMenuTemplate(
this.assetTypeSelect(),
this.mapDescriptors(this._loadedAssetTypes, {
@@ -581,7 +609,7 @@ export class OrDashboardSettingsPanel extends LitElement {
}}"
></or-mwc-input>
</div>
- <div style="padding: 0 10px 12px 10px;">
+ <div>
<div class="switchMwcInputContainer">
<span>${i18next.t('dashboard.showLabels')}</span>
<or-mwc-input .type="${InputType.SWITCH}" style="width: 70px;"
diff --git a/ui/component/or-dashboard-builder/src/style.ts b/ui/component/or-dashboard-builder/src/style.ts
index 2b953da6f..360101d03 100644
--- a/ui/component/or-dashboard-builder/src/style.ts
+++ b/ui/component/or-dashboard-builder/src/style.ts
@@ -84,6 +84,14 @@ export const style = css`
border-radius: 0;
width: 100%;
cursor: pointer;
+ font-weight: 700;
+ line-height: 1em;
+ color: var(--internal-or-asset-viewer-title-text-color);
+ flex: 0 0 auto;
+ }
+ .expandableHeader > or-icon {
+ --or-icon-height: 20px;
+ --or-icon-width: 20px;
}
.panel-title {
text-transform: uppercase;
diff --git a/ui/component/or-dashboard-builder/src/widgets/or-chart-widget.ts b/ui/component/or-dashboard-builder/src/widgets/or-chart-widget.ts
index fcb83349c..37d769bac 100644
--- a/ui/component/or-dashboard-builder/src/widgets/or-chart-widget.ts
+++ b/ui/component/or-dashboard-builder/src/widgets/or-chart-widget.ts
@@ -260,7 +260,7 @@ class OrChartWidgetSettings extends LitElement {
public widget?: DashboardWidget;
// Default values
- private expandedPanels: string[] = [i18next.t('attributes'), i18next.t('algorithm'), i18next.t('display'), i18next.t('dashboard.chartConfig')];
+ private expandedPanels: string[] = [i18next.t('attributes'), i18next.t('dataSampling'), i18next.t('display'), i18next.t('dashboard.chartConfig')];
static get styles() {
@@ -294,6 +294,9 @@ class OrChartWidgetSettings extends LitElement {
<div>
${this.expandedPanels.includes(i18next.t('attributes')) ? html`
<or-dashboard-settingspanel .type="${SettingsPanelType.MULTI_ATTRIBUTE}" .widgetConfig="${this.widget?.widgetConfig}"
+ .attributeFilter="${(attribute: Attribute<any>) => {
+ return ["positiveInteger", "positiveNumber", "number", "long", "integer", "bigInteger", "negativeInteger", "negativeNumber", "bigNumber", "integerByte", "direction", "boolean"]
+ .includes(attribute.type!)}}"
@updated="${(event: CustomEvent) => { this.updateConfig(this.widget!, event.detail.changes.get('config')) }}"
></or-dashboard-settingspanel>
` : null}
@@ -303,7 +306,7 @@ class OrChartWidgetSettings extends LitElement {
</div>
<div>
${this.expandedPanels.includes(i18next.t('display')) ? html`
- <div style="padding: 12px 24px 48px 24px;">
+ <div class="expanded-panel">
<div>
<or-mwc-input .type="${InputType.SELECT}" label="${i18next.t('timeframeDefault')}" style="width: 100%;"
.options="${Array.from(timePresetOptions.keys())}" value="${config.defaultTimePresetKey}"
@@ -313,23 +316,25 @@ class OrChartWidgetSettings extends LitElement {
}}"
></or-mwc-input>
</div>
- <div class="switchMwcInputContainer" style="margin-top: 16px;">
- <span>${i18next.t('dashboard.allowTimerangeSelect')}</span>
- <or-mwc-input .type="${InputType.SWITCH}" style="margin: 0 -10px;" .value="${config.showTimestampControls}"
- @or-mwc-input-changed="${(event: OrInputChangedEvent) => {
- config.showTimestampControls = event.detail.value;
- this.updateConfig(this.widget!, config);
- }}"
- ></or-mwc-input>
- </div>
- <div class="switchMwcInputContainer">
- <span>${i18next.t('dashboard.showLegend')}</span>
- <or-mwc-input .type="${InputType.SWITCH}" style="margin: 0 -10px;" .value="${config.showLegend}"
- @or-mwc-input-changed="${(event: OrInputChangedEvent) => {
- config.showLegend = event.detail.value;
- this.updateConfig(this.widget!, config);
- }}"
- ></or-mwc-input>
+ <div>
+ <div class="switchMwcInputContainer">
+ <span>${i18next.t('dashboard.allowTimerangeSelect')}</span>
+ <or-mwc-input .type="${InputType.SWITCH}" style="margin: 0 -10px;" .value="${config.showTimestampControls}"
+ @or-mwc-input-changed="${(event: OrInputChangedEvent) => {
+ config.showTimestampControls = event.detail.value;
+ this.updateConfig(this.widget!, config);
+ }}"
+ ></or-mwc-input>
+ </div>
+ <div class="switchMwcInputContainer">
+ <span>${i18next.t('dashboard.showLegend')}</span>
+ <or-mwc-input .type="${InputType.SWITCH}" style="margin: 0 -10px;" .value="${config.showLegend}"
+ @or-mwc-input-changed="${(event: OrInputChangedEvent) => {
+ config.showLegend = event.detail.value;
+ this.updateConfig(this.widget!, config);
+ }}"
+ ></or-mwc-input>
+ </div>
</div>
</div>
` : null}
@@ -342,7 +347,7 @@ class OrChartWidgetSettings extends LitElement {
const min = config.chartOptions.options?.scales?.y?.min;
const max = config.chartOptions.options?.scales?.y?.max;
return html`
- <div style="padding: 12px 24px 48px 24px; display: flex; flex-direction: column; gap: 16px;">
+ <div class="expanded-panel">
<div>
<div style="display: flex;">
${max != undefined ? html`
@@ -386,15 +391,15 @@ class OrChartWidgetSettings extends LitElement {
})}
</div>
<div>
- ${this.generateExpandableHeader(i18next.t('algorithm'))}
+ ${this.generateExpandableHeader(i18next.t('dataSampling'))}
</div>
<div>
- ${this.expandedPanels.includes(i18next.t('algorithm')) ? html`
+ ${this.expandedPanels.includes(i18next.t('dataSampling')) ? html`
${when(config.datapointQuery, () => {
- const typeOptions = new Map<string, string>([["Default", 'lttb'], ["With interval", 'interval']]);
+ const typeOptions = new Map<string, string>([["lttb", 'lttb'], ["withInterval", 'interval']]);
const typeValue = Array.from(typeOptions.entries()).find((entry => entry[1] == config.datapointQuery.type))![0]
return html`
- <div style="padding: 12px 24px 48px 24px;">
+ <div class="expanded-panel">
<or-mwc-input .type="${InputType.SELECT}" style="width: 100%" .options="${Array.from(typeOptions.keys())}"
.value="${typeValue}" label="${i18next.t('algorithm')}" @or-mwc-input-changed="${(event: OrInputChangedEvent) => {
config.datapointQuery.type = typeOptions.get(event.detail.value)! as any;
@@ -404,10 +409,10 @@ class OrChartWidgetSettings extends LitElement {
${choose(config.datapointQuery.type, [
['interval', () => {
const intervalQuery = config.datapointQuery as AssetDatapointIntervalQuery;
- const formulaOptions = [AssetDatapointIntervalQueryFormula.MIN, AssetDatapointIntervalQueryFormula.AVG, AssetDatapointIntervalQueryFormula.MAX];
+ const formulaOptions = [AssetDatapointIntervalQueryFormula.AVG, AssetDatapointIntervalQueryFormula.MIN, AssetDatapointIntervalQueryFormula.MAX];
return html`
- <or-mwc-input .type="${InputType.SELECT}" style="width: 100%; margin-top: 18px;" .options="${formulaOptions}"
- .value="${intervalQuery.formula}" label="${i18next.t('formula')}" @or-mwc-input-changed="${(event: OrInputChangedEvent) => {
+ <or-mwc-input .type="${InputType.SELECT}" style="width: 100%;" .options="${formulaOptions}"
+ .value="${intervalQuery.formula}" label="${i18next.t('algorithmMethod')}" @or-mwc-input-changed="${(event: OrInputChangedEvent) => {
intervalQuery.formula = event.detail.value;
this.updateConfig(this.widget!, config, true);
}}"
@@ -457,7 +462,7 @@ class OrChartWidgetSettings extends LitElement {
generateExpandableHeader(name: string): TemplateResult {
return html`
- <span class="expandableHeader panel-title" @click="${() => { this.expandPanel(name); }}">
+ <span class="expandableHeader" @click="${() => { this.expandPanel(name); }}">
<or-icon icon="${this.expandedPanels.includes(name) ? 'chevron-down' : 'chevron-right'}"></or-icon>
<span style="margin-left: 6px; height: 25px; line-height: 25px;">${name}</span>
</span>
diff --git a/ui/component/or-dashboard-builder/src/widgets/or-gauge-widget.ts b/ui/component/or-dashboard-builder/src/widgets/or-gauge-widget.ts
index 4d7bfef1b..b8b68ebb1 100644
--- a/ui/component/or-dashboard-builder/src/widgets/or-gauge-widget.ts
+++ b/ui/component/or-dashboard-builder/src/widgets/or-gauge-widget.ts
@@ -154,7 +154,10 @@ export class OrGaugeWidgetSettings extends LitElement {
</div>
<div>
${this.expandedPanels.includes(i18next.t('attributes')) ? html`
- <or-dashboard-settingspanel .type="${SettingsPanelType.SINGLE_ATTRIBUTE}" .onlyDataAttrs="${false}" .widgetConfig="${this.widget?.widgetConfig}"
+ <or-dashboard-settingspanel .type="${SettingsPanelType.SINGLE_ATTRIBUTE}" .onlyDataAttrs="${false}" .widgetConfig="${this.widget?.widgetConfig}"
+ .attributeFilter="${(attribute: Attribute<any>) => {
+ return ["positiveInteger", "positiveNumber", "number", "long", "integer", "bigInteger", "negativeInteger", "negativeNumber", "bigNumber", "integerByte", "direction"]
+ .includes(attribute.type!)}}"
@updated="${(event: CustomEvent) => {
this.updateConfig(this.widget!, event.detail.changes.get('config'));
this.onAttributesUpdate(event.detail.changes);
@@ -167,7 +170,7 @@ export class OrGaugeWidgetSettings extends LitElement {
</div>
<div>
${this.expandedPanels.includes(i18next.t('values')) ? html`
- <div style="padding: 12px 24px 48px 24px; display: flex; flex-direction: column; gap: 16px;">
+ <div class="expanded-panel">
<div style="display: flex; gap: 8px;">
<or-mwc-input type="${InputType.NUMBER}" label="${i18next.t('min')}" .max="${this.widget?.widgetConfig.max}" .value="${this.widget?.widgetConfig.min}"
@or-mwc-input-changed="${(event: CustomEvent) => {
@@ -242,7 +245,7 @@ export class OrGaugeWidgetSettings extends LitElement {
generateExpandableHeader(name: string): TemplateResult {
return html`
- <span class="expandableHeader panel-title" @click="${() => { this.expandPanel(name); }}">
+ <span class="expandableHeader" @click="${() => { this.expandPanel(name); }}">
<or-icon icon="${this.expandedPanels.includes(name) ? 'chevron-down' : 'chevron-right'}"></or-icon>
<span style="margin-left: 6px; height: 25px; line-height: 25px;">${name}</span>
</span>
diff --git a/ui/component/or-dashboard-builder/src/widgets/or-kpi-widget.ts b/ui/component/or-dashboard-builder/src/widgets/or-kpi-widget.ts
index 31cf28ed1..9d805d650 100644
--- a/ui/component/or-dashboard-builder/src/widgets/or-kpi-widget.ts
+++ b/ui/component/or-dashboard-builder/src/widgets/or-kpi-widget.ts
@@ -142,6 +142,9 @@ export class OrKpiWidgetSettings extends LitElement {
<div>
${this.expandedPanels.includes(i18next.t('attributes')) ? html`
<or-dashboard-settingspanel .type="${SettingsPanelType.SINGLE_ATTRIBUTE}" .widgetConfig="${this.widget!.widgetConfig}"
+ .attributeFilter="${(attribute: Attribute<any>) => {
+ return ["positiveInteger", "positiveNumber", "number", "long", "integer", "bigInteger", "negativeInteger", "negativeNumber", "bigNumber", "integerByte", "direction"]
+ .includes(attribute.type!)}}"
@updated="${(event: CustomEvent) => {
this.onAttributesUpdate(event.detail.changes);
this.updateConfig(this.widget!, event.detail.changes.get('config'));
@@ -154,7 +157,7 @@ export class OrKpiWidgetSettings extends LitElement {
</div>
<div>
${this.expandedPanels.includes(i18next.t('display')) ? html`
- <div style="padding: 24px 24px 48px 24px;">
+ <div class="expanded-panel">
<div>
<or-mwc-input .type="${InputType.SELECT}" style="width: 100%;"
.options="${['year', 'month', 'week', 'day', 'hour']}"
@@ -165,7 +168,7 @@ export class OrKpiWidgetSettings extends LitElement {
}}"
></or-mwc-input>
</div>
- <div class="switchMwcInputContainer" style="margin-top: 16px;">
+ <div class="switchMwcInputContainer">
<span>${i18next.t('dashboard.allowTimerangeSelect')}</span>
<or-mwc-input .type="${InputType.SWITCH}" style="margin: 0 -10px;" .value="${config.showTimestampControls}"
@or-mwc-input-changed="${(event: OrInputChangedEvent) => {
@@ -182,7 +185,7 @@ export class OrKpiWidgetSettings extends LitElement {
</div>
<div>
${this.expandedPanels.includes(i18next.t('values')) ? html`
- <div style="padding: 24px 24px 48px 24px;">
+ <div class="expanded-panel">
<div>
<or-mwc-input .type="${InputType.SELECT}" style="width: 100%;" .options="${['absolute', 'percentage']}" .value="${config.deltaFormat}" label="${i18next.t('dashboard.showValueAs')}"
@or-mwc-input-changed="${(event: OrInputChangedEvent) => {
@@ -191,7 +194,7 @@ export class OrKpiWidgetSettings extends LitElement {
}}"
></or-mwc-input>
</div>
- <div style="margin-top: 18px;">
+ <div>
<or-mwc-input .type="${InputType.NUMBER}" style="width: 100%;" .value="${config.decimals}" label="${i18next.t('decimals')}"
@or-mwc-input-changed="${(event: OrInputChangedEvent) => {
config.decimals = event.detail.value;
@@ -232,7 +235,7 @@ export class OrKpiWidgetSettings extends LitElement {
generateExpandableHeader(name: string): TemplateResult {
return html`
- <span class="expandableHeader panel-title" @click="${() => { this.expandPanel(name); }}">
+ <span class="expandableHeader" @click="${() => { this.expandPanel(name); }}">
<or-icon icon="${this.expandedPanels.includes(name) ? 'chevron-down' : 'chevron-right'}"></or-icon>
<span style="margin-left: 6px; height: 25px; line-height: 25px;">${name}</span>
</span>
diff --git a/ui/component/or-dashboard-builder/src/widgets/or-map-widget.ts b/ui/component/or-dashboard-builder/src/widgets/or-map-widget.ts
index 2b7ee8d69..c5615df29 100644
--- a/ui/component/or-dashboard-builder/src/widgets/or-map-widget.ts
+++ b/ui/component/or-dashboard-builder/src/widgets/or-map-widget.ts
@@ -244,8 +244,7 @@ class OrMapWidgetSettings extends LitElement {
</div>
<div>
${this.expandedPanels.includes(i18next.t('configuration.mapSettings')) ? html`
- <div style="padding: 12px 24px 48px 24px; display: flex; flex-direction: column; gap: 16px;">
-
+ <div class="expanded-panel">
<div>
<or-mwc-input .type="${InputType.NUMBER}" style="width: 100%;"
.value="${this.widget?.widgetConfig?.zoom}" label="${i18next.t('dashboard.zoom')}"
@@ -274,7 +273,7 @@ class OrMapWidgetSettings extends LitElement {
}}"
></or-mwc-input>
</div>
- <div style="display: flex; justify-content: space-between; align-items: center; padding: 0 10px 12px 10px;">
+ <div style="display: flex; justify-content: space-between; align-items: center;">
<span>${i18next.t('dashboard.showGeoJson')}</span>
<or-mwc-input .type="${InputType.SWITCH}" style="width: 70px;"
.value="${config.showGeoJson}"
@@ -342,7 +341,7 @@ class OrMapWidgetSettings extends LitElement {
generateExpandableHeader(name: string): TemplateResult {
return html`
- <span class="expandableHeader panel-title" @click="${() => {
+ <span class="expandableHeader" @click="${() => {
this.expandPanel(name);
}}">
<or-icon icon="${this.expandedPanels.includes(name) ? 'chevron-down' : 'chevron-right'}"></or-icon>