diff --git a/WebContent/WEB-INF/jsp/systemSettings.jsp b/WebContent/WEB-INF/jsp/systemSettings.jsp
index 924c5d4164..27f89f13aa 100644
--- a/WebContent/WEB-INF/jsp/systemSettings.jsp
+++ b/WebContent/WEB-INF/jsp/systemSettings.jsp
@@ -632,13 +632,13 @@
|
- "/>" type="text" class="formShort" style="width: 300px;"/>
+ "/>" type="text" class="formShort" style="width: 150px"/>
|
|
- "/>" type="text" class="formShort" style="width: 300px;"/>
+ "/>" type="text" class="formShort" style="width: 150px"/>
|
diff --git a/WebContent/WEB-INF/springDispatcher-servlet.xml b/WebContent/WEB-INF/springDispatcher-servlet.xml
index 75e5c7f565..38bbea3af0 100644
--- a/WebContent/WEB-INF/springDispatcher-servlet.xml
+++ b/WebContent/WEB-INF/springDispatcher-servlet.xml
@@ -17,6 +17,13 @@
+
+
+
+
+
+
+
org.springframework.web.servlet.view.JstlView
diff --git a/WebContent/WEB-INF/tags/logo.tag b/WebContent/WEB-INF/tags/logo.tag
index e8f28592dd..59f5186e4c 100644
--- a/WebContent/WEB-INF/tags/logo.tag
+++ b/WebContent/WEB-INF/tags/logo.tag
@@ -6,10 +6,10 @@
-
+
-
+
diff --git a/WebContent/assets/user_styles.css b/WebContent/assets/user_styles.css
index f8bd989d3b..1aa62c78c6 100644
--- a/WebContent/assets/user_styles.css
+++ b/WebContent/assets/user_styles.css
@@ -23,19 +23,19 @@
}
#top-description-prefix {
- color: black;
- font-size: 2em;
- margin-left: 0.5em;
- margin-right: 0.5em;
- display: inline-block;
- vertical-align: bottom;
- line-height: 1;
+ color: black !important;
+ font-size: 2em !important;
+ margin-left: 0.5em !important;
+ margin-right: 0.5em !important;
+ display: inline-block !important;
+ vertical-align: bottom !important;
+ line-height: 1 !important;
}
#top-description {
- color: #39B54A;
- font-size: 2em;
- display: inline-block;
- vertical-align: bottom;
- line-height: 1;
+ color: #39B54A !important;
+ font-size: 2em !important;
+ display: inline-block !important;
+ vertical-align: bottom !important;
+ line-height: 1 !important;
}
\ No newline at end of file
diff --git a/scadalts-ui/src/apps/App.vue b/scadalts-ui/src/apps/App.vue
index 1ae8b0b927..9211f0703f 100644
--- a/scadalts-ui/src/apps/App.vue
+++ b/scadalts-ui/src/apps/App.vue
@@ -5,11 +5,29 @@
- Scada-LTS
- mdi-access-point-network-off
-
- version {{ $store.getters.appMilestone }}
-
+
+
+ Scada-LTS
+ mdi-access-point-network-off
+
+
+ version {{ $store.getters.appMilestone }}
+
+
+
+
+
+
+
+ {{ topDescriptionPrefix }}
+
+
+ {{ topDescription }}
+
+
+
+
+
@@ -71,6 +89,7 @@
import NavigationBar from '../layout/NavigationBar.vue';
import internetMixin from '@/utils/connection-status-utils';
import NotificationAlert from '../layout/snackbars/NotificationAlert.vue';
+import {unescapeHtml} from "@/utils/common";
export default {
name: 'app',
@@ -104,17 +123,17 @@ export default {
4: {
image: "images/flag_red.png"
}
- },
+ }
};
},
computed: {
user() {
- return this.$store.state.loggedUser;
+ return this.$store.getters.loggedUser;
},
isUserRoleAdmin() {
- if (!!this.$store.state.loggedUser) {
- return this.$store.state.loggedUser.admin;
+ if (!!this.$store.getters.loggedUser) {
+ return this.$store.getters.loggedUser.admin;
} else {
return false;
}
@@ -128,14 +147,31 @@ export default {
isLoginPage() {
return this.$route.name === 'login';
},
+ topDescriptionPrefix() {
+ let systemInfoSettings = this.$store.state.systemSettings.systemInfoSettings;
+ if(systemInfoSettings && systemInfoSettings.topDescriptionPrefix) {
+ return systemInfoSettings.topDescriptionPrefix;
+ }
+ return '';
+ },
+ topDescription() {
+ let systemInfoSettings = this.$store.state.systemSettings.systemInfoSettings;
+ if(systemInfoSettings && systemInfoSettings.topDescription) {
+ return systemInfoSettings.topDescription;
+ }
+ return '';
+ }
},
- mounted() {
+ async mounted() {
if(!this.user) {
- this.$store.dispatch('getUserInfo');
- }
- this.$store.dispatch('getLocaleInfo');
+ await this.$store.dispatch('getUserInfo');
+ }
+ await this.$store.dispatch('getLocaleInfo');
+ await this.$store.dispatch('getCustomCss');
+ await this.$store.dispatch('getSystemInfoSettings');
this.connectToWebSocket();
+ this.fetchCustomCss();
},
destroyed() {
@@ -143,6 +179,26 @@ export default {
},
methods: {
+
+ fetchCustomCss() {
+ let customCss = this.$store.state.systemSettings.customCss;
+ let unescapedContent = unescapeHtml(customCss.content);
+ this.applyCustomCss(unescapedContent);
+ },
+
+ applyCustomCss(cssContent) {
+ let styleElement = document.getElementById('custom-css-style');
+
+ if (!styleElement) {
+ styleElement = document.createElement('style');
+ styleElement.id = 'custom-css-style';
+ styleElement.type = 'text/css';
+ document.head.appendChild(styleElement);
+ }
+ styleElement.innerHTML = '';
+ styleElement.appendChild(document.createTextNode(cssContent));
+ },
+
subscribeForAlarms() {
this.wsConnectionRetires = 5;
let stompClient = this.$store.state.webSocketModule.webSocket;
diff --git a/scadalts-ui/src/store/index.js b/scadalts-ui/src/store/index.js
index dffc1dd264..ca72dc8cd9 100644
--- a/scadalts-ui/src/store/index.js
+++ b/scadalts-ui/src/store/index.js
@@ -94,7 +94,7 @@ export default new Vuex.Store({
{ id: 2, label: i18n.t('common.alarmlevels.urgent') },
{ id: 3, label: i18n.t('common.alarmlevels.critical') },
{ id: 4, label: i18n.t('common.alarmlevels.lifesafety') },
- ],
+ ]
},
mutations: {
updateWebSocketUrl(state) {
@@ -107,6 +107,10 @@ export default new Vuex.Store({
updateRequestTimeout(state, timeout) {
state.requestConfig.timeout = timeout > 1000 ? timeout : 1000;
},
+
+ setLoggedUser(state, loggedUser) {
+ state.loggedUser = loggedUser;
+ }
},
actions: {
getUserRole() {
@@ -131,7 +135,7 @@ export default new Vuex.Store({
axios.defaults.withCredentials = true;
let logged = false;
let res = await dispatch('requestPostNonApi', {
- url: `/login.htm` + `?username=` + userdata.username + `&password=` + userdata.password + `&submit=Login`,
+ url: `login.htm` + `?username=` + userdata.username + `&password=` + userdata.password + `&submit=Login`,
data: null
});
if(res != null && res != '') {
@@ -142,7 +146,7 @@ export default new Vuex.Store({
},
logoutUser({ state, dispatch }) {
- dispatch('requestGetNonApi', `/logout.htm`)
+ dispatch('requestGetNonApi', `logout.htm`)
.then((resp) => {
state.loggedUser = null;
});
@@ -154,11 +158,13 @@ export default new Vuex.Store({
* @param {*} param0 - Vuex Store variables
*/
async getUserInfo({ state, dispatch, commit }) {
- state.loggedUser = await dispatch('requestGet', '/auth/user');
- commit('updateWebSocketUrl');
- commit('INIT_WEBSOCKET_URL');
- commit('INIT_WEBSOCKET');
- return state.loggedUser;
+ return dispatch('requestGet', '/auth/user').then((r) => {
+ commit('setLoggedUser', r);
+ commit('updateWebSocketUrl');
+ commit('INIT_WEBSOCKET_URL');
+ commit('INIT_WEBSOCKET');
+ return r;
+ });
},
/**
@@ -394,7 +400,7 @@ export default new Vuex.Store({
: reject(error.response);
});
});
- },
+ }
},
getters: {
appVersion: (state) => {
@@ -432,6 +438,9 @@ export default new Vuex.Store({
appPullRequestBranch: (state) => {
return state.scadaLtsPullRequestBranch;
},
+ loggedUser: (state) => {
+ return state.loggedUser;
+ }
},
plugins: [myLoggerForVuexMutation],
});
diff --git a/scadalts-ui/src/store/systemSettings/index.js b/scadalts-ui/src/store/systemSettings/index.js
index 559e932f4e..eb11e7ea81 100644
--- a/scadalts-ui/src/store/systemSettings/index.js
+++ b/scadalts-ui/src/store/systemSettings/index.js
@@ -23,6 +23,7 @@ const storeSystemSettings = {
schemaVersion: undefined,
scadaConfig: undefined,
defaultLoggingType: undefined,
+ customCss: undefined
},
mutations: {
setDatabaseType(state, databaseType) {
@@ -71,6 +72,9 @@ const storeSystemSettings = {
setDefaultLoggingType(state, defaultLoggingType) {
state.defaultLoggingType = defaultLoggingType;
},
+ setCustomCss(state, customCss) {
+ state.customCss = customCss;
+ }
},
actions: {
getDatabaseType({ commit, dispatch }) {
@@ -272,6 +276,13 @@ const storeSystemSettings = {
});
},
+ getCustomCss({ dispatch, commit }) {
+ return dispatch('requestGet', '/customcss/').then((r) => {
+ commit('setCustomCss', r);
+ return r;
+ });
+ },
+
purgeData(context) {
return new Promise((resolve, reject) => {
axios
diff --git a/scadalts-ui/src/views/System/SystemSettings/MiscSettingsComponent.vue b/scadalts-ui/src/views/System/SystemSettings/MiscSettingsComponent.vue
index fd3984b033..7e7aedde63 100644
--- a/scadalts-ui/src/views/System/SystemSettings/MiscSettingsComponent.vue
+++ b/scadalts-ui/src/views/System/SystemSettings/MiscSettingsComponent.vue
@@ -116,20 +116,6 @@
@change="watchDataChange()"
>
-
-
-
-
-
-
diff --git a/scadalts-ui/src/views/System/SystemSettings/index.vue b/scadalts-ui/src/views/System/SystemSettings/index.vue
index 5923ca8e28..9ea86bf15b 100644
--- a/scadalts-ui/src/views/System/SystemSettings/index.vue
+++ b/scadalts-ui/src/views/System/SystemSettings/index.vue
@@ -181,6 +181,20 @@
>
+
+
+
+
+
+
@@ -328,11 +342,16 @@ export default {
if (!this.isUserRoleAdmin) {
this.getUserRole();
}
- store.dispatch('getSystemInfoSettings');
+ this.fetchSystemInfoSettings();
this.loadClock();
this.scrollToComponent();
},
+
methods: {
+ async fetchSystemInfoSettings() {
+ await this.$store.dispatch('getSystemInfoSettings');
+ },
+
scrollToComponent() {
let element = window.location.href.split('#')[2];
if (!!element) {
@@ -354,7 +373,7 @@ export default {
i18n.locale = this.systemInfoSettings.language;
this.generateNotification(
'success',
- i18n.t('systemsettings.notification.save.systeminfo'),
+ i18n.t('systemsettings.notification.save.systeminfo')
);
} else {
this.generateNotification('danger', i18n.t('systemsettings.notification.fail'));
diff --git a/scadalts-ui/tests/mocks/store/systemSettings/index.js b/scadalts-ui/tests/mocks/store/systemSettings/index.js
index 4be154e2b2..1dfefbd58a 100644
--- a/scadalts-ui/tests/mocks/store/systemSettings/index.js
+++ b/scadalts-ui/tests/mocks/store/systemSettings/index.js
@@ -13,6 +13,8 @@ const storeSystemSettings = {
instanceDescription: 'Scada-LTS 2.3.3',
language: 'en',
newVersionNotificationLevel: '0',
+ topDescriptionPrefix: '',
+ topDescription: '',
},
emailSettings: {
auth: false,
diff --git a/src/com/serotonin/mango/web/dwr/SystemSettingsDwr.java b/src/com/serotonin/mango/web/dwr/SystemSettingsDwr.java
index 3a04ac6c2f..27d34e91ee 100644
--- a/src/com/serotonin/mango/web/dwr/SystemSettingsDwr.java
+++ b/src/com/serotonin/mango/web/dwr/SystemSettingsDwr.java
@@ -180,9 +180,9 @@ public Map getSettings() {
settings.put(SystemSettingsDAO.EVENT_ASSIGN_ENABLED,
systemSettingsService.getMiscSettings().isEventAssignEnabled());
settings.put(SystemSettingsDAO.TOP_DESCRIPTION,
- systemSettingsService.getMiscSettings().getTopDescription());
+ systemSettingsService.getSystemInfoSettings().getTopDescription());
settings.put(SystemSettingsDAO.TOP_DESCRIPTION_PREFIX,
- systemSettingsService.getMiscSettings().getTopDescriptionPrefix());
+ systemSettingsService.getSystemInfoSettings().getTopDescriptionPrefix());
return settings;
}
diff --git a/src/com/serotonin/mango/web/mvc/interceptor/CommonDataInterceptor.java b/src/com/serotonin/mango/web/mvc/interceptor/CommonDataInterceptor.java
index d855f4dc96..69dfe7fc9e 100644
--- a/src/com/serotonin/mango/web/mvc/interceptor/CommonDataInterceptor.java
+++ b/src/com/serotonin/mango/web/mvc/interceptor/CommonDataInterceptor.java
@@ -20,9 +20,10 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
import org.scada_lts.config.ScadaVersion;
-import org.joda.time.DateTime;
+
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
@@ -36,12 +37,15 @@
public class CommonDataInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
+
request.setAttribute("availableLanguages", Common.getLanguages());
request.setAttribute("lang", Common.getBundle(request).getLocale().getLanguage());
request.setAttribute("instanceDescriptionHeader", SystemSettingsDAO.getValue(SystemSettingsDAO.INSTANCE_DESCRIPTION));
request.setAttribute("NEW_ID", Common.NEW_ID);
request.setAttribute("scadaVersion", ScadaVersion.getInstance());
request.setAttribute("toYear", DateUtils.getCurrentYearInt());
+ request.setAttribute("topDescriptionPrefix", SystemSettingsDAO.getValue(SystemSettingsDAO.TOP_DESCRIPTION_PREFIX));
+ request.setAttribute("topDescription", SystemSettingsDAO.getValue(SystemSettingsDAO.TOP_DESCRIPTION));
return true;
}
diff --git a/src/org/scada_lts/config/ScadaVersion.java b/src/org/scada_lts/config/ScadaVersion.java
index c1012c8831..290da55380 100644
--- a/src/org/scada_lts/config/ScadaVersion.java
+++ b/src/org/scada_lts/config/ScadaVersion.java
@@ -138,10 +138,4 @@ public String getCompanyName() {
public String getPoweredBy() {
return poweredBy;
}
- public String getTopDescription() {
- return SystemSettingsDAO.getValue(TOP_DESCRIPTION);
- }
- public String getTopDescriptionPrefix(){
- return SystemSettingsDAO.getValue(TOP_DESCRIPTION_PREFIX);
- }
}
diff --git a/src/org/scada_lts/mango/service/SystemSettingsService.java b/src/org/scada_lts/mango/service/SystemSettingsService.java
index f52d512819..a1c1e889d9 100644
--- a/src/org/scada_lts/mango/service/SystemSettingsService.java
+++ b/src/org/scada_lts/mango/service/SystemSettingsService.java
@@ -147,8 +147,6 @@ public JsonSettingsMisc getMiscSettings() {
json.setWebResourceGraphicsPath(SystemSettingsDAO.getValue(SystemSettingsDAO.WEB_RESOURCE_GRAPHICS_PATH));
json.setWebResourceUploadsPath(SystemSettingsDAO.getValue(SystemSettingsDAO.WEB_RESOURCE_UPLOADS_PATH));
json.setEventAssignEnabled(SystemSettingsDAO.getBooleanValue(SystemSettingsDAO.EVENT_ASSIGN_ENABLED));
- json.setTopDescription(SystemSettingsDAO.getValue(SystemSettingsDAO.TOP_DESCRIPTION));
- json.setTopDescriptionPrefix(SystemSettingsDAO.getValue(SystemSettingsDAO.TOP_DESCRIPTION_PREFIX));
return json;
}
@@ -166,8 +164,6 @@ public void saveMiscSettings(JsonSettingsMisc json) {
systemSettingsDAO.setValue(SystemSettingsDAO.WEB_RESOURCE_GRAPHICS_PATH, json.getWebResourceGraphicsPath());
systemSettingsDAO.setValue(SystemSettingsDAO.WEB_RESOURCE_UPLOADS_PATH, json.getWebResourceUploadsPath());
saveEventAssignEnabled(json.isEventAssignEnabled());
- systemSettingsDAO.setValue(SystemSettingsDAO.TOP_DESCRIPTION, json.getTopDescription());
- systemSettingsDAO.setValue(SystemSettingsDAO.TOP_DESCRIPTION_PREFIX, json.getTopDescriptionPrefix());
}
public SettingsDataRetention getDataRetentionSettings() {
@@ -237,6 +233,8 @@ public JsonSettingsSystemInfo getSystemInfoSettings() {
json.setNewVersionNotificationLevel(SystemSettingsDAO.getValue(SystemSettingsDAO.NEW_VERSION_NOTIFICATION_LEVEL));
json.setInstanceDescription(SystemSettingsDAO.getValue(SystemSettingsDAO.INSTANCE_DESCRIPTION));
json.setLanguage(SystemSettingsDAO.getValue(SystemSettingsDAO.LANGUAGE));
+ json.setTopDescription(SystemSettingsDAO.getValue(SystemSettingsDAO.TOP_DESCRIPTION));
+ json.setTopDescriptionPrefix(SystemSettingsDAO.getValue(SystemSettingsDAO.TOP_DESCRIPTION_PREFIX));
return json;
}
@@ -244,6 +242,8 @@ public void saveSystemInfoSettings(JsonSettingsSystemInfo json) {
systemSettingsDAO.setValue(SystemSettingsDAO.NEW_VERSION_NOTIFICATION_LEVEL, json.getNewVersionNotificationLevel());
systemSettingsDAO.setValue(SystemSettingsDAO.INSTANCE_DESCRIPTION, json.getInstanceDescription());
systemSettingsDAO.setValue(SystemSettingsDAO.LANGUAGE, json.getLanguage());
+ systemSettingsDAO.setValue(SystemSettingsDAO.TOP_DESCRIPTION, json.getTopDescription());
+ systemSettingsDAO.setValue(SystemSettingsDAO.TOP_DESCRIPTION_PREFIX, json.getTopDescriptionPrefix());
}
public String getDatabaseType() {
diff --git a/src/org/scada_lts/web/mvc/api/json/JsonSettingsMisc.java b/src/org/scada_lts/web/mvc/api/json/JsonSettingsMisc.java
index ac4c33c59d..e82f3a7e06 100644
--- a/src/org/scada_lts/web/mvc/api/json/JsonSettingsMisc.java
+++ b/src/org/scada_lts/web/mvc/api/json/JsonSettingsMisc.java
@@ -17,8 +17,6 @@ public class JsonSettingsMisc implements Serializable {
public String webResourceGraphicsPath;
public String webResourceUploadsPath;
public boolean eventAssignEnabled;
- public String topDescription;
- public String topDescriptionPrefix;
public JsonSettingsMisc() {}
@@ -126,19 +124,4 @@ public void setEventAssignEnabled(boolean eventAssignEnabled) {
this.eventAssignEnabled = eventAssignEnabled;
}
- public String getTopDescription(){
- return topDescription;
- }
-
- public void setTopDescription(String topDescription){
- this.topDescription = topDescription;
- }
-
- public String getTopDescriptionPrefix(){
- return topDescriptionPrefix;
- }
-
- public void setTopDescriptionPrefix(String topDescriptionPrefix){
- this.topDescriptionPrefix = topDescriptionPrefix;
- }
}
diff --git a/src/org/scada_lts/web/mvc/api/json/JsonSettingsSystemInfo.java b/src/org/scada_lts/web/mvc/api/json/JsonSettingsSystemInfo.java
index 9b55baa443..d5a01ffa53 100644
--- a/src/org/scada_lts/web/mvc/api/json/JsonSettingsSystemInfo.java
+++ b/src/org/scada_lts/web/mvc/api/json/JsonSettingsSystemInfo.java
@@ -7,13 +7,17 @@ public class JsonSettingsSystemInfo implements Serializable {
private String newVersionNotificationLevel;
private String instanceDescription;
private String language;
+ private String topDescription;
+ private String topDescriptionPrefix;
public JsonSettingsSystemInfo() {}
- public JsonSettingsSystemInfo(String newVersionNotificationLevel, String instanceDescription, String language) {
+ public JsonSettingsSystemInfo(String newVersionNotificationLevel, String instanceDescription, String language, String topDescriptionPrefix, String topDescription) {
this.newVersionNotificationLevel = newVersionNotificationLevel;
this.instanceDescription = instanceDescription;
this.language = language;
+ this.topDescriptionPrefix = topDescriptionPrefix;
+ this.topDescription = topDescription;
}
public String getNewVersionNotificationLevel() {
@@ -39,4 +43,20 @@ public String getLanguage() {
public void setLanguage(String language) {
this.language = language;
}
+
+ public String getTopDescription(){
+ return topDescription;
+ }
+
+ public void setTopDescription(String topDescription){
+ this.topDescription = topDescription;
+ }
+
+ public String getTopDescriptionPrefix(){
+ return topDescriptionPrefix;
+ }
+
+ public void setTopDescriptionPrefix(String topDescriptionPrefix){
+ this.topDescriptionPrefix = topDescriptionPrefix;
+ }
}