Browse Source

Merge pull request #17390 from nextcloud/refactor/external-initial-state-impl

Use the external initial state implementation
tags/v18.0.0beta1
Roeland Jago Douma 4 years ago
parent
commit
24820e06e5
No account linked to committer's email address
37 changed files with 242 additions and 265 deletions
  1. 4
    4
      apps/oauth2/js/oauth2.js
  2. 1
    1
      apps/oauth2/js/oauth2.js.map
  3. 1
    1
      apps/oauth2/src/main.js
  4. 4
    4
      apps/settings/js/vue-0.js
  5. 1
    1
      apps/settings/js/vue-0.js.map
  6. 2
    2
      apps/settings/js/vue-4.js
  7. 1
    1
      apps/settings/js/vue-4.js.map
  8. 2
    2
      apps/settings/js/vue-5.js
  9. 1
    1
      apps/settings/js/vue-5.js.map
  10. 3
    3
      apps/settings/js/vue-6.js
  11. 1
    1
      apps/settings/js/vue-6.js.map
  12. 19
    19
      apps/settings/js/vue-settings-admin-security.js
  13. 1
    1
      apps/settings/js/vue-settings-admin-security.js.map
  14. 6
    6
      apps/settings/js/vue-settings-apps-users-management.js
  15. 1
    1
      apps/settings/js/vue-settings-apps-users-management.js.map
  16. 48
    48
      apps/settings/js/vue-settings-personal-security.js
  17. 1
    1
      apps/settings/js/vue-settings-personal-security.js.map
  18. 2
    1
      apps/settings/src/main-admin-security.js
  19. 3
    2
      apps/settings/src/main-personal-security.js
  20. 5
    5
      apps/twofactor_backupcodes/js/settings.js
  21. 1
    1
      apps/twofactor_backupcodes/js/settings.js.map
  22. 4
    4
      apps/twofactor_backupcodes/src/settings.js
  23. 15
    15
      apps/workflowengine/js/workflowengine.js
  24. 1
    1
      apps/workflowengine/js/workflowengine.js.map
  25. 3
    1
      apps/workflowengine/src/helpers/api.js
  26. 6
    5
      apps/workflowengine/src/store.js
  27. 18
    18
      core/js/dist/login.js
  28. 1
    1
      core/js/dist/login.js.map
  29. 47
    68
      core/js/dist/main.js
  30. 1
    1
      core/js/dist/main.js.map
  31. 9
    9
      core/js/dist/maintenance.js
  32. 1
    1
      core/js/dist/maintenance.js.map
  33. 7
    2
      core/src/OCP/index.js
  34. 2
    15
      core/src/OCP/initialstate.js
  35. 3
    2
      core/src/login.js
  36. 15
    15
      package-lock.json
  37. 1
    1
      package.json

+ 4
- 4
apps/oauth2/js/oauth2.js
File diff suppressed because it is too large
View File


+ 1
- 1
apps/oauth2/js/oauth2.js.map
File diff suppressed because it is too large
View File


+ 1
- 1
apps/oauth2/src/main.js View File

@@ -22,7 +22,7 @@

import Vue from 'vue'
import App from './App.vue'
import { loadState } from 'nextcloud-initial-state'
import { loadState } from '@nextcloud/initial-state'

Vue.prototype.t = t
Vue.prototype.OC = OC

+ 4
- 4
apps/settings/js/vue-0.js
File diff suppressed because it is too large
View File


+ 1
- 1
apps/settings/js/vue-0.js.map
File diff suppressed because it is too large
View File


+ 2
- 2
apps/settings/js/vue-4.js
File diff suppressed because it is too large
View File


+ 1
- 1
apps/settings/js/vue-4.js.map
File diff suppressed because it is too large
View File


+ 2
- 2
apps/settings/js/vue-5.js
File diff suppressed because it is too large
View File


+ 1
- 1
apps/settings/js/vue-5.js.map
File diff suppressed because it is too large
View File


+ 3
- 3
apps/settings/js/vue-6.js
File diff suppressed because it is too large
View File


+ 1
- 1
apps/settings/js/vue-6.js.map
File diff suppressed because it is too large
View File


+ 19
- 19
apps/settings/js/vue-settings-admin-security.js
File diff suppressed because it is too large
View File


+ 1
- 1
apps/settings/js/vue-settings-admin-security.js.map
File diff suppressed because it is too large
View File


+ 6
- 6
apps/settings/js/vue-settings-apps-users-management.js
File diff suppressed because it is too large
View File


+ 1
- 1
apps/settings/js/vue-settings-apps-users-management.js.map
File diff suppressed because it is too large
View File


+ 48
- 48
apps/settings/js/vue-settings-personal-security.js
File diff suppressed because it is too large
View File


+ 1
- 1
apps/settings/js/vue-settings-personal-security.js.map
File diff suppressed because it is too large
View File


+ 2
- 1
apps/settings/src/main-admin-security.js View File

@@ -1,3 +1,4 @@
import { loadState } from '@nextcloud/initial-state'
import Vue from 'vue'

import AdminTwoFactor from './components/AdminTwoFactor.vue'
@@ -13,7 +14,7 @@ window.OC = window.OC || {}
window.OC.Settings = window.OC.Settings || {}

store.replaceState(
OCP.InitialState.loadState('settings', 'mandatory2FAState')
loadState('settings', 'mandatory2FAState')
)

const View = Vue.extend(AdminTwoFactor)

+ 3
- 2
apps/settings/src/main-personal-security.js View File

@@ -19,6 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import { loadState } from '@nextcloud/initial-state'
import Vue from 'vue'
import VueClipboard from 'vue-clipboard2'
import VTooltip from 'v-tooltip'
@@ -35,7 +36,7 @@ Vue.prototype.t = t
const View = Vue.extend(AuthTokenSection)
new View({
propsData: {
tokens: OCP.InitialState.loadState('settings', 'app_tokens'),
canCreateToken: OCP.InitialState.loadState('settings', 'can_create_app_token')
tokens: loadState('settings', 'app_tokens'),
canCreateToken: loadState('settings', 'can_create_app_token')
}
}).$mount('#security-authtokens')

+ 5
- 5
apps/twofactor_backupcodes/js/settings.js
File diff suppressed because it is too large
View File


+ 1
- 1
apps/twofactor_backupcodes/js/settings.js.map
File diff suppressed because it is too large
View File


+ 4
- 4
apps/twofactor_backupcodes/src/settings.js View File

@@ -1,13 +1,13 @@
import { loadState } from '@nextcloud/initial-state'
import Vue from 'vue'

import PersonalSettings from './views/PersonalSettings'
import store from './store'

Vue.prototype.t = t

const initialState = OCP.InitialState.loadState('twofactor_backupcodes', 'state')
store.replaceState(
initialState
)
const initialState = loadState('twofactor_backupcodes', 'state')
store.replaceState(initialState)

const View = Vue.extend(PersonalSettings)
new View({

+ 15
- 15
apps/workflowengine/js/workflowengine.js
File diff suppressed because it is too large
View File


+ 1
- 1
apps/workflowengine/js/workflowengine.js.map
File diff suppressed because it is too large
View File


+ 3
- 1
apps/workflowengine/src/helpers/api.js View File

@@ -20,8 +20,10 @@
*
*/

import { loadState } from '@nextcloud/initial-state'

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'
}


+ 6
- 5
apps/workflowengine/src/store.js View File

@@ -25,22 +25,23 @@ import Vuex from 'vuex'
import axios from '@nextcloud/axios'
import { getApiUrl } from './helpers/api'
import confirmPassword from 'nextcloud-password-confirmation'
import { loadState } from '@nextcloud/initial-state'

Vue.use(Vuex)

const store = new Vuex.Store({
state: {
rules: [],
scope: OCP.InitialState.loadState('workflowengine', 'scope'),
operations: OCP.InitialState.loadState('workflowengine', 'operators'),
scope: loadState('workflowengine', 'scope'),
operations: loadState('workflowengine', 'operators'),

plugins: Vue.observable({
checks: {},
operators: {}
}),

entities: OCP.InitialState.loadState('workflowengine', 'entities'),
events: OCP.InitialState.loadState('workflowengine', 'entities')
entities: loadState('workflowengine', 'entities'),
events: loadState('workflowengine', 'entities')
.map((entity) => entity.events.map(event => {
return {
id: `${entity.id}::${event.eventName}`,
@@ -48,7 +49,7 @@ const store = new Vuex.Store({
...event
}
})).flat(),
checks: OCP.InitialState.loadState('workflowengine', 'checks')
checks: loadState('workflowengine', 'checks')
},
mutations: {
addRule(state, rule) {

+ 18
- 18
core/js/dist/login.js
File diff suppressed because it is too large
View File


+ 1
- 1
core/js/dist/login.js.map
File diff suppressed because it is too large
View File


+ 47
- 68
core/js/dist/main.js
File diff suppressed because it is too large
View File


+ 1
- 1
core/js/dist/main.js.map
File diff suppressed because it is too large
View File


+ 9
- 9
core/js/dist/maintenance.js
File diff suppressed because it is too large
View File


+ 1
- 1
core/js/dist/maintenance.js.map
File diff suppressed because it is too large
View File


+ 7
- 2
core/src/OCP/index.js View File

@@ -3,8 +3,8 @@
*/
import * as AppConfig from './appconfig'
import * as Comments from './comments'
import * as InitialState from './initialstate'
import Loader from './loader'
import { loadState } from '@nextcloud/initial-state'
import Collaboration from './collaboration'
import Toast from './toast'
import * as WhatsNew from './whatsnew'
@@ -14,7 +14,12 @@ export default {
AppConfig,
Collaboration,
Comments,
InitialState,
InitialState: {
/**
* @deprecated 18.0.0 add https://www.npmjs.com/package/@nextcloud/initial-state to your app
*/
loadState
},
Loader,
Toast,
WhatsNew

+ 2
- 15
core/src/OCP/initialstate.js View File

@@ -24,19 +24,6 @@
* @namespace OCP.InitialState
*/

export function loadState(app, key) {
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)
}
import { loadState as load } from '@nextcloud/initial-state'

try {
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)
}
}
export const loadState = load

+ 3
- 2
core/src/login.js View File

@@ -19,8 +19,9 @@
* 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 Vue from 'vue'

// eslint-disable-next-line no-unused-vars
import OC from './OC/index' // TODO: Not needed but L10n breaks if removed
@@ -42,7 +43,7 @@ Vue.mixin(Nextcloud)

const fromStateOr = (key, orValue) => {
try {
return OCP.InitialState.loadState('core', key)
return loadState('core', key)
} catch (e) {
return orValue
}

+ 15
- 15
package-lock.json View File

@@ -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": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/@nextcloud/paths/-/paths-0.2.0.tgz",
@@ -6200,21 +6215,6 @@
"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": {
"version": "0.4.2",
"resolved": "https://registry.npmjs.org/nextcloud-password-confirmation/-/nextcloud-password-confirmation-0.4.2.tgz",

+ 1
- 1
package.json View File

@@ -27,6 +27,7 @@
"@chenfengyuan/vue-qrcode": "^1.0.1",
"@nextcloud/axios": "^0.4.1",
"@nextcloud/event-bus": "^0.2.1",
"@nextcloud/initial-state": "^0.2.0",
"@nextcloud/paths": "^0.2.0",
"@nextcloud/router": "^0.1.0",
"autosize": "^4.0.2",
@@ -48,7 +49,6 @@
"marked": "^0.7.0",
"moment": "^2.24.0",
"moment-timezone": "^0.5.26",
"nextcloud-initial-state": "0.0.3",
"nextcloud-password-confirmation": "^0.4.2",
"nextcloud-router": "0.0.9",
"nextcloud-vue": "^0.12.3",

Loading…
Cancel
Save