Skip to content

armgit / core

Public Imported from GitHub
0

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

UI updates: minor

Rich Turner9aa8f2b1540c
diff --git a/ui/component/core/tsconfig.json b/ui/component/core/tsconfig.json
index 756167f6e..938343ca3 100644
--- a/ui/component/core/tsconfig.json
+++ b/ui/component/core/tsconfig.json
@@ -9,7 +9,6 @@
"./src"
],
"references": [
- { "path": "../rest" },
- { "path": "../or-icon" }
+ { "path": "../rest" }
]
}
\ No newline at end of file
diff --git a/ui/component/or-asset-viewer/src/index.ts b/ui/component/or-asset-viewer/src/index.ts
index 30b711574..d7c2de223 100644
--- a/ui/component/or-asset-viewer/src/index.ts
+++ b/ui/component/or-asset-viewer/src/index.ts
@@ -60,16 +60,6 @@ export interface ViewerConfig {
historyConfig?: HistoryConfig;
}
-function getAttributeLabel(attribute: Attribute | undefined, descriptor: AttributeDescriptor | undefined, fallback?: string): string {
- if (!attribute && !descriptor) {
- return fallback || "";
- }
-
- const labelMetaValue = AssetModelUtil.getMetaValue(MetaItemType.LABEL, attribute, descriptor);
- const name = attribute ? attribute.name : descriptor!.attributeName;
- return i18next.t([name, fallback || labelMetaValue || name]);
-}
-
@customElement("or-asset-viewer")
export class OrAssetViewer extends subscribe(manager)(translate(i18next)(LitElement)) {
@@ -352,7 +342,7 @@ export class OrAssetViewer extends subscribe(manager)(translate(i18next)(LitElem
content = html`
<div id="history-controls">
- <or-input id="history-attribute-picker" .label="${i18next.t("attribute")}" @or-input-changed="${(evt: OrInputChangedEvent) => attributeChanged(evt.detail.value)}" .type="${InputType.SELECT}" .options="${historyAttrs.map((attr) => [attr.name, getAttributeLabel(attr, undefined)])}"></or-input>
+ <or-input id="history-attribute-picker" .label="${i18next.t("attribute")}" @or-input-changed="${(evt: OrInputChangedEvent) => attributeChanged(evt.detail.value)}" .type="${InputType.SELECT}" .options="${historyAttrs.map((attr) => [attr.name, Util.getAttributeLabel(attr, undefined)])}"></or-input>
</div>
<or-attribute-history id="attribute-history" .config="${viewerConfig.historyConfig}" .assetType="${asset.type}"></or-attribute-history>
`;
diff --git a/ui/component/or-asset-viewer/src/style.ts b/ui/component/or-asset-viewer/src/style.ts
index f57d73e9b..1a3138928 100644
--- a/ui/component/or-asset-viewer/src/style.ts
+++ b/ui/component/or-asset-viewer/src/style.ts
@@ -109,10 +109,13 @@ export const style = css`
padding: var(--internal-or-asset-viewer-panel-padding);
}
+ #location-panel .panel-content {
+ height: 100%;
+ }
+
.panel-content {
display: flex;
flex-wrap: wrap;
- height: 100%;
}
.panel-title {
@@ -143,6 +146,7 @@ export const style = css`
text-align: center;
height: 100%;
}
+
.back-navigation {
display: none;
cursor: pointer;
diff --git a/ui/component/or-attribute-history/src/index.ts b/ui/component/or-attribute-history/src/index.ts
index 4590b3e80..ce2f83037 100644
--- a/ui/component/or-attribute-history/src/index.ts
+++ b/ui/component/or-attribute-history/src/index.ts
@@ -131,6 +131,13 @@ const style = css`
#ending-controls {
float: right;
padding-right: 10px;
+ display: table;
+ }
+
+ #ending-controls > * {
+ display: table-cell;
+ vertical-align: middle;
+ padding: 0 5px;
}
#chart-container {
@@ -264,9 +271,9 @@ export class OrAttributeHistory extends translate(i18next)(LitElement) {
<div id="controls">
<or-input .type="${InputType.SELECT}" ?disabled="${disabled}" .label="${i18next.t("period")}" @or-input-changed="${(evt: OrInputChangedEvent) => this.interval = evt.detail.value}" .value="${this.interval}" .options="${this._getIntervalOptions()}"></or-input>
<div id="ending-controls">
- <or-input .type="${InputType.BUTTON}" ?disabled="${disabled}" icon="chevron-left-circle" rounded @click="${() => this._updateTimestamp(this.timestamp!, false)}"></or-input>
+ <or-input class="button" .type="${InputType.BUTTON}" ?disabled="${disabled}" icon="chevron-left" @click="${() => this._updateTimestamp(this.timestamp!, false)}"></or-input>
<or-input .type="${InputType.DATETIME}" ?disabled="${disabled}" label="${i18next.t("ending")}" .value="${this.timestamp}" @or-input-changed="${(evt: OrInputChangedEvent) => this._updateTimestamp(moment(evt.detail.value as string).toDate())}"></or-input>
- <or-input .type="${InputType.BUTTON}" ?disabled="${disabled}" icon="chevron-right-circle" rounded @click="${() => this._updateTimestamp(this.timestamp!, true)}"></or-input>
+ <or-input class="button" .type="${InputType.BUTTON}" ?disabled="${disabled}" icon="chevron-right" @click="${() => this._updateTimestamp(this.timestamp!, true)}"></or-input>
</div>
</div>
@@ -387,7 +394,7 @@ export class OrAttributeHistory extends translate(i18next)(LitElement) {
this._chart.update();
}
}
- } else {
+ } else if (!this._tableTemplate) {
this._tableTemplate = this._getTableTemplate();
}
}
@@ -409,6 +416,10 @@ export class OrAttributeHistory extends translate(i18next)(LitElement) {
const attributeName = this.attribute ? this.attribute.name! : this.attributeRef!.attributeName!;
const attributeType = this.attribute ? this.attribute.type as string : undefined;
+ if (!this._data) {
+ return html``;
+ }
+
let config: AssetTableConfig = {
autoColumns: true
};