Skip to content

armgit / core

Public Imported from GitHub
0

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

put first column in and put an asset name span on the top left

Vincent3f9316715bf2
diff --git a/deployment/manager/shared/locales/de/or.json b/deployment/manager/shared/locales/de/or.json
index 046e16398..458700f24 100644
--- a/deployment/manager/shared/locales/de/or.json
+++ b/deployment/manager/shared/locales/de/or.json
@@ -104,6 +104,8 @@
"matched": "Passend",
"unmatched": "Nicht passend",
"wait": "Warte",
+ "group": "Gruppe",
+ "groupAssetName": "Asset Name",
"history": "Historie",
"attributes": "Attribute",
"info": "Info",
diff --git a/deployment/manager/shared/locales/en/or.json b/deployment/manager/shared/locales/en/or.json
index 5f31d3f66..23bd87650 100644
--- a/deployment/manager/shared/locales/en/or.json
+++ b/deployment/manager/shared/locales/en/or.json
@@ -140,6 +140,7 @@
"unmatched": "Unmatched",
"wait": "Wait",
"group": "Underlying assets",
+ "groupAssetName": "Asset name",
"history": "History",
"attributes": "Attributes",
"info": "Info",
diff --git a/deployment/manager/shared/locales/nl/or.json b/deployment/manager/shared/locales/nl/or.json
index 21daee345..6ee425493 100644
--- a/deployment/manager/shared/locales/nl/or.json
+++ b/deployment/manager/shared/locales/nl/or.json
@@ -139,7 +139,8 @@
"matched": "Dezelfde",
"unmatched": "Niet dezelfde",
"wait": "Wacht",
- "group": "Onderliggende assets",
+ "group": "Underlying assets",
+ "groupAssetName": "Asset naam",
"history": "Geschiedenis",
"attributes": "Attributen",
"info": "Info",
diff --git a/ui/component/or-asset-viewer/src/index.ts b/ui/component/or-asset-viewer/src/index.ts
index c9f28d7c5..d0777e520 100644
--- a/ui/component/or-asset-viewer/src/index.ts
+++ b/ui/component/or-asset-viewer/src/index.ts
@@ -622,11 +622,15 @@ export class OrAssetViewer extends subscribe(manager)(translate(i18next)(LitElem
// Update table properties which will cause a re-render
loadingMsg.hidden = true;
attributeTable.hidden = false;
- attributeTable.headers = [...selectedAttributes].sort().map((header) => i18next.t(header));
+ const headers = [...selectedAttributes].sort();
+ attributeTable.headers = headers.map((header) => i18next.t(header));
+ attributeTable.headers.unshift(i18next.t("groupAssetName"));
attributeTable.rows = childAssets.map((asset) => {
- return [...selectedAttributes].sort().map((attributeName) => {
+ const arr = headers.map((attributeName) => {
return asset.attributes![attributeName] ? asset.attributes![attributeName].value! as string : "";
});
+ arr.unshift(asset.name!);
+ return arr;
});
};
diff --git a/ui/component/or-table/src/index.ts b/ui/component/or-table/src/index.ts
index 2a5e009a9..539735444 100644
--- a/ui/component/or-table/src/index.ts
+++ b/ui/component/or-table/src/index.ts
@@ -10,10 +10,34 @@ const dataTableStyle = require("!!raw-loader!@material/data-table/dist/mdc.data-
// language=CSS
const style = css`
+ :host {
+ width: 100%;
+ }
+
:host([hidden]) {
display: none;
}
+ .mdc-data-table {
+ width: 100%;
+ max-width: 100%;
+ max-height: 500px;
+ overflow: auto;
+ }
+ .mdc-data-table.has-sticky-first-column tr th:first-of-type,
+ .mdc-data-table.has-sticky-first-column tr td:first-of-type {
+ z-index: 1;
+ position: sticky;
+ left: 0;
+ background-color: var(--internal-or-asset-viewer-panel-color);
+ }
+
+ th {
+ position: sticky;
+ top: 0;
+ background-color: var(--internal-or-asset-viewer-panel-color);
+ }
+
.mdc-data-table__header-cell {
font-weight: 700;
color: #aaa;
@@ -54,25 +78,6 @@ export class OrTable extends LitElement {
</tr>
</thead>`;
return html`
- <style>
- :host {
- width: 100%;
- }
-
- .mdc-data-table {
- width: 100%;
- max-width: 100%;
- max-height: 500px;
- overflow: auto;
- }
-
- th {
- position: sticky;
- top: 0;
- background-color: var(--internal-or-asset-viewer-panel-color);
- }
- </style>
-
<div class="mdc-data-table">
<table class="mdc-data-table__table" aria-label="Dessert calories">
${headerTemplate}