@rancher/shell 0.3.4 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. package/assets/styles/app.scss +1 -1
  2. package/assets/styles/fonts/_fontstack.scss +11 -11
  3. package/assets/styles/vendor/vue-js-modal.scss +3 -3
  4. package/assets/translations/en-us.yaml +92 -22
  5. package/assets/translations/zh-hans.yaml +84 -15
  6. package/babel.config.js +13 -0
  7. package/chart/gatekeeper.vue +77 -0
  8. package/chart/istio.vue +108 -111
  9. package/chart/logging/index.vue +13 -4
  10. package/chart/monitoring/index.vue +15 -5
  11. package/chart/monitoring/steps/uninstall-v1.vue +2 -2
  12. package/chart/rancher-backup/index.vue +10 -3
  13. package/cloud-credential/aws.vue +1 -1
  14. package/cloud-credential/digitalocean.vue +1 -1
  15. package/cloud-credential/gcp.vue +1 -1
  16. package/cloud-credential/generic.vue +2 -2
  17. package/cloud-credential/linode.vue +1 -1
  18. package/cloud-credential/pnap.vue +1 -1
  19. package/components/ActionMenu.vue +3 -4
  20. package/components/AssignTo.vue +1 -1
  21. package/components/AsyncButton.vue +1 -1
  22. package/components/BannerGraphic.vue +1 -1
  23. package/components/ButtonDropdown.vue +2 -3
  24. package/components/ChartPsp.vue +76 -0
  25. package/components/CruResource.vue +6 -2
  26. package/components/DashboardMetrics.vue +12 -10
  27. package/components/DetailText.vue +1 -1
  28. package/components/DisableAuthProviderModal.vue +1 -1
  29. package/components/EmberPage.vue +1 -1
  30. package/components/EtcdInfoBanner.vue +5 -4
  31. package/components/ExplorerMembers.vue +1 -1
  32. package/components/ExplorerProjectsNamespaces.vue +14 -1
  33. package/components/FileDiff.vue +6 -7
  34. package/components/GrafanaDashboard.vue +18 -21
  35. package/components/LazyImage.vue +10 -12
  36. package/components/LogItem.vue +1 -1
  37. package/components/Markdown.vue +1 -1
  38. package/components/PromptRemove.vue +2 -2
  39. package/components/PromptRestore.vue +1 -1
  40. package/components/ResourceDetail/Masthead.vue +16 -0
  41. package/components/ResourceDetail/index.vue +21 -4
  42. package/components/ResourceList/index.vue +1 -1
  43. package/components/ResourceTable.vue +4 -1
  44. package/components/SingleClusterInfo.vue +2 -2
  45. package/components/SortableTable/THead.vue +1 -1
  46. package/components/SortableTable/index.vue +5 -2
  47. package/components/__tests__/AsyncButton.test.ts +3 -1
  48. package/components/__tests__/ChartPsp.test.ts +75 -0
  49. package/components/__tests__/CruResource.test.ts +3 -1
  50. package/components/auth/Principal.vue +1 -1
  51. package/components/fleet/FleetBundles.vue +3 -1
  52. package/components/fleet/FleetClusters.vue +1 -2
  53. package/components/fleet/FleetIntro.vue +9 -1
  54. package/components/fleet/FleetNoWorkspaces.vue +62 -0
  55. package/components/fleet/FleetSummary.vue +7 -1
  56. package/components/form/LabeledSelect.vue +14 -11
  57. package/components/form/MatchExpressions.vue +17 -2
  58. package/components/form/NameNsDescription.vue +31 -45
  59. package/components/form/ResourceSelector.vue +1 -1
  60. package/components/form/SecretSelector.vue +5 -1
  61. package/components/form/ServiceNameSelect.vue +1 -1
  62. package/components/form/SimpleSecretSelector.vue +9 -9
  63. package/components/form/__tests__/LabeledSelect.test.ts +138 -0
  64. package/components/form/__tests__/NameNsDescription.ts +32 -0
  65. package/components/formatter/InternalExternalIP.vue +6 -0
  66. package/components/formatter/InvolvedObjectLink.vue +54 -0
  67. package/components/formatter/Link.vue +20 -4
  68. package/components/formatter/LinkName.vue +6 -1
  69. package/components/formatter/ServiceTargets.vue +1 -1
  70. package/components/nav/Group.vue +2 -2
  71. package/components/nav/NamespaceFilter.vue +15 -11
  72. package/components/nav/TopLevelMenu.vue +2 -4
  73. package/components/nav/Type.vue +1 -1
  74. package/components/nav/WorkspaceSwitcher.vue +46 -5
  75. package/config/labels-annotations.js +17 -0
  76. package/config/product/auth.js +3 -2
  77. package/config/product/explorer.js +11 -4
  78. package/config/product/fleet.js +2 -0
  79. package/config/router.js +414 -0
  80. package/config/table-headers.js +10 -2
  81. package/config/types.js +11 -8
  82. package/config/uiplugins.js +30 -0
  83. package/content/docs/en-us/whats-new.md +10 -0
  84. package/content/docs/zh-hans/whats-new.md +11 -1
  85. package/core/plugin-routes.ts +23 -0
  86. package/creators/app/app.package.json +2 -1
  87. package/creators/app/files/.eslintrc.js +1 -1
  88. package/creators/app/files/babel.config.js +1 -18
  89. package/creators/app/files/vue.config.js +7 -0
  90. package/creators/app/init +5 -5
  91. package/creators/pkg/files/.github/workflows/build-extension.yml +111 -0
  92. package/creators/pkg/init +35 -4
  93. package/creators/update/init +1 -1
  94. package/detail/constraints.gatekeeper.sh.constraint.vue +20 -10
  95. package/detail/fleet.cattle.io.gitrepo.vue +19 -11
  96. package/detail/harvesterhci.io.management.cluster.vue +3 -3
  97. package/detail/provisioning.cattle.io.cluster.vue +54 -12
  98. package/detail/workload/index.vue +3 -3
  99. package/dialog/AddClusterMemberDialog.vue +1 -1
  100. package/dialog/AddProjectMemberDialog.vue +2 -2
  101. package/dialog/AddonConfigConfirmationDialog.vue +27 -15
  102. package/dialog/DiagnosticTimingsDialog.vue +1 -1
  103. package/dialog/ForceMachineRemoveDialog.vue +1 -1
  104. package/dialog/GenericPrompt.vue +18 -6
  105. package/dialog/RotateEncryptionKeyDialog.vue +1 -1
  106. package/dialog/SaveAsRKETemplateDialog.vue +1 -1
  107. package/dialog/ScaleMachineDownDialog.vue +1 -1
  108. package/edit/auth/github.vue +8 -8
  109. package/edit/auth/googleoauth.vue +5 -5
  110. package/edit/auth/ldap/index.vue +1 -1
  111. package/edit/auth/oidc.vue +1 -1
  112. package/edit/auth/saml.vue +1 -1
  113. package/edit/cis.cattle.io.clusterscan.vue +1 -1
  114. package/edit/fleet.cattle.io.clustergroup.vue +6 -4
  115. package/edit/fleet.cattle.io.gitrepo.vue +16 -3
  116. package/edit/helm.cattle.io.projecthelmchart.vue +5 -1
  117. package/edit/management.cattle.io.fleetworkspace.vue +141 -6
  118. package/edit/management.cattle.io.podsecurityadmissionconfigurationtemplate.vue +4 -1
  119. package/edit/management.cattle.io.setting.vue +1 -1
  120. package/edit/monitoring.coreos.com.alertmanagerconfig/types/webhook.vue +2 -2
  121. package/edit/monitoring.coreos.com.receiver/tls.vue +18 -18
  122. package/edit/monitoring.coreos.com.receiver/types/webhook.banner.vue +4 -4
  123. package/edit/monitoring.coreos.com.receiver/types/webhook.vue +1 -1
  124. package/edit/namespace.vue +2 -2
  125. package/edit/networking.k8s.io.networkpolicy/PolicyRuleTarget.vue +126 -45
  126. package/edit/networking.k8s.io.networkpolicy/index.vue +1 -1
  127. package/edit/provisioning.cattle.io.cluster/MachinePool.vue +10 -0
  128. package/edit/provisioning.cattle.io.cluster/RegistryConfigs.vue +1 -0
  129. package/edit/provisioning.cattle.io.cluster/__tests__/rke2.test.ts +202 -2
  130. package/edit/provisioning.cattle.io.cluster/rke2.vue +248 -84
  131. package/edit/resources.cattle.io.backup.vue +1 -1
  132. package/edit/service.vue +1 -1
  133. package/edit/storage.k8s.io.storageclass/provisioners/driver.harvesterhci.io.vue +2 -2
  134. package/edit/workload/__tests__/Job.test.ts +3 -1
  135. package/edit/workload/index.vue +8 -3
  136. package/edit/workload/mixins/workload.js +16 -0
  137. package/layouts/default.vue +7 -3
  138. package/list/fleet.cattle.io.bundle.vue +6 -3
  139. package/list/fleet.cattle.io.clusterregistrationtoken.vue +3 -1
  140. package/list/fleet.cattle.io.gitrepo.vue +44 -5
  141. package/list/management.cattle.io.fleetworkspace.vue +45 -0
  142. package/list/node.vue +69 -16
  143. package/list/provisioning.cattle.io.cluster.vue +30 -1
  144. package/machine-config/azure.vue +97 -38
  145. package/middleware/authenticated.js +34 -0
  146. package/mixins/chart.js +73 -2
  147. package/mixins/resource-fetch.js +2 -2
  148. package/models/apps.statefulset.js +28 -0
  149. package/models/cluster/node.js +23 -2
  150. package/models/cluster.x-k8s.io.machine.js +4 -2
  151. package/models/clusterroletemplatebinding.js +7 -0
  152. package/models/constraints.gatekeeper.sh.constraint.js +9 -0
  153. package/models/fleet.cattle.io.cluster.js +19 -10
  154. package/models/fleet.cattle.io.gitrepo.js +7 -2
  155. package/models/management.cattle.io.cluster.js +1 -1
  156. package/models/management.cattle.io.fleetworkspace.js +12 -0
  157. package/models/management.cattle.io.gitreporestriction.js +5 -0
  158. package/models/management.cattle.io.podsecurityadmissionconfigurationtemplate.js +3 -0
  159. package/models/provisioning.cattle.io.cluster.js +7 -5
  160. package/nuxt/App.js +210 -0
  161. package/nuxt/axios.js +186 -0
  162. package/nuxt/client.js +817 -0
  163. package/nuxt/components/nuxt-build-indicator.vue +143 -0
  164. package/nuxt/components/nuxt-child.js +122 -0
  165. package/nuxt/components/nuxt-error.vue +98 -0
  166. package/nuxt/components/nuxt-link.client.js +98 -0
  167. package/nuxt/components/nuxt-link.server.js +16 -0
  168. package/nuxt/components/nuxt-loading.vue +154 -0
  169. package/nuxt/components/nuxt.js +101 -0
  170. package/nuxt/cookie-universal-nuxt.js +9 -0
  171. package/nuxt/empty.js +1 -0
  172. package/nuxt/index.js +365 -0
  173. package/nuxt/jsonp.js +82 -0
  174. package/nuxt/loading.html +39 -0
  175. package/nuxt/middleware.js +12 -0
  176. package/nuxt/mixins/fetch.client.js +90 -0
  177. package/nuxt/mixins/fetch.server.js +69 -0
  178. package/nuxt/portal-vue.js +4 -0
  179. package/nuxt/server.js +312 -0
  180. package/nuxt/store.js +178 -0
  181. package/nuxt/utils.js +630 -0
  182. package/nuxt/views/app.template.html +9 -0
  183. package/nuxt/views/error.html +23 -0
  184. package/package.json +5 -9
  185. package/pages/auth/setup.vue +2 -2
  186. package/pages/c/_cluster/apps/charts/__tests__/install.helper.test.ts +33 -0
  187. package/pages/c/_cluster/apps/charts/chart.vue +4 -4
  188. package/pages/c/_cluster/apps/charts/install.helpers.js +26 -0
  189. package/pages/c/_cluster/apps/charts/install.vue +40 -66
  190. package/pages/c/_cluster/explorer/EventsTable.vue +5 -19
  191. package/pages/c/_cluster/explorer/index.vue +29 -25
  192. package/pages/c/_cluster/explorer/tools/index.vue +8 -8
  193. package/pages/c/_cluster/fleet/index.vue +95 -34
  194. package/pages/c/_cluster/gatekeeper/index.vue +1 -1
  195. package/pages/c/_cluster/istio/index.vue +5 -5
  196. package/pages/c/_cluster/manager/cloudCredential/index.vue +1 -1
  197. package/pages/c/_cluster/monitoring/index.vue +7 -0
  198. package/pages/c/_cluster/uiplugins/InstallDialog.vue +8 -8
  199. package/pages/c/_cluster/uiplugins/PluginInfoPanel.vue +20 -7
  200. package/pages/c/_cluster/uiplugins/index.vue +49 -17
  201. package/pages/home.vue +9 -4
  202. package/pages/index.vue +10 -1
  203. package/plugins/clean-html-directive.js +31 -0
  204. package/plugins/dashboard-store/actions.js +32 -9
  205. package/plugins/dashboard-store/mutations.js +5 -2
  206. package/plugins/dashboard-store/resource-class.js +8 -1
  207. package/plugins/steve/mutations.js +3 -2
  208. package/plugins/steve/steve-description-class.js +5 -1
  209. package/plugins/steve/subscribe.js +63 -54
  210. package/plugins/steve-create-worker.js +14 -0
  211. package/promptRemove/management.cattle.io.globalrole.vue +2 -2
  212. package/promptRemove/management.cattle.io.project.vue +2 -2
  213. package/promptRemove/management.cattle.io.roletemplate.vue +2 -2
  214. package/promptRemove/pod.vue +1 -1
  215. package/public/index.html +65 -0
  216. package/rancher-components/components/Banner/Banner.test.ts +9 -1
  217. package/rancher-components/components/Banner/Banner.vue +1 -1
  218. package/rancher-components/components/Form/Checkbox/Checkbox.vue +2 -0
  219. package/rancher-components/components/Form/Radio/RadioButton.vue +1 -1
  220. package/scripts/build-pkg.sh +1 -0
  221. package/scripts/clean +6 -0
  222. package/scripts/extension/bundle +58 -0
  223. package/scripts/extension/helmpatch +89 -0
  224. package/scripts/extension/publish +314 -0
  225. package/scripts/test-plugins-build.sh +4 -0
  226. package/store/__tests__/index.test.ts +110 -0
  227. package/store/index.js +145 -58
  228. package/store/type-map.js +5 -1
  229. package/tsconfig.default.json +36 -0
  230. package/tsconfig.json +24 -0
  231. package/types/shell/index.d.ts +420 -343
  232. package/utils/__tests__/string.test.ts +12 -0
  233. package/utils/auth.js +65 -0
  234. package/utils/monitoring.js +2 -1
  235. package/utils/position.js +5 -8
  236. package/utils/router.scrollBehavior.js +80 -0
  237. package/utils/select.js +1 -3
  238. package/utils/socket.js +1 -0
  239. package/utils/string.js +13 -0
  240. package/utils/time.js +9 -0
  241. package/vue.config.js +679 -0
  242. package/chart/rancher-alerting-drivers.vue +0 -53
  243. package/chart/rancher-gatekeeper.vue +0 -37
  244. package/creators/app/files/nuxt.config.js +0 -6
  245. package/models/management.cattle.io.podsecurityadmissionconfigurationtemplate.ts +0 -4
  246. package/nuxt.config.js +0 -798
@@ -0,0 +1,101 @@
1
+ import Vue from 'vue'
2
+ import { compile } from '../utils'
3
+
4
+ import NuxtError from '../../layouts/error.vue'
5
+
6
+ import NuxtChild from './nuxt-child'
7
+
8
+ export default {
9
+ name: 'Nuxt',
10
+ components: {
11
+ NuxtChild,
12
+ NuxtError
13
+ },
14
+ props: {
15
+ nuxtChildKey: {
16
+ type: String,
17
+ default: undefined
18
+ },
19
+ keepAlive: Boolean,
20
+ keepAliveProps: {
21
+ type: Object,
22
+ default: undefined
23
+ },
24
+ name: {
25
+ type: String,
26
+ default: 'default'
27
+ }
28
+ },
29
+ errorCaptured (error) {
30
+ // if we receive and error while showing the NuxtError component
31
+ // capture the error and force an immediate update so we re-render
32
+ // without the NuxtError component
33
+ if (this.displayingNuxtError) {
34
+ this.errorFromNuxtError = error
35
+ this.$forceUpdate()
36
+ }
37
+ },
38
+ computed: {
39
+ routerViewKey () {
40
+ // If nuxtChildKey prop is given or current route has children
41
+ if (typeof this.nuxtChildKey !== 'undefined' || this.$route.matched.length > 1) {
42
+ return this.nuxtChildKey || compile(this.$route.matched[0].path)(this.$route.params)
43
+ }
44
+
45
+ const [matchedRoute] = this.$route.matched
46
+
47
+ if (!matchedRoute) {
48
+ return this.$route.path
49
+ }
50
+
51
+ const Component = matchedRoute.components.default
52
+
53
+ if (Component && Component.options) {
54
+ const { options } = Component
55
+
56
+ if (options.key) {
57
+ return (typeof options.key === 'function' ? options.key(this.$route) : options.key)
58
+ }
59
+ }
60
+
61
+ const strict = /\/$/.test(matchedRoute.path)
62
+ return strict ? this.$route.path : this.$route.path.replace(/\/$/, '')
63
+ }
64
+ },
65
+ beforeCreate () {
66
+ Vue.util.defineReactive(this, 'nuxt', this.$root.$options.nuxt)
67
+ },
68
+ render (h) {
69
+ // if there is no error
70
+ if (!this.nuxt.err) {
71
+ // Directly return nuxt child
72
+ return h('NuxtChild', {
73
+ key: this.routerViewKey,
74
+ props: this.$props
75
+ })
76
+ }
77
+
78
+ // if an error occurred within NuxtError show a simple
79
+ // error message instead to prevent looping
80
+ if (this.errorFromNuxtError) {
81
+ this.$nextTick(() => (this.errorFromNuxtError = false))
82
+
83
+ return h('div', {}, [
84
+ h('h2', 'An error occurred while showing the error page'),
85
+ h('p', 'Unfortunately an error occurred and while showing the error page another error occurred'),
86
+ h('p', `Error details: ${this.errorFromNuxtError.toString()}`),
87
+ h('nuxt-link', { props: { to: '/' } }, 'Go back to home')
88
+ ])
89
+ }
90
+
91
+ // track if we are showing the NuxtError component
92
+ this.displayingNuxtError = true
93
+ this.$nextTick(() => (this.displayingNuxtError = false))
94
+
95
+ return h(NuxtError, {
96
+ props: {
97
+ error: this.nuxt.err
98
+ }
99
+ })
100
+ }
101
+ }
@@ -0,0 +1,9 @@
1
+ import cookieUniversal from 'cookie-universal'
2
+
3
+ export default ({ req, res }, inject) => {
4
+ const options = {
5
+ "alias": "cookies",
6
+ "parseJSON": true
7
+ }
8
+ inject(options.alias, cookieUniversal(req, res, options.parseJSON))
9
+ }
package/nuxt/empty.js ADDED
@@ -0,0 +1 @@
1
+ // This file is intentionally left empty for noop aliases
package/nuxt/index.js ADDED
@@ -0,0 +1,365 @@
1
+ import Vue from 'vue';
2
+ import Vuex from 'vuex';
3
+ import Meta from 'vue-meta';
4
+ import ClientOnly from 'vue-client-only';
5
+ import NoSsr from 'vue-no-ssr';
6
+ import { createRouter } from '../config/router.js';
7
+ import NuxtChild from './components/nuxt-child.js';
8
+ import NuxtError from '../layouts/error.vue';
9
+ import Nuxt from './components/nuxt.js';
10
+ import App from './App.js';
11
+ import { setContext, getLocation, getRouteData, normalizeError } from './utils';
12
+ import { createStore } from './store.js';
13
+
14
+ /* Plugins */
15
+
16
+ import './portal-vue.js';
17
+ import cookieUniversalNuxt from './cookie-universal-nuxt.js';
18
+ import axios from './axios.js';
19
+ import plugins from '../core/plugins.js';
20
+ import pluginsLoader from '../core/plugins-loader.js';
21
+ import axiosShell from '../plugins/axios';
22
+ import '../plugins/tooltip';
23
+ import '../plugins/vue-clipboard2';
24
+ import '../plugins/v-select';
25
+ import '../plugins/directives';
26
+ import '../plugins/clean-html-directive';
27
+ import '../plugins/transitions';
28
+ import '../plugins/vue-js-modal';
29
+ import '../plugins/js-yaml';
30
+ import '../plugins/resize';
31
+ import '../plugins/shortkey';
32
+ import '../plugins/i18n';
33
+ import '../plugins/global-formatters';
34
+ import '../plugins/trim-whitespace';
35
+ import '../plugins/extend-router';
36
+
37
+ import consolePlugin from '../plugins/console';
38
+ import intNumber from '../plugins/int-number';
39
+ import nuxtClientInit from '../plugins/nuxt-client-init';
40
+ import replaceAll from '../plugins/replaceall';
41
+ import backButton from '../plugins/back-button';
42
+ import plugin from '../plugins/plugin';
43
+ import codeMirror from '../plugins/codemirror-loader';
44
+ import '../plugins/formatters';
45
+ import version from '../plugins/version';
46
+ import steveCreateWorker from '../plugins/steve-create-worker';
47
+
48
+ // Component: <ClientOnly>
49
+ Vue.component(ClientOnly.name, ClientOnly);
50
+
51
+ // TODO: Remove in Nuxt 3: <NoSsr>
52
+ Vue.component(NoSsr.name, {
53
+ ...NoSsr,
54
+ render(h, ctx) {
55
+ if (process.client && !NoSsr._warned) {
56
+ NoSsr._warned = true;
57
+
58
+ console.warn('<no-ssr> has been deprecated and will be removed in Nuxt 3, please use <client-only> instead');
59
+ }
60
+
61
+ return NoSsr.render(h, ctx);
62
+ }
63
+ });
64
+
65
+ // Component: <NuxtChild>
66
+ Vue.component(NuxtChild.name, NuxtChild);
67
+ Vue.component('NChild', NuxtChild);
68
+
69
+ // Component NuxtLink is imported in server.js or client.js
70
+
71
+ // Component: <Nuxt>
72
+ Vue.component(Nuxt.name, Nuxt);
73
+
74
+ Object.defineProperty(Vue.prototype, '$nuxt', {
75
+ get() {
76
+ const globalNuxt = this.$root.$options.$nuxt;
77
+
78
+ if (process.client && !globalNuxt && typeof window !== 'undefined') {
79
+ return window.$nuxt;
80
+ }
81
+
82
+ return globalNuxt;
83
+ },
84
+ configurable: true
85
+ });
86
+
87
+ Vue.use(Meta, {
88
+ keyName: 'head', attribute: 'data-n-head', ssrAttribute: 'data-n-head-ssr', tagIDKeyName: 'hid'
89
+ });
90
+
91
+ const defaultTransition = {
92
+ name: 'page', mode: 'out-in', appear: true, appearClass: 'appear', appearActiveClass: 'appear-active', appearToClass: 'appear-to'
93
+ };
94
+
95
+ const originalRegisterModule = Vuex.Store.prototype.registerModule;
96
+
97
+ function registerModule(path, rawModule, options = {}) {
98
+ const preserveState = process.client && (
99
+ Array.isArray(path) ? !!path.reduce((namespacedState, path) => namespacedState && namespacedState[path], this.state) : path in this.state
100
+ );
101
+
102
+ return originalRegisterModule.call(this, path, rawModule, { preserveState, ...options });
103
+ }
104
+
105
+ async function createApp(ssrContext, config = {}) {
106
+ const router = await createRouter(ssrContext, config);
107
+
108
+ const store = createStore(ssrContext);
109
+
110
+ // Add this.$router into store actions/mutations
111
+ store.$router = router;
112
+
113
+ // Create Root instance
114
+
115
+ // here we inject the router and store to all child components,
116
+ // making them available everywhere as `this.$router` and `this.$store`.
117
+ const app = {
118
+ head: {"title":"dashboard","meta":[{"charset":"utf-8"},{"name":"viewport","content":"width=device-width, initial-scale=1"},{"hid":"description","name":"description","content":"Rancher Dashboard"}],"link":[{"hid":"icon","rel":"icon","type":"image\u002Fx-icon","href":"\u002Ffavicon.png"}],"style":[],"script":[]},
119
+
120
+ store,
121
+ router,
122
+ nuxt: {
123
+ defaultTransition,
124
+ transitions: [defaultTransition],
125
+ setTransitions(transitions) {
126
+ if (!Array.isArray(transitions)) {
127
+ transitions = [transitions];
128
+ }
129
+ transitions = transitions.map((transition) => {
130
+ if (!transition) {
131
+ transition = defaultTransition;
132
+ } else if (typeof transition === 'string') {
133
+ transition = Object.assign({}, defaultTransition, { name: transition });
134
+ } else {
135
+ transition = Object.assign({}, defaultTransition, transition);
136
+ }
137
+
138
+ return transition;
139
+ });
140
+ this.$options.nuxt.transitions = transitions;
141
+
142
+ return transitions;
143
+ },
144
+
145
+ err: null,
146
+ dateErr: null,
147
+ error(err) {
148
+ err = err || null;
149
+ app.context._errored = Boolean(err);
150
+ err = err ? normalizeError(err) : null;
151
+ let nuxt = app.nuxt; // to work with @vue/composition-api, see https://github.com/nuxt/nuxt.js/issues/6517#issuecomment-573280207
152
+
153
+ if (this) {
154
+ nuxt = this.nuxt || this.$options.nuxt;
155
+ }
156
+ nuxt.dateErr = Date.now();
157
+ nuxt.err = err;
158
+ // Used in src/server.js
159
+ if (ssrContext) {
160
+ ssrContext.nuxt.error = err;
161
+ }
162
+
163
+ return err;
164
+ }
165
+ },
166
+ ...App
167
+ };
168
+
169
+ // Make app available into store via this.app
170
+ store.app = app;
171
+
172
+ const next = ssrContext ? ssrContext.next : location => app.router.push(location);
173
+ // Resolve route
174
+ let route;
175
+
176
+ if (ssrContext) {
177
+ route = router.resolve(ssrContext.url).route;
178
+ } else {
179
+ const path = getLocation(router.options.base, router.options.mode);
180
+
181
+ route = router.resolve(path).route;
182
+ }
183
+
184
+ // Set context to app.context
185
+ await setContext(app, {
186
+ store,
187
+ route,
188
+ next,
189
+ error: app.nuxt.error.bind(app),
190
+ payload: ssrContext ? ssrContext.payload : undefined,
191
+ req: ssrContext ? ssrContext.req : undefined,
192
+ res: ssrContext ? ssrContext.res : undefined,
193
+ beforeRenderFns: ssrContext ? ssrContext.beforeRenderFns : undefined,
194
+ ssrContext
195
+ });
196
+
197
+ function inject(key, value) {
198
+ if (!key) {
199
+ throw new Error('inject(key, value) has no key provided');
200
+ }
201
+ if (value === undefined) {
202
+ throw new Error(`inject('${ key }', value) has no value provided`);
203
+ }
204
+
205
+ key = `$${ key }`;
206
+ // Add into app
207
+ app[key] = value;
208
+ // Add into context
209
+ if (!app.context[key]) {
210
+ app.context[key] = value;
211
+ }
212
+
213
+ // Add into store
214
+ store[key] = app[key];
215
+
216
+ // Check if plugin not already installed
217
+ const installKey = `__nuxt_${ key }_installed__`;
218
+
219
+ if (Vue[installKey]) {
220
+ return;
221
+ }
222
+ Vue[installKey] = true;
223
+ // Call Vue.use() to install the plugin into vm
224
+ Vue.use(() => {
225
+ if (!Object.prototype.hasOwnProperty.call(Vue.prototype, key)) {
226
+ Object.defineProperty(Vue.prototype, key, {
227
+ get() {
228
+ return this.$root.$options[key];
229
+ }
230
+ });
231
+ }
232
+ });
233
+ }
234
+
235
+ // Inject runtime config as $config
236
+ inject('config', config);
237
+
238
+ if (process.client) {
239
+ // Replace store state before plugins execution
240
+ if (window.__NUXT__ && window.__NUXT__.state) {
241
+ store.replaceState(window.__NUXT__.state);
242
+ }
243
+ }
244
+
245
+ // Add enablePreview(previewData = {}) in context for plugins
246
+ if (process.static && process.client) {
247
+ app.context.enablePreview = function(previewData = {}) {
248
+ app.previewData = Object.assign({}, previewData);
249
+ inject('preview', previewData);
250
+ };
251
+ }
252
+ // Plugin execution
253
+
254
+ // if (typeof nuxt_plugin_portalvue_6babae27 === 'function') {
255
+ // await nuxt_plugin_portalvue_6babae27(app.context, inject);
256
+ // }
257
+
258
+ if (typeof cookieUniversalNuxt === 'function') {
259
+ await cookieUniversalNuxt(app.context, inject);
260
+ }
261
+
262
+ if (typeof axios === 'function') {
263
+ await axios(app.context, inject);
264
+ }
265
+
266
+ if (typeof plugins === 'function') {
267
+ await plugins(app.context, inject);
268
+ }
269
+
270
+ if (typeof pluginsLoader === 'function') {
271
+ await pluginsLoader(app.context, inject);
272
+ }
273
+
274
+ if (typeof axiosShell === 'function') {
275
+ await axiosShell(app.context, inject);
276
+ }
277
+
278
+ if (process.client && typeof consolePlugin === 'function') {
279
+ await consolePlugin(app.context, inject);
280
+ }
281
+
282
+ if (process.client && typeof intNumber === 'function') {
283
+ await intNumber(app.context, inject);
284
+ }
285
+
286
+ if (process.client && typeof nuxtClientInit === 'function') {
287
+ await nuxtClientInit(app.context, inject);
288
+ }
289
+
290
+ if (typeof replaceAll === 'function') {
291
+ await replaceAll(app.context, inject);
292
+ }
293
+
294
+ if (typeof backButton === 'function') {
295
+ await backButton(app.context, inject);
296
+ }
297
+
298
+ if (process.client && typeof plugin === 'function') {
299
+ await plugin(app.context, inject);
300
+ }
301
+
302
+ if (process.client && typeof codeMirror === 'function') {
303
+ await codeMirror(app.context, inject);
304
+ }
305
+
306
+ if (process.client && typeof version === 'function') {
307
+ await version(app.context, inject);
308
+ }
309
+
310
+ if (process.client && typeof steveCreateWorker === 'function') {
311
+ await steveCreateWorker(app.context, inject);
312
+ }
313
+
314
+ // if (process.client && typeof formatters === 'function') {
315
+ // await formatters(app.context, inject);
316
+ // }
317
+
318
+ // Lock enablePreview in context
319
+ if (process.static && process.client) {
320
+ app.context.enablePreview = function() {
321
+ console.warn('You cannot call enablePreview() outside a plugin.');
322
+ };
323
+ }
324
+
325
+ // Wait for async component to be resolved first
326
+ await new Promise((resolve, reject) => {
327
+ // Ignore 404s rather than blindly replacing URL in browser
328
+ if (process.client) {
329
+ const { route } = router.resolve(app.context.route.fullPath);
330
+
331
+ if (!route.matched.length) {
332
+ return resolve();
333
+ }
334
+ }
335
+ router.replace(app.context.route.fullPath, resolve, (err) => {
336
+ // https://github.com/vuejs/vue-router/blob/v3.4.3/src/util/errors.js
337
+ if (!err._isRouter) {
338
+ return reject(err);
339
+ }
340
+ if (err.type !== 2 /* NavigationFailureType.redirected */) {
341
+ return resolve();
342
+ }
343
+
344
+ // navigated to a different route in router guard
345
+ const unregister = router.afterEach(async(to, from) => {
346
+ if (process.server && ssrContext && ssrContext.url) {
347
+ ssrContext.url = to.fullPath;
348
+ }
349
+ app.context.route = await getRouteData(to);
350
+ app.context.params = to.params || {};
351
+ app.context.query = to.query || {};
352
+ unregister();
353
+ resolve();
354
+ });
355
+ });
356
+ });
357
+
358
+ return {
359
+ store,
360
+ app,
361
+ router
362
+ };
363
+ }
364
+
365
+ export { createApp, NuxtError };
package/nuxt/jsonp.js ADDED
@@ -0,0 +1,82 @@
1
+ const chunks = {} // chunkId => exports
2
+ const chunksInstalling = {} // chunkId => Promise
3
+ const failedChunks = {}
4
+
5
+ function importChunk(chunkId, src) {
6
+ // Already installed
7
+ if (chunks[chunkId]) {
8
+ return Promise.resolve(chunks[chunkId])
9
+ }
10
+
11
+ // Failed loading
12
+ if (failedChunks[chunkId]) {
13
+ return Promise.reject(failedChunks[chunkId])
14
+ }
15
+
16
+ // Installing
17
+ if (chunksInstalling[chunkId]) {
18
+ return chunksInstalling[chunkId]
19
+ }
20
+
21
+ // Set a promise in chunk cache
22
+ let resolve, reject
23
+ const promise = chunksInstalling[chunkId] = new Promise((_resolve, _reject) => {
24
+ resolve = _resolve
25
+ reject = _reject
26
+ })
27
+
28
+ // Clear chunk data from cache
29
+ delete chunks[chunkId]
30
+
31
+ // Start chunk loading
32
+ const script = document.createElement('script')
33
+ script.charset = 'utf-8'
34
+ script.timeout = 120
35
+ script.src = src
36
+ let timeout
37
+
38
+ // Create error before stack unwound to get useful stacktrace later
39
+ const error = new Error()
40
+
41
+ // Complete handlers
42
+ const onScriptComplete = script.onerror = script.onload = (event) => {
43
+ // Cleanups
44
+ clearTimeout(timeout)
45
+ delete chunksInstalling[chunkId]
46
+
47
+ // Avoid mem leaks in IE
48
+ script.onerror = script.onload = null
49
+
50
+ // Verify chunk is loaded
51
+ if (chunks[chunkId]) {
52
+ return resolve(chunks[chunkId])
53
+ }
54
+
55
+ // Something bad happened
56
+ const errorType = event && (event.type === 'load' ? 'missing' : event.type)
57
+ const realSrc = event && event.target && event.target.src
58
+ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')'
59
+ error.name = 'ChunkLoadError'
60
+ error.type = errorType
61
+ error.request = realSrc
62
+ failedChunks[chunkId] = error
63
+ reject(error)
64
+ }
65
+
66
+ // Timeout
67
+ timeout = setTimeout(() => {
68
+ onScriptComplete({ type: 'timeout', target: script })
69
+ }, 120000)
70
+
71
+ // Append script
72
+ document.head.appendChild(script)
73
+
74
+ // Return promise
75
+ return promise
76
+ }
77
+
78
+ export function installJsonp() {
79
+ window.__NUXT_JSONP__ = function (chunkId, exports) { chunks[chunkId] = exports }
80
+ window.__NUXT_JSONP_CACHE__ = chunks
81
+ window.__NUXT_IMPORT__ = importChunk
82
+ }
@@ -0,0 +1,39 @@
1
+ <style>
2
+ .initial-load-spinner-container {
3
+ align-items: center;
4
+ background-color: #f8f8f8;
5
+ display: flex;
6
+ justify-content: center;
7
+ height: 100vh;
8
+ left: 0;
9
+ position: absolute;
10
+ top: 0;
11
+ width: 100vw;
12
+ }
13
+
14
+ .initial-load-spinner {
15
+ animation: initial-load-animate 1s infinite linear;
16
+ background-color: #fff;
17
+ box-sizing: border-box;
18
+ border: 5px solid #008ACF;
19
+ border-radius: 50%;
20
+ border-top-color: #00B2E2;
21
+ display: inline-block;
22
+ height: 80px;
23
+ margin: 0 auto;
24
+ width: 80px;
25
+ }
26
+
27
+ @keyframes initial-load-animate {
28
+ 0% {
29
+ transform: rotate(0deg);
30
+ }
31
+
32
+ 100% {
33
+ transform: rotate(359deg);
34
+ }
35
+ }
36
+ </style>
37
+ <div class="initial-load-spinner-container">
38
+ <i class="initial-load-spinner"></i>
39
+ </div>
@@ -0,0 +1,12 @@
1
+ const middleware = {}
2
+
3
+ middleware['authenticated'] = require('../middleware/authenticated.js')
4
+ middleware['authenticated'] = middleware['authenticated'].default || middleware['authenticated']
5
+
6
+ middleware['i18n'] = require('../middleware/i18n.js')
7
+ middleware['i18n'] = middleware['i18n'].default || middleware['i18n']
8
+
9
+ middleware['unauthenticated'] = require('../middleware/unauthenticated.js')
10
+ middleware['unauthenticated'] = middleware['unauthenticated'].default || middleware['unauthenticated']
11
+
12
+ export default middleware
@@ -0,0 +1,90 @@
1
+ import Vue from 'vue'
2
+ import { hasFetch, normalizeError, addLifecycleHook, createGetCounter } from '../utils'
3
+
4
+ const isSsrHydration = (vm) => vm.$vnode && vm.$vnode.elm && vm.$vnode.elm.dataset && vm.$vnode.elm.dataset.fetchKey
5
+ const nuxtState = window.__NUXT__
6
+
7
+ export default {
8
+ beforeCreate () {
9
+ if (!hasFetch(this)) {
10
+ return
11
+ }
12
+
13
+ this._fetchDelay = typeof this.$options.fetchDelay === 'number' ? this.$options.fetchDelay : 200
14
+
15
+ Vue.util.defineReactive(this, '$fetchState', {
16
+ pending: false,
17
+ error: null,
18
+ timestamp: Date.now()
19
+ })
20
+
21
+ this.$fetch = $fetch.bind(this)
22
+ addLifecycleHook(this, 'created', created)
23
+ addLifecycleHook(this, 'beforeMount', beforeMount)
24
+ }
25
+ }
26
+
27
+ function beforeMount() {
28
+ if (!this._hydrated) {
29
+ return this.$fetch()
30
+ }
31
+ }
32
+
33
+ function created() {
34
+ if (!isSsrHydration(this)) {
35
+ return
36
+ }
37
+
38
+ // Hydrate component
39
+ this._hydrated = true
40
+ this._fetchKey = this.$vnode.elm.dataset.fetchKey
41
+ const data = nuxtState.fetch[this._fetchKey]
42
+
43
+ // If fetch error
44
+ if (data && data._error) {
45
+ this.$fetchState.error = data._error
46
+ return
47
+ }
48
+
49
+ // Merge data
50
+ for (const key in data) {
51
+ Vue.set(this.$data, key, data[key])
52
+ }
53
+ }
54
+
55
+ function $fetch() {
56
+ if (!this._fetchPromise) {
57
+ this._fetchPromise = $_fetch.call(this)
58
+ .then(() => { delete this._fetchPromise })
59
+ }
60
+ return this._fetchPromise
61
+ }
62
+
63
+ async function $_fetch() {
64
+ this.$nuxt.nbFetching++
65
+ this.$fetchState.pending = true
66
+ this.$fetchState.error = null
67
+ this._hydrated = false
68
+ let error = null
69
+ const startTime = Date.now()
70
+
71
+ try {
72
+ await this.$options.fetch.call(this)
73
+ } catch (err) {
74
+ if (process.dev) {
75
+ console.error('Error in fetch():', err)
76
+ }
77
+ error = normalizeError(err)
78
+ }
79
+
80
+ const delayLeft = this._fetchDelay - (Date.now() - startTime)
81
+ if (delayLeft > 0) {
82
+ await new Promise(resolve => setTimeout(resolve, delayLeft))
83
+ }
84
+
85
+ this.$fetchState.error = error
86
+ this.$fetchState.pending = false
87
+ this.$fetchState.timestamp = Date.now()
88
+
89
+ this.$nextTick(() => this.$nuxt.nbFetching--)
90
+ }