Skip to content

armgit / core

Public Imported from GitHub
0

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

Improvement/asset viewer breakpoints (#466)

DonWillemsda97ab564fa8
diff --git a/manager/src/web/shared/locales/ar/or.json b/manager/src/web/shared/locales/ar/or.json
index b99f51654..75c2674fc 100644
--- a/manager/src/web/shared/locales/ar/or.json
+++ b/manager/src/web/shared/locales/ar/or.json
@@ -88,8 +88,8 @@
"ok": "موافق",
"cancel": "إلغاء",
"createdOn": "أنشئ في",
- "createdOnWithDate": "أنشئ في: {{-date, LLLL}}",
- "updatedWithDate": "تم التحديث في تاريخ: {{-date, llll}}",
+ "createdOnWithDate": "أنشئ في: {{-date, lll}}",
+ "updatedWithDate": "تم التحديث في تاريخ: {{-date, lll}}",
"accessPublicRead": "عام",
"type": "نوع",
"path": "المسار",
diff --git a/manager/src/web/shared/locales/cn/or.json b/manager/src/web/shared/locales/cn/or.json
index 3e4168954..78ab1a57d 100644
--- a/manager/src/web/shared/locales/cn/or.json
+++ b/manager/src/web/shared/locales/cn/or.json
@@ -88,8 +88,8 @@
"ok": "OK",
"cancel": "取消",
"createdOn": "创建于",
- "createdOnWithDate": "创建于: {{-date, LLLL}}",
- "updatedWithDate": "更新于: {{-date, llll}}",
+ "createdOnWithDate": "创建于: {{-date, lll}}",
+ "updatedWithDate": "更新于: {{-date, lll}}",
"accessPublicRead": "公开",
"type": "类型",
"path": "路径",
diff --git a/manager/src/web/shared/locales/de/or.json b/manager/src/web/shared/locales/de/or.json
index 384da976d..2fd583027 100644
--- a/manager/src/web/shared/locales/de/or.json
+++ b/manager/src/web/shared/locales/de/or.json
@@ -333,42 +333,31 @@
"hertz": "Hz",
"rpm": "rpm",
"carbon": "CO2",
- "meta": {
- },
- "attribute": {
- }
+ "meta": {},
+ "attribute": {}
},
"format": {
- "meta": {
- },
- "attribute": {
- }
+ "meta": {},
+ "attribute": {}
},
"constraints": {
- "meta": {
- },
- "attribute": {
- }
+ "meta": {},
+ "attribute": {}
},
"label": {
"asset": {
"ElectricityProducerSolarAsset": "PV-Solaranlage",
"ElectricityProducerWindAsset": "Windturbinenanlage"
},
- "meta": {
- },
- "attribute": {
- },
- "value": {
- }
+ "meta": {},
+ "attribute": {},
+ "value": {}
},
"metaOverrides": {
- "label": {
- }
+ "label": {}
},
"attributeOverrides": {
- "label": {
- }
+ "label": {}
},
"addMetaItems": "Konfigurationselemente hinzufügen",
"loseChanges": "Änderungen verwerfen?",
diff --git a/manager/src/web/shared/locales/en/or.json b/manager/src/web/shared/locales/en/or.json
index 93323d912..b86882af6 100644
--- a/manager/src/web/shared/locales/en/or.json
+++ b/manager/src/web/shared/locales/en/or.json
@@ -88,8 +88,8 @@
"ok": "OK",
"cancel": "Cancel",
"createdOn": "Created on",
- "createdOnWithDate": "Created on: {{-date, LLLL}}",
- "updatedWithDate": "Updated on: {{-date, llll}}",
+ "createdOnWithDate": "Created: {{-date, lll}}",
+ "updatedWithDate": "Updated: {{-date, lll}}",
"accessPublicRead": "Public read",
"type": "Type",
"path": "Path",
@@ -266,8 +266,8 @@
"editDelta": "Delta",
"editCurrentValue": "Decimals",
"decimals": "Decimals",
- "editAsset": "Edit asset",
- "viewAsset": "View asset",
+ "editAsset": "Modify",
+ "viewAsset": "View",
"addAsset": "Add asset",
"parent": "Parent",
"none": "None",
diff --git a/manager/src/web/shared/locales/es/or.json b/manager/src/web/shared/locales/es/or.json
index 856a14ccd..2f63fe37a 100644
--- a/manager/src/web/shared/locales/es/or.json
+++ b/manager/src/web/shared/locales/es/or.json
@@ -88,8 +88,8 @@
"ok": "OK",
"cancel": "Cancelar",
"createdOn": "Creado en",
- "createdOnWithDate": "Creado en: {{-date, LLLL}}",
- "updatedWithDate": "Actualizado: {{-date, llll}}",
+ "createdOnWithDate": "Creado: {{-date, lll}}",
+ "updatedWithDate": "Actualizado: {{-date, lll}}",
"accessPublicRead": "Acceso público de lectura",
"type": "Tipo",
"path": "Ruta",
@@ -266,8 +266,8 @@
"editDelta": "Delta",
"editCurrentValue": "Decimales",
"decimals": "Decimales",
- "editAsset": "Editar activo",
- "viewAsset": "Ver activo",
+ "editAsset": "Editar",
+ "viewAsset": "Ver",
"addAsset": "Agregar activo",
"parent": "Principal",
"none": "Ninguna",
diff --git a/manager/src/web/shared/locales/fr/or.json b/manager/src/web/shared/locales/fr/or.json
index 4969e51c0..c705985ca 100644
--- a/manager/src/web/shared/locales/fr/or.json
+++ b/manager/src/web/shared/locales/fr/or.json
@@ -88,8 +88,8 @@
"ok": "OK",
"cancel": "Annuler",
"createdOn": "Créé le",
- "createdOnWithDate": "Créé le: {{-date, LLLL}}",
- "updatedWithDate": "Mise à jour: {{-date, llll}}",
+ "createdOnWithDate": "Créé le: {{-date, lll}}",
+ "updatedWithDate": "Mise à jour: {{-date, lll}}",
"accessPublicRead": "Accès public en lecture",
"type": "Type",
"path": "Chemin",
@@ -266,8 +266,8 @@
"editDelta": "Delta",
"editCurrentValue": "Décimales",
"decimals": "Décimales",
- "editAsset": "Modifier ressource",
- "viewAsset": "Afficher ressource",
+ "editAsset": "Modifier",
+ "viewAsset": "Afficher",
"addAsset": "Ajouter ressource",
"parent": "Parent",
"none": "Aucun",
diff --git a/manager/src/web/shared/locales/it/or.json b/manager/src/web/shared/locales/it/or.json
index a00867848..a8b2740c9 100644
--- a/manager/src/web/shared/locales/it/or.json
+++ b/manager/src/web/shared/locales/it/or.json
@@ -88,8 +88,8 @@
"ok": "OK",
"cancel": "Annulla",
"createdOn": "Creato il",
- "createdOnWithDate": "Creato il: {{-date, LLLL}}",
- "updatedWithDate": "Aggiornato il: {{-date, llll}}",
+ "createdOnWithDate": "Creato il: {{-date, lll}}",
+ "updatedWithDate": "Aggiornato il: {{-date, lll}}",
"accessPublicRead": "Lettura pubblica",
"type": "Tipo",
"path": "Percorso",
diff --git a/manager/src/web/shared/locales/nl/or.json b/manager/src/web/shared/locales/nl/or.json
index 4b5d23fef..e21edf9b8 100644
--- a/manager/src/web/shared/locales/nl/or.json
+++ b/manager/src/web/shared/locales/nl/or.json
@@ -88,8 +88,8 @@
"ok": "OK",
"cancel": "Annuleren",
"createdOn": "Aangemaakt op",
- "createdOnWithDate": "Aangemaakt op: {{-date, LLLL}}",
- "updatedWithDate": "Bijgewerkt op: {{-date, llll}}",
+ "createdOnWithDate": "Aangemaakt: {{-date, lll}}",
+ "updatedWithDate": "Bijgewerkt: {{-date, lll}}",
"accessPublicRead": "Publiek",
"type": "Type",
"path": "Pad",
@@ -266,8 +266,8 @@
"editDelta": "Delta",
"editCurrentValue": "Decimalen",
"decimals": "Decimalen",
- "editAsset": "Asset aanpassen",
- "viewAsset": "Asset bekijken",
+ "editAsset": "Aanpassen",
+ "viewAsset": "Bekijk",
"addAsset": "Asset toevoegen",
"parent": "Parent",
"none": "Geen",
diff --git a/manager/src/web/shared/locales/pt/or.json b/manager/src/web/shared/locales/pt/or.json
index 8d54cf2f8..8f851d8d4 100644
--- a/manager/src/web/shared/locales/pt/or.json
+++ b/manager/src/web/shared/locales/pt/or.json
@@ -88,8 +88,8 @@
"ok": "OK",
"cancel": "Cancelar",
"createdOn": "Criado em",
- "createdOnWithDate": "Criado em: {{-date, LLLL}}",
- "updatedWithDate": "Atualizado em: {{-date, llll}}",
+ "createdOnWithDate": "Criado em: {{-date, lll}}",
+ "updatedWithDate": "Atualizado em: {{-date, lll}}",
"accessPublicRead": "Leitura pública",
"type": "Tipo",
"path": "Trajeto",
diff --git a/ui/app/manager/src/pages/page-assets.ts b/ui/app/manager/src/pages/page-assets.ts
index b077e846d..d652ce335 100644
--- a/ui/app/manager/src/pages/page-assets.ts
+++ b/ui/app/manager/src/pages/page-assets.ts
@@ -112,6 +112,7 @@ class PageAssets<S extends AppStateKeyed> extends Page<S> {
or-asset-viewer,
or-asset-viewer.hideMobile {
display: initial;
+ max-width: calc(100vw - 300px);
}
}
`;
diff --git a/ui/component/or-app/src/or-header.ts b/ui/component/or-app/src/or-header.ts
index c2db8c5c9..7abac07c0 100644
--- a/ui/component/or-app/src/or-header.ts
+++ b/ui/component/or-app/src/or-header.ts
@@ -260,9 +260,9 @@ class OrHeader extends LitElement {
margin-right: 2px;
}
- /* Wide layout: when the viewport width is bigger than 780px, layout
+ /* Wide layout: when the viewport width is bigger than 768px, layout
changes to a wide layout. */
- @media (min-width: 780px) {
+ @media (min-width: 768px) {
#menu-btn-desktop {
display: block;
}
diff --git a/ui/component/or-asset-tree/src/style.ts b/ui/component/or-asset-tree/src/style.ts
index c62a07e2d..a043432e3 100644
--- a/ui/component/or-asset-tree/src/style.ts
+++ b/ui/component/or-asset-tree/src/style.ts
@@ -185,7 +185,7 @@ export const style = css`
font-size: 14px;
}
- @media only screen and (min-width: 769px){
+ @media only screen and (min-width: 768px){
.expander {
width: 26px;
}
diff --git a/ui/component/or-asset-viewer/src/index.ts b/ui/component/or-asset-viewer/src/index.ts
index 595cf864c..0918adae9 100644
--- a/ui/component/or-asset-viewer/src/index.ts
+++ b/ui/component/or-asset-viewer/src/index.ts
@@ -61,6 +61,7 @@ export interface InfoPanelItemConfig {
disableButton?: boolean;
disableHelperText?: boolean;
inputTypeOverride?: InputType;
+ fullWidth?: boolean;
priority?: number;
styles?: { [style: string]: string };
}
@@ -796,7 +797,7 @@ export function getAttributeTemplate(asset: Asset, attribute: Attribute<any>, ho
}
return html`
- <or-attribute-input class="force-btn-padding" .assetType="${asset!.type}" .attribute="${attribute}" .assetId="${asset.id!}" .disabled="${attrDisabled}" .label="${attrLabel}" .readonly="${attrReadonly}" .disableButton="${attrDisableButton}" .inputType="${attrInputType}" .hasHelperText="${!attrDisableHelper}"></or-attribute-input>
+ <or-attribute-input class="force-btn-padding" .assetType="${asset!.type}" .attribute="${attribute}" .assetId="${asset.id!}" .disabled="${attrDisabled}" .label="${attrLabel}" .readonly="${attrReadonly}" .disableButton="${attrDisableButton}" .inputType="${attrInputType}" .hasHelperText="${!attrDisableHelper}" .fullWidth="${attribute.name === 'location' ? true : false}"></or-attribute-input>
`;
}
@@ -1201,11 +1202,10 @@ export class OrAssetViewer extends subscribe(manager)(translate(i18next)(LitElem
`
: html`<span>${this.asset.name}</span>`}
</div>
- <div id="error-wrapper">${validationErrors.length === 0 ? `` : html`<span .title="${validationErrors.join("\n")}"><or-icon icon="alert"></or-icon><or-translate value="validation.invalidAsset"></or-translate></span>`}</div>
<div id="right-wrapper" class="mobileHidden">
- ${this.asset!.createdOn ? html`<or-translate id="created-time" value="createdOnWithDate" .options="${{ date: new Date(this.asset!.createdOn!) } as TOptions<InitOptions>}"></or-translate>` : ``}
+ ${validationErrors.length === 0 ? (this.asset!.createdOn ? html`<or-translate id="created-time" class="tabletHidden" value="createdOnWithDate" .options="${{ date: new Date(this.asset!.createdOn!) } as TOptions<InitOptions>}"></or-translate>` : ``) : html`<span id="error-wrapper" .title="${validationErrors.join("\n")}"><or-icon icon="alert"></or-icon><or-translate class="tabletHidden" value="validation.invalidAsset"></or-translate></span>`}
${editMode ? html`<or-mwc-input id="save-btn" .disabled="${!this.isModified()}" raised .type="${InputType.BUTTON}" .label="${i18next.t("save")}" @or-mwc-input-changed="${() => this._onSaveClicked()}"></or-mwc-input>` : ``}
- ${!this._isReadonly() ? html`<or-mwc-input id="edit-btn" class="mobileHidden" outlined .type="${InputType.BUTTON}" .value="${this.editMode}" .label="${this.editMode ? i18next.t("view") : i18next.t("modify")}" icon="${this.editMode ? "eye" : "pencil"}" @or-mwc-input-changed="${() => this._onEditToggleClicked(!this.editMode!)}"></or-mwc-input>
+ ${!this._isReadonly() ? html`<or-mwc-input id="edit-btn" outlined .type="${InputType.BUTTON}" .value="${this.editMode}" .label="${this.editMode ? i18next.t("viewAsset") : i18next.t("editAsset")}" icon="${this.editMode ? "eye" : "pencil"}" @or-mwc-input-changed="${() => this._onEditToggleClicked(!this.editMode!)}"></or-mwc-input>
`: ``}
</div>
</div>
diff --git a/ui/component/or-asset-viewer/src/style.ts b/ui/component/or-asset-viewer/src/style.ts
index 96a809e6f..d178146ec 100644
--- a/ui/component/or-asset-viewer/src/style.ts
+++ b/ui/component/or-asset-viewer/src/style.ts
@@ -1,5 +1,5 @@
import {css, unsafeCSS} from "lit";
-import {DefaultColor1, DefaultColor2, DefaultColor3, DefaultColor5, DefaultColor4, DefaultHeaderHeight} from "@openremote/core";
+import {DefaultColor1, DefaultColor2, DefaultColor3, DefaultColor5, DefaultColor4, DefaultColor6, DefaultHeaderHeight} from "@openremote/core";
// language=CSS
export const panelStyles = css`
@@ -48,6 +48,14 @@ export const panelStyles = css`
.panel-content > :last-child {
margin-bottom: 0;
}
+
+ @media screen and (max-width: 767px) {
+ .panel {
+ border-radius: 0;
+ border-right: none;
+ border-left: none;
+ }
+ }
`;
// language=CSS
@@ -62,6 +70,7 @@ export const style = css`
--internal-or-asset-viewer-panel-color: var(--or-asset-viewer-panel-color, var(--or-app-color1, ${unsafeCSS(DefaultColor1)}));
--internal-or-asset-viewer-line-color: var(--or-asset-viewer-line-color, var(--or-app-color5, ${unsafeCSS(DefaultColor5)}));
--internal-or-asset-viewer-button-color: var(--or-asset-viewer-button-color, var(--or-app-color4, ${unsafeCSS(DefaultColor4)}));
+ --internal-or-asset-viewer-error-color: var(--or-asset-viewer-error-color, var(--or-app-color6, ${unsafeCSS(DefaultColor6)}));
--internal-or-header-height: var(--or-header-height, ${unsafeCSS(DefaultHeaderHeight)});
height: 100%;
@@ -87,7 +96,6 @@ export const style = css`
#view-container, #edit-container {
flex: 0 1 auto;
- padding-top: 10px;
overflow: auto;
min-height: calc(100vh - 88px - var(--internal-or-header-height));
}
@@ -107,19 +115,15 @@ export const style = css`
-o-animation: fadein 0.3s; /* Opera < 12.1 */
animation: fadein 0.3s;
}
+
+ #edit-container {
+ padding: 10px 20px 0;
+ }
#name-input {
width: 300px;
}
-
- @media only screen and (max-width: 767px) {
- #wrapper {
- position: absolute;
- left: 0;
- right: 0;
- }
- }
-
+
@keyframes fadein {
from { opacity: 0; }
to { opacity: 1; }
@@ -164,7 +168,7 @@ export const style = css`
}
#title {
- flex: 1 1 0%;
+ flex: 1 1 auto;
font-size: 18px;
font-weight: bold;
display: flex;
@@ -177,18 +181,15 @@ export const style = css`
}
#error-wrapper {
- color: red;
- flex: 1;
- display: flex;
- align-items: center;
+ color: var(--internal-or-asset-viewer-error-color);
}
-
- #error-wrapper > span {
- margin: auto;
+
+ #error-wrapper > * {
+ vertical-align: middle;
}
- #error-wrapper or-icon {
- margin-right: 5px;
+ #error-wrapper or-translate {
+ margin-left: 5px;
}
#created-time {
@@ -196,7 +197,7 @@ export const style = css`
}
#right-wrapper {
- flex: 1 1 0%;
+ flex: 1 1 auto;
text-align: right;
}
@@ -237,7 +238,39 @@ export const style = css`
cursor: pointer;
}
- @media screen and (max-width: 769px) {
+ @media screen and (max-width: 1200px) {
+ #name-input {
+ width: 150px;
+ }
+
+ #chart-panel {
+ grid-row-start: 1;
+ }
+
+ #attributes-panel {
+ grid-row-start: 2;
+ }
+
+ #location-panel {
+ grid-row-start: 3;
+ }
+
+ #history-panel {
+ grid-row-start: 4;
+ }
+
+ .tabletHidden {
+ display: none;
+ }
+
+ #view-container {
+ grid-auto-rows: auto;
+ grid-template-columns: 100% !important;
+ min-height: unset;
+ }
+ }
+
+ @media screen and (max-width: 767px) {
#wrapper {
position: absolute;
left: 0;
@@ -254,36 +287,19 @@ export const style = css`
#asset-header {
grid-area: auto!important;
- padding: 20px 15px 0;
+ padding: 15px 15px 5px;
}
- .panel {
- border-radius: 0;
- border-right: none;
- border-left: none;
+ #name-input {
+ width: auto;
}
- #chart-panel {
- grid-row-start: 1;
+ #view-container {
+ padding: 0;
}
- #attributes-panel {
- grid-row-start: 2;
- }
-
- #location-panel {
- grid-row-start: 3;
- }
-
- #history-panel {
- grid-row-start: 4;
- }
-
- #view-container {
- grid-auto-rows: auto;
- grid-template-columns: 100% !important;
+ #edit-container {
padding: 10px 0;
- min-height: unset;
}
}
`;
diff --git a/ui/component/or-mwc-components/src/or-mwc-table.ts b/ui/component/or-mwc-components/src/or-mwc-table.ts
index a41444bff..1485ebbe6 100644
--- a/ui/component/or-mwc-components/src/or-mwc-table.ts
+++ b/ui/component/or-mwc-components/src/or-mwc-table.ts
@@ -4,7 +4,7 @@ import {classMap} from "lit/directives/class-map";
import {ifDefined} from "lit/directives/if-defined";
import {MDCDataTable} from "@material/data-table";
-import {DefaultColor1, DefaultColor4, DefaultColor8} from "@openremote/core";
+import {DefaultColor3, DefaultColor2, DefaultColor1} from "@openremote/core";
const dataTableStyle = require("@material/data-table/dist/mdc.data-table.css");
@@ -36,7 +36,7 @@ const style = css`
z-index: 1;
position: sticky;
left: 0;
- background-color: var(--internal-or-asset-viewer-panel-color);
+ background-color: ${unsafeCSS(DefaultColor2)};
}
.mdc-data-table.has-sticky-first-column tr th:first-of-type {
z-index: 2;
@@ -55,7 +55,7 @@ const style = css`
th {
position: sticky;
top: 0;
- background-color: var(--internal-or-asset-viewer-panel-color);
+ background-color: ${unsafeCSS(DefaultColor1)};
}
th, td {
@@ -69,7 +69,7 @@ const style = css`
.mdc-data-table__header-cell {
font-weight: 700;
- color: #aaa;
+ color: ${unsafeCSS(DefaultColor3)};
font-size: 12px;
}
`;