@rancher/shell 0.1.3 → 0.1.21
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.
- package/assets/brand/suse/dark/rancher-logo.svg +1 -148
- package/assets/brand/suse/favicon.png +0 -0
- package/assets/brand/suse/rancher-logo.svg +1 -130
- package/assets/images/featured/img1.jpg +0 -0
- package/assets/images/featured.jpg +0 -0
- package/assets/images/generic-plugin.svg +1 -0
- package/assets/styles/themes/_dark.scss +3 -0
- package/assets/styles/themes/_light.scss +3 -0
- package/assets/styles/themes/_suse.scss +1 -1
- package/assets/translations/en-us.yaml +219 -47
- package/assets/translations/zh-hans.yaml +21 -24
- package/components/AsyncButton.vue +17 -2
- package/components/ButtonDropdown.vue +4 -0
- package/components/Carousel.vue +291 -0
- package/components/CommunityLinks.vue +64 -22
- package/components/CruResource.vue +11 -3
- package/components/Dialog.vue +102 -0
- package/components/ExplorerMembers.vue +2 -4
- package/components/ExplorerProjectsNamespaces.vue +25 -9
- package/components/IconMessage.vue +9 -1
- package/components/LazyImage.vue +21 -8
- package/components/LocaleSelector.vue +62 -29
- package/components/PromptRemove.vue +2 -2
- package/components/ResourceList/Masthead.vue +21 -1
- package/components/ResourceList/ResourceLoadingIndicator.vue +0 -8
- package/components/ResourceList/index.vue +9 -23
- package/components/ResourceTable.vue +7 -2
- package/components/SimpleBox.vue +6 -4
- package/components/SortableTable/index.vue +18 -25
- package/components/Tabbed/Tab.vue +5 -0
- package/components/Tabbed/index.vue +54 -9
- package/components/TypeDescription.vue +10 -1
- package/components/auth/Principal.vue +1 -0
- package/components/fleet/FleetBundles.vue +8 -3
- package/components/fleet/FleetClusters.vue +6 -0
- package/components/fleet/FleetRepos.vue +7 -1
- package/components/fleet/FleetSummary.vue +6 -0
- package/components/form/Command.vue +5 -0
- package/components/form/EnvVars.vue +5 -0
- package/components/form/KeyValue.vue +80 -58
- package/components/form/NameNsDescription.vue +13 -5
- package/components/form/NodeScheduling.vue +6 -1
- package/components/form/PodAffinity.vue +5 -0
- package/components/form/ResourceTabs/index.vue +5 -1
- package/components/form/ServiceNameSelect.vue +5 -0
- package/components/form/ValueFromResource.vue +7 -1
- package/components/formatter/ClusterLink.vue +3 -7
- package/components/nav/NamespaceFilter.vue +3 -3
- package/components/nav/TopLevelMenu.vue +12 -29
- package/config/home-links.js +155 -0
- package/config/labels-annotations.js +2 -1
- package/config/private-label.js +1 -1
- package/config/product/explorer.js +5 -4
- package/config/product/legacy.js +0 -47
- package/config/product/manager.js +0 -2
- package/config/product/multi-cluster-apps.js +0 -12
- package/config/product/settings.js +12 -1
- package/config/product/uiplugins.js +17 -0
- package/config/settings.js +23 -2
- package/config/types.js +5 -1
- package/config/uiplugins.js +117 -0
- package/config/version.js +17 -0
- package/content/docs/en-us/getting-started.md +1 -26
- package/core/plugin.ts +12 -0
- package/core/plugins.js +38 -2
- package/core/types.ts +6 -0
- package/creators/app/{.eslintignore → files/.eslintignore} +0 -0
- package/creators/app/{.eslintrc.js → files/.eslintrc.js} +0 -0
- package/creators/app/{.vscode → files/.vscode}/settings.json +0 -0
- package/creators/app/{babel.config.js → files/babel.config.js} +0 -0
- package/creators/app/{nuxt.config.js → files/nuxt.config.js} +0 -0
- package/creators/app/{tsconfig.json → files/tsconfig.json} +2 -1
- package/creators/app/init +16 -17
- package/creators/app/package.json +6 -0
- package/creators/pkg/{babel.config.js → files/babel.config.js} +0 -0
- package/creators/pkg/{index.ts → files/index.ts} +0 -0
- package/creators/pkg/{tsconfig.json → files/tsconfig.json} +13 -12
- package/creators/pkg/{vue.config.js → files/vue.config.js} +0 -0
- package/creators/pkg/init +1 -1
- package/creators/update/init +54 -0
- package/creators/update/package.json +20 -0
- package/creators/update/upgrade +56 -0
- package/creators/update/yarn-error.log +54 -0
- package/detail/provisioning.cattle.io.cluster.vue +3 -3
- package/detail/workload/index.vue +3 -2
- package/dialog/DiagnosticTimingsDialog.vue +116 -0
- package/dialog/RotateCertificatesDialog.vue +9 -3
- package/edit/auth/azuread.vue +28 -9
- package/edit/networking.k8s.io.ingress/index.vue +2 -2
- package/edit/persistentvolume/index.vue +51 -13
- package/edit/persistentvolumeclaim.vue +31 -13
- package/edit/pod.vue +27 -0
- package/edit/provisioning.cattle.io.cluster/rke2.vue +103 -24
- package/edit/service.vue +7 -5
- package/edit/workload/__tests__/Upgrading.test.ts +1 -0
- package/edit/workload/index.vue +32 -10
- package/edit/workload/mixins/workload.js +121 -126
- package/edit/workload/storage/ContainerMountPaths.vue +240 -0
- package/edit/workload/storage/Mount.vue +1 -0
- package/edit/workload/storage/awsElasticBlockStore.vue +20 -1
- package/edit/workload/storage/azureDisk.vue +22 -2
- package/edit/workload/storage/azureFile.vue +20 -2
- package/edit/workload/storage/csi/index.vue +23 -1
- package/edit/workload/storage/gcePersistentDisk.vue +20 -2
- package/edit/workload/storage/index.vue +33 -65
- package/edit/workload/storage/persistentVolumeClaim/index.vue +5 -0
- package/edit/workload/storage/secret.vue +6 -1
- package/edit/workload/storage/vsphereVolume.vue +11 -1
- package/layouts/default.vue +14 -8
- package/layouts/home.vue +9 -4
- package/layouts/plain.vue +10 -5
- package/list/catalog.cattle.io.app.vue +10 -9
- package/list/catalog.cattle.io.clusterrepo.vue +6 -61
- package/list/cis.cattle.io.clusterscan.vue +12 -12
- package/list/fleet.cattle.io.bundle.vue +33 -28
- package/list/fleet.cattle.io.cluster.vue +26 -22
- package/list/fleet.cattle.io.clustergroup.vue +6 -0
- package/list/fleet.cattle.io.clusterregistrationtoken.vue +28 -24
- package/list/fleet.cattle.io.gitrepo.vue +25 -14
- package/list/helm.cattle.io.projecthelmchart.vue +52 -33
- package/list/logging.banzaicloud.io.clusterflow.vue +7 -12
- package/list/logging.banzaicloud.io.flow.vue +7 -14
- package/list/management.cattle.io.cluster.vue +26 -15
- package/list/management.cattle.io.feature.vue +13 -8
- package/list/management.cattle.io.setting.vue +3 -3
- package/list/management.cattle.io.user.vue +38 -19
- package/list/monitoring.coreos.com.alertmanagerconfig.vue +8 -15
- package/list/namespace.vue +14 -1
- package/list/node.vue +13 -16
- package/list/persistentvolume.vue +16 -9
- package/list/persistentvolumeclaim.vue +5 -8
- package/list/provisioning.cattle.io.cluster.vue +35 -9
- package/list/service.vue +24 -12
- package/list/ui.cattle.io.navlink.vue +6 -0
- package/list/workload.vue +2 -2
- package/machine-config/harvester.vue +5 -3
- package/middleware/authenticated.js +6 -0
- package/mixins/resource-fetch.js +12 -18
- package/mixins/resource-manager.js +126 -0
- package/models/catalog.cattle.io.uiplugin.js +38 -0
- package/models/cluster/node.js +25 -2
- package/models/fleet.cattle.io.bundle.js +1 -1
- package/models/harvesterhci.io.management.cluster.js +11 -5
- package/models/pod.js +15 -5
- package/models/provisioning.cattle.io.cluster.js +16 -6
- package/models/workload.js +5 -3
- package/models/workload.service.js +10 -0
- package/nuxt.config.js +70 -25
- package/package.json +108 -109
- package/pages/auth/login.vue +11 -1
- package/pages/auth/verify.vue +9 -0
- package/pages/c/_cluster/apps/charts/index.vue +46 -1
- package/pages/c/_cluster/apps/charts/install.vue +10 -9
- package/pages/c/_cluster/explorer/index.vue +72 -9
- package/pages/c/_cluster/explorer/tools/index.vue +12 -5
- package/pages/c/_cluster/mcapps/index.vue +1 -1
- package/pages/c/_cluster/settings/DefaultLinksEditor.vue +108 -0
- package/pages/c/_cluster/settings/brand.vue +0 -40
- package/pages/c/_cluster/settings/links.vue +152 -0
- package/pages/c/_cluster/settings/performance.vue +90 -7
- package/pages/c/_cluster/uiplugins/DeveloperInstallDialog.vue +232 -0
- package/pages/c/_cluster/uiplugins/InstallDialog.vue +293 -0
- package/pages/c/_cluster/uiplugins/PluginInfoPanel.vue +300 -0
- package/pages/c/_cluster/uiplugins/RemoveUIPlugins.vue +125 -0
- package/pages/c/_cluster/uiplugins/SetupUIPlugins.vue +261 -0
- package/pages/c/_cluster/uiplugins/UninstallDialog.vue +122 -0
- package/pages/c/_cluster/uiplugins/index.vue +808 -0
- package/pages/diagnostic.vue +185 -101
- package/pages/docs/_doc.vue +3 -1
- package/pages/home.vue +21 -56
- package/pages/prefs.vue +108 -88
- package/pages/safeMode.vue +17 -0
- package/pages/support/index.vue +34 -137
- package/pkg/dynamic-importer.lib.js +4 -0
- package/plugins/dashboard-store/actions.js +19 -0
- package/plugins/dashboard-store/getters.js +20 -3
- package/plugins/dashboard-store/mutations.js +13 -7
- package/plugins/dashboard-store/resource-class.js +2 -2
- package/plugins/formatters.js +15 -0
- package/plugins/plugin.js +61 -6
- package/plugins/steve/getters.js +12 -0
- package/plugins/steve/mutations.js +1 -1
- package/plugins/steve/subscribe.js +94 -72
- package/plugins/steve/web-worker.steve-sub-worker.js +24 -15
- package/plugins/version.js +21 -0
- package/promptRemove/management.cattle.io.globalrole.vue +47 -0
- package/promptRemove/management.cattle.io.roletemplate.vue +47 -0
- package/promptRemove/mixin/roleDeletionCheck.js +97 -0
- package/rancher-components/Form/TextArea/TextAreaAutoGrow.vue +6 -7
- package/rancher-components/components/BadgeState/BadgeState.spec.ts +12 -0
- package/rancher-components/components/BadgeState/BadgeState.vue +107 -0
- package/rancher-components/components/BadgeState/index.ts +1 -0
- package/rancher-components/components/Banner/Banner.test.ts +13 -0
- package/rancher-components/components/Banner/Banner.vue +163 -0
- package/rancher-components/components/Banner/index.ts +1 -0
- package/rancher-components/components/Card/Card.vue +150 -0
- package/rancher-components/components/Card/index.ts +1 -0
- package/rancher-components/components/Form/Checkbox/Checkbox.test.ts +77 -0
- package/rancher-components/components/Form/Checkbox/Checkbox.vue +395 -0
- package/rancher-components/components/Form/Checkbox/index.ts +1 -0
- package/rancher-components/components/Form/LabeledInput/LabeledInput.test.ts +29 -0
- package/rancher-components/components/Form/LabeledInput/LabeledInput.vue +343 -0
- package/rancher-components/components/Form/LabeledInput/index.ts +1 -0
- package/rancher-components/components/Form/Radio/RadioButton.vue +270 -0
- package/rancher-components/components/Form/Radio/RadioGroup.vue +235 -0
- package/rancher-components/components/Form/Radio/index.ts +2 -0
- package/rancher-components/components/Form/TextArea/TextAreaAutoGrow.vue +168 -0
- package/rancher-components/components/Form/TextArea/index.ts +1 -0
- package/rancher-components/components/Form/ToggleSwitch/ToggleSwitch.test.ts +107 -0
- package/rancher-components/components/Form/ToggleSwitch/ToggleSwitch.vue +137 -0
- package/rancher-components/components/Form/ToggleSwitch/index.ts +1 -0
- package/rancher-components/components/Form/index.ts +5 -0
- package/rancher-components/components/LabeledTooltip/LabeledTooltip.vue +137 -0
- package/rancher-components/components/LabeledTooltip/index.ts +1 -0
- package/scripts/publish-shell.sh +40 -7
- package/scripts/record-deps.js +37 -0
- package/scripts/sync-shell-deps +37 -0
- package/scripts/test-plugins-build.sh +8 -5
- package/scripts/typegen.sh +84 -0
- package/store/auth.js +3 -0
- package/store/catalog.js +9 -8
- package/store/i18n.js +10 -1
- package/store/index.js +12 -3
- package/store/prefs.js +16 -0
- package/store/type-map.js +32 -5
- package/store/uiplugins.ts +15 -61
- package/types/shell/index.d.ts +3046 -0
- package/utils/__tests__/object.test.ts +0 -24
- package/utils/__tests__/selector.test.ts +1 -1
- package/utils/dynamic-importer.js +4 -0
- package/utils/favicon.js +8 -2
- package/utils/gc/gc-interval.ts +40 -0
- package/utils/gc/gc-root-store.js +76 -0
- package/utils/gc/gc-route-changed.ts +44 -0
- package/utils/gc/gc-types.ts +21 -0
- package/utils/gc/gc.ts +282 -0
- package/utils/grafana.js +2 -6
- package/utils/socket.js +41 -20
- package/utils/string.js +1 -7
- package/utils/validators/formRules/__tests__/index.test.ts +108 -0
- package/utils/validators/formRules/index.ts +9 -1
- package/config/footer.js +0 -19
- package/creators/pkg/nuxt.config.js +0 -6
- package/pages/plugins.vue +0 -387
- package/server/verdaccio-middleware.js +0 -56
package/store/type-map.js
CHANGED
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
// )
|
|
123
123
|
import { AGE, NAME, NAMESPACE as NAMESPACE_COL, STATE } from '@shell/config/table-headers';
|
|
124
124
|
import { COUNT, SCHEMA, MANAGEMENT, NAMESPACE } from '@shell/config/types';
|
|
125
|
-
import {
|
|
125
|
+
import { VIEW_IN_API, EXPANDED_GROUPS, FAVORITE_TYPES } from '@shell/store/prefs';
|
|
126
126
|
import {
|
|
127
127
|
addObject, findBy, insertAt, isArray, removeObject, filterBy
|
|
128
128
|
} from '@shell/utils/array';
|
|
@@ -131,7 +131,7 @@ import {
|
|
|
131
131
|
ensureRegex, escapeHtml, escapeRegex, ucFirst, pluralize
|
|
132
132
|
} from '@shell/utils/string';
|
|
133
133
|
import {
|
|
134
|
-
importList, importDetail, importEdit, listProducts, loadProduct, importCustomPromptRemove, resolveList, resolveEdit, resolveWindowComponent, importWindowComponent, resolveDetail, importDialog
|
|
134
|
+
importChart, importList, importDetail, importEdit, listProducts, loadProduct, importCustomPromptRemove, resolveList, resolveEdit, resolveWindowComponent, importWindowComponent, resolveChart, resolveDetail, importDialog
|
|
135
135
|
} from '@shell/utils/dynamic-importer';
|
|
136
136
|
|
|
137
137
|
import { NAME as EXPLORER } from '@shell/config/product/explorer';
|
|
@@ -168,6 +168,7 @@ export const IF_HAVE = {
|
|
|
168
168
|
NOT_V1_ISTIO: 'not-v1-istio',
|
|
169
169
|
MULTI_CLUSTER: 'multi-cluster',
|
|
170
170
|
NEUVECTOR_NAMESPACE: 'neuvector-namespace',
|
|
171
|
+
ADMIN: 'admin-user',
|
|
171
172
|
};
|
|
172
173
|
|
|
173
174
|
export function DSL(store, product, module = 'type-map') {
|
|
@@ -360,6 +361,7 @@ export const state = function() {
|
|
|
360
361
|
groupLabel: {},
|
|
361
362
|
ignore: {},
|
|
362
363
|
list: {},
|
|
364
|
+
chart: {},
|
|
363
365
|
detail: {},
|
|
364
366
|
edit: {},
|
|
365
367
|
componentFor: {},
|
|
@@ -802,7 +804,7 @@ export const getters = {
|
|
|
802
804
|
const module = findBy(state.products, 'name', product).inStore;
|
|
803
805
|
const schemas = rootGetters[`${ module }/all`](SCHEMA);
|
|
804
806
|
const counts = rootGetters[`${ module }/all`](COUNT)?.[0]?.counts || {};
|
|
805
|
-
const isDev = rootGetters['prefs/get'](
|
|
807
|
+
const isDev = rootGetters['prefs/get'](VIEW_IN_API);
|
|
806
808
|
const isBasic = mode === BASIC;
|
|
807
809
|
|
|
808
810
|
const out = {};
|
|
@@ -1055,6 +1057,14 @@ export const getters = {
|
|
|
1055
1057
|
};
|
|
1056
1058
|
},
|
|
1057
1059
|
|
|
1060
|
+
hasCustomChart(state, getters, rootState) {
|
|
1061
|
+
return (rawType) => {
|
|
1062
|
+
const key = getters.componentFor(rawType);
|
|
1063
|
+
|
|
1064
|
+
return hasCustom(state, rootState, 'chart', key, key => resolveChart(key));
|
|
1065
|
+
};
|
|
1066
|
+
},
|
|
1067
|
+
|
|
1058
1068
|
hasCustomDetail(state, getters, rootState) {
|
|
1059
1069
|
return (rawType, subType) => {
|
|
1060
1070
|
const key = getters.componentFor(rawType, subType);
|
|
@@ -1123,6 +1133,12 @@ export const getters = {
|
|
|
1123
1133
|
};
|
|
1124
1134
|
},
|
|
1125
1135
|
|
|
1136
|
+
importChart(state, getters, rootState) {
|
|
1137
|
+
return (rawType) => {
|
|
1138
|
+
return loadExtension(rootState, 'chart', getters.componentFor(rawType), importChart);
|
|
1139
|
+
};
|
|
1140
|
+
},
|
|
1141
|
+
|
|
1126
1142
|
importDetail(state, getters, rootState) {
|
|
1127
1143
|
return (rawType, subType) => {
|
|
1128
1144
|
return loadExtension(rootState, 'detail', getters.componentFor(rawType, subType), importDetail);
|
|
@@ -1215,7 +1231,7 @@ export const getters = {
|
|
|
1215
1231
|
activeProducts(state, getters, rootState, rootGetters) {
|
|
1216
1232
|
const knownTypes = {};
|
|
1217
1233
|
const knownGroups = {};
|
|
1218
|
-
const isDev = rootGetters['prefs/get'](
|
|
1234
|
+
const isDev = rootGetters['prefs/get'](VIEW_IN_API);
|
|
1219
1235
|
|
|
1220
1236
|
if ( state.schemaGeneration < 0 ) {
|
|
1221
1237
|
// This does nothing, but makes activeProducts depend on schemaGeneration
|
|
@@ -1544,7 +1560,7 @@ export const mutations = {
|
|
|
1544
1560
|
let obj = { ...options, match };
|
|
1545
1561
|
|
|
1546
1562
|
if ( idx >= 0 ) {
|
|
1547
|
-
obj = Object.assign(
|
|
1563
|
+
obj = Object.assign(state.typeOptions[idx], obj);
|
|
1548
1564
|
state.typeOptions.splice(idx, 1, obj);
|
|
1549
1565
|
} else {
|
|
1550
1566
|
const obj = Object.assign({}, options, { match });
|
|
@@ -1732,11 +1748,22 @@ function ifHave(getters, option) {
|
|
|
1732
1748
|
case IF_HAVE.NEUVECTOR_NAMESPACE: {
|
|
1733
1749
|
return getters[`cluster/all`](NAMESPACE).find(n => n.metadata.name === NEU_VECTOR_NAMESPACE);
|
|
1734
1750
|
}
|
|
1751
|
+
case IF_HAVE.ADMIN: {
|
|
1752
|
+
return isAdminUser(getters);
|
|
1753
|
+
}
|
|
1735
1754
|
default:
|
|
1736
1755
|
return false;
|
|
1737
1756
|
}
|
|
1738
1757
|
}
|
|
1739
1758
|
|
|
1759
|
+
// Could list a larger set of resources that typically only an admin user would have
|
|
1760
|
+
export function isAdminUser(getters) {
|
|
1761
|
+
const canEditSettings = (getters['management/schemaFor'](MANAGEMENT.SETTING)?.resourceMethods || []).includes('PUT');
|
|
1762
|
+
const canEditFeatureFlags = (getters['management/schemaFor'](MANAGEMENT.FEATURE)?.resourceMethods || []).includes('PUT');
|
|
1763
|
+
|
|
1764
|
+
return canEditSettings && canEditFeatureFlags;
|
|
1765
|
+
}
|
|
1766
|
+
|
|
1740
1767
|
// Is V1 Istio installed?
|
|
1741
1768
|
function isV1Istio(getters) {
|
|
1742
1769
|
const cluster = getters['currentCluster'];
|
package/store/uiplugins.ts
CHANGED
|
@@ -3,20 +3,22 @@
|
|
|
3
3
|
|
|
4
4
|
// import { addObject, removeObject } from '@shell/utils/array';
|
|
5
5
|
|
|
6
|
-
import { allHash } from '@shell/utils/promise';
|
|
7
6
|
import { Plugin } from '@shell/core/plugin';
|
|
8
7
|
|
|
9
8
|
interface UIPluginState {
|
|
10
9
|
plugins: Plugin[],
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
errors: any,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface LoadError {
|
|
14
|
+
name: string,
|
|
15
|
+
error: boolean,
|
|
13
16
|
}
|
|
14
17
|
|
|
15
18
|
export const state = function(): UIPluginState {
|
|
16
19
|
return {
|
|
17
20
|
plugins: [],
|
|
18
|
-
|
|
19
|
-
catalogs: [''],
|
|
21
|
+
errors: {},
|
|
20
22
|
};
|
|
21
23
|
};
|
|
22
24
|
|
|
@@ -25,16 +27,16 @@ export const getters = {
|
|
|
25
27
|
return state.plugins;
|
|
26
28
|
},
|
|
27
29
|
|
|
28
|
-
|
|
29
|
-
return state.
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
catalogs: (state: any) => {
|
|
33
|
-
return state.catalogs;
|
|
30
|
+
errors: (state: any) => {
|
|
31
|
+
return state.errors;
|
|
34
32
|
},
|
|
35
33
|
};
|
|
36
34
|
|
|
37
35
|
export const mutations = {
|
|
36
|
+
setError(state: UIPluginState, error: LoadError) {
|
|
37
|
+
state.errors[error.name] = error.error;
|
|
38
|
+
},
|
|
39
|
+
|
|
38
40
|
addPlugin(state: UIPluginState, plugin: Plugin) {
|
|
39
41
|
// TODO: Duplicates?
|
|
40
42
|
state.plugins.push(plugin);
|
|
@@ -47,59 +49,11 @@ export const mutations = {
|
|
|
47
49
|
state.plugins.splice(index, 1);
|
|
48
50
|
}
|
|
49
51
|
},
|
|
50
|
-
|
|
51
|
-
setCatalog(state: UIPluginState, catalog: any) {
|
|
52
|
-
state.catalog = catalog;
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
addCatalog(state: UIPluginState, catalog: string) {
|
|
56
|
-
state.catalogs.push(catalog);
|
|
57
|
-
}
|
|
58
52
|
};
|
|
59
53
|
|
|
60
54
|
export const actions = {
|
|
61
|
-
|
|
62
|
-
commit('
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
// This is just for PoC - we wouldn't get the catalog from Verdaccio
|
|
66
|
-
// This fetches the catalog each time
|
|
67
|
-
async loadCatalogs( { getters, commit, dispatch }: any) {
|
|
68
|
-
const packages: any[] = [];
|
|
69
|
-
const catalogHash = {} as any;
|
|
70
|
-
const catalogs = getters['catalogs'];
|
|
71
|
-
|
|
72
|
-
catalogs.forEach((url: string) => {
|
|
73
|
-
const base = url;
|
|
74
|
-
|
|
75
|
-
if (!url) {
|
|
76
|
-
url = '/verdaccio/data/packages';
|
|
77
|
-
} else {
|
|
78
|
-
url = `/uiplugins-catalog/?${ url }`;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
try {
|
|
82
|
-
catalogHash[base] = dispatch('rancher/request', { url }, { root: true });
|
|
83
|
-
} catch (err) {
|
|
84
|
-
// Ignore errors... or all plugins fail
|
|
85
|
-
console.warn('Unable to fetch catalog: ', url, err); // eslint-disable-line no-console
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
const res = await allHash(catalogHash);
|
|
90
|
-
|
|
91
|
-
Object.keys(res as any).forEach((r: string) => {
|
|
92
|
-
const v: any = (res as any)[r];
|
|
93
|
-
|
|
94
|
-
v.forEach((p: any) => {
|
|
95
|
-
p.location = r;
|
|
96
|
-
packages.push(p);
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
const uiPackages = packages.filter((pkg: any) => pkg.rancher);
|
|
101
|
-
|
|
102
|
-
commit('setCatalog', uiPackages);
|
|
55
|
+
setError( { commit }: any, error: LoadError ) {
|
|
56
|
+
commit('setError', error);
|
|
103
57
|
},
|
|
104
58
|
|
|
105
59
|
addPlugin({ commit }: any, plugin: Plugin) {
|