diff --git a/app/src/components/BasicForm.vue b/app/src/components/BasicForm.vue
index e7c5a919..7eb537a6 100644
--- a/app/src/components/BasicForm.vue
+++ b/app/src/components/BasicForm.vue
@@ -4,7 +4,7 @@
-
+
{{ submit ? submit : $t('save') }}
@@ -21,7 +21,8 @@ export default {
props: {
header: { type: String, required: true },
id: { type: String, default: 'ynh-form' },
- submit: { type: String, default: null }
+ submit: { type: String, default: null },
+ noFooter: { type: Boolean, default: false }
}
}
diff --git a/app/src/i18n/locales/en.json b/app/src/i18n/locales/en.json
index 1a7bf9c0..85893c84 100644
--- a/app/src/i18n/locales/en.json
+++ b/app/src/i18n/locales/en.json
@@ -323,6 +323,12 @@
"tools_shutdown_done": "Shutting down...",
"tools_shuttingdown": "Your server is powering off. As long as your server is off, you won't be able to use the web administration.",
"tools_shutdown_reboot": "Shutdown/Reboot",
+ "tools_webadmin": {
+ "locale": "Locale",
+ "fallback_locale": "Fallback locale",
+ "cache": "Cache",
+ "cache_description": "Consider disabling the cache if you plan on working with the CLI while also navigating in this web-admin."
+ },
"tools_webadmin_settings": "Web-admin settings",
"udp": "UDP",
"unauthorized": "Unauthorized",
diff --git a/app/src/router/routes.js b/app/src/router/routes.js
index 13f2ac6c..06878ad2 100644
--- a/app/src/router/routes.js
+++ b/app/src/router/routes.js
@@ -241,6 +241,17 @@ const routes = [
{ name: 'tool-adminpw', trad: 'tools_adminpw' }
]
}
+ },
+ {
+ name: 'tool-webadmin',
+ path: '/tools/webadmin',
+ component: () => import(/* webpackChunkName: "views/tools" */ '@/views/tool/ToolWebadmin'),
+ meta: {
+ breadcrumb: [
+ { name: 'tool-list', trad: 'tools' },
+ { name: 'tool-webadmin', trad: 'tools_webadmin_settings' }
+ ]
+ }
}
]
diff --git a/app/src/store/data.js b/app/src/store/data.js
index 130e945b..03247f5c 100644
--- a/app/src/store/data.js
+++ b/app/src/store/data.js
@@ -85,23 +85,24 @@ export default {
},
actions: {
- 'FETCH' ({ state, commit }, { uri, param, storeKey = uri, force = false }) {
+ 'FETCH' ({ state, commit, rootState }, { uri, param, storeKey = uri, cache = rootState.cache }) {
const currentState = param ? state[storeKey][param] : state[storeKey]
// if data has already been queried, simply return
- if (currentState !== undefined && !force) return currentState
+ if (currentState !== undefined && cache) return currentState
return api.get(param ? `${uri}/${param}` : uri).then(responseData => {
+ console.log('api')
const data = responseData[storeKey] ? responseData[storeKey] : responseData
commit('SET_' + storeKey.toUpperCase(), param ? [param, data] : data)
return param ? state[storeKey][param] : state[storeKey]
})
},
- 'FETCH_ALL' ({ state, commit }, queries) {
- return Promise.all(queries.map(({ uri, param, storeKey = uri, force = false }) => {
+ 'FETCH_ALL' ({ state, commit, rootState }, queries) {
+ return Promise.all(queries.map(({ uri, param, storeKey = uri, cache = rootState.cache }) => {
const currentState = param ? state[storeKey][param] : state[storeKey]
// if data has already been queried, simply return the state as cached
- if (currentState !== undefined && !force) {
+ if (currentState !== undefined && cache) {
return { cached: currentState }
}
return api.get(param ? `${uri}/${param}` : uri).then(responseData => {
diff --git a/app/src/store/index.js b/app/src/store/index.js
index 6a8cf4a8..6f6ac192 100644
--- a/app/src/store/index.js
+++ b/app/src/store/index.js
@@ -8,9 +8,12 @@ import data from './data'
Vue.use(Vuex)
export default new Vuex.Store({
+ state: settings.state,
+ mutations: settings.mutations,
+ actions: settings.actions,
+ getters: settings.getters,
modules: {
info,
- settings,
data
}
})
diff --git a/app/src/store/settings.js b/app/src/store/settings.js
index 77b2b238..9913a31c 100644
--- a/app/src/store/settings.js
+++ b/app/src/store/settings.js
@@ -5,11 +5,14 @@
import i18n from '@/i18n'
import { loadLocaleMessages, updateDocumentLocale, loadDateFnsLocale } from '@/i18n/helpers'
+import supportedLocales from '@/i18n/supportedLocales'
export default {
state: {
locale: localStorage.getItem('locale'),
- fallbackLocale: localStorage.getItem('fallbackLocale')
+ fallbackLocale: localStorage.getItem('fallbackLocale'),
+ cache: localStorage.getItem('cache') !== 'false',
+ supportedLocales: supportedLocales
},
mutations: {
@@ -21,6 +24,11 @@ export default {
'SET_FALLBACK_LOCALE' (state, locale) {
localStorage.setItem('fallbackLocale', locale)
state.fallbackLocale = locale
+ },
+
+ 'SET_CACHE' (state, enable) {
+ localStorage.setItem('cache', enable)
+ state.cache = enable
}
},
@@ -45,6 +53,13 @@ export default {
getters: {
locale: state => (state.locale),
- fallbackLocale: state => (state.fallbackLocale)
+ fallbackLocale: state => (state.fallbackLocale),
+ cache: state => (state.cache),
+
+ availableLocales: state => {
+ return Object.entries(state.supportedLocales).map(([locale, { name }]) => {
+ return { value: locale, text: name }
+ })
+ }
}
}
diff --git a/app/src/views/tool/ToolList.vue b/app/src/views/tool/ToolList.vue
index c7bb18ba..cef5d5ee 100644
--- a/app/src/views/tool/ToolList.vue
+++ b/app/src/views/tool/ToolList.vue
@@ -26,7 +26,7 @@ export default {
{ id: 1, routeName: 'tool-migrations', icon: 'share', translation: 'migrations' },
{ id: 2, routeName: 'tool-firewall', icon: 'shield', translation: 'firewall' },
{ id: 3, routeName: 'tool-adminpw', icon: 'key-modern', translation: 'tools_adminpw' },
- { id: 4, routeName: 'tool-wabadmin', icon: 'cog', translation: 'tools_webadmin_settings' },
+ { id: 4, routeName: 'tool-webadmin', icon: 'cog', translation: 'tools_webadmin_settings' },
{ id: 5, routeName: 'tool-power', icon: 'power-off', translation: 'tools_shutdown_reboot' }
]
}
diff --git a/app/src/views/tool/ToolWebadmin.vue b/app/src/views/tool/ToolWebadmin.vue
new file mode 100644
index 00000000..0f0b6e16
--- /dev/null
+++ b/app/src/views/tool/ToolWebadmin.vue
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $t(currentCache ? 'enabled' : 'disabled') }}
+
+
+
+
+
+