Use the external initial state implementation
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
parent
7f8ff16c76
commit
c2e8821345
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import App from './App.vue'
|
import App from './App.vue'
|
||||||
import { loadState } from 'nextcloud-initial-state'
|
import { loadState } from '@nextcloud/initial-state'
|
||||||
|
|
||||||
Vue.prototype.t = t
|
Vue.prototype.t = t
|
||||||
Vue.prototype.OC = OC
|
Vue.prototype.OC = OC
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,3 +1,4 @@
|
||||||
|
import { loadState } from '@nextcloud/initial-state'
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
|
|
||||||
import AdminTwoFactor from './components/AdminTwoFactor.vue'
|
import AdminTwoFactor from './components/AdminTwoFactor.vue'
|
||||||
|
@ -13,7 +14,7 @@ window.OC = window.OC || {}
|
||||||
window.OC.Settings = window.OC.Settings || {}
|
window.OC.Settings = window.OC.Settings || {}
|
||||||
|
|
||||||
store.replaceState(
|
store.replaceState(
|
||||||
OCP.InitialState.loadState('settings', 'mandatory2FAState')
|
loadState('settings', 'mandatory2FAState')
|
||||||
)
|
)
|
||||||
|
|
||||||
const View = Vue.extend(AdminTwoFactor)
|
const View = Vue.extend(AdminTwoFactor)
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { loadState } from '@nextcloud/initial-state'
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import VueClipboard from 'vue-clipboard2'
|
import VueClipboard from 'vue-clipboard2'
|
||||||
import VTooltip from 'v-tooltip'
|
import VTooltip from 'v-tooltip'
|
||||||
|
@ -35,7 +36,7 @@ Vue.prototype.t = t
|
||||||
const View = Vue.extend(AuthTokenSection)
|
const View = Vue.extend(AuthTokenSection)
|
||||||
new View({
|
new View({
|
||||||
propsData: {
|
propsData: {
|
||||||
tokens: OCP.InitialState.loadState('settings', 'app_tokens'),
|
tokens: loadState('settings', 'app_tokens'),
|
||||||
canCreateToken: OCP.InitialState.loadState('settings', 'can_create_app_token')
|
canCreateToken: loadState('settings', 'can_create_app_token')
|
||||||
}
|
}
|
||||||
}).$mount('#security-authtokens')
|
}).$mount('#security-authtokens')
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,13 +1,13 @@
|
||||||
|
import { loadState } from '@nextcloud/initial-state'
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
|
|
||||||
import PersonalSettings from './views/PersonalSettings'
|
import PersonalSettings from './views/PersonalSettings'
|
||||||
import store from './store'
|
import store from './store'
|
||||||
|
|
||||||
Vue.prototype.t = t
|
Vue.prototype.t = t
|
||||||
|
|
||||||
const initialState = OCP.InitialState.loadState('twofactor_backupcodes', 'state')
|
const initialState = loadState('twofactor_backupcodes', 'state')
|
||||||
store.replaceState(
|
store.replaceState(initialState)
|
||||||
initialState
|
|
||||||
)
|
|
||||||
|
|
||||||
const View = Vue.extend(PersonalSettings)
|
const View = Vue.extend(PersonalSettings)
|
||||||
new View({
|
new View({
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -20,8 +20,10 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { loadState } from '@nextcloud/initial-state'
|
||||||
|
|
||||||
const getApiUrl = (url) => {
|
const getApiUrl = (url) => {
|
||||||
const scopeValue = OCP.InitialState.loadState('workflowengine', 'scope') === 0 ? 'global' : 'user'
|
const scopeValue = loadState('workflowengine', 'scope') === 0 ? 'global' : 'user'
|
||||||
return OC.linkToOCS('apps/workflowengine/api/v1/workflows', 2) + scopeValue + url + '?format=json'
|
return OC.linkToOCS('apps/workflowengine/api/v1/workflows', 2) + scopeValue + url + '?format=json'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,22 +25,23 @@ import Vuex from 'vuex'
|
||||||
import axios from '@nextcloud/axios'
|
import axios from '@nextcloud/axios'
|
||||||
import { getApiUrl } from './helpers/api'
|
import { getApiUrl } from './helpers/api'
|
||||||
import confirmPassword from 'nextcloud-password-confirmation'
|
import confirmPassword from 'nextcloud-password-confirmation'
|
||||||
|
import { loadState } from '@nextcloud/initial-state'
|
||||||
|
|
||||||
Vue.use(Vuex)
|
Vue.use(Vuex)
|
||||||
|
|
||||||
const store = new Vuex.Store({
|
const store = new Vuex.Store({
|
||||||
state: {
|
state: {
|
||||||
rules: [],
|
rules: [],
|
||||||
scope: OCP.InitialState.loadState('workflowengine', 'scope'),
|
scope: loadState('workflowengine', 'scope'),
|
||||||
operations: OCP.InitialState.loadState('workflowengine', 'operators'),
|
operations: loadState('workflowengine', 'operators'),
|
||||||
|
|
||||||
plugins: Vue.observable({
|
plugins: Vue.observable({
|
||||||
checks: {},
|
checks: {},
|
||||||
operators: {}
|
operators: {}
|
||||||
}),
|
}),
|
||||||
|
|
||||||
entities: OCP.InitialState.loadState('workflowengine', 'entities'),
|
entities: loadState('workflowengine', 'entities'),
|
||||||
events: OCP.InitialState.loadState('workflowengine', 'entities')
|
events: loadState('workflowengine', 'entities')
|
||||||
.map((entity) => entity.events.map(event => {
|
.map((entity) => entity.events.map(event => {
|
||||||
return {
|
return {
|
||||||
id: `${entity.id}::${event.eventName}`,
|
id: `${entity.id}::${event.eventName}`,
|
||||||
|
@ -48,7 +49,7 @@ const store = new Vuex.Store({
|
||||||
...event
|
...event
|
||||||
}
|
}
|
||||||
})).flat(),
|
})).flat(),
|
||||||
checks: OCP.InitialState.loadState('workflowengine', 'checks')
|
checks: loadState('workflowengine', 'checks')
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
addRule(state, rule) {
|
addRule(state, rule) {
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -3,8 +3,8 @@
|
||||||
*/
|
*/
|
||||||
import * as AppConfig from './appconfig'
|
import * as AppConfig from './appconfig'
|
||||||
import * as Comments from './comments'
|
import * as Comments from './comments'
|
||||||
import * as InitialState from './initialstate'
|
|
||||||
import Loader from './loader'
|
import Loader from './loader'
|
||||||
|
import { loadState } from '@nextcloud/initial-state'
|
||||||
import Collaboration from './collaboration'
|
import Collaboration from './collaboration'
|
||||||
import Toast from './toast'
|
import Toast from './toast'
|
||||||
import * as WhatsNew from './whatsnew'
|
import * as WhatsNew from './whatsnew'
|
||||||
|
@ -14,7 +14,12 @@ export default {
|
||||||
AppConfig,
|
AppConfig,
|
||||||
Collaboration,
|
Collaboration,
|
||||||
Comments,
|
Comments,
|
||||||
InitialState,
|
InitialState: {
|
||||||
|
/**
|
||||||
|
* @deprecated 18.0.0 add https://www.npmjs.com/package/@nextcloud/initial-state to your app
|
||||||
|
*/
|
||||||
|
loadState
|
||||||
|
},
|
||||||
Loader,
|
Loader,
|
||||||
Toast,
|
Toast,
|
||||||
WhatsNew
|
WhatsNew
|
||||||
|
|
|
@ -24,19 +24,6 @@
|
||||||
* @namespace OCP.InitialState
|
* @namespace OCP.InitialState
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export function loadState(app, key) {
|
import { loadState as load } from '@nextcloud/initial-state'
|
||||||
const elem = document.querySelector(`#initial-state-${app}-${key}`)
|
|
||||||
if (elem === null) {
|
|
||||||
const msg = `Could not find initial state ${key} of ${app}`
|
|
||||||
console.debug(msg)
|
|
||||||
throw new Error(msg)
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
export const loadState = load
|
||||||
return JSON.parse(atob(elem.value))
|
|
||||||
} catch (e) {
|
|
||||||
const msg = `Could not parse initial state ${key} of ${app}`
|
|
||||||
console.debug(msg)
|
|
||||||
throw new Error(msg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -19,8 +19,9 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import Vue from 'vue'
|
import { loadState } from '@nextcloud/initial-state'
|
||||||
import queryString from 'query-string'
|
import queryString from 'query-string'
|
||||||
|
import Vue from 'vue'
|
||||||
|
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
import OC from './OC/index' // TODO: Not needed but L10n breaks if removed
|
import OC from './OC/index' // TODO: Not needed but L10n breaks if removed
|
||||||
|
@ -42,7 +43,7 @@ Vue.mixin(Nextcloud)
|
||||||
|
|
||||||
const fromStateOr = (key, orValue) => {
|
const fromStateOr = (key, orValue) => {
|
||||||
try {
|
try {
|
||||||
return OCP.InitialState.loadState('core', key)
|
return loadState('core', key)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return orValue
|
return orValue
|
||||||
}
|
}
|
||||||
|
|
|
@ -866,6 +866,21 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@nextcloud/initial-state": {
|
||||||
|
"version": "0.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@nextcloud/initial-state/-/initial-state-0.2.0.tgz",
|
||||||
|
"integrity": "sha512-aFkEXxEchawyn1HWn/nStX25324/4+RcOHiHJ1gW/vVH6bPRW8suj9V1Rsi380mMRM7sjkICyeNPxOZ8f+WZrA==",
|
||||||
|
"requires": {
|
||||||
|
"core-js": "3.1.4"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"core-js": {
|
||||||
|
"version": "3.1.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.1.4.tgz",
|
||||||
|
"integrity": "sha512-YNZN8lt82XIMLnLirj9MhKDFZHalwzzrL9YLt6eb0T5D0EDl4IQ90IGkua8mHbnxNrkj1d8hbdizMc0Qmg1WnQ=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"@nextcloud/paths": {
|
"@nextcloud/paths": {
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@nextcloud/paths/-/paths-0.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/@nextcloud/paths/-/paths-0.2.0.tgz",
|
||||||
|
@ -6200,21 +6215,6 @@
|
||||||
"axios": "^0.19.0"
|
"axios": "^0.19.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nextcloud-initial-state": {
|
|
||||||
"version": "0.0.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/nextcloud-initial-state/-/nextcloud-initial-state-0.0.3.tgz",
|
|
||||||
"integrity": "sha512-sL0dKbOb63QwvkAfQdDC5AldshVwaY8B8tKpAci7UMmJV3M1KLxTBzQoY+CVy03/uqTvvFt3Brz/Bd2UNp3zsQ==",
|
|
||||||
"requires": {
|
|
||||||
"core-js": "^3.1.4"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"core-js": {
|
|
||||||
"version": "3.2.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.2.1.tgz",
|
|
||||||
"integrity": "sha512-Qa5XSVefSVPRxy2XfUC13WbvqkxhkwB3ve+pgCQveNgYzbM/UxZeu1dcOX/xr4UmfUd+muuvsaxilQzCyUurMw=="
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nextcloud-password-confirmation": {
|
"nextcloud-password-confirmation": {
|
||||||
"version": "0.4.2",
|
"version": "0.4.2",
|
||||||
"resolved": "https://registry.npmjs.org/nextcloud-password-confirmation/-/nextcloud-password-confirmation-0.4.2.tgz",
|
"resolved": "https://registry.npmjs.org/nextcloud-password-confirmation/-/nextcloud-password-confirmation-0.4.2.tgz",
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
"@chenfengyuan/vue-qrcode": "^1.0.1",
|
"@chenfengyuan/vue-qrcode": "^1.0.1",
|
||||||
"@nextcloud/axios": "^0.4.1",
|
"@nextcloud/axios": "^0.4.1",
|
||||||
"@nextcloud/event-bus": "^0.2.1",
|
"@nextcloud/event-bus": "^0.2.1",
|
||||||
|
"@nextcloud/initial-state": "^0.2.0",
|
||||||
"@nextcloud/paths": "^0.2.0",
|
"@nextcloud/paths": "^0.2.0",
|
||||||
"@nextcloud/router": "^0.1.0",
|
"@nextcloud/router": "^0.1.0",
|
||||||
"autosize": "^4.0.2",
|
"autosize": "^4.0.2",
|
||||||
|
@ -48,7 +49,6 @@
|
||||||
"marked": "^0.7.0",
|
"marked": "^0.7.0",
|
||||||
"moment": "^2.24.0",
|
"moment": "^2.24.0",
|
||||||
"moment-timezone": "^0.5.26",
|
"moment-timezone": "^0.5.26",
|
||||||
"nextcloud-initial-state": "0.0.3",
|
|
||||||
"nextcloud-password-confirmation": "^0.4.2",
|
"nextcloud-password-confirmation": "^0.4.2",
|
||||||
"nextcloud-router": "0.0.9",
|
"nextcloud-router": "0.0.9",
|
||||||
"nextcloud-vue": "^0.12.3",
|
"nextcloud-vue": "^0.12.3",
|
||||||
|
|
Loading…
Reference in New Issue