Skip to content

Commit

Permalink
UI update: Several bugfixes for appearance page (openremote#1062)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinaeyNL authored Jun 13, 2023
1 parent 9d20afb commit 3de4f78
Show file tree
Hide file tree
Showing 13 changed files with 1,059 additions and 1,041 deletions.
2 changes: 1 addition & 1 deletion manager/src/web/shared/locales/en/or.json
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@
"deleteRealmCustomization": "Delete Style",
"deleteRealmCustomizationConfirm":"Are you sure you want to delete this Realm style?",
"mapBounds": "Boundaries",
"mapBoundsDescription": "Define a view box that the user sees",
"mapBoundsDescription": "Override the default bounds of the map",
"mapZoom": "Zoom",
"mapZoomDescription": "Define the zoom level. The entire Earth is '1' and '24' shows the most detail",
"mapSettings": "Map settings",
Expand Down
2 changes: 1 addition & 1 deletion manager/src/web/shared/locales/nl/or.json
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@
"deleteRealmCustomization": "Verwijder stijl",
"deleteRealmCustomizationConfirm":"Weet je zeker dat je deze realm stijl wilt verwijderen?",
"mapBounds": "Randen",
"mapBoundsDescription": "Defineer het gebied dat de gebruiker kan gebruiken",
"mapBoundsDescription": "Overschrijf de standaard kaders van de kaart",
"mapZoom": "Zoom",
"mapZoomDescription": "Defineer het zoom niveau. De gehele wereld is '1' en '24' laat het meeste detail zien",
"mapSettings": "Kaartinstelling",
Expand Down
134 changes: 67 additions & 67 deletions ui/app/manager/src/components/configuration/or-conf-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,80 +30,80 @@ import { ManagerAppConfig } from "@openremote/model";
@customElement("or-conf-json")
export class OrConfJson extends LitElement {

@property({attribute: false})
public managerConfig: ManagerAppConfig = {};
@property({attribute: false})
public managerConfig: ManagerAppConfig = {};

protected _aceEditor: Ref<OrAceEditor> = createRef();
protected _aceEditor: Ref<OrAceEditor> = createRef();

public beforeSave():false|string|undefined {
if (!this._aceEditor.value) {
return false;
public beforeSave():false|string|undefined {
if (!this._aceEditor.value) {
return false;
}
const value = this._aceEditor.value.getValue()
try {
return JSON.parse(value || '{}');
} catch (e) {
return false;
}
}
const value = this._aceEditor.value.getValue()
try {
return JSON.parse(value ? value : '{}');
} catch (e) {
return false;
}
}

protected _showManagerConfigDialog(){
const _saveConfig = ()=>{
const config = this.beforeSave()
if (config){
this.managerConfig = config as ManagerAppConfig
document.dispatchEvent(
new CustomEvent('saveLocalManagerConfig',
{detail: {value: this.managerConfig}}
)
)
return true
}
return false
}
const dialogActions: DialogAction[] = [
{
actionName: "cancel",
content: i18next.t("cancel")
},
{
actionName: "ok",
content: i18next.t("update"),
action: _saveConfig
},
protected _showManagerConfigDialog(){
const _saveConfig = ()=>{
const config = this.beforeSave()
if (config) {
this.managerConfig = config as ManagerAppConfig
this.dispatchEvent(
new CustomEvent('saveLocalManagerConfig',
{detail: {value: this.managerConfig}}
)
)
return true
}
return false
}
const dialogActions: DialogAction[] = [
{
actionName: "cancel",
content: i18next.t("cancel")
},
{
actionName: "ok",
content: i18next.t("update"),
action: _saveConfig
},

];
const dialog = showDialog(new OrMwcDialog()
.setActions(dialogActions)
.setHeading("manager_config.json")
.setContent(html `<or-ace-editor ${ref(this._aceEditor)} .value="${this.managerConfig}" ></or-ace-editor>`)
.setStyles(html`
<style>
.mdc-dialog__surface {
width: 1024px;
overflow-x: visible !important;
overflow-y: visible !important;
}
#dialog-content {
border-top-width: 1px;
border-top-style: solid;
border-bottom-width: 1px;
border-bottom-style: solid;
padding: 0;
overflow: visible;
height: 60vh;
}
</style>
`)
.setDismissAction(null));
];
showDialog(new OrMwcDialog()
.setActions(dialogActions)
.setHeading("manager_config.json")
.setContent(html `<or-ace-editor ${ref(this._aceEditor)} .value="${this.managerConfig}" ></or-ace-editor>`)
.setStyles(html`
<style>
.mdc-dialog__surface {
width: 1024px;
overflow-x: visible !important;
overflow-y: visible !important;
}
#dialog-content {
border-top-width: 1px;
border-top-style: solid;
border-bottom-width: 1px;
border-bottom-style: solid;
padding: 0;
overflow: visible;
height: 60vh;
}
</style>
`)
.setDismissAction(null));

}
}

render() {
return html`
<or-mwc-input type="button" label="JSON" outlined icon="pencil" @click="${() => {this._showManagerConfigDialog()}}"></or-mwc-input>
`
}
render() {
return html`
<or-mwc-input type="button" label="JSON" outlined icon="pencil" @click="${() => {this._showManagerConfigDialog()}}"></or-mwc-input>
`
}



Expand Down
138 changes: 0 additions & 138 deletions ui/app/manager/src/components/configuration/or-conf-map/index.ts

This file was deleted.

Loading

0 comments on commit 3de4f78

Please sign in to comment.