@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.
- package/assets/styles/app.scss +1 -1
- package/assets/styles/fonts/_fontstack.scss +11 -11
- package/assets/styles/vendor/vue-js-modal.scss +3 -3
- package/assets/translations/en-us.yaml +92 -22
- package/assets/translations/zh-hans.yaml +84 -15
- package/babel.config.js +13 -0
- package/chart/gatekeeper.vue +77 -0
- package/chart/istio.vue +108 -111
- package/chart/logging/index.vue +13 -4
- package/chart/monitoring/index.vue +15 -5
- package/chart/monitoring/steps/uninstall-v1.vue +2 -2
- package/chart/rancher-backup/index.vue +10 -3
- package/cloud-credential/aws.vue +1 -1
- package/cloud-credential/digitalocean.vue +1 -1
- package/cloud-credential/gcp.vue +1 -1
- package/cloud-credential/generic.vue +2 -2
- package/cloud-credential/linode.vue +1 -1
- package/cloud-credential/pnap.vue +1 -1
- package/components/ActionMenu.vue +3 -4
- package/components/AssignTo.vue +1 -1
- package/components/AsyncButton.vue +1 -1
- package/components/BannerGraphic.vue +1 -1
- package/components/ButtonDropdown.vue +2 -3
- package/components/ChartPsp.vue +76 -0
- package/components/CruResource.vue +6 -2
- package/components/DashboardMetrics.vue +12 -10
- package/components/DetailText.vue +1 -1
- package/components/DisableAuthProviderModal.vue +1 -1
- package/components/EmberPage.vue +1 -1
- package/components/EtcdInfoBanner.vue +5 -4
- package/components/ExplorerMembers.vue +1 -1
- package/components/ExplorerProjectsNamespaces.vue +14 -1
- package/components/FileDiff.vue +6 -7
- package/components/GrafanaDashboard.vue +18 -21
- package/components/LazyImage.vue +10 -12
- package/components/LogItem.vue +1 -1
- package/components/Markdown.vue +1 -1
- package/components/PromptRemove.vue +2 -2
- package/components/PromptRestore.vue +1 -1
- package/components/ResourceDetail/Masthead.vue +16 -0
- package/components/ResourceDetail/index.vue +21 -4
- package/components/ResourceList/index.vue +1 -1
- package/components/ResourceTable.vue +4 -1
- package/components/SingleClusterInfo.vue +2 -2
- package/components/SortableTable/THead.vue +1 -1
- package/components/SortableTable/index.vue +5 -2
- package/components/__tests__/AsyncButton.test.ts +3 -1
- package/components/__tests__/ChartPsp.test.ts +75 -0
- package/components/__tests__/CruResource.test.ts +3 -1
- package/components/auth/Principal.vue +1 -1
- package/components/fleet/FleetBundles.vue +3 -1
- package/components/fleet/FleetClusters.vue +1 -2
- package/components/fleet/FleetIntro.vue +9 -1
- package/components/fleet/FleetNoWorkspaces.vue +62 -0
- package/components/fleet/FleetSummary.vue +7 -1
- package/components/form/LabeledSelect.vue +14 -11
- package/components/form/MatchExpressions.vue +17 -2
- package/components/form/NameNsDescription.vue +31 -45
- package/components/form/ResourceSelector.vue +1 -1
- package/components/form/SecretSelector.vue +5 -1
- package/components/form/ServiceNameSelect.vue +1 -1
- package/components/form/SimpleSecretSelector.vue +9 -9
- package/components/form/__tests__/LabeledSelect.test.ts +138 -0
- package/components/form/__tests__/NameNsDescription.ts +32 -0
- package/components/formatter/InternalExternalIP.vue +6 -0
- package/components/formatter/InvolvedObjectLink.vue +54 -0
- package/components/formatter/Link.vue +20 -4
- package/components/formatter/LinkName.vue +6 -1
- package/components/formatter/ServiceTargets.vue +1 -1
- package/components/nav/Group.vue +2 -2
- package/components/nav/NamespaceFilter.vue +15 -11
- package/components/nav/TopLevelMenu.vue +2 -4
- package/components/nav/Type.vue +1 -1
- package/components/nav/WorkspaceSwitcher.vue +46 -5
- package/config/labels-annotations.js +17 -0
- package/config/product/auth.js +3 -2
- package/config/product/explorer.js +11 -4
- package/config/product/fleet.js +2 -0
- package/config/router.js +414 -0
- package/config/table-headers.js +10 -2
- package/config/types.js +11 -8
- package/config/uiplugins.js +30 -0
- package/content/docs/en-us/whats-new.md +10 -0
- package/content/docs/zh-hans/whats-new.md +11 -1
- package/core/plugin-routes.ts +23 -0
- package/creators/app/app.package.json +2 -1
- package/creators/app/files/.eslintrc.js +1 -1
- package/creators/app/files/babel.config.js +1 -18
- package/creators/app/files/vue.config.js +7 -0
- package/creators/app/init +5 -5
- package/creators/pkg/files/.github/workflows/build-extension.yml +111 -0
- package/creators/pkg/init +35 -4
- package/creators/update/init +1 -1
- package/detail/constraints.gatekeeper.sh.constraint.vue +20 -10
- package/detail/fleet.cattle.io.gitrepo.vue +19 -11
- package/detail/harvesterhci.io.management.cluster.vue +3 -3
- package/detail/provisioning.cattle.io.cluster.vue +54 -12
- package/detail/workload/index.vue +3 -3
- package/dialog/AddClusterMemberDialog.vue +1 -1
- package/dialog/AddProjectMemberDialog.vue +2 -2
- package/dialog/AddonConfigConfirmationDialog.vue +27 -15
- package/dialog/DiagnosticTimingsDialog.vue +1 -1
- package/dialog/ForceMachineRemoveDialog.vue +1 -1
- package/dialog/GenericPrompt.vue +18 -6
- package/dialog/RotateEncryptionKeyDialog.vue +1 -1
- package/dialog/SaveAsRKETemplateDialog.vue +1 -1
- package/dialog/ScaleMachineDownDialog.vue +1 -1
- package/edit/auth/github.vue +8 -8
- package/edit/auth/googleoauth.vue +5 -5
- package/edit/auth/ldap/index.vue +1 -1
- package/edit/auth/oidc.vue +1 -1
- package/edit/auth/saml.vue +1 -1
- package/edit/cis.cattle.io.clusterscan.vue +1 -1
- package/edit/fleet.cattle.io.clustergroup.vue +6 -4
- package/edit/fleet.cattle.io.gitrepo.vue +16 -3
- package/edit/helm.cattle.io.projecthelmchart.vue +5 -1
- package/edit/management.cattle.io.fleetworkspace.vue +141 -6
- package/edit/management.cattle.io.podsecurityadmissionconfigurationtemplate.vue +4 -1
- package/edit/management.cattle.io.setting.vue +1 -1
- package/edit/monitoring.coreos.com.alertmanagerconfig/types/webhook.vue +2 -2
- package/edit/monitoring.coreos.com.receiver/tls.vue +18 -18
- package/edit/monitoring.coreos.com.receiver/types/webhook.banner.vue +4 -4
- package/edit/monitoring.coreos.com.receiver/types/webhook.vue +1 -1
- package/edit/namespace.vue +2 -2
- package/edit/networking.k8s.io.networkpolicy/PolicyRuleTarget.vue +126 -45
- package/edit/networking.k8s.io.networkpolicy/index.vue +1 -1
- package/edit/provisioning.cattle.io.cluster/MachinePool.vue +10 -0
- package/edit/provisioning.cattle.io.cluster/RegistryConfigs.vue +1 -0
- package/edit/provisioning.cattle.io.cluster/__tests__/rke2.test.ts +202 -2
- package/edit/provisioning.cattle.io.cluster/rke2.vue +248 -84
- package/edit/resources.cattle.io.backup.vue +1 -1
- package/edit/service.vue +1 -1
- package/edit/storage.k8s.io.storageclass/provisioners/driver.harvesterhci.io.vue +2 -2
- package/edit/workload/__tests__/Job.test.ts +3 -1
- package/edit/workload/index.vue +8 -3
- package/edit/workload/mixins/workload.js +16 -0
- package/layouts/default.vue +7 -3
- package/list/fleet.cattle.io.bundle.vue +6 -3
- package/list/fleet.cattle.io.clusterregistrationtoken.vue +3 -1
- package/list/fleet.cattle.io.gitrepo.vue +44 -5
- package/list/management.cattle.io.fleetworkspace.vue +45 -0
- package/list/node.vue +69 -16
- package/list/provisioning.cattle.io.cluster.vue +30 -1
- package/machine-config/azure.vue +97 -38
- package/middleware/authenticated.js +34 -0
- package/mixins/chart.js +73 -2
- package/mixins/resource-fetch.js +2 -2
- package/models/apps.statefulset.js +28 -0
- package/models/cluster/node.js +23 -2
- package/models/cluster.x-k8s.io.machine.js +4 -2
- package/models/clusterroletemplatebinding.js +7 -0
- package/models/constraints.gatekeeper.sh.constraint.js +9 -0
- package/models/fleet.cattle.io.cluster.js +19 -10
- package/models/fleet.cattle.io.gitrepo.js +7 -2
- package/models/management.cattle.io.cluster.js +1 -1
- package/models/management.cattle.io.fleetworkspace.js +12 -0
- package/models/management.cattle.io.gitreporestriction.js +5 -0
- package/models/management.cattle.io.podsecurityadmissionconfigurationtemplate.js +3 -0
- package/models/provisioning.cattle.io.cluster.js +7 -5
- package/nuxt/App.js +210 -0
- package/nuxt/axios.js +186 -0
- package/nuxt/client.js +817 -0
- package/nuxt/components/nuxt-build-indicator.vue +143 -0
- package/nuxt/components/nuxt-child.js +122 -0
- package/nuxt/components/nuxt-error.vue +98 -0
- package/nuxt/components/nuxt-link.client.js +98 -0
- package/nuxt/components/nuxt-link.server.js +16 -0
- package/nuxt/components/nuxt-loading.vue +154 -0
- package/nuxt/components/nuxt.js +101 -0
- package/nuxt/cookie-universal-nuxt.js +9 -0
- package/nuxt/empty.js +1 -0
- package/nuxt/index.js +365 -0
- package/nuxt/jsonp.js +82 -0
- package/nuxt/loading.html +39 -0
- package/nuxt/middleware.js +12 -0
- package/nuxt/mixins/fetch.client.js +90 -0
- package/nuxt/mixins/fetch.server.js +69 -0
- package/nuxt/portal-vue.js +4 -0
- package/nuxt/server.js +312 -0
- package/nuxt/store.js +178 -0
- package/nuxt/utils.js +630 -0
- package/nuxt/views/app.template.html +9 -0
- package/nuxt/views/error.html +23 -0
- package/package.json +5 -9
- package/pages/auth/setup.vue +2 -2
- package/pages/c/_cluster/apps/charts/__tests__/install.helper.test.ts +33 -0
- package/pages/c/_cluster/apps/charts/chart.vue +4 -4
- package/pages/c/_cluster/apps/charts/install.helpers.js +26 -0
- package/pages/c/_cluster/apps/charts/install.vue +40 -66
- package/pages/c/_cluster/explorer/EventsTable.vue +5 -19
- package/pages/c/_cluster/explorer/index.vue +29 -25
- package/pages/c/_cluster/explorer/tools/index.vue +8 -8
- package/pages/c/_cluster/fleet/index.vue +95 -34
- package/pages/c/_cluster/gatekeeper/index.vue +1 -1
- package/pages/c/_cluster/istio/index.vue +5 -5
- package/pages/c/_cluster/manager/cloudCredential/index.vue +1 -1
- package/pages/c/_cluster/monitoring/index.vue +7 -0
- package/pages/c/_cluster/uiplugins/InstallDialog.vue +8 -8
- package/pages/c/_cluster/uiplugins/PluginInfoPanel.vue +20 -7
- package/pages/c/_cluster/uiplugins/index.vue +49 -17
- package/pages/home.vue +9 -4
- package/pages/index.vue +10 -1
- package/plugins/clean-html-directive.js +31 -0
- package/plugins/dashboard-store/actions.js +32 -9
- package/plugins/dashboard-store/mutations.js +5 -2
- package/plugins/dashboard-store/resource-class.js +8 -1
- package/plugins/steve/mutations.js +3 -2
- package/plugins/steve/steve-description-class.js +5 -1
- package/plugins/steve/subscribe.js +63 -54
- package/plugins/steve-create-worker.js +14 -0
- package/promptRemove/management.cattle.io.globalrole.vue +2 -2
- package/promptRemove/management.cattle.io.project.vue +2 -2
- package/promptRemove/management.cattle.io.roletemplate.vue +2 -2
- package/promptRemove/pod.vue +1 -1
- package/public/index.html +65 -0
- package/rancher-components/components/Banner/Banner.test.ts +9 -1
- package/rancher-components/components/Banner/Banner.vue +1 -1
- package/rancher-components/components/Form/Checkbox/Checkbox.vue +2 -0
- package/rancher-components/components/Form/Radio/RadioButton.vue +1 -1
- package/scripts/build-pkg.sh +1 -0
- package/scripts/clean +6 -0
- package/scripts/extension/bundle +58 -0
- package/scripts/extension/helmpatch +89 -0
- package/scripts/extension/publish +314 -0
- package/scripts/test-plugins-build.sh +4 -0
- package/store/__tests__/index.test.ts +110 -0
- package/store/index.js +145 -58
- package/store/type-map.js +5 -1
- package/tsconfig.default.json +36 -0
- package/tsconfig.json +24 -0
- package/types/shell/index.d.ts +420 -343
- package/utils/__tests__/string.test.ts +12 -0
- package/utils/auth.js +65 -0
- package/utils/monitoring.js +2 -1
- package/utils/position.js +5 -8
- package/utils/router.scrollBehavior.js +80 -0
- package/utils/select.js +1 -3
- package/utils/socket.js +1 -0
- package/utils/string.js +13 -0
- package/utils/time.js +9 -0
- package/vue.config.js +679 -0
- package/chart/rancher-alerting-drivers.vue +0 -53
- package/chart/rancher-gatekeeper.vue +0 -37
- package/creators/app/files/nuxt.config.js +0 -6
- package/models/management.cattle.io.podsecurityadmissionconfigurationtemplate.ts +0 -4
- package/nuxt.config.js +0 -798
package/store/index.js
CHANGED
|
@@ -55,89 +55,150 @@ export const plugins = [
|
|
|
55
55
|
}),
|
|
56
56
|
];
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
/**
|
|
59
|
+
* Get all the namespaces categories
|
|
60
|
+
* @returns Record<string, true>
|
|
61
|
+
*/
|
|
62
|
+
const getActiveNamespacesCategories = (getters, namespaces, filters) => {
|
|
63
|
+
// Split namespaces by category
|
|
64
|
+
const includeAll = getters.isAllNamespaces;
|
|
65
|
+
const includeSystem = filters.includes(ALL_SYSTEM);
|
|
66
|
+
const includeUser = filters.includes(ALL_USER);
|
|
67
|
+
const includeOrphans = filters.includes(ALL_ORPHANS);
|
|
68
|
+
|
|
69
|
+
// Categories to pull in all the user, system, or orphaned namespaces
|
|
70
|
+
const hasCategory = includeAll || includeOrphans || includeSystem || includeUser;
|
|
71
|
+
|
|
72
|
+
return hasCategory ? Object.values(namespaces).reduce((acc, ns) => {
|
|
73
|
+
if (
|
|
74
|
+
includeAll ||
|
|
75
|
+
(includeOrphans && !ns.projectId) ||
|
|
76
|
+
(includeUser && !ns.isSystem) ||
|
|
77
|
+
(includeSystem && ns.isSystem)
|
|
78
|
+
) {
|
|
79
|
+
acc[ns.id] = true;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return acc;
|
|
83
|
+
}, {}) : {};
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Get handpicked namespaces from the filters
|
|
88
|
+
* @returns Record<string, true>
|
|
89
|
+
*/
|
|
90
|
+
const getActiveSingleNamespaces = (getters, filters) => {
|
|
91
|
+
const activeNamespaces = {};
|
|
92
|
+
|
|
93
|
+
// Individual cases for stacked project and/or namespace filters
|
|
94
|
+
if ( !getters.isAllNamespaces ) {
|
|
95
|
+
const clusterId = getters['currentCluster']?.id;
|
|
96
|
+
|
|
97
|
+
for ( const filter of filters ) {
|
|
98
|
+
const [type, id] = filter.split('://', 2);
|
|
99
|
+
|
|
100
|
+
if ( !type ) {
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if ( type === 'ns' ) {
|
|
105
|
+
activeNamespaces[id] = true;
|
|
106
|
+
} else if (type === 'project') {
|
|
107
|
+
// Set all the namespaces contained in the project
|
|
108
|
+
const project = getters['management/byId'](MANAGEMENT.PROJECT, `${ clusterId }/${ id }`);
|
|
109
|
+
|
|
110
|
+
if ( project ) {
|
|
111
|
+
for ( const projectNamespace of project.namespaces ) {
|
|
112
|
+
activeNamespaces[projectNamespace.id] = true;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return activeNamespaces;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Get only namespaces for user with roles "Cluster Member" and "View All Projects"
|
|
124
|
+
* @returns Record<string, true>
|
|
125
|
+
*/
|
|
126
|
+
const getReadOnlyActiveNamespaces = (namespaces, activeNamespaces) => {
|
|
127
|
+
const readonlyNamespaces = Object
|
|
128
|
+
.values(namespaces)
|
|
129
|
+
.filter(ns => !!ns.links.update)
|
|
130
|
+
.map(({ id }) => id);
|
|
131
|
+
|
|
132
|
+
return Object.keys(activeNamespaces)
|
|
133
|
+
.filter(ns => readonlyNamespaces.includes(ns))
|
|
134
|
+
.reduce((acc, ns) => ({
|
|
135
|
+
...acc,
|
|
136
|
+
[ns]: true
|
|
137
|
+
}), {});
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Collect all the namespaces grouped by category, project or single pick
|
|
142
|
+
* @returns Record<string, true>
|
|
143
|
+
*/
|
|
144
|
+
const getActiveNamespaces = (state, getters, readonly = false) => {
|
|
60
145
|
const product = getters['currentProduct'];
|
|
61
|
-
const workspace = state.workspace;
|
|
62
146
|
|
|
63
147
|
if ( !product ) {
|
|
64
|
-
return
|
|
148
|
+
return {};
|
|
65
149
|
}
|
|
66
150
|
|
|
151
|
+
// TODO: Add comment with logic for fleet
|
|
67
152
|
if ( product.showWorkspaceSwitcher ) {
|
|
68
|
-
const fleetOut = { [workspace]: true };
|
|
153
|
+
const fleetOut = { [state.workspace]: true };
|
|
69
154
|
|
|
70
155
|
updateActiveNamespaceCache(state, fleetOut);
|
|
71
156
|
|
|
72
157
|
return fleetOut;
|
|
73
158
|
}
|
|
74
159
|
|
|
160
|
+
// Reset cache if no cluster is found or is not in store
|
|
75
161
|
const inStore = product?.inStore;
|
|
76
162
|
const clusterId = getters['currentCluster']?.id;
|
|
77
163
|
|
|
78
164
|
if ( !clusterId || !inStore ) {
|
|
79
|
-
updateActiveNamespaceCache(state,
|
|
165
|
+
updateActiveNamespaceCache(state, {});
|
|
80
166
|
|
|
81
|
-
return
|
|
167
|
+
return {};
|
|
82
168
|
}
|
|
83
169
|
|
|
84
|
-
|
|
170
|
+
// Use default "All Namespaces" category if no namespaces is found
|
|
171
|
+
const hasNamespaces = Array.isArray(state.allNamespaces) && state.allNamespaces.length > 0;
|
|
172
|
+
const allNamespaces = hasNamespaces ? state.allNamespaces : getters[`${ inStore }/all`](NAMESPACE);
|
|
85
173
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
namespaces = getters[`${ inStore }/all`](NAMESPACE);
|
|
90
|
-
}
|
|
174
|
+
const allowedNamespaces = allNamespaces
|
|
175
|
+
.filter(ns => state.prefs.data['all-namespaces'] ? true : !ns.isObscure) // Filter out Rancher system namespaces
|
|
176
|
+
.filter(ns => product.hideSystemResources ? !ns.isSystem : true); // Filter out Fleet system namespaces
|
|
91
177
|
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
const includeOrphans = filters.includes(ALL_ORPHANS);
|
|
178
|
+
// Retrieve all the filters selected by the user
|
|
179
|
+
const filters = state.namespaceFilters.filter(
|
|
180
|
+
filters => !!filters && !`${ filters }`.startsWith(NAMESPACED_PREFIX)
|
|
181
|
+
);
|
|
97
182
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
includeAll ||
|
|
103
|
-
( includeOrphans && !ns.projectId ) ||
|
|
104
|
-
( includeUser && !ns.isSystem ) ||
|
|
105
|
-
( includeSystem && ns.isSystem )
|
|
106
|
-
) {
|
|
107
|
-
out[ns.id] = true;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// Individual requests for a specific project/namespace
|
|
113
|
-
if ( !includeAll ) {
|
|
114
|
-
for ( const filter of filters ) {
|
|
115
|
-
const [type, id] = filter.split('://', 2);
|
|
116
|
-
|
|
117
|
-
if ( !type ) {
|
|
118
|
-
continue;
|
|
119
|
-
}
|
|
183
|
+
const activeNamespaces = {
|
|
184
|
+
...getActiveNamespacesCategories(getters, allowedNamespaces, filters),
|
|
185
|
+
...getActiveSingleNamespaces(getters, filters),
|
|
186
|
+
};
|
|
120
187
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
} else if ( type === 'project' ) {
|
|
124
|
-
const project = getters['management/byId'](MANAGEMENT.PROJECT, `${ clusterId }/${ id }`);
|
|
188
|
+
// Create map that can be used to efficiently check if a resource should be displayed
|
|
189
|
+
updateActiveNamespaceCache(state, activeNamespaces);
|
|
125
190
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
191
|
+
// Exclude namespaces restricted to the user for writing
|
|
192
|
+
if (readonly) {
|
|
193
|
+
return getReadOnlyActiveNamespaces(allowedNamespaces, activeNamespaces);
|
|
133
194
|
}
|
|
134
|
-
// Create map that can be used to efficiently check if a
|
|
135
|
-
// resource should be displayed
|
|
136
|
-
updateActiveNamespaceCache(state, out);
|
|
137
195
|
|
|
138
|
-
return
|
|
196
|
+
return activeNamespaces;
|
|
139
197
|
};
|
|
140
198
|
|
|
199
|
+
/**
|
|
200
|
+
* Caching side-effect while retrieving namespaces filters
|
|
201
|
+
*/
|
|
141
202
|
const updateActiveNamespaceCache = (state, activeNamespaceCache) => {
|
|
142
203
|
// This is going to run a lot, so keep it optimised
|
|
143
204
|
let cacheKey = '';
|
|
@@ -164,8 +225,8 @@ export const state = () => {
|
|
|
164
225
|
namespaceFilters: [],
|
|
165
226
|
activeNamespaceCache: {}, // Used to efficiently check if a resource should be displayed
|
|
166
227
|
activeNamespaceCacheKey: '', // Fingerprint of activeNamespaceCache
|
|
167
|
-
allNamespaces:
|
|
168
|
-
allWorkspaces:
|
|
228
|
+
allNamespaces: [],
|
|
229
|
+
allWorkspaces: [],
|
|
169
230
|
clusterId: null,
|
|
170
231
|
productId: null,
|
|
171
232
|
workspace: null,
|
|
@@ -241,6 +302,12 @@ export const getters = {
|
|
|
241
302
|
return out;
|
|
242
303
|
},
|
|
243
304
|
|
|
305
|
+
getStoreNameByProductId(state) {
|
|
306
|
+
const products = state['type-map']?.products;
|
|
307
|
+
|
|
308
|
+
return (products.find(p => p.name === state.productId) || {})?.inStore || 'cluster';
|
|
309
|
+
},
|
|
310
|
+
|
|
244
311
|
currentStore(state, getters) {
|
|
245
312
|
return (type) => {
|
|
246
313
|
const product = getters['currentProduct'];
|
|
@@ -404,6 +471,10 @@ export const getters = {
|
|
|
404
471
|
return state.namespaceFilters;
|
|
405
472
|
},
|
|
406
473
|
|
|
474
|
+
allNamespaces(state) {
|
|
475
|
+
return state.allNamespaces;
|
|
476
|
+
},
|
|
477
|
+
|
|
407
478
|
namespaces(state, getters) {
|
|
408
479
|
// Call this getter if you want to recompute the active namespaces
|
|
409
480
|
// by looping over all namespaces in a cluster. Otherwise call activeNamespaceCache,
|
|
@@ -412,6 +483,14 @@ export const getters = {
|
|
|
412
483
|
return () => getActiveNamespaces(state, getters);
|
|
413
484
|
},
|
|
414
485
|
|
|
486
|
+
/**
|
|
487
|
+
* Return namespaces which the user can refer to create resources
|
|
488
|
+
* @returns Record<string, true>
|
|
489
|
+
*/
|
|
490
|
+
allowedNamespaces(state, getters) {
|
|
491
|
+
return () => getActiveNamespaces(state, getters, true);
|
|
492
|
+
},
|
|
493
|
+
|
|
415
494
|
defaultNamespace(state, getters, rootState, rootGetters) {
|
|
416
495
|
const product = getters['currentProduct'];
|
|
417
496
|
|
|
@@ -529,6 +608,15 @@ export const mutations = {
|
|
|
529
608
|
getActiveNamespaces(state, getters);
|
|
530
609
|
},
|
|
531
610
|
|
|
611
|
+
changeAllNamespaces(state, namespace) {
|
|
612
|
+
// `allNamespaces/changeAllNamespaces` allow products to restrict the namespaces shown to the user in the NamespaceFilter and NameNsDescription components.
|
|
613
|
+
// You can configure the `notFilterNamespace` parameter for each resource page to define namespaces that do not need to be filtered, and then change `allNamespaces` by calling `changeAllNamespaces`
|
|
614
|
+
// eg:
|
|
615
|
+
// const notFilterNamespaces = this.$store.getters[`type-map/optionsFor`](resource).notFilterNamespace || [];
|
|
616
|
+
// const allNamespaces = this.$store.getters[`${ this.currentProduct.inStore }/filterNamespace`](notFilterNamespaces);
|
|
617
|
+
state.allNamespaces = namespace;
|
|
618
|
+
},
|
|
619
|
+
|
|
532
620
|
setNamespaceFilterMode(state, mode) {
|
|
533
621
|
state.namespaceFilterMode = mode;
|
|
534
622
|
},
|
|
@@ -552,7 +640,6 @@ export const mutations = {
|
|
|
552
640
|
}
|
|
553
641
|
|
|
554
642
|
state.workspace = value;
|
|
555
|
-
|
|
556
643
|
getActiveNamespaces(state, getters);
|
|
557
644
|
},
|
|
558
645
|
|
package/store/type-map.js
CHANGED
|
@@ -104,6 +104,8 @@
|
|
|
104
104
|
// customRoute: undefined,
|
|
105
105
|
// hasGraph: undefined -- If true, render ForceDirectedTreeChart graph (ATTENTION: option graphConfig is needed also!!!)
|
|
106
106
|
// graphConfig: undefined -- Use this to pass along the graph configuration
|
|
107
|
+
// notFilterNamespace: undefined -- Define namespaces that do not need to be filtered
|
|
108
|
+
// localOnly: False -- Hide this type from the nav/search bar on downstream clusters
|
|
107
109
|
// }
|
|
108
110
|
// )
|
|
109
111
|
// ignoreGroup(group): Never show group or any types in it
|
|
@@ -842,7 +844,7 @@ export const getters = {
|
|
|
842
844
|
|
|
843
845
|
allTypes(state, getters, rootState, rootGetters) {
|
|
844
846
|
return (product, mode = ALL) => {
|
|
845
|
-
const module = findBy(state.products, 'name', product)
|
|
847
|
+
const module = findBy(state.products, 'name', product)?.inStore;
|
|
846
848
|
const schemas = rootGetters[`${ module }/all`](SCHEMA);
|
|
847
849
|
const counts = rootGetters[`${ module }/all`](COUNT)?.[0]?.counts || {};
|
|
848
850
|
const isDev = rootGetters['prefs/get'](VIEW_IN_API);
|
|
@@ -869,6 +871,8 @@ export const getters = {
|
|
|
869
871
|
continue;
|
|
870
872
|
} else if ( typeof typeOptions.ifRancherCluster !== 'undefined' && typeOptions.ifRancherCluster !== rootGetters.isRancher ) {
|
|
871
873
|
continue;
|
|
874
|
+
} else if (typeOptions.localOnly && !rootGetters.currentCluster?.isLocal) {
|
|
875
|
+
continue;
|
|
872
876
|
}
|
|
873
877
|
|
|
874
878
|
out[schema.id] = {
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2018",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "Node",
|
|
6
|
+
"lib": [
|
|
7
|
+
"ESNext",
|
|
8
|
+
"ESNext.AsyncIterable",
|
|
9
|
+
"DOM"
|
|
10
|
+
],
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"allowJs": true,
|
|
13
|
+
"sourceMap": true,
|
|
14
|
+
"strict": true,
|
|
15
|
+
"noEmit": false,
|
|
16
|
+
"baseUrl": ".",
|
|
17
|
+
"rootDir": ".",
|
|
18
|
+
"paths": {
|
|
19
|
+
"~/*": [
|
|
20
|
+
"../*"
|
|
21
|
+
],
|
|
22
|
+
"@/*": [
|
|
23
|
+
"../*"
|
|
24
|
+
],
|
|
25
|
+
"@shell/*": [
|
|
26
|
+
"../shell/*"
|
|
27
|
+
],
|
|
28
|
+
"@pkg/*": [
|
|
29
|
+
"../shell/pkg/*"
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
"typeRoots": [
|
|
33
|
+
"./node_modules/@types"
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.default.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"types": [
|
|
5
|
+
"@types/node",
|
|
6
|
+
"@types/jest",
|
|
7
|
+
"@nuxt/types"
|
|
8
|
+
]
|
|
9
|
+
},
|
|
10
|
+
"exclude": [
|
|
11
|
+
"node_modules",
|
|
12
|
+
".nuxt",
|
|
13
|
+
"dist",
|
|
14
|
+
"dist-pkg",
|
|
15
|
+
"cypress",
|
|
16
|
+
"shell/creators",
|
|
17
|
+
"shell/scripts",
|
|
18
|
+
"cypress",
|
|
19
|
+
"./cypress.config.ts",
|
|
20
|
+
"docusaurus",
|
|
21
|
+
"script/standalone",
|
|
22
|
+
"**/*.spec.ts"
|
|
23
|
+
]
|
|
24
|
+
}
|