Skip to content

armgit / core

Public Imported from GitHub
0

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

Manager configuration V1 (#884)

Neal Geilenaac9ce72385b
diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml
index 51de94d85..d92b7d4a7 100644
--- a/.github/workflows/ci_cd.yml
+++ b/.github/workflows/ci_cd.yml
@@ -171,6 +171,7 @@ jobs:
# This will only be available when run by workflow_dispatch otherwise will checkout branch/commit that triggered the workflow
ref: ${{ steps.inputs-and-secrets.outputs.COMMIT }}
submodules: recursive
+ fetch-depth: 200
# Check which files have changed to only run appropriate tests and checks
- name: Backend files changed
diff --git a/manager/src/main/java/org/openremote/manager/app/ConfigurationResourceImpl.java b/manager/src/main/java/org/openremote/manager/app/ConfigurationResourceImpl.java
new file mode 100644
index 000000000..e22c72e17
--- /dev/null
+++ b/manager/src/main/java/org/openremote/manager/app/ConfigurationResourceImpl.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2022, OpenRemote Inc.
+ *
+ * See the CONTRIBUTORS.txt file in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.openremote.manager.app;
+
+import org.openremote.container.timer.TimerService;
+import org.openremote.container.web.WebService;
+import org.openremote.manager.security.ManagerIdentityService;
+import org.openremote.manager.web.ManagerWebResource;
+import org.openremote.model.manager.ConfigurationResource;
+import org.openremote.model.file.FileInfo;
+import org.openremote.model.http.RequestParams;
+
+import java.io.*;
+import java.util.logging.Logger;
+
+public class ConfigurationResourceImpl extends ManagerWebResource implements ConfigurationResource {
+
+ protected ConfigurationService configurationService;
+ private static final Logger LOG = Logger.getLogger(WebService.class.getName());
+
+ public ConfigurationResourceImpl(TimerService timerService, ManagerIdentityService identityService, ConfigurationService configurationService) {
+ super(timerService, identityService);
+ this.configurationService = configurationService;
+ }
+
+
+ @Override
+ public Object update(RequestParams requestParams, Object managerConfiguration) throws IOException {
+ this.configurationService.saveMangerConfig(managerConfiguration);
+ return managerConfiguration;
+ }
+
+ @Override
+ public String fileUpload(RequestParams requestParams, String path, FileInfo fileInfo) throws IOException {
+ this.configurationService.saveImageFile(path, fileInfo);
+ return path;
+ }
+}
diff --git a/manager/src/main/java/org/openremote/manager/app/ConfigurationService.java b/manager/src/main/java/org/openremote/manager/app/ConfigurationService.java
new file mode 100644
index 000000000..12167da36
--- /dev/null
+++ b/manager/src/main/java/org/openremote/manager/app/ConfigurationService.java
@@ -0,0 +1,126 @@
+/*
+ * Copyright 2022, OpenRemote Inc.
+ *
+ * See the CONTRIBUTORS.txt file in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.openremote.manager.app;
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.PropertyAccessor;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import org.apache.camel.builder.RouteBuilder;
+import org.openremote.container.persistence.PersistenceService;
+import org.openremote.container.timer.TimerService;
+import org.openremote.container.util.CodecUtil;
+import org.openremote.container.web.WebService;
+import org.openremote.manager.security.ManagerIdentityService;
+import org.openremote.manager.web.ManagerWebService;
+import org.openremote.model.Container;
+import org.openremote.model.ContainerService;
+import org.openremote.model.file.FileInfo;
+
+import java.io.*;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import static org.openremote.manager.web.ManagerWebService.OR_CUSTOM_APP_DOCROOT;
+import static org.openremote.manager.web.ManagerWebService.OR_CUSTOM_APP_DOCROOT_DEFAULT;
+import static org.openremote.container.util.MapAccess.getString;
+
+public class ConfigurationService extends RouteBuilder implements ContainerService {
+
+ protected ManagerIdentityService identityService;
+ protected PersistenceService persistenceService;
+ protected Path pathPublicRoot;
+
+ private static final Logger LOG = Logger.getLogger(WebService.class.getName());
+
+ @Override
+ public int getPriority() {
+ return ContainerService.DEFAULT_PRIORITY;
+ }
+
+ @Override
+ public void configure() throws Exception {
+ /* code not overridden yet */
+ }
+
+ @Override
+ public void init(Container container) throws Exception {
+ identityService = container.getService(ManagerIdentityService.class);
+ persistenceService = container.getService(PersistenceService.class);
+ pathPublicRoot = Paths.get(getString(container.getConfig(), OR_CUSTOM_APP_DOCROOT, OR_CUSTOM_APP_DOCROOT_DEFAULT));
+ container.getService(ManagerWebService.class).addApiSingleton(
+ new ConfigurationResourceImpl(
+ container.getService(TimerService.class),
+ identityService, this)
+ );
+ }
+
+ @Override
+ public void start(Container container) throws Exception {
+ /* code not overridden yet */
+ }
+
+ @Override
+ public void stop(Container container) throws Exception {
+ /* code not overridden yet */
+ }
+
+
+ public void saveMangerConfig(Object managerConfiguration) throws IOException {
+ LOG.log(Level.INFO, "Saving manager_config.json");
+ try {
+ OutputStream out = new FileOutputStream(new File(pathPublicRoot + "/manager_config.json"));
+ ObjectMapper mapper = new ObjectMapper();
+
+ mapper
+ .setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY)
+ .setSerializationInclusion(JsonInclude.Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT);
+
+ out.write(mapper.writeValueAsString(managerConfiguration).getBytes());
+ out.close();
+ } catch (IOException exception) {
+ LOG.log(Level.WARNING, "Saving manager_config.json error", exception);
+ throw exception;
+ }
+
+ }
+
+
+ public void saveImageFile(String path, FileInfo fileInfo) throws IOException {
+ LOG.log(Level.INFO, "Saving image for manger_config.json");
+ try {
+ File file = new File(pathPublicRoot + path);
+ file.getParentFile().mkdirs();
+ if (file.exists()) {
+ file.delete();
+ }
+ OutputStream out = new FileOutputStream(file);
+ out.write(CodecUtil.decodeBase64(fileInfo.getContents()));
+ } catch (IOException exception) {
+ LOG.log(Level.WARNING, "saving error for image manger_config.json", exception);
+ throw exception;
+ }
+
+ }
+}
diff --git a/manager/src/main/java/org/openremote/manager/web/ManagerWebService.java b/manager/src/main/java/org/openremote/manager/web/ManagerWebService.java
index feb3939d2..3b9187abc 100644
--- a/manager/src/main/java/org/openremote/manager/web/ManagerWebService.java
+++ b/manager/src/main/java/org/openremote/manager/web/ManagerWebService.java
@@ -77,7 +77,7 @@ public class ManagerWebService extends WebService {
public static final String OR_APP_DOCROOT = "OR_APP_DOCROOT";
public static final String OR_APP_DOCROOT_DEFAULT = "manager/src/web";
public static final String OR_CUSTOM_APP_DOCROOT = "OR_CUSTOM_APP_DOCROOT";
- public static final String OR_CUSTOM_APP_DOCROOT_DEFAULT = "ui/app";
+ public static final String OR_CUSTOM_APP_DOCROOT_DEFAULT = "deployment/manager/app";
public static final String OR_ROOT_REDIRECT_PATH = "OR_ROOT_REDIRECT_PATH";
public static final String OR_ROOT_REDIRECT_PATH_DEFAULT = "/manager";
public static final String API_PATH = "/api";
diff --git a/manager/src/main/resources/META-INF/services/org.openremote.model.ContainerService b/manager/src/main/resources/META-INF/services/org.openremote.model.ContainerService
index b0093efab..f4a2314f3 100644
--- a/manager/src/main/resources/META-INF/services/org.openremote.model.ContainerService
+++ b/manager/src/main/resources/META-INF/services/org.openremote.model.ContainerService
@@ -32,3 +32,4 @@ org.openremote.manager.energy.ForecastSolarService
org.openremote.manager.provisioning.ProvisioningService
org.openremote.manager.dashboard.DashboardStorageService
org.openremote.manager.security.AuthorisationService
+org.openremote.manager.app.ConfigurationService
diff --git a/manager/src/web/shared/locales/en/or.json b/manager/src/web/shared/locales/en/or.json
index 5e0d797ff..ed8ef1d45 100644
--- a/manager/src/web/shared/locales/en/or.json
+++ b/manager/src/web/shared/locales/en/or.json
@@ -18,6 +18,7 @@
"selectLanguage": "Select language",
"logout": "Log out",
"login": "Log in",
+ "reload": "Reload",
"edit": "Edit",
"monday": "Monday",
"tuesday": "Tuesday",
@@ -136,7 +137,7 @@
"selectAttributes": "Select attributes",
"selectAttribute": "Select attribute",
"clearTable": "Clear",
- "export": "export",
+ "export": "Export",
"addAssetAttribute": "Add asset attribute",
"add": "Add",
"EQUALS_COMPARATOR": "Equals",
@@ -281,6 +282,7 @@
"GROOVY": "Groovy",
"JAVASCRIPT": "JavaScript",
"gatewayConnection": "Manager interconnect",
+ "gateway": "Manager interconnect",
"connectionDetails": "CONNECTION DETAILS",
"secured": "Secured",
"clientSecret": "Client secret",
@@ -544,6 +546,7 @@
"layout": "Layout",
"display": "Display",
"screen": "Screen",
+ "uploadFile" : "Upload file",
"thresholds": "Thresholds",
"noDashboardSelected": "Please select a dashboard on the left",
"noDashboardFound": "No dashboard could be found.",
@@ -591,5 +594,32 @@
"deleteWidget": "Delete widget",
"myDashboards": "My dashboards",
"createdByOthers": "Created by others"
+ },
+ "appearance": "Appearance",
+ "configuration": {
+ "" : "Appearance",
+ "main": "Main",
+ "realmStyling": "REALM STYLING",
+ "addRealmCustomization" : "Add Realm Style",
+ "realmTitle": "Manager app title",
+ "defaultLanguage": "Default language",
+ "images": "Images",
+ "logo": "Logo",
+ "logoMobile": "Logo mobile",
+ "realmColors": "Realm colours",
+ "--or-app-color4": "Primary: buttons, actions, and list headers",
+ "--or-app-color5": "Borders and lines: tables and separators",
+ "--or-app-color6": "Invalid and errors: warning icons and helper text",
+ "--or-app-color1": "Surface: surface colour for dialogs, panels, and headers",
+ "--or-app-color2": "Background: colour behind surface panels",
+ "--or-app-color3": "Text: page and panel titles",
+ "--or-app-color8": "Text on primary: text on items with the primary colour",
+ "navigation" : "Navigation",
+ "navigationDescription": "Primary navigation is shown in the page header, secondary items can be found in the menu on the right.",
+ "primaryNavigation" : "Primary menu",
+ "secondaryNavigation" : "Secondary menu",
+ "reloadPage" : "To see the changes that have been made, reload the page",
+ "deleteRealmCustomization": "Delete Style",
+ "deleteRealmCustomizationConfirm":"Are you sure you want to delete this Realm style?"
}
}
diff --git a/manager/src/web/shared/locales/nl/or.json b/manager/src/web/shared/locales/nl/or.json
index 8c6d7e354..96905139b 100644
--- a/manager/src/web/shared/locales/nl/or.json
+++ b/manager/src/web/shared/locales/nl/or.json
@@ -18,6 +18,7 @@
"selectLanguage": "Taal kiezen",
"logout": "Uitloggen",
"login": "Log in",
+ "reload": "Herladen",
"edit": "Aanpassen",
"monday": "maandag",
"tuesday": "dinsdag",
@@ -281,6 +282,7 @@
"GROOVY": "Groovy",
"JAVASCRIPT": "JavaScript",
"gatewayConnection": "Manager interconnect",
+ "gateway": "Manager interconnect",
"connectionDetails": "CONNECTIE DETAILS",
"secured": "Beveiligd",
"clientSecret": "Client wachtwoord",
@@ -544,6 +546,7 @@
"layout": "Indeling",
"display": "Weergave",
"screen": "Scherm",
+ "uploadFile" : "Uploaden bestand",
"thresholds": "Drempelwaardes",
"noDashboardSelected": "Selecteer een dashboard aan de linkerkant",
"noDashboardFound": "Geen dashboard gevonden.",
@@ -591,5 +594,32 @@
"deleteWidget": "Verwijder widget",
"myDashboards": "Mijn dashboards",
"createdByOthers": "Gemaakt door anderen"
+ },
+ "appearance": "Weergave",
+ "configuration": {
+ "" : "Weergave",
+ "main": "Algemeen",
+ "realmStyling": "REALM STIJL",
+ "addRealmCustomization" : "Voeg realm stijl toe",
+ "realmTitle": "Manager app titel",
+ "defaultLanguage": "Standaard taal",
+ "images": "Afbeeldingen",
+ "logo": "Logo",
+ "logoMobile": "Logo mobiel",
+ "realmColors": "Realm kleuren",
+ "--or-app-color4": "Primair: knoppen, acties, and lijst header",
+ "--or-app-color5": "Rand en lijnen: tabellen en scheidingslijnen",
+ "--or-app-color6": "Ongelding en foutmeldingen: alarm iconen en helpteksten",
+ "--or-app-color1": "Oppervlak: oppervlakkleur voor dialogen, panelen, en headers",
+ "--or-app-color2": "Achtergrond: kleur achter panelen met oppervlakkleur",
+ "--or-app-color3": "Tekst: pagina en panel titels",
+ "--or-app-color8": "Tekst op primair: tekst op onderdelen met de primaire kleur",
+ "navigation" : "Navigatie",
+ "navigationDescription": "De primaire navigatie staat in de header, secundaire items kun je in het menu rechtsboven vinden.",
+ "primaryNavigation" : "Primair menu",
+ "secondaryNavigation" : "Secundair menu",
+ "reloadPage" : "Om de wijzigingen te zien die gemaakt zijn, herlaad de pagina",
+ "deleteRealmCustomization": "Verwijder stijl",
+ "deleteRealmCustomizationConfirm":"Weet je zeker dat je deze realm stijl wilt verwijderen?"
}
}
diff --git a/model/src/main/java/org/openremote/model/manager/Auth.java b/model/src/main/java/org/openremote/model/manager/Auth.java
new file mode 100644
index 000000000..9d25ea617
--- /dev/null
+++ b/model/src/main/java/org/openremote/model/manager/Auth.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2022, OpenRemote Inc.
+ *
+ * See the CONTRIBUTORS.txt file in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.openremote.model.manager;
+
+public enum Auth {
+ KEYCLOAK, BASIC, NONE
+}
diff --git a/model/src/main/java/org/openremote/model/manager/ConfigurationResource.java b/model/src/main/java/org/openremote/model/manager/ConfigurationResource.java
new file mode 100644
index 000000000..c0d7d5424
--- /dev/null
+++ b/model/src/main/java/org/openremote/model/manager/ConfigurationResource.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2022, OpenRemote Inc.
+ *
+ * See the CONTRIBUTORS.txt file in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.openremote.model.manager;
+
+import io.swagger.v3.oas.annotations.tags.Tag;
+import org.openremote.model.Constants;
+import org.openremote.model.file.FileInfo;
+import org.openremote.model.http.RequestParams;
+
+import javax.annotation.security.RolesAllowed;
+import javax.ws.rs.*;
+import java.io.IOException;
+
+import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
+
+@Tag(name = "Configuration")
+@Path("configuration")
+public interface ConfigurationResource {
+
+ @PUT
+ @Consumes(APPLICATION_JSON)
+ @Produces(APPLICATION_JSON)
+ @Path("manager")
+ @RolesAllowed({Constants.WRITE_ADMIN_ROLE})
+ Object update(@BeanParam RequestParams requestParams, Object managerConfiguration) throws IOException;
+
+ @POST
+ @Consumes(APPLICATION_JSON)
+ @Produces(APPLICATION_JSON)
+ @Path("manager/file")
+ @RolesAllowed({Constants.WRITE_ADMIN_ROLE})
+ String fileUpload(
+ @BeanParam RequestParams requestParams,
+ @QueryParam("path")
+ String path,
+ FileInfo fileInfo
+ ) throws IOException;
+
+
+}
diff --git a/model/src/main/java/org/openremote/model/manager/EventProviderType.java b/model/src/main/java/org/openremote/model/manager/EventProviderType.java
new file mode 100644
index 000000000..3231830fd
--- /dev/null
+++ b/model/src/main/java/org/openremote/model/manager/EventProviderType.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2022, OpenRemote Inc.
+ *
+ * See the CONTRIBUTORS.txt file in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.openremote.model.manager;
+
+public enum EventProviderType {
+ WEBSOCKET, POLLING
+}
diff --git a/model/src/main/java/org/openremote/model/manager/ManagerAppConfig.java b/model/src/main/java/org/openremote/model/manager/ManagerAppConfig.java
new file mode 100644
index 000000000..61ac54e54
--- /dev/null
+++ b/model/src/main/java/org/openremote/model/manager/ManagerAppConfig.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2022, OpenRemote Inc.
+ *
+ * See the CONTRIBUTORS.txt file in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.openremote.model.manager;
+
+import java.io.Serializable;
+import java.util.Map;
+
+public class ManagerAppConfig implements Serializable {
+ protected boolean loadLocales;
+ protected Map<String, String> languages;
+ protected Map<String, ManagerAppRealmConfig> realms;
+ protected Map<String, Object> pages;
+ protected ManagerConfig manager;
+}
diff --git a/model/src/main/java/org/openremote/model/manager/ManagerAppRealmConfig.java b/model/src/main/java/org/openremote/model/manager/ManagerAppRealmConfig.java
new file mode 100644
index 000000000..c4cdfa5ce
--- /dev/null
+++ b/model/src/main/java/org/openremote/model/manager/ManagerAppRealmConfig.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2022, OpenRemote Inc.
+ *
+ * See the CONTRIBUTORS.txt file in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.openremote.model.manager;
+
+public class ManagerAppRealmConfig {
+ protected String appTitle = null;
+ protected String styles = null;
+ protected String logo = null;
+ protected String logoMobile = null;
+ protected String favicon = null;
+ protected String language = null;
+ protected String[] headers = null;
+}
diff --git a/model/src/main/java/org/openremote/model/manager/ManagerConfig.java b/model/src/main/java/org/openremote/model/manager/ManagerConfig.java
new file mode 100644
index 000000000..497d26d31
--- /dev/null
+++ b/model/src/main/java/org/openremote/model/manager/ManagerConfig.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2022, OpenRemote Inc.
+ *
+ * See the CONTRIBUTORS.txt file in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.openremote.model.manager;
+
+import org.openremote.model.auth.UsernamePassword;
+
+public class ManagerConfig {
+ protected String managerUrl;
+ protected String keycloakUrl;
+ protected String appVersion;
+ protected String realm;
+ protected String clientId;
+ protected boolean autoLogin;
+ protected boolean consoleAutoEnable;
+ protected boolean loadIcons;
+ protected int pollingIntervalMillis;
+ protected String[] loadTranslations;
+ protected boolean loadDescriptors;
+ protected String translationsLoadPath;
+ protected boolean skipFallbackToBasicAuth;
+ protected Auth auth;
+ protected UsernamePassword credentials;
+ protected EventProviderType eventProviderType;
+ protected MapType mapType;
+ protected Object configureTranslationsOptions;
+ protected Object basicLoginProvider;
+
+}
diff --git a/model/src/main/java/org/openremote/model/manager/MapType.java b/model/src/main/java/org/openremote/model/manager/MapType.java
new file mode 100644
index 000000000..d315c649c
--- /dev/null
+++ b/model/src/main/java/org/openremote/model/manager/MapType.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2022, OpenRemote Inc.
+ *
+ * See the CONTRIBUTORS.txt file in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.openremote.model.manager;
+
+public enum MapType {
+ VECTOR, RASTER
+}
diff --git a/ui/app/console_loader/src/index.ts b/ui/app/console_loader/src/index.ts
index 554be09c8..45fd98606 100644
--- a/ui/app/console_loader/src/index.ts
+++ b/ui/app/console_loader/src/index.ts
@@ -1,4 +1,6 @@
// Declare require method which we'll use for importing webpack resources (using ES6 imports will confuse typescript parser)
+import { Auth, ManagerConfig } from "@openremote/model";
+
declare function require(name: string): any;
import {combineReducers, configureStore} from "@reduxjs/toolkit";
@@ -9,7 +11,6 @@ import {
appReducer,
getRealmQueryParameter} from "@openremote/or-app";
-import {Auth, ManagerConfig} from "@openremote/core";
import "./pages/page-mobile-onboarding";
import {pageMobileOnboardingProvider, OnboardingConfig} from "./pages/page-mobile-onboarding";
import "./pages/page-mobile-splash";
diff --git a/ui/app/manager/src/components/configuration/or-conf-json.ts b/ui/app/manager/src/components/configuration/or-conf-json.ts
new file mode 100644
index 000000000..a19294a6f
--- /dev/null
+++ b/ui/app/manager/src/components/configuration/or-conf-json.ts
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2022, OpenRemote Inc.
+ *
+ * See the CONTRIBUTORS.txt file in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+import { html, LitElement } from "lit";
+import { customElement, property } from "lit/decorators.js";
+import "@openremote/or-components/or-ace-editor";
+import { i18next } from "@openremote/or-translate";
+import { DialogAction } from "@openremote/or-mwc-components/or-mwc-dialog";
+import { OrMwcDialog, showDialog } from "@openremote/or-mwc-components/or-mwc-dialog";
+import { createRef, Ref, ref } from "lit/directives/ref.js";
+import { OrAceEditor } from "@openremote/or-components/or-ace-editor";
+import { ManagerAppConfig } from "@openremote/model";
+
+@customElement("or-conf-json")
+export class OrConfJson extends LitElement {
+
+ @property({attribute: false})
+ public managerConfig: ManagerAppConfig = {};
+
+ protected _aceEditor: Ref<OrAceEditor> = createRef();
+
+ public beforeSave():false|string|undefined {
+ if (!this._aceEditor.value) {
+ 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
+ },
+
+ ];
+ 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));
+
+ }
+
+ render() {
+ return html`
+ <or-mwc-input type="button" label="JSON" outlined icon="pencil" @click="${() => {this._showManagerConfigDialog()}}"></or-mwc-input>
+ `
+ }
+
+
+
+}
diff --git a/ui/app/manager/src/components/configuration/or-conf-realm/index.ts b/ui/app/manager/src/components/configuration/or-conf-realm/index.ts
new file mode 100644
index 000000000..e58f306db
--- /dev/null
+++ b/ui/app/manager/src/components/configuration/or-conf-realm/index.ts
@@ -0,0 +1,155 @@
+/*
+ * Copyright 2022, OpenRemote Inc.
+ *
+ * See the CONTRIBUTORS.txt file in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+import { css, html, LitElement, PropertyValues } from "lit";
+import { InputType, OrInputChangedEvent } from "@openremote/or-mwc-components/or-mwc-input";
+import "./or-conf-realm-card";
+import {customElement, property} from "lit/decorators.js";
+import manager from "@openremote/core";
+import { ManagerAppConfig, ManagerAppRealmConfig } from "@openremote/model";
+import { OrMwcDialog, showDialog, DialogAction } from "@openremote/or-mwc-components/or-mwc-dialog";
+import { i18next } from "@openremote/or-translate";
+import "@openremote/or-components/or-loading-indicator";
+
+@customElement("or-conf-realm")
+export class OrConfRealm extends LitElement {
+
+ static styles = css`
+ #btn-add-realm {
+ margin-top: 4px;
+ }
+ `;
+
+ @property({attribute: false})
+ public config: ManagerAppConfig = {};
+
+ protected _availableRealms: {name:string, displayName:string}[] = [];
+ protected _allRealms: {name:string, displayName:string}[] = [];
+ protected _addedRealm: null|string = null
+
+ protected firstUpdated(_changedProperties: Map<PropertyKey, unknown>): void {
+ const app = this
+ manager.rest.api.RealmResource.getAccessible().then((response)=>{
+ app._allRealms = response.data as {name:string, displayName:string}[];
+ app._allRealms.push({name: 'default', displayName: 'Default'})
+ app._loadListOfAvailableRealms()
+ });
+ }
+
+ protected _removeRealm(realm:string){
+ if (this.config.realms){
+ delete this.config?.realms[realm]
+ this._loadListOfAvailableRealms()
+ this.requestUpdate()
+ }
+ }
+
+ protected _loadListOfAvailableRealms(){
+ const app = this
+ this._availableRealms = this._allRealms.filter(function(realm){
+ if (realm.name && app.config?.realms){
+ if (!app.config?.realms[realm.name]){
+ return realm
+ }
+ }
+ return null
+ }).sort(function(a, b){
+ if (a.displayName && b.displayName){
+ return (a.displayName > b.displayName) ? 1 : -1
+ }
+ return -1
+ })
+ }
+
+ protected _showAddingRealmDialog(){
+ this._addedRealm = null;
+ const _AddRealmToView = () => {
+ if (this._addedRealm){
+ if (!this.config.realms){
+ this.config.realms = {}
+ }
+ this.config.realms[this._addedRealm] = {
+ styles: ":host > * {--or-app-color1:#FFFFFF;--or-app-color2:#F9F9F9;--or-app-color3:#4c4c4c;--or-app-color4:#4d9d2a;--or-app-color5:#CCCCCC;--or-app-color6:#be0000;"
+ }
+ this._loadListOfAvailableRealms()
+ this.requestUpdate()
+ return true
+ }
+ return false
+ }
+ const dialogActions: DialogAction[] = [
+ {
+ actionName: "cancel",
+ content: i18next.t("cancel")
+ },
+ {
+ default: true,
+ actionName: "ok",
+ content: i18next.t("ok"),
+ action: _AddRealmToView
+ },
+
+ ];
+ const dialog = showDialog(new OrMwcDialog()
+ .setHeading(i18next.t('configuration.addRealmCustomization'))
+ .setActions(dialogActions)
+ .setContent(html `
+ <or-mwc-input class="selector" label="Realm" @or-mwc-input-changed="${(e: OrInputChangedEvent) => this._addedRealm = e.detail.value}" .type="${InputType.SELECT}" .options="${Object.entries(this._availableRealms).map(([key, value]) => {return [value.name, value.displayName]})}"></or-mwc-input>
+ `)
+ .setStyles(html`
+ <style>
+ .mdc-dialog__surface {
+ padding: 4px 8px;
+ }
+ #dialog-content {
+ flex: 1;
+ overflow: visible;
+ min-height: 0;
+ padding: 0;
+ }
+ or-mwc-input.selector {
+ width: 300px;
+ display: block;
+ padding: 10px 20px;
+ }
+ </style>
+ `)
+ .setDismissAction(null));
+
+ }
+
+
+
+ updated(changedProperties: PropertyValues) {
+ super.updated(changedProperties);
+ }
+
+ render() {
+ const app = this;
+ return html`
+ <div class="panels">
+ ${Object.entries(this.config.realms === undefined ? {} : this.config.realms).map(function([key , value]){
+ return html`<or-conf-realm-card .expanded="${app._addedRealm === key}" .name="${key}" .realm="${value}" .onRemove="${() => {app._removeRealm(key)}}"></or-conf-realm-card>`
+ })}
+ </div>
+
+ <or-mwc-input id="btn-add-realm" .type="${InputType.BUTTON}" .label="${i18next.t('configuration.addRealmCustomization')}" icon="plus" @click="${() => this._showAddingRealmDialog()}"></or-mwc-input>
+ `
+ }
+}
diff --git a/ui/app/manager/src/components/configuration/or-conf-realm/or-conf-realm-card.ts b/ui/app/manager/src/components/configuration/or-conf-realm/or-conf-realm-card.ts
new file mode 100644
index 000000000..2605b3a30
--- /dev/null
+++ b/ui/app/manager/src/components/configuration/or-conf-realm/or-conf-realm-card.ts
@@ -0,0 +1,375 @@
+/*
+ * Copyright 2022, OpenRemote Inc.
+ *
+ * See the CONTRIBUTORS.txt file in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+import { css, html, LitElement, unsafeCSS } from "lit";
+import { InputType, OrInputChangedEvent } from "@openremote/or-mwc-components/or-mwc-input";
+import { customElement, property } from "lit/decorators.js";
+import "@openremote/or-components/or-file-uploader";
+import manager, {
+ DEFAULT_LANGUAGES,
+ DefaultColor1,
+ DefaultColor2,
+ DefaultColor3,
+ DefaultColor4,
+ DefaultColor5,
+ DefaultColor6,
+ DefaultColor8,
+ Util,
+} from "@openremote/core";
+import { i18next } from "@openremote/or-translate";
+import { FileInfo, ManagerAppRealmConfig } from "@openremote/model";
+import { DialogAction, OrMwcDialog, showDialog } from "@openremote/or-mwc-components/or-mwc-dialog";
+
+
+@customElement("or-conf-realm-card")
+export class OrConfRealmCard extends LitElement {
+
+ static styles = css`
+ .language {
+ width: 100%;
+ padding: 10px 0px;
+ max-width: 800px;
+ }
+
+ .appTitle {
+ width: 100%;
+ max-width: 800px;
+ padding: 10px 0px;
+ }
+
+ .header-group .header-item {
+ width: 100%;
+ padding: 10px 0px;
+ max-width: 800px;
+ }
+
+ .color-group .color-item {
+ width: 100%;
+ }
+
+ .logo-group {
+ width: 100%;
+ }
+
+ @media screen and (max-width: 768px) {
+ .logo-group or-file-uploader {
+ min-width: calc(50% - 6px);
+ padding: 0 12px 12px 0!important;
+ }
+
+ .logo-group or-file-uploader:nth-child(2n + 2){
+ padding: 0 0 12px 0!important;
+ }
+
+ .logo-group .d-inline-flex{
+ display: flex;
+ flex-wrap: wrap;
+ }
+ }
+
+ .logo-group or-file-uploader {
+ padding: 0 24px 12px 0;
+ }
+
+ #remove-realm {
+ margin: 12px 0 0 0;
+ }
+
+ .subheader {
+ padding: 10px 0 4px;
+ font-weight: bolder;
+ }
+
+ .d-inline-flex {
+ display: inline-flex;
+ }
+
+ .panel-content {
+ padding: 0 24px 24px;
+ }
+
+ .description {
+ font-size: 12px;
+ }
+
+ or-collapsible-panel {
+ margin-bottom: 10px;
+ }
+ `;
+
+ @property({ attribute: false })
+ public realm: ManagerAppRealmConfig = {};
+
+ @property({ attribute: true })
+ public name: string = "";
+
+ @property({type: Boolean})
+ expanded: boolean = false;
+
+ @property({ attribute: true })
+ public onRemove: CallableFunction = () => {
+ };
+
+ protected logo:string = this.realm.logo;
+ protected logoMobile:string = this.realm.logoMobile;
+ protected favicon:string = this.realm.favicon;
+
+ protected headerListPrimary: string[] = [
+ "map",
+ "assets",
+ "rules",
+ "insights",
+ ];
+
+
+ protected headerListSecondary: string[] = [
+ "gateway",
+ "export",
+ "logs",
+ "realms",
+
+ "users",
+ "roles",
+
+ "account",
+ "language",
+ "appearance",
+ "logout"
+
+ ];
+
+ protected _getColors() {
+ const colors: { [name: string]: string } = {
+ "--or-app-color1": unsafeCSS(DefaultColor1).toString(),
+ "--or-app-color2": unsafeCSS(DefaultColor2).toString(),
+ '--or-app-color3': unsafeCSS(DefaultColor3).toString(),
+ '--or-app-color4': unsafeCSS(DefaultColor4).toString(),
+ '--or-app-color5': unsafeCSS(DefaultColor5).toString(),
+ '--or-app-color6': unsafeCSS(DefaultColor6).toString(),
+ '--or-app-color8': unsafeCSS(DefaultColor8).toString()
+ }
+ if (this.realm?.styles){
+ //TODO use regex for filtering and getting color codes CSS
+ const css = this.realm.styles.slice(this.realm.styles.indexOf("{") +1, this.realm.styles.indexOf("}"))
+ css.split(";").forEach(function(value){
+ const col = value.split(":")
+ if (col.length >= 2){
+ colors[col[0].trim()] = col[1].trim()
+ }
+ })
+ }
+ return colors
+ }
+
+ protected _setColor(key:string, value:string){
+ const colors = this._getColors()
+ colors[key] = value
+ let css = ":host > * {"
+ Object.entries(colors).map(([key, value]) => {
+ css += key +":" +value + ";"
+ })
+ this.realm.styles = css
+ }
+
+ protected _setHeader(keys: string[], list: string[]) {
+ if (!this.realm.headers) {
+ this.realm.headers = this.headerListSecondary.concat(this.headerListPrimary);
+ }
+ this.realm.headers = this.realm.headers?.filter(function(ele) {
+ return !list.includes(ele);
+ });
+ this.realm.headers = this.realm.headers?.concat(keys);
+ }
+
+ protected _getImagePath(file:File, fileName: string){
+ let extension = "";
+ switch (file.type){
+ case "image/png":
+ extension = "png"
+ break;
+ case "image/jpg":
+ extension = "jpg"
+ break;
+ case "image/jpeg":
+ extension = "jpeg"
+ break;
+ case "image/vnd.microsoft.icon":
+ extension = "ico"
+ break;
+ case "image/svg+xml":
+ extension = "svg"
+ break;
+ }
+ return "/images/" + this.name + "/" + fileName + "." + extension
+ }
+
+ protected files: {[name:string] : FileInfo} = {}
+
+ protected async _setImageForUpload(file: File, fileName: string) {
+ const path = this._getImagePath(file, fileName)
+ this.files[path] = {
+ path: path,
+ contents: await Util.blobToBase64(file),
+ } as FileInfo;
+ this.realm[fileName] = path
+ this[fileName] = this.files[path].contents
+ this.requestUpdate()
+ return this.files[path].contents;
+ }
+
+ protected _showRemoveRealmDialog(){
+
+ const dialogActions: DialogAction[] = [
+ {
+ actionName: "cancel",
+ content: i18next.t("cancel")
+ },
+ {
+ default: true,
+ actionName: "ok",
+ content: i18next.t("yes"),
+ action: () => {this.onRemove()}},
+
+ ];
+ const dialog = showDialog(new OrMwcDialog()
+ .setHeading(i18next.t('delete'))
+ .setActions(dialogActions)
+ .setContent(html `
+ ${i18next.t('configuration.deleteRealmCustomizationConfirm')}
+ `)
+ .setStyles(html`
+ <style>
+ .mdc-dialog__surface {
+ padding: 4px 8px;
+ }
+
+ #dialog-content {
+ padding: 24px;
+ }
+ </style>
+ `)
+ .setDismissAction(null));
+
+ }
+
+ protected firstUpdated(_changedProperties: Map<PropertyKey, unknown>): void {
+ document.addEventListener('saveManagerConfig', () => {
+ Object.entries(this.files).map(async ([x, y]) => {
+ await manager.rest.api.ConfigurationResource.fileUpload(y, { path: x })
+ })
+ });
+ }
+
+
+ render() {
+ const colors = this._getColors();
+ const app = this;
+ return html`
+ <or-collapsible-panel
+ .expanded="${this.expanded}">
+ <div slot="header" class="header-container">
+ ${this.name}
+ </div>
+ <div slot="content" class="panel-content">
+ <div class="subheader">${i18next.t("configuration.main")}</div>
+ <or-mwc-input class="appTitle" .type="${InputType.TEXT}" value="${this.realm?.appTitle}"
+ @or-mwc-input-changed="${(e: OrInputChangedEvent) => this.realm.appTitle = e.detail.value}"
+ .label="${i18next.t("configuration.realmTitle")}"></or-mwc-input>
+ <or-mwc-input class="language" .type="${InputType.SELECT}" value="${this.realm?.language}"
+ .options="${Object.entries(DEFAULT_LANGUAGES).map(([key, value]) => {
+ return [key, i18next.t(value)];
+ })}" @or-mwc-input-changed="${(e: OrInputChangedEvent) => this.realm.language = e.detail.value}"
+ .label="${i18next.t("configuration.defaultLanguage")}"></or-mwc-input>
+ <div class="logo-group">
+ <div class="subheader">${i18next.t("configuration.images")}</div>
+ <div class="d-inline-flex">
+ <or-file-uploader .title="${i18next.t('configuration.logo')}"
+ @change="${async (e: CustomEvent) => await this._setImageForUpload(e.detail.value[0], "logo")}"
+ .src="${this.logo ? this.logo : this.realm.logo}"></or-file-uploader>
+ <or-file-uploader .title="${i18next.t('configuration.logoMobile')}"
+ @change="${async (e: CustomEvent) => await this._setImageForUpload(e.detail.value[0], "logoMobile")}"
+ .src="${this.logoMobile ? this.logoMobile : this.realm.logoMobile}"></or-file-uploader>
+ <or-file-uploader .title="${html`Favicon`}"
+ @change="${async (e: CustomEvent) => await this._setImageForUpload(e.detail.value[0], "favicon")}"
+ .src="${this.favicon ? this.favicon : this.realm.favicon}"></or-file-uploader>
+ </div>
+ </div>
+ <div class="color-group">
+ <div class="subheader">${i18next.t('configuration.realmColors')}</div>
+ <div>
+ <or-mwc-input class="color-item" .type="${InputType.COLOUR}" value="${colors["--or-app-color4"]}"
+ .label="${i18next.t('configuration.--or-app-color4')}"
+ @or-mwc-input-changed="${(e: OrInputChangedEvent) => this._setColor("--or-app-color4", e.detail.value)}"></or-mwc-input>
+ <or-mwc-input class="color-item" .type="${InputType.COLOUR}" value="${colors["--or-app-color5"]}"
+ .label="${i18next.t('configuration.--or-app-color5')}"
+ @or-mwc-input-changed="${(e: OrInputChangedEvent) => this._setColor("--or-app-color5", e.detail.value)}"></or-mwc-input>
+ <or-mwc-input class="color-item" .type="${InputType.COLOUR}" value="${colors["--or-app-color6"]}"
+ .label="${i18next.t("configuration.--or-app-color6")}"
+ @or-mwc-input-changed="${(e: OrInputChangedEvent) => this._setColor("--or-app-color6", e.detail.value)}"></or-mwc-input>
+ <or-mwc-input class="color-item" .type="${InputType.COLOUR}" value="${colors["--or-app-color1"]}"
+ .label="${i18next.t("configuration.--or-app-color1")}"
+ @or-mwc-input-changed="${(e: OrInputChangedEvent) => this._setColor("--or-app-color1", e.detail.value)}"></or-mwc-input>
+ <or-mwc-input class="color-item" .type="${InputType.COLOUR}" value="${colors["--or-app-color2"]}"
+ .label="${i18next.t("configuration.--or-app-color2")}"
+ @or-mwc-input-changed="${(e: OrInputChangedEvent) => this._setColor("--or-app-color2", e.detail.value)}"></or-mwc-input>
+ <or-mwc-input class="color-item" .type="${InputType.COLOUR}" value="${colors["--or-app-color3"]}"
+ .label="${i18next.t("configuration.--or-app-color3")}"
+ @or-mwc-input-changed="${(e: OrInputChangedEvent) => this._setColor("--or-app-color3", e.detail.value)}"></or-mwc-input>
+ <or-mwc-input class="color-item" .type="${InputType.COLOUR}" value="${colors["--or-app-color8"]}"
+ .label="${i18next.t("configuration.--or-app-color8")}"
+ @or-mwc-input-changed="${(e: OrInputChangedEvent) => this._setColor("--or-app-color8", e.detail.value)}"></or-mwc-input>
+ </div>
+ </div>
+ <div class="header-group">
+ <div class="subheader">${i18next.t("configuration.navigation")}</div>
+ <span>${i18next.t("configuration.navigationDescription")}</span>
+ <div>
+ <or-mwc-input
+ .type="${InputType.SELECT}" multiple
+ class="header-item"
+ .label="${i18next.t("configuration.primaryNavigation")}"
+ .value="${!!this.realm.headers ? this.realm.headers?.filter(function(ele: string) {
+ return app.headerListPrimary.includes(ele);
+ }) : this.headerListPrimary}"
+ .options="${this.headerListPrimary}"
+ @or-mwc-input-changed="${(e: OrInputChangedEvent) => this._setHeader(e.detail.value, this.headerListPrimary)}"
+ ></or-mwc-input>
+ <or-mwc-input
+ .type="${InputType.SELECT}" multiple
+ class="header-item"
+ .label="${i18next.t("configuration.secondaryNavigation")}"
+ .value="${!!this.realm.headers ? this.realm.headers?.filter(function(ele: string) {
+ return app.headerListSecondary.includes(ele);
+ }) : this.headerListSecondary}"
+ .options="${this.headerListSecondary}"
+ @or-mwc-input-changed="${(e: OrInputChangedEvent) => this._setHeader(e.detail.value, this.headerListSecondary)}"
+ ></or-mwc-input>
+ </div>
+ </div>
+
+ <or-mwc-input outlined id="remove-realm" .type="${InputType.BUTTON}"
+ .label="${i18next.t("configuration.deleteRealmCustomization")}"
+ @click="${() => {
+ this._showRemoveRealmDialog();
+ }}"></or-mwc-input>
+ </div>
+ </or-collapsible-panel>
+ `;
+ }
+}
diff --git a/ui/app/manager/src/headers.ts b/ui/app/manager/src/headers.ts
index b781201f2..1a797e417 100644
--- a/ui/app/manager/src/headers.ts
+++ b/ui/app/manager/src/headers.ts
@@ -2,6 +2,7 @@ import { manager } from "@openremote/core";
import { AppStateKeyed, HeaderItem, OrApp } from "@openremote/or-app";
import {AnyAction} from "@reduxjs/toolkit";
import { getMapRoute } from "./routes";
+import { i18next } from "@openremote/or-translate";
export function headerItemMap<S extends AppStateKeyed, A extends AnyAction>(orApp: OrApp<S>): HeaderItem {
return {
@@ -135,3 +136,13 @@ export function headerItemProvisioning<S extends AppStateKeyed, A extends AnyAct
roles: () => manager.isSuperUser()
};
}
+
+export function headerItemConfiguration<S extends AppStateKeyed, A extends AnyAction>(orApp: OrApp<S>): HeaderItem {
+ return {
+ icon: "palette-outline",
+ value: "configuration",
+ href: "configuration",
+ text: "appearance",
+ roles: () => manager.isSuperUser()
+ };
+}
diff --git a/ui/app/manager/src/index.ts b/ui/app/manager/src/index.ts
index 288bee110..d662ea095 100644
--- a/ui/app/manager/src/index.ts
+++ b/ui/app/manager/src/index.ts
@@ -6,6 +6,7 @@ import {AppConfig, appReducer, HeaderConfig, HeaderItem, OrApp, PageProvider, Re
import {
headerItemAccount,
headerItemAssets,
+ headerItemConfiguration,
headerItemExport,
headerItemGatewayConnection,
headerItemInsights,
@@ -40,7 +41,8 @@ import {pageRolesProvider} from "./pages/page-roles";
import "./pages/page-realms";
import {pageRealmsProvider} from "./pages/page-realms";
import {pageExportProvider} from "./pages/page-export";
-import {ManagerConfig} from "@openremote/core";
+import { pageConfigurationProvider } from "./pages/page-configuration";
+import { ManagerAppConfig } from "@openremote/model";
declare var CONFIG_URL_PREFIX: string;
@@ -56,30 +58,6 @@ export const store = configureStore({
reducer: rootReducer
});
-type HeaderName = "map" | "assets" | "rules" | "insights" | "gateway" | "logs" | "account" | "users" | "roles" | "realms" | "logout" | "language" | "export";
-
-export interface ManagerRealmConfig {
- appTitle?: string;
- logo?: HTMLTemplateElement | string;
- logoMobile?: HTMLTemplateElement | string;
- favicon?: HTMLTemplateElement | string;
- headers?: HeaderName[];
- language?: string;
- styles?: string;
-}
-
-export interface ManagerAppConfig {
- pages?: {
- [name in HeaderName]: any;
- },
- realms?: {
- default?: ManagerRealmConfig;
- [realm: string]: ManagerRealmConfig;
- };
- loadLocales?: boolean;
- manager?: ManagerConfig;
-}
-
const orApp = new OrApp(store);
export const DefaultPagesConfig: PageProvider<any>[] = [
@@ -94,7 +72,8 @@ export const DefaultPagesConfig: PageProvider<any>[] = [
pageUsersProvider(store),
pageRealmsProvider(store),
pageExportProvider(store),
- pageProvisioningProvider(store)
+ pageProvisioningProvider(store),
+ pageConfigurationProvider(store)
];
export const DefaultHeaderMainMenu: {[name: string]: HeaderItem} = {
@@ -114,6 +93,7 @@ export const DefaultHeaderSecondaryMenu: {[name: string]: HeaderItem} = {
realms: headerItemRealms(orApp),
export: headerItemExport(orApp),
provisioning: headerItemProvisioning(orApp),
+ configuration: headerItemConfiguration(orApp),
logout: headerItemLogout(orApp)
};
@@ -251,7 +231,13 @@ fetch(configURL).then(async (result) => {
manager.console.retrieveData("LANGUAGE").then((value: string | undefined) => {
manager.language = (value ? value : orAppConfig.realms[manager.displayRealm].language);
}).catch(() => {
- manager.language = orAppConfig.realms[manager.displayRealm].language;
+ if (orAppConfig.realms[manager.displayRealm]){
+ manager.language = orAppConfig.realms[manager.displayRealm].language
+ } else if (orAppConfig.realms['default']){
+ manager.language = orAppConfig.realms['default'].language
+ } else {
+ manager.language = 'en'
+ }
})
// Add config prefix if defined (used in dev)
diff --git a/ui/app/manager/src/pages/page-configuration.ts b/ui/app/manager/src/pages/page-configuration.ts
new file mode 100644
index 000000000..6b385a80d
--- /dev/null
+++ b/ui/app/manager/src/pages/page-configuration.ts
@@ -0,0 +1,226 @@
+/*
+ * Copyright 2022, OpenRemote Inc.
+ *
+ * See the CONTRIBUTORS.txt file in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+import { css, html, TemplateResult, unsafeCSS } from "lit";
+import { customElement } from "lit/decorators.js";
+import manager, { DefaultColor1, DefaultColor3 } from "@openremote/core";
+import "@openremote/or-components/or-panel";
+import "@openremote/or-translate";
+import { Store } from "@reduxjs/toolkit";
+import { AppStateKeyed, Page, PageProvider } from "@openremote/or-app";
+import "@openremote/or-components/or-collapsible-panel";
+import "@openremote/or-mwc-components/or-mwc-input";
+import "../components/configuration/or-conf-json";
+import "../components/configuration/or-conf-realm/index";
+import { ManagerAppConfig } from "@openremote/model";
+import { i18next } from "@openremote/or-translate";
+import "@openremote/or-components/or-loading-indicator";
+
+export function pageConfigurationProvider(store: Store<AppStateKeyed>): PageProvider<AppStateKeyed> {
+ return {
+ name: "configuration",
+ routes: [
+ "configuration",
+ ],
+ pageCreator: () => {
+ return new PageConfiguration(store);
+ }
+ };
+}
+
+@customElement("page-configuration")
+export class PageConfiguration extends Page<AppStateKeyed> {
+
+ static get styles() {
+ // language=CSS
+ return css`
+ .main-content{
+ display: unset!important;
+ }
+
+ :host {
+ flex: 1;
+ width: 100%;
+
+ display: flex;
+ justify-content: center;
+
+ --or-collapisble-panel-background-color: #fff;
+ --or-panel-background-color: #fff;
+ --or-panel-padding: 18px 24px 24px;
+ --or-panel-heading-margin: 0 0 14px 0;
+ --or-panel-background-color: var(--or-app-color1, ${unsafeCSS(DefaultColor1)});
+ --or-panel-heading-font-size: 14px;
+ }
+
+ or-panel {
+ width: calc(100% - 40px);
+ max-width: 1360px;
+ margin-bottom: 16px;
+ }
+
+ #wrapper {
+ display: flex;
+ min-width: 0px;
+ width: 100%;
+ height: 100%;
+ flex-direction: column;
+ align-items: center;
+ overflow: auto;
+ }
+
+ #header-wrapper {
+ display: flex;
+ width: calc(100% - 40px);
+ max-width: 1360px;
+ padding: 0 20px;
+ flex-direction: row;
+ align-items: center;
+ justify-content: space-between;
+ margin: 15px auto;
+ }
+
+ #header-title {
+ font-size: 18px;
+ font-weight: bold;
+ align-items: center;
+ display: flex;
+ color: var(--or-app-color3, ${unsafeCSS(DefaultColor3)});
+ }
+
+ #header-title > or-icon {
+ margin-right: 10px;
+ margin-left: 14px;
+ }
+
+ #header-actions or-mwc-input{
+ margin-left: 12px;
+ }
+
+ or-icon {
+ vertical-align: middle;
+ --or-icon-width: 20px;
+ --or-icon-height: 20px;
+ margin-right: 2px;
+ margin-left: -5px;
+ }
+
+ @media screen and (max-width: 768px) {
+ or-panel {
+ border-left: 0px;
+ border-right: 0px;
+ width: 100%;
+ --or-panel-border-radius: 0;
+ }
+
+ #header-wrapper{
+ /*width: 100%*/
+ }
+
+ .hide-mobile {
+ display: none;
+ }
+ }
+ `;
+ }
+
+ get name(): string {
+ return "configuration";
+ }
+
+ constructor(store: Store<AppStateKeyed>) {
+ super(store);
+ }
+
+ private getManagerConfig(): Promise<boolean> {
+ return fetch("/manager_config.json", { cache: "reload" })
+ .then(async (response) => {
+ return response.json().then((json) => {
+ this.managerConfiguration = json;
+ this.loading = false;
+ this.requestUpdate();
+ return true;
+ });
+
+ }).catch(() => {
+ return false;
+ });
+ }
+
+ private loading: boolean = true;
+ private managerConfiguration: ManagerAppConfig = {};
+
+ protected firstUpdated(_changedProperties: Map<PropertyKey, unknown>): void {
+ const app = this;
+ document.addEventListener("saveLocalManagerConfig", (e: CustomEvent) => {
+ this.managerConfiguration = e.detail?.value as ManagerAppConfig;
+ app.requestUpdate();
+ });
+
+ document.addEventListener("saveManagerConfig", (e: CustomEvent) => {
+ manager.rest.api.ConfigurationResource.update(e.detail?.value as ManagerAppConfig).then(() => {
+ fetch("/manager_config.json", { cache: "reload" });
+ this.managerConfiguration = e.detail?.value as ManagerAppConfig;
+ Object.entries(this.managerConfiguration.realms).map(([name, settings]) => {
+ fetch(settings?.favicon, { cache: "reload" });
+ fetch(settings?.logo, { cache: "reload" });
+ fetch(settings?.logoMobile, { cache: "reload" });
+ });
+ app.requestUpdate();
+ })
+ })
+
+ this.getManagerConfig();
+ }
+
+ protected render(): TemplateResult | void {
+ if (!manager.authenticated) {
+ return html`
+ <or-translate value="notAuthenticated"></or-translate>
+ `;
+ }
+ return html`
+ ${this.loading ? html`
+ <or-loading-indicator .overlay="${true}"></or-loading-indicator>` : ""}
+ <div id="wrapper">
+ <div id="header-wrapper">
+ <div id="header-title">
+ <or-icon icon="palette-outline"></or-icon>
+ ${i18next.t("appearance")}
+ </div>
+ <div id="header-actions">
+ <or-conf-json .managerConfig="${this.managerConfiguration}" class="hide-mobile"></or-conf-json>
+ <or-mwc-input id="save-btn" raised="" type="button" .label="${i18next.t("save")}"
+ @click="${() => {
+ document.dispatchEvent(new CustomEvent("saveManagerConfig", { detail: { value: this.managerConfiguration } }));
+ }}"></or-mwc-input>
+ </div>
+ </div>
+ <or-panel .heading="${i18next.t("configuration.realmStyling")}">
+ <or-conf-realm .config="${this.managerConfiguration}"></or-conf-realm>
+ </or-panel>
+ </div>
+ `;
+
+
+ }
+
+ public stateChanged(state: AppStateKeyed) {
+ }
+}
diff --git a/ui/app/manager/src/pages/page-export.ts b/ui/app/manager/src/pages/page-export.ts
index ffcaa5a78..b78d8e140 100644
--- a/ui/app/manager/src/pages/page-export.ts
+++ b/ui/app/manager/src/pages/page-export.ts
@@ -67,6 +67,7 @@ export class PageExport extends Page<AppStateKeyed> {
margin: 20px auto;
align-items: center;
display: flex;
+ color: var(--or-app-color3, ${unsafeCSS(DefaultColor3)});
}
#title or-icon {
@@ -94,6 +95,7 @@ export class PageExport extends Page<AppStateKeyed> {
margin-top: 0;
flex: 0 0 auto;
letter-spacing: 0.025em;
+ color: var(--or-app-color3, ${unsafeCSS(DefaultColor3)});
}
th {
diff --git a/ui/app/manager/src/pages/page-gateway.ts b/ui/app/manager/src/pages/page-gateway.ts
index 3a73889e8..79c71917a 100644
--- a/ui/app/manager/src/pages/page-gateway.ts
+++ b/ui/app/manager/src/pages/page-gateway.ts
@@ -3,7 +3,7 @@ import {customElement, property, state} from "lit/decorators.js";
import i18next from "i18next";
import "@openremote/or-components/or-panel";
import {ClientRole, ConnectionStatus, GatewayConnection, GatewayConnectionStatusEvent} from "@openremote/model";
-import manager, {DefaultColor1, OREvent} from "@openremote/core";
+import manager, {DefaultColor1, DefaultColor3, OREvent} from "@openremote/core";
import {InputType, OrInputChangedEvent} from "@openremote/or-mwc-components/or-mwc-input";
import {Page, PageProvider} from "@openremote/or-app";
import {AppStateKeyed} from "@openremote/or-app";
@@ -34,7 +34,7 @@ export class PageGateway extends Page<AppStateKeyed> {
display: flex;
justify-content: center;
- --or-panel-heading-margin: 0 0 5px 10px;
+ --or-panel-heading-margin: 4px 0 0 10px;
--or-panel-background-color: var(--or-app-color1, ${unsafeCSS(DefaultColor1)});
--or-panel-heading-font-size: 14px;
--or-panel-padding: 14px;
@@ -54,6 +54,7 @@ export class PageGateway extends Page<AppStateKeyed> {
font-weight: bold;
max-width: 1000px;
min-width: 600px;
+ color: var(--or-app-color3, ${unsafeCSS(DefaultColor3)});
}
#title > or-icon {
diff --git a/ui/app/manager/src/pages/page-provisioning.ts b/ui/app/manager/src/pages/page-provisioning.ts
index fb714772e..fdfd389c4 100644
--- a/ui/app/manager/src/pages/page-provisioning.ts
+++ b/ui/app/manager/src/pages/page-provisioning.ts
@@ -50,6 +50,7 @@ export class PageProvisioning extends Page<AppStateKeyed> {
margin: 20px auto;
align-items: center;
display: flex;
+ color: var(--or-app-color3, ${unsafeCSS(DefaultColor3)});
}
#title or-icon {
@@ -77,6 +78,7 @@ export class PageProvisioning extends Page<AppStateKeyed> {
margin-top: 0;
flex: 0 0 auto;
letter-spacing: 0.025em;
+ color: var(--or-app-color3, ${unsafeCSS(DefaultColor3)});
}
#table-users,
diff --git a/ui/app/manager/src/pages/page-realms.ts b/ui/app/manager/src/pages/page-realms.ts
index e2b62dea2..edccd95cb 100644
--- a/ui/app/manager/src/pages/page-realms.ts
+++ b/ui/app/manager/src/pages/page-realms.ts
@@ -52,6 +52,7 @@ export class PageRealms extends Page<AppStateKeyed> {
margin: 20px auto;
align-items: center;
display: flex;
+ color: var(--or-app-color3, ${unsafeCSS(DefaultColor3)});
}
#title or-icon {
@@ -75,7 +76,7 @@ export class PageRealms extends Page<AppStateKeyed> {
text-transform: uppercase;
font-weight: bolder;
line-height: 1em;
- color: var(--internal-or-asset-viewer-title-text-color);
+ color: var(--or-app-color3, ${unsafeCSS(DefaultColor3)});
margin-bottom: 20px;
margin-top: 0;
flex: 0 0 auto;
diff --git a/ui/app/manager/src/pages/page-roles.ts b/ui/app/manager/src/pages/page-roles.ts
index adce5b28d..8cfa4220c 100644
--- a/ui/app/manager/src/pages/page-roles.ts
+++ b/ui/app/manager/src/pages/page-roles.ts
@@ -55,6 +55,7 @@ export class PageRoles extends Page<AppStateKeyed> {
margin: 20px auto;
align-items: center;
display: flex;
+ color: var(--or-app-color3, ${unsafeCSS(DefaultColor3)});
}
#title or-icon {
@@ -70,18 +71,18 @@ export class PageRoles extends Page<AppStateKeyed> {
border-radius: 5px;
position: relative;
margin: 0 auto;
- padding: 24px;
+ padding: 18px 24px 24px;
}
.panel-title {
- text-transform: uppercase;
- font-weight: bolder;
- line-height: 1em;
- color: var(--internal-or-asset-viewer-title-text-color);
- margin-bottom: 20px;
- margin-top: 0;
- flex: 0 0 auto;
- letter-spacing: 0.025em;
+ text-transform: uppercase;
+ font-weight: bolder;
+ line-height: 1em;
+ color: var(--or-app-color3, ${unsafeCSS(DefaultColor3)});
+ margin-bottom: 20px;
+ margin-top: 0;
+ flex: 0 0 auto;
+ letter-spacing: 0.025em;
}
#table-roles,
@@ -327,116 +328,108 @@ export class PageRoles extends Page<AppStateKeyed> {
const writeRoles = this._roles.filter(role => role.name.includes('write')).sort((a, b) => a.name.localeCompare(b.name))
const otherRoles = this._roles.filter(role => !role.name.includes('read') && !role.name.includes('write')).sort((a, b) => a.name.localeCompare(b.name))
return html`
- <div id="wrapper">
- <div id="title">
- <or-icon icon="account-box-multiple"></or-icon>${i18next.t(
- "role_plural"
- )}
- </div>
- <div class="panel">
- <p class="panel-title">${i18next.t("role")}</p>
- <div id="table-roles" class="mdc-data-table">
- <table class="mdc-data-table__table" aria-label="attribute list" >
- <thead>
- <tr class="mdc-data-table__header-row">
- <th class="mdc-data-table__header-cell" role="columnheader" scope="col"><or-translate value="name"></or-translate></th>
- <th class="mdc-data-table__header-cell" role="columnheader" scope="col"><or-translate value="description"></or-translate></th>
- <th class="mdc-data-table__header-cell hide-mobile large" role="columnheader" scope="col"><or-translate value="permissions"></or-translate></th>
- </tr>
- </thead>
- <tbody class="mdc-data-table__content">
- ${this._compositeRoles.map(
- (role, index) => {
- const compositeRoleName = role.compositeRoleIds.map(id => this._rolesMapper[id]).sort((a, b) => a.localeCompare(b)).join(', ');
- return html`
- <tr id="mdc-data-table-row-${index}" class="mdc-data-table__row" @click="${() => this.expanderToggle(index)}">
- <td class="padded-cell mdc-data-table__cell"
- >
- <or-icon id="mdc-data-table-icon-${index}" icon="chevron-right"></or-icon>
- <span>${role.name}</span>
+ <div id="wrapper">
+ <div id="title">
+ <or-icon icon="account-box-multiple"></or-icon>${i18next.t("role_plural")}
+ </div>
+ <div class="panel">
+ <p class="panel-title">${i18next.t("role")}</p>
+ <div id="table-roles" class="mdc-data-table">
+ <table class="mdc-data-table__table" aria-label="attribute list">
+ <thead>
+ <tr class="mdc-data-table__header-row">
+ <th class="mdc-data-table__header-cell" role="columnheader" scope="col">
+ <or-translate value="name"></or-translate>
+ </th>
+ <th class="mdc-data-table__header-cell" role="columnheader" scope="col">
+ <or-translate value="description"></or-translate>
+ </th>
+ <th class="mdc-data-table__header-cell hide-mobile large" role="columnheader" scope="col">
+ <or-translate value="permissions"></or-translate>
+ </th>
+ </tr>
+ </thead>
+ <tbody class="mdc-data-table__content">
+ ${this._compositeRoles.map((role, index) => {
+ const compositeRoleName = role.compositeRoleIds.map(id => this._rolesMapper[id]).sort((a, b) => a.localeCompare(b)).join(', '); return html`
+ <tr id="mdc-data-table-row-${index}" class="mdc-data-table__row" @click="${() => this.expanderToggle(index)}">
+ <td class="padded-cell mdc-data-table__cell">
+ <or-icon id="mdc-data-table-icon-${index}" icon="chevron-right"></or-icon>
+ <span>${role.name}</span>
</td>
<td class="padded-cell mdc-data-table__cell">
- ${role.description}
+ ${role.description}
</td>
<td class="padded-cell hide-mobile mdc-data-table__cell large">
- ${compositeRoleName}
+ ${compositeRoleName}
</td>
- </tr>
- <tr id="attribute-meta-row-${index}" class="attribute-meta-row${!role.id ? " expanded" : ""}">
+ </tr>
+ <tr id="attribute-meta-row-${index}" class="attribute-meta-row${!role.id ? " expanded " : " "}">
<td colspan="100%">
- <div class="meta-item-container">
-
- <div class="row">
- <div class="column">
- <or-mwc-input .label="${i18next.t("role")}" .type="${InputType.TEXT}" min="1" required .value="${role.name}" @or-mwc-input-changed="${(e: OrInputChangedEvent) => role.name = e.detail.value}"></or-mwc-input>
+ <div class="meta-item-container">
+
+ <div class="row">
+ <div class="column">
+ <or-mwc-input .label="${i18next.t(" role ")}" .type="${InputType.TEXT}" min="1" required .value="${role.name}" @or-mwc-input-changed="${(e: OrInputChangedEvent) => role.name = e.detail.value}"></or-mwc-input>
+ </div>
+ <div class="column">
+ <or-mwc-input .label="${i18next.t(" description ")}" .type="${InputType.TEXT}" min="1" required .value="${role.description}" @or-mwc-input-changed="${(e: OrInputChangedEvent) => role.description = e.detail.value}"></or-mwc-input>
+ </div>
+ </div>
+
+ <div class="row">
+ <div class="column">
+ <strong class="column-title">${i18next.t("readPermissions")}</strong> ${readRoles.map(r => {
+ return html`
+ <or-mwc-input ?readonly="${readonly}" .label="${r.name.split(" : ")[1]}: ${r.description}" .type="${InputType.CHECKBOX}" .value="${role.compositeRoleIds && role.compositeRoleIds.find(id => id === r.id)}" @or-mwc-input-changed="${(e: OrInputChangedEvent) => this.addRemoveRole(e, r, index)}"></or-mwc-input>
+ ` })}
+
+ </div>
+ <div class="column">
+ <strong class="column-title">${i18next.t("writePermissions")}</strong> ${writeRoles.map(r => {
+ return html`
+ <or-mwc-input ?readonly="${readonly}" .label="${r.name.split(" : ")[1]}: ${r.description}" .type="${InputType.CHECKBOX}" .value="${role.compositeRoleIds && role.compositeRoleIds.find(id => id === r.id)}" @or-mwc-input-changed="${(e: OrInputChangedEvent) => this.addRemoveRole(e, r, index)}"></or-mwc-input>
+ ` })}
+ </div>
+ </div>
+
+ <div class="row">
+ <div class="column">
+ ${otherRoles.map(r => {
+ return html`
+ <or-mwc-input ?readonly="${readonly}" .label="${r.name.split(" : ")[1]}: ${r.description}" .type="${InputType.CHECKBOX}" .value="${role.compositeRoleIds && role.compositeRoleIds.find(id => id === r.id)}" @or-mwc-input-changed="${(e: OrInputChangedEvent) => this.addRemoveRole(e, r, index)}"></or-mwc-input>
+ ` })}
+ </div>
</div>
- <div class="column">
- <or-mwc-input .label="${i18next.t("description")}" .type="${InputType.TEXT}" min="1" required .value="${role.description}" @or-mwc-input-changed="${(e: OrInputChangedEvent) => role.description = e.detail.value}"></or-mwc-input>
+
+ ${readonly ? html`` : html`
+ <div class="row" style="margin-bottom: 0;">
+ ${role.id ? html`
+ <or-mwc-input .label="${i18next.t(" delete ")}" .type="${InputType.BUTTON}" @click="${() => this._deleteRole(role, index)}"></or-mwc-input>
+ <or-mwc-input ?disabled="${this._compositeRoles.some(role => role.compositeRoleIds.length === 0)}" style="margin-left: auto;" .label="${i18next.t(" save ")}" .type="${InputType.BUTTON}" @click="${() => this._updateRoles()}"></or-mwc-input>
+ ` : html`
+ <or-mwc-input .label="${i18next.t(" cancel ")}" .type="${InputType.BUTTON}" @click="${() => { this._compositeRoles.splice(-1, 1); this._compositeRoles = [...this._compositeRoles] }}"></or-mwc-input>
+ <or-mwc-input ?disabled="${this._compositeRoles.some(role => role.compositeRoleIds.length === 0)}" style="margin-left: auto;" .label="${i18next.t(" create ")}" .type="${InputType.BUTTON}" @click="${() => this._updateRoles()}"></or-mwc-input>
+ `}
</div>
- </div>
-
- <div class="row">
- <div class="column">
- <strong class="column-title">${i18next.t("readPermissions")}</strong>
-
- ${readRoles.map(r => {
- return html`
- <or-mwc-input ?readonly="${readonly}" .label="${r.name.split(":")[1]}: ${r.description}" .type="${InputType.CHECKBOX}" .value="${role.compositeRoleIds && role.compositeRoleIds.find(id => id === r.id)}" @or-mwc-input-changed="${(e: OrInputChangedEvent) => this.addRemoveRole(e, r, index) }"></or-mwc-input>
- `
- })}
-
- </div>
-
- <div class="column">
- <strong class="column-title">${i18next.t("writePermissions")}</strong>
- ${writeRoles.map(r => {
- return html`
- <or-mwc-input ?readonly="${readonly}" .label="${r.name.split(":")[1]}: ${r.description}" .type="${InputType.CHECKBOX}" .value="${role.compositeRoleIds && role.compositeRoleIds.find(id => id === r.id)}" @or-mwc-input-changed="${(e: OrInputChangedEvent) => this.addRemoveRole(e, r, index) }"></or-mwc-input>
- `
- })}
- </div>
- </div>
- <div class="row">
- <div class="column">
- ${otherRoles.map(r => {
- return html`
- <or-mwc-input ?readonly="${readonly}" .label="${r.name.split(":")[1]}: ${r.description}" .type="${InputType.CHECKBOX}" .value="${role.compositeRoleIds && role.compositeRoleIds.find(id => id === r.id)}" @or-mwc-input-changed="${(e: OrInputChangedEvent) => this.addRemoveRole(e, r, index) }"></or-mwc-input>
- `
- })}
- </div>
- </div>
-
- ${readonly ? html`` : html`
- <div class="row" style="margin-bottom: 0;">
- ${role.id ? html`
- <or-mwc-input .label="${i18next.t("delete")}" .type="${InputType.BUTTON}" @click="${() => this._deleteRole(role, index)}"></or-mwc-input>
- <or-mwc-input ?disabled="${this._compositeRoles.some(role => role.compositeRoleIds.length === 0)}" style="margin-left: auto;" .label="${i18next.t("save")}" .type="${InputType.BUTTON}" @click="${() => this._updateRoles()}"></or-mwc-input>
- ` : html`
- <or-mwc-input .label="${i18next.t("cancel")}" .type="${InputType.BUTTON}" @click="${() => {this._compositeRoles.splice(-1,1); this._compositeRoles = [...this._compositeRoles]}}"></or-mwc-input>
- <or-mwc-input ?disabled="${this._compositeRoles.some(role => role.compositeRoleIds.length === 0)}" style="margin-left: auto;" .label="${i18next.t("create")}" .type="${InputType.BUTTON}" @click="${() => this._updateRoles()}"></or-mwc-input>
- `}
- </div>
- `}
- </div>
+ `}
+ </div>
</td>
- </tr>
- `
- })}
- ${this._compositeRoles.length > 0 && !!this._compositeRoles[this._compositeRoles.length -1].id && !readonly ? html`
+ </tr>
+ ` })} ${this._compositeRoles.length > 0 && !!this._compositeRoles[this._compositeRoles.length - 1].id && !readonly ? html`
<tr class="mdc-data-table__row">
- <td colspan="100%">
- <a class="button" @click="${() => this._compositeRoles = [...this._compositeRoles, {composite:true, name:"", compositeRoleIds:[]}]}"><or-icon icon="plus"></or-icon>${i18next.t("add")} ${i18next.t("role")}</a>
- </td>
+ <td colspan="100%">
+ <a class="button" @click="${() => this._compositeRoles = [...this._compositeRoles, { composite: true, name: " ", compositeRoleIds: [] }]}">
+ <or-icon icon="plus"></or-icon>${i18next.t("add")} ${i18next.t("role")}</a>
+ </td>
</tr>
- ` : ``}
- </tbody>
- </table>
- </div>
-
- </div>
+ ` : ``}
+ </tbody>
+ </table>
</div>
-
- `;
+ </div>
+ </div>
+ `;
}
public stateChanged(state: AppStateKeyed) {
diff --git a/ui/app/manager/src/pages/page-users.ts b/ui/app/manager/src/pages/page-users.ts
index 1af229b12..088da670a 100644
--- a/ui/app/manager/src/pages/page-users.ts
+++ b/ui/app/manager/src/pages/page-users.ts
@@ -1,6 +1,6 @@
import {css, html, PropertyValues, TemplateResult, unsafeCSS} from "lit";
import {customElement, property, state} from "lit/decorators.js";
-import manager, {DefaultColor4, Util} from "@openremote/core";
+import manager, {DefaultColor4, DefaultColor3, Util} from "@openremote/core";
import "@openremote/or-components/or-panel";
import "@openremote/or-translate";
import {Store} from "@reduxjs/toolkit";
@@ -71,6 +71,7 @@ export class PageUsers extends Page<AppStateKeyed> {
margin: 20px auto;
align-items: center;
display: flex;
+ color: var(--or-app-color3, ${unsafeCSS(DefaultColor3)});
}
#title or-icon {
@@ -92,6 +93,7 @@ export class PageUsers extends Page<AppStateKeyed> {
.panel-title {
text-transform: uppercase;
font-weight: bolder;
+ color: var(--or-app-color3, ${unsafeCSS(DefaultColor3)});
line-height: 1em;
margin-bottom: 10px;
margin-top: 0;
diff --git a/ui/component/core/src/defaults.ts b/ui/component/core/src/defaults.ts
index ad835cebd..60f93877b 100644
--- a/ui/component/core/src/defaults.ts
+++ b/ui/component/core/src/defaults.ts
@@ -1,14 +1,14 @@
export const DefaultColor4: string = "#4d9d2a"; // Primary
-export const DefaultColor7: string = "#FFF"; // Secondary
-export const DefaultColor1: string = "#FFF"; // Surface
+export const DefaultColor7: string = "#FFFFFF"; // Secondary
+export const DefaultColor1: string = "#FFFFFF"; // Surface
export const DefaultColor2: string = "#F9F9F9"; // Background
-export const DefaultColor5: string = "#CCC"; // Borders and lines
+export const DefaultColor5: string = "#CCCCCC"; // Borders and lines
export const DefaultColor6: string = "#be0000"; // Invalid/Error
-export const DefaultColor8: string = "#FFF"; // On Primary
+export const DefaultColor8: string = "#FFFFFF"; // On Primary
export const DefaultColor3: string = "#4c4c4c"; // Text / On Secondary
-export const DefaultColor9: string = "#000"; // On Background
-export const DefaultColor10: string = "#000"; // On Surface
-export const DefaultColor11: string = "#FFF"; // On Error
+export const DefaultColor9: string = "#000000"; // On Background
+export const DefaultColor10: string = "#000000"; // On Surface
+export const DefaultColor11: string = "#FFFFFF"; // On Error
export const DefaultBoxShadowBottom: string = "0 5px 5px -5px rgba(0,0,0,0.3)";
export const DefaultBoxShadow: string = "0 1px 3px 0 rgba(0,0,0,0.21)";
export const DefaultHeaderHeight: string = "50px";
diff --git a/ui/component/core/src/index.ts b/ui/component/core/src/index.ts
index 3ed983f97..01b0c6612 100644
--- a/ui/component/core/src/index.ts
+++ b/ui/component/core/src/index.ts
@@ -6,9 +6,17 @@ import {EventProvider, EventProviderFactory, EventProviderStatus, WebSocketEvent
import i18next, {InitOptions} from "i18next";
import i18nextBackend from "i18next-http-backend";
import moment from "moment";
-import {AssetModelUtil, ConsoleAppConfig, Role, User} from "@openremote/model";
+import {
+ AssetModelUtil,
+ ConsoleAppConfig,
+ MapType,
+ Role,
+ User,
+ UsernamePassword,
+} from "@openremote/model";
import * as Util from "./util";
import {IconSets, createSvgIconSet, createMdiIconSet, OrIconSet} from "@openremote/or-icon";
+import { Auth, EventProviderType, ManagerConfig } from "@openremote/model/lib";
// Re-exports
export {Util};
@@ -49,12 +57,6 @@ export enum ORError {
TRANSLATION_ERROR = "TRANSLATION_ERROR"
}
-export enum Auth {
- KEYCLOAK = "KEYCLOAK",
- BASIC = "BASIC",
- NONE = "NONE"
-}
-
export enum OREvent {
ERROR = "ERROR",
READY = "READY",
@@ -68,19 +70,9 @@ export enum OREvent {
DISPLAY_REALM_CHANGED = "DISPLAY_REALM_CHANGED"
}
-export enum EventProviderType {
- WEBSOCKET = "WEBSOCKET",
- POLLING = "POLLING"
-}
-
-export interface Credentials {
- username: string;
- password: string;
-}
-
export interface LoginOptions {
redirectUrl?: string;
- credentials?: Credentials;
+ credentials?: UsernamePassword;
}
export interface BasicLoginResult {
@@ -89,32 +81,20 @@ export interface BasicLoginResult {
cancel: boolean;
}
-export enum MapType {
- VECTOR = "VECTOR",
- RASTER = "RASTER"
+export interface Languages {
+ [langKey: string]: string;
}
-export interface ManagerConfig {
- managerUrl?: string;
- keycloakUrl?: string;
- appVersion?: string;
- auth?: Auth;
- realm?: string;
- clientId?: string;
- autoLogin?: boolean;
- credentials?: Credentials;
- consoleAutoEnable?: boolean;
- eventProviderType?: EventProviderType;
- pollingIntervalMillis?: number;
- loadIcons?: boolean;
- loadDescriptors?: boolean;
- mapType?: MapType;
- loadTranslations?: string[];
- translationsLoadPath?: string;
- configureTranslationsOptions?: (i18next: InitOptions) => void;
- skipFallbackToBasicAuth?: boolean;
- basicLoginProvider?: (username: string | undefined, password: string | undefined) => PromiseLike<BasicLoginResult>;
-}
+export const DEFAULT_LANGUAGES: Languages = {
+ en: "english",
+ cn: "chinese",
+ nl: "dutch",
+ fr: "french",
+ de: "german",
+ it: "italian",
+ pt: "portuguese",
+ es: "spanish"
+};
export function normaliseConfig(config: ManagerConfig): ManagerConfig {
const normalisedConfig: ManagerConfig = config ? Object.assign({}, config) : {};
@@ -724,8 +704,8 @@ export class Manager implements EventProviderFactory {
}
let result: BasicLoginResult = {
- username: this._config.credentials ? this._config.credentials.username : "",
- password: this._config.credentials ? this._config.credentials.password : "",
+ username: this._config.credentials?.username ? this._config.credentials?.username : "",
+ password: this._config.credentials?.password ? this._config.credentials?.password : "",
cancel: false
};
let authenticated = false;
diff --git a/ui/component/core/src/util.ts b/ui/component/core/src/util.ts
index 6e8fd9a33..85c728504 100644
--- a/ui/component/core/src/util.ts
+++ b/ui/component/core/src/util.ts
@@ -1056,3 +1056,18 @@ export function enableScroll() {
window.removeEventListener('touchmove', preventDefault, wheelOpt);
window.removeEventListener('keydown', preventDefaultForScrollKeys, false);
}
+
+export function blobToBase64(blob:Blob) {
+ return new Promise((resolve, reject) => {
+ const fileReader = new FileReader();
+ fileReader.readAsDataURL(blob);
+
+ fileReader.onload = () => {
+ resolve(fileReader.result);
+ };
+
+ fileReader.onerror = (error) => {
+ reject(error);
+ };
+ });
+}
diff --git a/ui/component/or-app/src/index.ts b/ui/component/or-app/src/index.ts
index 84ee323f2..f8a691f51 100644
--- a/ui/component/or-app/src/index.ts
+++ b/ui/component/or-app/src/index.ts
@@ -15,7 +15,7 @@ import "./or-header";
import "@openremote/or-icon";
import {updateMetadata} from "pwa-helpers/metadata";
import i18next from "i18next";
-import manager, {Auth, DefaultColor2, DefaultColor3, DefaultColor4, ManagerConfig, Util, BasicLoginResult, normaliseConfig, Manager} from "@openremote/core";
+import manager, {DefaultColor2, DefaultColor3, DefaultColor4, Util, BasicLoginResult, normaliseConfig, Manager} from "@openremote/core";
import {DEFAULT_LANGUAGES, HeaderConfig} from "./or-header";
import {OrMwcDialog, showErrorDialog, showDialog} from "@openremote/or-mwc-components/or-mwc-dialog";
import {OrMwcSnackbar} from "@openremote/or-mwc-components/or-mwc-snackbar";
@@ -23,7 +23,7 @@ import {AnyAction, Store, Unsubscribe} from "@reduxjs/toolkit";
import {AppStateKeyed, updatePage, updateRealm} from "./app";
import { InputType, OrInputChangedEvent } from "@openremote/or-mwc-components/or-mwc-input";
import { ORError } from "@openremote/core";
-import { Realm } from "@openremote/model";
+import { Auth, ManagerConfig, Realm } from "@openremote/model";
const DefaultLogo = require("../images/logo.svg");
const DefaultMobileLogo = require("../images/logo-mobile.svg");
@@ -38,7 +38,7 @@ export * from "./types";
declare var MANAGER_URL: string | undefined;
declare var KEYCLOAK_URL: string | undefined;
-export {HeaderConfig};
+export {HeaderConfig, DEFAULT_LANGUAGES};
export function getRealmQueryParameter(): string | undefined {
if(location.search && location.search !== "") {
@@ -182,7 +182,7 @@ export class OrApp<S extends AppStateKeyed> extends LitElement {
managerConfig.realm = getRealmQueryParameter();
}
managerConfig.skipFallbackToBasicAuth = true; // We do this so we can load styling config before displaying basic login
- managerConfig.basicLoginProvider = (u, p) => this.doBasicLogin(u, p);
+ managerConfig.basicLoginProvider = (u:any, p:any) => this.doBasicLogin(u, p);
console.info("Initialising the manager");
@@ -225,6 +225,7 @@ export class OrApp<S extends AppStateKeyed> extends LitElement {
// Load available realm info
const response = await manager.rest.api.RealmResource.getAccessible();
this._realms = response.data;
+
let realm: string | null | undefined = undefined;
// Set current display realm if super user
diff --git a/ui/component/or-app/src/or-header.ts b/ui/component/or-app/src/or-header.ts
index daebacecd..019fff371 100644
--- a/ui/component/or-app/src/or-header.ts
+++ b/ui/component/or-app/src/or-header.ts
@@ -8,7 +8,9 @@ import manager, {
DefaultColor4,
DefaultColor5,
DefaultHeaderHeight,
- Util
+ Util,
+ DEFAULT_LANGUAGES,
+ Languages
} from "@openremote/core";
import "@openremote/or-mwc-components/or-mwc-dialog";
import "@openremote/or-icon";
@@ -18,6 +20,8 @@ import {Realm} from "@openremote/model";
import {AppStateKeyed, router, updateRealm} from "./index";
import {AnyAction, Store} from "@reduxjs/toolkit";
+export {DEFAULT_LANGUAGES, Languages}
+
export interface HeaderConfig {
mainMenu: HeaderItem[];
secondaryMenu?: HeaderItem[];
@@ -34,21 +38,6 @@ export interface HeaderItem {
roles?: string[] | {[client: string]: string[]} | (() => boolean);
}
-export interface Languages {
- [langKey: string]: string;
-}
-
-export const DEFAULT_LANGUAGES: Languages = {
- en: "english",
- cn: "chinese",
- nl: "dutch",
- fr: "french",
- de: "german",
- it: "italian",
- pt: "portuguese",
- es: "spanish"
-};
-
function getHeaderMenuItems(items: HeaderItem[]): ListItem[] {
return items.filter(hasRequiredRole).map((option) => {
return {
diff --git a/ui/component/or-asset-tree/src/style.ts b/ui/component/or-asset-tree/src/style.ts
index bed82443a..c57c2137f 100644
--- a/ui/component/or-asset-tree/src/style.ts
+++ b/ui/component/or-asset-tree/src/style.ts
@@ -1,5 +1,5 @@
import {css, unsafeCSS} from "lit";
-import {DefaultColor1, DefaultColor2, DefaultColor4, DefaultColor5} from "@openremote/core";
+import { DefaultColor1, DefaultColor2, DefaultColor4, DefaultColor5, DefaultColor8 } from "@openremote/core";
import {mdiChevronRight} from "@mdi/js";
import {mdiChevronDown} from "@mdi/js";
@@ -8,7 +8,7 @@ export const style = css`
:host {
--internal-or-asset-tree-header-color: var(--or-asset-tree-header-color, var(--or-app-color4, ${unsafeCSS(DefaultColor4)}));
- --internal-or-asset-tree-header-text-color: var(--or-asset-tree-header-text-color, var(--or-app-color7, ${unsafeCSS(DefaultColor1)}));
+ --internal-or-asset-tree-header-text-color: var(--or-asset-tree-header-text-color, var(--or-app-color8, ${unsafeCSS(DefaultColor8)}));
--internal-or-asset-tree-header-menu-background-color: var(--or-asset-tree-header-menu-background-color, var(--internal-or-asset-tree-header-text-color));
--internal-or-asset-tree-header-menu-text-color: var(--or-asset-tree-header-menu-text-color, inherit);
--internal-or-asset-tree-header-height: var(--or-asset-tree-header-height, 48px);
diff --git a/ui/component/or-asset-viewer/src/or-edit-asset-panel.ts b/ui/component/or-asset-viewer/src/or-edit-asset-panel.ts
index 4bd325dbd..230e6ab25 100644
--- a/ui/component/or-asset-viewer/src/or-edit-asset-panel.ts
+++ b/ui/component/or-asset-viewer/src/or-edit-asset-panel.ts
@@ -87,10 +87,10 @@ const style = css`
.actions-cell {
text-align: right;
width: 40px;
- padding-right: 5px;
+ padding-right: 4px;
}
.meta-item-container {
- padding: 0 16px 0 36px;
+ padding: 0 4px 0 24px;
overflow: hidden;
max-height: 0;
transition: max-height 0.25s ease-out;
@@ -124,7 +124,7 @@ const style = css`
visibility: hidden;
display: inline-block;
border: none;
- padding: 0 0 0 5px;
+ padding: 0 0 0 4px;
cursor: pointer;
}
.button-clear:hover {
diff --git a/ui/component/or-asset-viewer/src/style.ts b/ui/component/or-asset-viewer/src/style.ts
index 3fad9c07d..1c1133caf 100644
--- a/ui/component/or-asset-viewer/src/style.ts
+++ b/ui/component/or-asset-viewer/src/style.ts
@@ -192,6 +192,7 @@ export const style = css`
display: flex;
flex-direction: row;
align-items: center;
+ color: var(--internal-or-asset-viewer-title-text-color);
}
#title > or-icon {
diff --git a/ui/component/or-components/package.json b/ui/component/or-components/package.json
index b99208ca1..b758764b2 100644
--- a/ui/component/or-components/package.json
+++ b/ui/component/or-components/package.json
@@ -23,6 +23,7 @@
"license": "AGPL-3.0-or-later",
"dependencies": {
"@material/elevation": "^9.0.0",
+ "@openremote/core": "workspace:*",
"lit": "^2.0.2",
"simplebar": "^5.3.6"
},
diff --git a/ui/component/or-components/src/or-collapsible-panel.ts b/ui/component/or-components/src/or-collapsible-panel.ts
index b92197b35..23cde4aa5 100644
--- a/ui/component/or-components/src/or-collapsible-panel.ts
+++ b/ui/component/or-components/src/or-collapsible-panel.ts
@@ -1,18 +1,38 @@
-import {css, html, LitElement, PropertyValues, unsafeCSS} from "lit";
-import {customElement, property, query} from "lit/decorators.js";
-import {DefaultColor2, DefaultColor5} from "@openremote/core";
+/*
+ * Copyright 2017, OpenRemote Inc.
+ *
+ * See the CONTRIBUTORS.txt file in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+import { css, html, LitElement, unsafeCSS } from "lit";
+import { customElement, property, query } from "lit/decorators.js";
+import { DefaultColor5 } from "@openremote/core";
// language=CSS
const style = css`
-
+
:host {
display: block;
box-sizing: content-box;
margin: 0;
overflow: hidden;
- transition: margin 225ms cubic-bezier(0.4, 0, 0.2, 1),box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1);
+ transition: margin 225ms cubic-bezier(0.4, 0, 0.2, 1), box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1);
position: relative;
border-color: var(--or-app-color5, ${unsafeCSS(DefaultColor5)});
+ background-color: var(--or-collapisble-panel-background-color);
border-radius: 4px;
border-width: 1px;
border-style: solid;
@@ -30,7 +50,7 @@ const style = css`
font-size: 15px;
font-weight: 400;
align-items: center;
- padding: 0 24px;
+ padding: 0 24px 0 16px;
border-radius: inherit;
}
@@ -44,7 +64,6 @@ const style = css`
}
#header.expanded > #indicator {
- transform: rotate(180deg);
}
#header-content {
@@ -55,14 +74,9 @@ const style = css`
}
#header-title, #header-description {
- margin-right: 16px;
display: inline-flex;
align-items: center;
}
-
- #header-title {
- flex: 0;
- }
#header-description {
flex-grow: 2;
@@ -70,20 +84,11 @@ const style = css`
#indicator {
align-self: center;
- }
-
- #indicator::after {
- border-style: solid;
- border-width: 0 2px 2px 0;
- content: "";
- display: inline-block;
- padding: 3px;
- transform: rotate(45deg);
- vertical-align: middle;
+ margin-right: 6px;
+ margin-left: -5px;
}
#content {
- display: flex;
height: 0;
visibility: hidden;
}
@@ -92,6 +97,14 @@ const style = css`
height: unset;
visibility: visible;
}
+
+ or-icon {
+ vertical-align: middle;
+ --or-icon-width: 20px;
+ --or-icon-height: 20px;
+ margin-right: 2px;
+ margin-left: -5px;
+ }
`;
@customElement("or-collapsible-panel")
@@ -122,11 +135,11 @@ export class OrCollapsiblePanel extends LitElement {
return html`
<div id="header" class="${this.expandable ? "expandable" : ""} ${this.expandable && this.expanded ? "expanded" : ""}" @click="${(ev:MouseEvent) => this._onHeaderClicked(ev)}">
+ ${this.expandable ? html`<or-icon icon="chevron-${this.expanded ? "down" : "right"}"></or-icon>` : ""}
<span id="header-content">
<span id="header-title"><slot name="header"></slot></span>
<span id="header-description"><slot name="header-description"></slot></span>
</span>
- ${this.expandable ? html`<span id="indicator"></span>` : ""}
</div>
<div id="content" class="${this.expandable && this.expanded ? "expanded" : ""}">
<slot name="content"></slot>
diff --git a/ui/component/or-components/src/or-file-uploader.ts b/ui/component/or-components/src/or-file-uploader.ts
new file mode 100644
index 000000000..4f3826e15
--- /dev/null
+++ b/ui/component/or-components/src/or-file-uploader.ts
@@ -0,0 +1,154 @@
+/*
+ * Copyright 2022, OpenRemote Inc.
+ *
+ * See the CONTRIBUTORS.txt file in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+import { css, html, LitElement, PropertyValues } from "lit";
+import { customElement, property } from "lit/decorators.js";
+import { i18next } from "@openremote/or-translate";
+import { FileInfo } from "@openremote/model";
+import "./or-loading-indicator";
+
+@customElement("or-file-uploader")
+export class OrFileUploader extends LitElement {
+
+ //Contains the content that will be shown towards the user.
+ @property({ attribute: false })
+ public src: string = "";
+
+ @property()
+ public title: string = "";
+
+ @property({ attribute: false })
+ public accept: string = "image/png,image/jpeg,image/vnd.microsoft.icon,image/svg+xml";
+
+ private loading: boolean = false;
+ private files: FileInfo[] = []
+
+ get Files(): FileInfo[] {
+ return this.files
+ }
+ static get styles() {
+ return css`
+ #imageContainer {
+ position: relative;
+ max-width: 150px;
+ background-color: whitesmoke;
+ border: 1px solid var(--or-app-color5, #CCC);;
+ cursor: pointer;
+ border-radius: 4px;
+ padding: 4px;
+ }
+
+ #imageContainer img {
+ max-width: 100%;
+ max-height: 100%;
+ border-radius: 2px;
+ margin: unset;
+ }
+
+ input {
+ display: none;
+ }
+
+ .placeholder-container {
+ text-align: center;
+ width: 100%;
+ }
+
+ .placeholder-container or-icon {
+ font-size: 24px;
+ margin: 16px 0;
+ max-height: 24px;
+ width: 100%;
+ text-align: center;
+ }
+
+ #imageContainer:hover .pencil-container{
+ display: flex;
+ }
+
+ #imageContainer .pencil-container {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ background: rgba(0,0,0,.4);
+ color: var(--or-app-color4);
+ display: none;
+ justify-content: center;
+ align-items: center;
+ }
+
+ .container {
+ position: relative;
+ }
+ `;
+ }
+
+ protected firstUpdated(_changedProperties: PropertyValues): void {
+ super.firstUpdated(_changedProperties);
+ const fileInput = this.shadowRoot?.getElementById('fileInput')
+ const imageContainer = this.shadowRoot?.getElementById('imageContainer')
+ fileInput?.addEventListener("input", (e) => {
+ this._onChange(e);
+ });
+ imageContainer?.addEventListener("click", (e) => {
+ fileInput?.click();
+ });
+ }
+
+ async _onChange(e: any) {
+ this.files = e?.target?.files;
+ this.loading = true;
+ this.requestUpdate();
+ this.dispatchEvent(new CustomEvent("change", {
+ detail: { value: this.files },
+ }));
+ this.loading = false;
+ this.requestUpdate();
+ }
+
+ render() {
+ return html`
+ <div class="container">
+ ${this.loading ? html`
+ <or-loading-indicator .overlay="${true}"></or-loading-indicator>` : ""}
+ <div class="title">${this.title}</div>
+ <div id="imageContainer">
+
+ ${!!this.src ?
+ html`<img src="${this.src}" alt="OR-File-Uploader">
+ <div class="pencil-container">
+ <or-icon icon="pencil-circle"></or-icon>
+ </div>
+ `
+ :
+ html`
+ <div class="placeholder-container">
+ <or-icon icon="upload"></or-icon>
+ ${i18next.t('uploadFile')}
+ </div>
+ `
+ }
+ </div>
+ <input type="file" id="fileInput" accept="${this.accept}">
+ </div>
+ `;
+ }
+}
diff --git a/ui/component/or-components/src/or-loading-indicator.ts b/ui/component/or-components/src/or-loading-indicator.ts
new file mode 100644
index 000000000..1963dcff3
--- /dev/null
+++ b/ui/component/or-components/src/or-loading-indicator.ts
@@ -0,0 +1,115 @@
+/*
+ * Copyright 2022, OpenRemote Inc.
+ *
+ * See the CONTRIBUTORS.txt file in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+import { css, html, LitElement } from "lit";
+import { customElement, property } from "lit/decorators.js";
+
+@customElement("or-loading-indicator")
+export class OrLoadingIndicator extends LitElement {
+
+ @property({ attribute: true })
+ public overlay: boolean = false;
+
+ static get styles() {
+ return css`
+ .loader-container {
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background-color: rgba(0, 0, 0, .2);
+ z-index: 1000;
+ }
+
+ .loader {
+ position: absolute;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ top: 50%;
+ z-index: 1010;
+ }
+
+ .loader svg {
+ height: 60px;
+ width: 60px;
+ }
+
+ @-webkit-keyframes rotate-right {
+ from {
+ -webkit-transform: rotate(0deg);
+ }
+ to {
+ -webkit-transform: rotate(360deg);
+ }
+ }
+ @-webkit-keyframes rotate-left {
+ from {
+ -webkit-transform: rotate(0deg);
+ }
+ to {
+ -webkit-transform: rotate(-360deg);
+ }
+ }
+
+ .loader #circle1 {
+ -webkit-transform: translate3d(0, 0, 0);
+ -webkit-transform-origin: 54.1px 53.6px;
+ -webkit-animation: rotate-right 7s linear 0s infinite;
+ }
+
+ .loader #circle2 {
+ -webkit-transform: translate3d(0, 0, 0);
+ -webkit-transform-origin: 54.1px 53.6px;
+ -webkit-animation: rotate-left 6s linear 0s infinite;
+ }
+
+ .loader #circle3 {
+ -webkit-transform: translate3d(0, 0, 0);
+ -webkit-transform-origin: 54.1px 53.6px;
+ -webkit-animation: rotate-right 5s linear 0s infinite;
+ }
+ `;
+ }
+
+
+ render() {
+ const loader = html`
+ <div class="loader">
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 110 110"
+ xml:space="preserve">
+ <path fill="#d2d2d2" id="circle1"
+ d="M53.648,107.296C24.068,107.296,0,83.236,0,53.646h11.234c0,23.391,19.025,42.42,42.414,42.42 c23.385,0,42.416-19.029,42.416-42.42c0-23.382-19.031-42.408-42.416-42.408V0c29.582,0,53.65,24.068,53.65,53.646 C107.299,83.236,83.23,107.296,53.648,107.296L53.648,107.296z" />
+ <path fill="#a5a5a5" id="circle2"
+ d="M45.525,92.57c-10.395-2.166-19.324-8.262-25.145-17.137c-5.814-8.884-7.826-19.511-5.654-29.906 c2.174-10.399,8.258-19.325,17.141-25.145c8.889-5.815,19.506-7.825,29.906-5.655c21.463,4.479,35.281,25.582,30.803,47.041 L81.58,59.478c3.207-15.397-6.703-30.539-22.105-33.751c-7.461-1.56-15.078-0.119-21.455,4.06 c-6.369,4.169-10.736,10.58-12.299,18.039c-1.555,7.458-0.113,15.075,4.064,21.453c4.17,6.37,10.576,10.744,18.041,12.297 L45.525,92.57L45.525,92.57z" />
+ <path fill="#878787" id="circle3"
+ d="M53.682,79.428c-0.432,0-0.871-0.012-1.309-0.032c-6.869-0.342-13.205-3.344-17.83-8.439 c-4.621-5.108-6.982-11.705-6.639-18.582l11.215,0.553c-0.188,3.879,1.141,7.609,3.75,10.488c2.604,2.879,6.186,4.568,10.059,4.761 c3.869,0.179,7.607-1.142,10.48-3.748c2.887-2.603,4.576-6.179,4.773-10.057c0.391-8.012-5.803-14.854-13.816-15.248l0.559-11.222 c14.201,0.71,25.178,12.823,24.475,27.021c-0.344,6.883-3.336,13.212-8.441,17.831C66.174,77.086,60.084,79.428,53.682,79.428 L53.682,79.428z" />
+ </svg>
+ </div>`;
+
+
+ if (this.overlay) {
+ return html`
+ <div class="loader-container">
+ ${loader}
+ </div>`;
+ }
+ return loader;
+ }
+}
diff --git a/ui/component/or-components/src/or-panel.ts b/ui/component/or-components/src/or-panel.ts
index e4fcc9333..bbfb66c5f 100644
--- a/ui/component/or-components/src/or-panel.ts
+++ b/ui/component/or-components/src/or-panel.ts
@@ -1,6 +1,6 @@
import {css, html, LitElement, PropertyValues, unsafeCSS} from "lit";
import {customElement, property, query} from "lit/decorators.js";
-import {DefaultColor2} from "@openremote/core";
+import {DefaultColor2, DefaultColor3} from "@openremote/core";
// TODO: Add webpack/rollup to build so consumers aren't forced to use the same tooling
const simpleBarStyle = require("simplebar/dist/simplebar.css");
@@ -13,9 +13,11 @@ const style = css`
--internal-or-panel-background-color: var(--or-panel-background-color, var(--or-app-color2, ${unsafeCSS(DefaultColor2)}));
--internal-or-panel-padding: var(--or-panel-padding, 10px);
--internal-or-panel-heading-margin: var(--or-panel-heading-margin, 0 0 5px 7px);
+ --internal-or-panel-heading-color: var(--or-panel-heading-color, var(--or-app-color3, ${unsafeCSS(DefaultColor3)}));
--internal-or-panel-border: var(--or-panel-border, 1px solid #e5e5e5);
--internal-or-panel-border-radius: var(--or-panel-border-radius, 5px);
--internal-or-panel-heading-font-size: var(--or-panel-heading-font-size, larger);
+ --internal-or-panel-heading-font-weight: var(--or-panel-heading-font-weight, bolder);
display: block;
}
@@ -36,9 +38,11 @@ const style = css`
border-radius: var(--internal-or-panel-border-radius);
}
- strong {
+ #heading {
margin: var(--internal-or-panel-heading-margin);
font-size: var(--internal-or-panel-heading-font-size);
+ font-weight: var(--internal-or-panel-heading-font-weight);
+ color: var(--internal-or-panel-heading-color);
}
`;
@@ -79,7 +83,7 @@ export class OrPanel extends LitElement {
return html`
<div id="wrapper">
<div id="panel">
- ${this.heading ? html`<strong>${this.heading}</strong>` : ``}
+ ${this.heading ? html`<div id="heading">${this.heading}</div>` : ``}
<slot></slot>
</div>
</div>
diff --git a/ui/component/or-dashboard-builder/src/index.ts b/ui/component/or-dashboard-builder/src/index.ts
index ee812bb77..dc29a4cb3 100644
--- a/ui/component/or-dashboard-builder/src/index.ts
+++ b/ui/component/or-dashboard-builder/src/index.ts
@@ -20,7 +20,7 @@ import {
DashboardTemplate,
DashboardWidget
} from "@openremote/model";
-import manager, {DefaultColor3, DefaultColor5} from "@openremote/core";
+import manager, {DefaultColor1, DefaultColor3, DefaultColor5} from "@openremote/core";
import {ListItem} from "@openremote/or-mwc-components/or-mwc-list";
import {OrMwcTabItem} from "@openremote/or-mwc-components/or-mwc-tabs";
import "@openremote/or-mwc-components/or-mwc-tabs";
@@ -53,7 +53,7 @@ const styling = css`
#header {
display: table-row;
height: 1px;
- background: white;
+ background: var(--or-app-color1, ${unsafeCSS(DefaultColor1)});
}
#header-wrapper {
padding: 14px 30px;
@@ -99,6 +99,7 @@ const styling = css`
#fullscreen-header-title {
font-size: 18px;
font-weight: bold;
+ color: var(--or-app-color3, ${unsafeCSS(DefaultColor3)});
}
#fullscreen-header-title > or-mwc-input {
margin-right: 4px;
diff --git a/ui/component/or-dashboard-builder/src/or-dashboard-tree.ts b/ui/component/or-dashboard-builder/src/or-dashboard-tree.ts
index a74712b50..1cd807eab 100644
--- a/ui/component/or-dashboard-builder/src/or-dashboard-tree.ts
+++ b/ui/component/or-dashboard-builder/src/or-dashboard-tree.ts
@@ -183,11 +183,9 @@ export class OrDashboardTree extends LitElement {
` : undefined}
` : undefined}
${!this.readonly ? html`
- <span style="--or-icon-fill: black">
- <or-mwc-input type="${InputType.BUTTON}" class="hideMobile" icon="plus" style="--or-icon-fill: white;"
- @or-mwc-input-changed="${() => { this.createDashboard(DashboardSizeOption.DESKTOP); }}"
- ></or-mwc-input>
- </span>
+ <or-mwc-input type="${InputType.BUTTON}" class="hideMobile" icon="plus"
+ @or-mwc-input-changed="${() => { this.createDashboard(DashboardSizeOption.DESKTOP); }}"
+ ></or-mwc-input>
` : undefined}
</div>
` : undefined}
diff --git a/ui/component/or-json-forms/package.json b/ui/component/or-json-forms/package.json
index 5b4eb0321..8fc0017d3 100644
--- a/ui/component/or-json-forms/package.json
+++ b/ui/component/or-json-forms/package.json
@@ -18,6 +18,7 @@
"license": "AGPL-3.0-or-later",
"dependencies": {
"@jsonforms/core": "^3.0.0-beta.1",
+ "@openremote/or-components": "^1.1.0",
"@openremote/or-mwc-components": "^1.1.0",
"@polymer/polymer": "^3.3.1",
"ajv": "^8.8.2",
diff --git a/ui/component/or-json-forms/src/layouts/layout-vertical-element.ts b/ui/component/or-json-forms/src/layouts/layout-vertical-element.ts
index d07257b8f..0a0a1919e 100644
--- a/ui/component/or-json-forms/src/layouts/layout-vertical-element.ts
+++ b/ui/component/or-json-forms/src/layouts/layout-vertical-element.ts
@@ -56,8 +56,15 @@ const style = css`
display: table-cell;
}
- .key-container, .value-container {
- padding: 10px;
+ .value-container {
+ padding: 0 0 20px 10px;
+ }
+
+ .key-container {
+ padding: 0 10px 20px 0;
+ }
+
+ .value-container, .key-container {
vertical-align: top;
}
diff --git a/ui/component/or-json-forms/src/styles.ts b/ui/component/or-json-forms/src/styles.ts
index 0c6bf9974..a062bbe43 100644
--- a/ui/component/or-json-forms/src/styles.ts
+++ b/ui/component/or-json-forms/src/styles.ts
@@ -88,7 +88,7 @@ export const panelStyle = css`
#content-wrapper {
flex: 1;
- padding: 0 10px 10px 10px;
+ padding: 0 4px 14px 24px;
}
#content {
diff --git a/ui/component/or-map/src/index.ts b/ui/component/or-map/src/index.ts
index 50f7d1584..b50b2df42 100644
--- a/ui/component/or-map/src/index.ts
+++ b/ui/component/or-map/src/index.ts
@@ -1,4 +1,4 @@
-import manager, {EventCallback, MapType} from "@openremote/core";
+import manager, {EventCallback} from "@openremote/core";
import {FlattenedNodesObserver} from "@polymer/polymer/lib/utils/flattened-nodes-observer.js";
import {CSSResult, html, LitElement, PropertyValues} from "lit";
import {customElement, property, query} from "lit/decorators.js";
@@ -18,6 +18,7 @@ import {
import {OrMwcDialog, showDialog} from "@openremote/or-mwc-components/or-mwc-dialog";
import {getMarkerIconAndColorFromAssetType} from "./util";
import {i18next} from "@openremote/or-translate";
+import { MapType } from "@openremote/model";
// Re-exports
export {Util, LngLatLike};
diff --git a/ui/component/or-map/src/mapwidget.ts b/ui/component/or-map/src/mapwidget.ts
index b1062639b..2cb4336d0 100644
--- a/ui/component/or-map/src/mapwidget.ts
+++ b/ui/component/or-map/src/mapwidget.ts
@@ -1,4 +1,4 @@
-import manager, {MapType} from "@openremote/core";
+import manager from "@openremote/core";
import {LngLatLike, Map as MapGL, MapboxOptions as OptionsGL, Marker as MarkerGL, Style as StyleGL, LngLat,
MapMouseEvent,
NavigationControl,
@@ -13,6 +13,7 @@ import {
OrMapMarker
} from "./markers/or-map-marker";
import {getLatLngBounds, getLngLat} from "./util";
+import { MapType } from "@openremote/model";
const mapboxJsStyles = require("mapbox.js/dist/mapbox.css");
const maplibreGlStyles = require("maplibre-gl/dist/maplibre-gl.css");
const maplibreGeoCoderStyles = require("@maplibre/maplibre-gl-geocoder/dist/maplibre-gl-geocoder.css");
diff --git a/ui/component/or-mwc-components/src/or-mwc-input.ts b/ui/component/or-mwc-components/src/or-mwc-input.ts
index b75e8d5ea..4f77e5822 100644
--- a/ui/component/or-mwc-components/src/or-mwc-input.ts
+++ b/ui/component/or-mwc-components/src/or-mwc-input.ts
@@ -425,7 +425,7 @@ const style = css`
:host {
display: inline-block;
--internal-or-mwc-input-color: var(--or-mwc-input-color, var(--or-app-color4, ${unsafeCSS(DefaultColor4)}));
- --internal-or-mwc-input-text-color: var(--or-mwc-input-text-color, var(--or-app-color1, ${unsafeCSS(DefaultColor8)}));
+ --internal-or-mwc-input-text-color: var(--or-mwc-input-text-color, var(--or-app-color8, ${unsafeCSS(DefaultColor8)}));
--mdc-theme-primary: var(--internal-or-mwc-input-color);
--mdc-theme-on-primary: var(--internal-or-mwc-input-text-color);
@@ -597,10 +597,16 @@ const style = css`
.mdc-select__menu .mdc-list .mdc-list-item.mdc-list-item--selected or-icon {
--or-icon-fill: var(--or-app-color4);
}
+
+ .mdc-select__selected-text {
+ white-space: normal;
+ }
+
.mdc-menu__searchable {
overflow: hidden;
flex-direction: column;
}
+
.mdc-menu__searchable.mdc-menu-surface--is-open-below {
display: flex;
}
@@ -1233,12 +1239,13 @@ export class OrMwcInput extends LitElement {
`;
case InputType.COLOUR:
return html`
- <div id="component" style="width: 100%; height: 100%;">
- <input type="color" id="elem" style="border: none; height: 100%; width: 100%; padding: 1px 3px; min-height: 22px; min-width: 30px;" value="${this.value}"
+ <div id="component" style="width: 100%; height: 100%; display: inline-flex; align-items: center; padding: 8px 0;">
+ <input type="color" id="elem" style="border: none; height: 31px; width: 31px; padding: 1px 3px; min-height: 22px; min-width: 30px;cursor: pointer" value="${this.value}"
?disabled="${this.disabled || this.readonly}"
?required="${this.required}"
@change="${(e: any) => this.onValueChange((e.target as HTMLInputElement), (e.target as HTMLInputElement).value)}"
/>
+ <label style="margin-left: 10px; cursor: pointer" for="elem">${this.label}</label>
</div>
`
case InputType.NUMBER:
diff --git a/ui/component/or-mwc-components/src/or-mwc-list.ts b/ui/component/or-mwc-components/src/or-mwc-list.ts
index 5e346968b..bc21208a7 100644
--- a/ui/component/or-mwc-components/src/or-mwc-list.ts
+++ b/ui/component/or-mwc-components/src/or-mwc-list.ts
@@ -211,7 +211,7 @@ const style = css`
:host {
white-space: nowrap;
--internal-or-mwc-input-color: var(--or-mwc-input-color, var(--or-app-color4, ${unsafeCSS(DefaultColor4)}));
- --internal-or-mwc-input-text-color: var(--or-mwc-input-text-color, var(--or-app-color1, ${unsafeCSS(DefaultColor8)}));
+ --internal-or-mwc-input-text-color: var(--or-mwc-input-text-color, var(--or-app-color8, ${unsafeCSS(DefaultColor8)}));
--mdc-theme-primary: var(--internal-or-mwc-input-color);
--mdc-theme-on-primary: var(--internal-or-mwc-input-text-color);
diff --git a/ui/component/or-mwc-components/src/or-mwc-menu.ts b/ui/component/or-mwc-components/src/or-mwc-menu.ts
index f729763e8..63d79bb22 100644
--- a/ui/component/or-mwc-components/src/or-mwc-menu.ts
+++ b/ui/component/or-mwc-components/src/or-mwc-menu.ts
@@ -73,7 +73,7 @@ const style = css`
:host {
white-space: nowrap;
--internal-or-mwc-input-color: var(--or-mwc-input-color, var(--or-app-color4, ${unsafeCSS(DefaultColor4)}));
- --internal-or-mwc-input-text-color: var(--or-mwc-input-text-color, var(--or-app-color1, ${unsafeCSS(DefaultColor8)}));
+ --internal-or-mwc-input-text-color: var(--or-mwc-input-text-color, var(--or-app-color8, ${unsafeCSS(DefaultColor8)}));
--mdc-theme-primary: var(--internal-or-mwc-input-color);
--mdc-theme-on-primary: var(--internal-or-mwc-input-text-color);
diff --git a/ui/component/or-rules/src/or-rule-list.ts b/ui/component/or-rules/src/or-rule-list.ts
index f7d49917c..490776025 100644
--- a/ui/component/or-rules/src/or-rule-list.ts
+++ b/ui/component/or-rules/src/or-rule-list.ts
@@ -56,7 +56,7 @@ const style = css`
align-items: center;
height: var(--internal-or-asset-tree-header-height);
line-height: var(--internal-or-asset-tree-header-height);
- color: var(--internal-or-asset-tree-header-text-color);
+ color: var(--internal-or-rules-panel-color);
background-color: var(--internal-or-rules-header-background-color);
}
@@ -241,7 +241,7 @@ export class OrRuleList extends translate(i18next)(LitElement) {
return html`
<div id="wrapper" ?data-disabled="${this.disabled}">
${manager.isSuperUser() ? html`
- <div class="header-ruleset-type bg-grey">
+ <div class="header-ruleset-type">
<p>${i18next.t("realmRules")}</p>
<div style="flex: 1 1 0; display: flex;">
diff --git a/yarn.lock b/yarn.lock
index 597a54643..ab088aa87 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2441,6 +2441,7 @@ __metadata:
resolution: "@openremote/or-components@workspace:ui/component/or-components"
dependencies:
"@material/elevation": ^9.0.0
+ "@openremote/core": "workspace:*"
"@openremote/util": "workspace:*"
lit: ^2.0.2
simplebar: ^5.3.6
@@ -2514,6 +2515,7 @@ __metadata:
resolution: "@openremote/or-json-forms@workspace:ui/component/or-json-forms"
dependencies:
"@jsonforms/core": ^3.0.0-beta.1
+ "@openremote/or-components": ^1.1.0
"@openremote/or-mwc-components": ^1.1.0
"@openremote/util": "workspace:*"
"@polymer/polymer": ^3.3.1