@rancher/shell 0.3.5 → 0.3.7

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 (120) hide show
  1. package/assets/images/providers/outscale.svg +19 -0
  2. package/assets/styles/base/_basic.scss +18 -0
  3. package/assets/styles/base/_mixins.scss +0 -11
  4. package/assets/styles/base/_variables.scss +2 -4
  5. package/assets/styles/global/_button.scss +12 -2
  6. package/assets/translations/en-us.yaml +35 -1
  7. package/assets/translations/zh-hans.yaml +30 -10
  8. package/chart/gatekeeper.vue +3 -2
  9. package/chart/istio.vue +29 -3
  10. package/components/BrandImage.vue +1 -4
  11. package/components/Carousel.vue +85 -37
  12. package/components/EtcdInfoBanner.vue +7 -3
  13. package/components/ExplorerMembers.vue +100 -5
  14. package/components/ExplorerProjectsNamespaces.vue +32 -2
  15. package/components/GrafanaDashboard.vue +9 -2
  16. package/components/SortableTable/index.vue +23 -11
  17. package/components/SortableTable/selection.js +58 -50
  18. package/components/Wizard.vue +4 -2
  19. package/components/auth/AuthBanner.vue +6 -0
  20. package/components/auth/RoleDetailEdit.vue +2 -2
  21. package/components/form/HookOption.vue +14 -10
  22. package/components/form/Labels.vue +32 -27
  23. package/components/form/MatchExpressions.vue +2 -2
  24. package/components/form/Members/ClusterPermissionsEditor.vue +32 -7
  25. package/components/form/NameNsDescription.vue +1 -1
  26. package/components/form/ProjectMemberEditor.vue +46 -21
  27. package/components/form/Tolerations.vue +4 -1
  28. package/components/form/ValueFromResource.vue +14 -9
  29. package/components/form/WorkloadPorts.vue +2 -2
  30. package/components/form/__tests__/NameNsDescription.ts +27 -0
  31. package/components/formatter/WorkloadHealthScale.vue +8 -2
  32. package/components/nav/NamespaceFilter.vue +8 -0
  33. package/{nuxt/components → components/nuxt}/nuxt.js +1 -1
  34. package/{nuxt → config}/middleware.js +8 -8
  35. package/config/product/explorer.js +24 -3
  36. package/config/query-params.js +1 -0
  37. package/config/router.js +1 -1
  38. package/{nuxt → config}/store.js +82 -79
  39. package/config/table-headers.js +46 -12
  40. package/config/types.js +7 -0
  41. package/core/plugin.ts +4 -2
  42. package/core/types.ts +258 -1
  43. package/creators/app/files/tsconfig.json +0 -1
  44. package/creators/app/files/vue.config.js +0 -1
  45. package/creators/pkg/files/.github/workflows/build-extension.yml +3 -4
  46. package/creators/pkg/files/tsconfig.json +0 -1
  47. package/creators/pkg/pkg.package.json +3 -3
  48. package/detail/constraints.gatekeeper.sh.constraint.vue +14 -7
  49. package/detail/fleet.cattle.io.clustergroup.vue +7 -1
  50. package/edit/auth/ldap/config.vue +21 -1
  51. package/edit/auth/saml.vue +132 -37
  52. package/edit/fleet.cattle.io.gitrepo.vue +16 -1
  53. package/edit/logging.banzaicloud.io.output/index.vue +18 -5
  54. package/edit/logging.banzaicloud.io.output/providers/loki.vue +1 -0
  55. package/edit/namespace.vue +12 -8
  56. package/edit/provisioning.cattle.io.cluster/MachinePool.vue +11 -4
  57. package/edit/provisioning.cattle.io.cluster/import.vue +23 -25
  58. package/edit/provisioning.cattle.io.cluster/rke2.vue +96 -18
  59. package/edit/workload/mixins/workload.js +6 -7
  60. package/edit/workload/storage/Mount.vue +3 -3
  61. package/initialize/App.js +206 -0
  62. package/{nuxt → initialize}/client.js +406 -360
  63. package/{nuxt → initialize}/index.js +21 -22
  64. package/layouts/standalone.vue +13 -0
  65. package/list/catalog.cattle.io.clusterrepo.vue +1 -0
  66. package/list/rbac.authorization.k8s.io.clusterrolebinding.vue +48 -0
  67. package/list/workload.vue +6 -4
  68. package/mixins/chart.js +29 -1
  69. package/mixins/fetch.client.js +95 -0
  70. package/{nuxt/mixins → mixins}/fetch.server.js +30 -26
  71. package/mixins/labeled-form-element.ts +2 -2
  72. package/models/constraints.gatekeeper.sh.constraint.js +37 -0
  73. package/models/pod.js +4 -0
  74. package/models/rbac.authorization.k8s.io.clusterrolebinding.js +16 -0
  75. package/models/rbac.authorization.k8s.io.rolebinding.js +16 -0
  76. package/package.json +9 -13
  77. package/pages/c/_cluster/apps/charts/install.vue +61 -39
  78. package/pages/diagnostic.vue +32 -25
  79. package/pages/rio/mesh.vue +1 -2
  80. package/pkg/tsconfig.json +0 -1
  81. package/plugins/clean-html-directive.js +3 -0
  82. package/plugins/dashboard-store/index.js +1 -1
  83. package/plugins/plugin.js +0 -14
  84. package/plugins/portal-vue.js +4 -0
  85. package/rancher-components/components/Banner/Banner.test.ts +3 -5
  86. package/rancher-components/components/Banner/Banner.vue +1 -0
  87. package/rancher-components/components/Form/Radio/RadioButton.test.ts +31 -0
  88. package/rancher-components/components/Form/Radio/RadioButton.vue +14 -3
  89. package/scripts/extension/publish +42 -23
  90. package/scripts/serve-pkgs +6 -2
  91. package/store/type-map.js +1 -1
  92. package/tsconfig.json +0 -1
  93. package/types/rancher/index.d.ts +2 -0
  94. package/types/shell/index.d.ts +353 -284
  95. package/utils/__tests__/grafana.test.ts +44 -0
  96. package/utils/axios.js +190 -0
  97. package/{nuxt → utils}/cookie-universal-nuxt.js +7 -6
  98. package/utils/dom.js +15 -0
  99. package/utils/gc/gc.ts +1 -1
  100. package/utils/grafana.js +35 -16
  101. package/{nuxt/utils.js → utils/nuxt.js} +265 -236
  102. package/utils/router.scrollBehavior.js +1 -1
  103. package/vue.config.js +30 -19
  104. package/nuxt/App.js +0 -210
  105. package/nuxt/axios.js +0 -186
  106. package/nuxt/empty.js +0 -1
  107. package/nuxt/jsonp.js +0 -82
  108. package/nuxt/loading.html +0 -39
  109. package/nuxt/mixins/fetch.client.js +0 -90
  110. package/nuxt/portal-vue.js +0 -4
  111. package/nuxt/server.js +0 -312
  112. package/nuxt/views/app.template.html +0 -9
  113. package/nuxt/views/error.html +0 -23
  114. package/plugins/dashboard-store/extensions.js +0 -22
  115. /package/{nuxt/components → components/nuxt}/nuxt-build-indicator.vue +0 -0
  116. /package/{nuxt/components → components/nuxt}/nuxt-child.js +0 -0
  117. /package/{nuxt/components → components/nuxt}/nuxt-error.vue +0 -0
  118. /package/{nuxt/components → components/nuxt}/nuxt-link.client.js +0 -0
  119. /package/{nuxt/components → components/nuxt}/nuxt-link.server.js +0 -0
  120. /package/{nuxt/components → components/nuxt}/nuxt-loading.vue +0 -0
@@ -276,7 +276,7 @@ export default {
276
276
  'show-ipam': showIpam,
277
277
  }"
278
278
  >
279
- <div class="service-type col">
279
+ <div class="service-type">
280
280
  <LabeledSelect
281
281
  v-model="row._serviceType"
282
282
  :mode="mode"
@@ -444,7 +444,7 @@ $checkbox: 75;
444
444
  }
445
445
  .ports-headers, .ports-row{
446
446
  display: grid;
447
- grid-template-columns: 20% 32% 145px 90px .5fr .5fr;
447
+ grid-template-columns: 28% 28% 15% 10% 75px 0.5fr;
448
448
  grid-column-gap: $column-gutter;
449
449
  margin-bottom: 10px;
450
450
  align-items: center;
@@ -29,4 +29,31 @@ describe('component: NameNsDescription', () => {
29
29
 
30
30
  expect((wrapper.vm as any).options).toStrictEqual(result);
31
31
  });
32
+
33
+ it('should emit in case of new namespace', () => {
34
+ const namespaceName = 'test';
35
+ const newNamespaceName = 'bananas';
36
+ const wrapper = mount(NameNsDescription, {
37
+ propsData: {
38
+ value: { metadata: {} },
39
+ mode: 'create',
40
+ },
41
+ mocks: {
42
+ $store: {
43
+ getters: {
44
+ namespaces: jest.fn(),
45
+ allowedNamespaces: () => ({ [namespaceName]: true }),
46
+ currentStore: () => 'cluster',
47
+ 'cluster/schemaFor': jest.fn(),
48
+ 'i18n/t': jest.fn()
49
+ },
50
+ },
51
+ $refs: { name: { focus: jest.fn() } }
52
+ }
53
+ });
54
+
55
+ (wrapper.vm as any).updateNamespace(newNamespaceName);
56
+
57
+ expect(wrapper.emitted().isNamespaceNew?.[0][0]).toBe(true);
58
+ });
32
59
  });
@@ -2,10 +2,11 @@
2
2
  import Vue from 'vue';
3
3
  import ProgressBarMulti from '@shell/components/ProgressBarMulti';
4
4
  import PlusMinus from '@shell/components/form/PlusMinus';
5
- import { SCALABLE_WORKLOAD_TYPES } from '@shell/config/types';
5
+ import { POD, SCALABLE_WORKLOAD_TYPES } from '@shell/config/types';
6
6
  import { ucFirst } from '@shell/utils/string';
7
7
 
8
8
  const SCALABLE_TYPES = Object.values(SCALABLE_WORKLOAD_TYPES);
9
+ const INVALID_TYPES = [POD];
9
10
 
10
11
  export default {
11
12
  components: { PlusMinus, ProgressBarMulti },
@@ -47,6 +48,10 @@ export default {
47
48
  return !!SCALABLE_TYPES.includes(this.row.type) && this.row.canUpdate;
48
49
  },
49
50
 
51
+ canShow() {
52
+ return !INVALID_TYPES.includes(this.row.type);
53
+ },
54
+
50
55
  parts() {
51
56
  return this.cParts;
52
57
  },
@@ -162,8 +167,9 @@ export default {
162
167
  </script>
163
168
 
164
169
  <template>
170
+ <div v-if="!canShow" />
165
171
  <div
166
- v-if="loading"
172
+ v-else-if="loading"
167
173
  class="hs-popover__loader"
168
174
  >
169
175
  <i class="icon icon-spinner" />
@@ -953,6 +953,14 @@ export default {
953
953
  color: var(--dropdown-hover-bg);
954
954
  }
955
955
  }
956
+
957
+ &:focus {
958
+ .ns-item {
959
+ > * {
960
+ color: var(--dropdown-hover-text);
961
+ }
962
+ }
963
+ }
956
964
  }
957
965
  }
958
966
 
@@ -1,5 +1,5 @@
1
1
  import Vue from 'vue'
2
- import { compile } from '../utils'
2
+ import { compile } from '../../utils/nuxt'
3
3
 
4
4
  import NuxtError from '../../layouts/error.vue'
5
5
 
@@ -1,12 +1,12 @@
1
- const middleware = {}
1
+ const middleware = {};
2
2
 
3
- middleware['authenticated'] = require('../middleware/authenticated.js')
4
- middleware['authenticated'] = middleware['authenticated'].default || middleware['authenticated']
3
+ middleware['authenticated'] = require('../middleware/authenticated.js');
4
+ middleware['authenticated'] = middleware['authenticated'].default || middleware['authenticated'];
5
5
 
6
- middleware['i18n'] = require('../middleware/i18n.js')
7
- middleware['i18n'] = middleware['i18n'].default || middleware['i18n']
6
+ middleware['i18n'] = require('../middleware/i18n.js');
7
+ middleware['i18n'] = middleware['i18n'].default || middleware['i18n'];
8
8
 
9
- middleware['unauthenticated'] = require('../middleware/unauthenticated.js')
10
- middleware['unauthenticated'] = middleware['unauthenticated'].default || middleware['unauthenticated']
9
+ middleware['unauthenticated'] = require('../middleware/unauthenticated.js');
10
+ middleware['unauthenticated'] = middleware['unauthenticated'].default || middleware['unauthenticated'];
11
11
 
12
- export default middleware
12
+ export default middleware;
@@ -18,7 +18,7 @@ import {
18
18
  STORAGE_CLASS_PROVISIONER, PERSISTENT_VOLUME_SOURCE,
19
19
  HPA_REFERENCE, MIN_REPLICA, MAX_REPLICA, CURRENT_REPLICA,
20
20
  ACCESS_KEY, DESCRIPTION, EXPIRES, EXPIRY_STATE, SUB_TYPE, AGE_NORMAN, SCOPE_NORMAN, PERSISTENT_VOLUME_CLAIM, RECLAIM_POLICY, PV_REASON, WORKLOAD_HEALTH_SCALE, POD_RESTARTS,
21
- DURATION, MESSAGE, REASON, LAST_SEEN_TIME, EVENT_TYPE, OBJECT,
21
+ DURATION, MESSAGE, REASON, LAST_SEEN_TIME, EVENT_TYPE, OBJECT, RBAC_GROUPS, RBAC_USERS, RBAC_SERVICE_ACCOUNTS, ROLE,
22
22
  } from '@shell/config/table-headers';
23
23
 
24
24
  import { DSL } from '@shell/store/type-map';
@@ -157,9 +157,9 @@ export function init(store) {
157
157
  listGroups: [
158
158
  {
159
159
  icon: 'icon-cluster',
160
- value: 'node',
160
+ value: 'role',
161
161
  field: 'groupByNode',
162
- hideColumn: NODE_COL.name,
162
+ hideColumn: 'groupByNode',
163
163
  tooltipKey: 'resourceTable.groupBy.node'
164
164
  }
165
165
  ]
@@ -224,9 +224,30 @@ export function init(store) {
224
224
  headers(RBAC.CLUSTER_ROLE, [
225
225
  STATE,
226
226
  NAME_COL,
227
+ AGE,
228
+ ]);
229
+
230
+ headers(RBAC.CLUSTER_ROLE_BINDING, [
231
+ STATE,
232
+ NAME_COL,
233
+ RBAC_GROUPS,
234
+ RBAC_USERS,
235
+ RBAC_SERVICE_ACCOUNTS, // groupname //roles // users// service accounts
227
236
  AGE
228
237
  ]);
229
238
 
239
+ configureType(MANAGEMENT.CLUSTER_ROLE_TEMPLATE_BINDING, {
240
+ listGroups: [
241
+ {
242
+ icon: 'icon-role-binding',
243
+ value: 'node',
244
+ field: 'roleDisplay',
245
+ hideColumn: ROLE.name,
246
+ tooltipKey: 'resourceTable.groupBy.role'
247
+ }
248
+ ]
249
+ });
250
+
230
251
  headers(MANAGEMENT.USER, [
231
252
  STATE,
232
253
  USER_ID,
@@ -73,3 +73,4 @@ export const CLOUD_CREDENTIAL = 'cloud';
73
73
 
74
74
  // NAMESPACE/PROJECT
75
75
  export const PROJECT_ID = 'projectId';
76
+ export const FLAT_VIEW = 'flatView';
package/config/router.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import Vue from 'vue';
2
2
  import Router from 'vue-router';
3
3
  import { normalizeURL } from 'ufo';
4
- import { interopDefault } from '../nuxt/utils';
4
+ import { interopDefault } from '../utils/nuxt';
5
5
  import scrollBehavior from '../utils/router.scrollBehavior.js';
6
6
 
7
7
  const emptyFn = () => {};
@@ -1,41 +1,41 @@
1
- import Vue from 'vue'
2
- import Vuex from 'vuex'
1
+ import Vue from 'vue';
2
+ import Vuex from 'vuex';
3
3
 
4
- Vue.use(Vuex)
4
+ Vue.use(Vuex);
5
5
 
6
- const VUEX_PROPERTIES = ['state', 'getters', 'actions', 'mutations']
6
+ const VUEX_PROPERTIES = ['state', 'getters', 'actions', 'mutations'];
7
7
 
8
8
  let store = {};
9
9
 
10
- (function updateModules () {
11
- store = normalizeRoot(require('../store/index.js'), 'store/index.js')
10
+ (function updateModules() {
11
+ store = normalizeRoot(require('../store/index.js'), 'store/index.js');
12
12
 
13
13
  // If store is an exported method = classic mode (deprecated)
14
14
 
15
15
  if (typeof store === 'function') {
16
- return console.warn('Classic mode for store/ is deprecated and will be removed in Nuxt 3.')
16
+ return console.warn('Classic mode for store/ is deprecated and will be removed in Nuxt 3.'); // eslint-disable-line no-console
17
17
  }
18
18
 
19
19
  // Enforce store modules
20
- store.modules = store.modules || {}
21
-
22
- resolveStoreModules(require('../store/action-menu.js'), 'action-menu.js')
23
- resolveStoreModules(require('../store/auth.js'), 'auth.js')
24
- resolveStoreModules(require('../store/aws.js'), 'aws.js')
25
- resolveStoreModules(require('../store/catalog.js'), 'catalog.js')
26
- resolveStoreModules(require('../store/digitalocean.js'), 'digitalocean.js')
27
- resolveStoreModules(require('../store/features.js'), 'features.js')
28
- resolveStoreModules(require('../store/github.js'), 'github.js')
29
- resolveStoreModules(require('../store/growl.js'), 'growl.js')
30
- resolveStoreModules(require('../store/i18n.js'), 'i18n.js')
31
- resolveStoreModules(require('../store/linode.js'), 'linode.js')
32
- resolveStoreModules(require('../store/plugins.js'), 'plugins.js')
33
- resolveStoreModules(require('../store/pnap.js'), 'pnap.js')
34
- resolveStoreModules(require('../store/prefs.js'), 'prefs.js')
35
- resolveStoreModules(require('../store/resource-fetch.js'), 'resource-fetch.js')
36
- resolveStoreModules(require('../store/type-map.js'), 'type-map.js')
37
- resolveStoreModules(require('../store/uiplugins.ts'), 'uiplugins.ts')
38
- resolveStoreModules(require('../store/wm.js'), 'wm.js')
20
+ store.modules = store.modules || {};
21
+
22
+ resolveStoreModules(require('../store/action-menu.js'), 'action-menu.js');
23
+ resolveStoreModules(require('../store/auth.js'), 'auth.js');
24
+ resolveStoreModules(require('../store/aws.js'), 'aws.js');
25
+ resolveStoreModules(require('../store/catalog.js'), 'catalog.js');
26
+ resolveStoreModules(require('../store/digitalocean.js'), 'digitalocean.js');
27
+ resolveStoreModules(require('../store/features.js'), 'features.js');
28
+ resolveStoreModules(require('../store/github.js'), 'github.js');
29
+ resolveStoreModules(require('../store/growl.js'), 'growl.js');
30
+ resolveStoreModules(require('../store/i18n.js'), 'i18n.js');
31
+ resolveStoreModules(require('../store/linode.js'), 'linode.js');
32
+ resolveStoreModules(require('../store/plugins.js'), 'plugins.js');
33
+ resolveStoreModules(require('../store/pnap.js'), 'pnap.js');
34
+ resolveStoreModules(require('../store/prefs.js'), 'prefs.js');
35
+ resolveStoreModules(require('../store/resource-fetch.js'), 'resource-fetch.js');
36
+ resolveStoreModules(require('../store/type-map.js'), 'type-map.js');
37
+ resolveStoreModules(require('../store/uiplugins.ts'), 'uiplugins.ts');
38
+ resolveStoreModules(require('../store/wm.js'), 'wm.js');
39
39
 
40
40
  // If the environment supports hot reloading...
41
41
 
@@ -62,117 +62,120 @@ let store = {};
62
62
  '../store/wm.js',
63
63
  ], () => {
64
64
  // Update `root.modules` with the latest definitions.
65
- updateModules()
65
+ updateModules();
66
66
  // Trigger a hot update in the store.
67
- window.$nuxt.$store.hotUpdate(store)
68
- })
67
+ window.$nuxt.$store.hotUpdate(store);
68
+ });
69
69
  }
70
- })()
70
+ })();
71
71
 
72
72
  // createStore
73
73
  export const createStore = store instanceof Function ? store : () => {
74
- return new Vuex.Store(Object.assign({
75
- strict: (process.env.NODE_ENV !== 'production')
76
- }, store))
77
- }
74
+ return new Vuex.Store(Object.assign({ strict: (process.env.NODE_ENV !== 'production') }, store));
75
+ };
78
76
 
79
- function normalizeRoot (moduleData, filePath) {
80
- moduleData = moduleData.default || moduleData
77
+ function normalizeRoot(moduleData, filePath) {
78
+ moduleData = moduleData.default || moduleData;
81
79
 
82
80
  if (moduleData.commit) {
83
- throw new Error(`[nuxt] ${filePath} should export a method that returns a Vuex instance.`)
81
+ throw new Error(`[nuxt] ${ filePath } should export a method that returns a Vuex instance.`);
84
82
  }
85
83
 
86
84
  if (typeof moduleData !== 'function') {
87
85
  // Avoid TypeError: setting a property that has only a getter when overwriting top level keys
88
- moduleData = Object.assign({}, moduleData)
86
+ moduleData = Object.assign({}, moduleData);
89
87
  }
90
- return normalizeModule(moduleData, filePath)
88
+
89
+ return normalizeModule(moduleData, filePath);
91
90
  }
92
91
 
93
- function normalizeModule (moduleData, filePath) {
92
+ function normalizeModule(moduleData, filePath) {
94
93
  if (moduleData.state && typeof moduleData.state !== 'function') {
95
- console.warn(`'state' should be a method that returns an object in ${filePath}`)
94
+ console.warn(`'state' should be a method that returns an object in ${ filePath }`); // eslint-disable-line no-console
95
+
96
+ const state = Object.assign({}, moduleData.state);
96
97
 
97
- const state = Object.assign({}, moduleData.state)
98
98
  // Avoid TypeError: setting a property that has only a getter when overwriting top level keys
99
- moduleData = Object.assign({}, moduleData, { state: () => state })
99
+ moduleData = Object.assign({}, moduleData, { state: () => state });
100
100
  }
101
- return moduleData
101
+
102
+ return moduleData;
102
103
  }
103
104
 
104
- function resolveStoreModules (moduleData, filename) {
105
- moduleData = moduleData.default || moduleData
105
+ function resolveStoreModules(moduleData, filename) {
106
+ moduleData = moduleData.default || moduleData;
106
107
  // Remove store src + extension (./foo/index.js -> foo/index)
107
- const namespace = filename.replace(/\.(js|mjs|ts)$/, '')
108
- const namespaces = namespace.split('/')
109
- let moduleName = namespaces[namespaces.length - 1]
110
- const filePath = `store/${filename}`
108
+ const namespace = filename.replace(/\.(js|mjs|ts)$/, '');
109
+ const namespaces = namespace.split('/');
110
+ let moduleName = namespaces[namespaces.length - 1];
111
+ const filePath = `store/${ filename }`;
111
112
 
112
- moduleData = moduleName === 'state'
113
- ? normalizeState(moduleData, filePath)
114
- : normalizeModule(moduleData, filePath)
113
+ moduleData = moduleName === 'state' ? normalizeState(moduleData, filePath) : normalizeModule(moduleData, filePath);
115
114
 
116
115
  // If src is a known Vuex property
117
116
  if (VUEX_PROPERTIES.includes(moduleName)) {
118
- const property = moduleName
119
- const propertyStoreModule = getStoreModule(store, namespaces, { isProperty: true })
117
+ const property = moduleName;
118
+ const propertyStoreModule = getStoreModule(store, namespaces, { isProperty: true });
120
119
 
121
120
  // Replace state since it's a function
122
- mergeProperty(propertyStoreModule, moduleData, property)
123
- return
121
+ mergeProperty(propertyStoreModule, moduleData, property);
122
+
123
+ return;
124
124
  }
125
125
 
126
126
  // If file is foo/index.js, it should be saved as foo
127
- const isIndexModule = (moduleName === 'index')
127
+ const isIndexModule = (moduleName === 'index');
128
+
128
129
  if (isIndexModule) {
129
- namespaces.pop()
130
- moduleName = namespaces[namespaces.length - 1]
130
+ namespaces.pop();
131
+ moduleName = namespaces[namespaces.length - 1];
131
132
  }
132
133
 
133
- const storeModule = getStoreModule(store, namespaces)
134
+ const storeModule = getStoreModule(store, namespaces);
134
135
 
135
136
  for (const property of VUEX_PROPERTIES) {
136
- mergeProperty(storeModule, moduleData[property], property)
137
+ mergeProperty(storeModule, moduleData[property], property);
137
138
  }
138
139
 
139
140
  if (moduleData.namespaced === false) {
140
- delete storeModule.namespaced
141
+ delete storeModule.namespaced;
141
142
  }
142
143
  }
143
144
 
144
- function normalizeState (moduleData, filePath) {
145
+ function normalizeState(moduleData, filePath) {
145
146
  if (typeof moduleData !== 'function') {
146
- console.warn(`${filePath} should export a method that returns an object`)
147
- const state = Object.assign({}, moduleData)
148
- return () => state
147
+ console.warn(`${ filePath } should export a method that returns an object`); // eslint-disable-line no-console
148
+ const state = Object.assign({}, moduleData);
149
+
150
+ return () => state;
149
151
  }
150
- return normalizeModule(moduleData, filePath)
152
+
153
+ return normalizeModule(moduleData, filePath);
151
154
  }
152
155
 
153
- function getStoreModule (storeModule, namespaces, { isProperty = false } = {}) {
156
+ function getStoreModule(storeModule, namespaces, { isProperty = false } = {}) {
154
157
  // If ./mutations.js
155
158
  if (!namespaces.length || (isProperty && namespaces.length === 1)) {
156
- return storeModule
159
+ return storeModule;
157
160
  }
158
161
 
159
- const namespace = namespaces.shift()
162
+ const namespace = namespaces.shift();
160
163
 
161
- storeModule.modules[namespace] = storeModule.modules[namespace] || {}
162
- storeModule.modules[namespace].namespaced = true
163
- storeModule.modules[namespace].modules = storeModule.modules[namespace].modules || {}
164
+ storeModule.modules[namespace] = storeModule.modules[namespace] || {};
165
+ storeModule.modules[namespace].namespaced = true;
166
+ storeModule.modules[namespace].modules = storeModule.modules[namespace].modules || {};
164
167
 
165
- return getStoreModule(storeModule.modules[namespace], namespaces, { isProperty })
168
+ return getStoreModule(storeModule.modules[namespace], namespaces, { isProperty });
166
169
  }
167
170
 
168
- function mergeProperty (storeModule, moduleData, property) {
171
+ function mergeProperty(storeModule, moduleData, property) {
169
172
  if (!moduleData) {
170
- return
173
+ return;
171
174
  }
172
175
 
173
176
  if (property === 'state') {
174
- storeModule.state = moduleData || storeModule.state
177
+ storeModule.state = moduleData || storeModule.state;
175
178
  } else {
176
- storeModule[property] = Object.assign({}, storeModule[property], moduleData)
179
+ storeModule[property] = Object.assign({}, storeModule[property], moduleData);
177
180
  }
178
181
  }
@@ -718,7 +718,7 @@ export const APP_SUMMARY = {
718
718
 
719
719
  export const CONSTRAINT_VIOLATION_CONSTRAINT_LINK = {
720
720
  name: 'Constraint',
721
- label: 'Constraint',
721
+ labelKey: 'tableHeaders.constraint',
722
722
  value: 'constraintLink',
723
723
  sort: `constraintLink.text`,
724
724
  formatter: 'Link',
@@ -727,30 +727,39 @@ export const CONSTRAINT_VIOLATION_CONSTRAINT_LINK = {
727
727
 
728
728
  export const CONSTRAINT_VIOLATION_RESOURCE_LINK = {
729
729
  name: 'Name',
730
- label: 'Name',
730
+ labelKey: 'tableHeaders.name',
731
731
  value: 'resourceLink',
732
732
  sort: `resourceLink.text`,
733
+ search: `resourceLink.text`,
733
734
  formatter: 'Link',
734
735
  formatterOpts: { options: { internal: true } },
735
736
  };
736
737
 
737
738
  export const CONSTRAINT_VIOLATION_TYPE = {
738
- name: 'Type',
739
- label: 'Type',
740
- value: `kind`,
741
- sort: `kind`
739
+ name: 'Type',
740
+ labelKey: 'tableHeaders.type',
741
+ value: `kind`,
742
+ sort: `kind`
743
+ };
744
+
745
+ export const CONSTRAINT_VIOLATION_NAMESPACE = {
746
+ name: 'Namespace',
747
+ labelKey: 'tableHeaders.namespace',
748
+ value: `namespace`,
749
+ sort: `namespace`,
750
+ search: `namespace`,
742
751
  };
743
752
 
744
753
  export const CONSTRAINT_VIOLATION_MESSAGE = {
745
- name: 'Message',
746
- label: 'Message',
747
- value: `message`,
748
- sort: `message`
754
+ name: 'Message',
755
+ labelKey: 'tableHeaders.message',
756
+ value: `message`,
757
+ sort: `message`
749
758
  };
750
759
 
751
760
  export const CONSTRAINT_VIOLATION_TEMPLATE_LINK = {
752
761
  name: 'TemplateLink',
753
- label: 'Template',
762
+ labelKey: 'tableHeaders.template',
754
763
  value: `templateLink`,
755
764
  sort: `templateLink.text`,
756
765
  formatter: 'Link',
@@ -759,7 +768,7 @@ export const CONSTRAINT_VIOLATION_TEMPLATE_LINK = {
759
768
 
760
769
  export const CONSTRAINT_VIOLATION_COUNT = {
761
770
  name: 'Count',
762
- label: 'Count',
771
+ labelKey: 'tableHeaders.count',
763
772
  value: `count`,
764
773
  sort: `count`,
765
774
  formatter: 'QualityText',
@@ -960,3 +969,28 @@ export const FLEET_BUNDLE_TYPE = {
960
969
  sort: ['bundleType'],
961
970
  width: 100,
962
971
  };
972
+
973
+ // export const RBAC_ROLE = {
974
+ // name: 'role',
975
+ // value: 'roleRef.name',
976
+ // sort: ['roleRef.name'],
977
+ // };
978
+
979
+ export const RBAC_USERS = {
980
+ name: 'users',
981
+ sort: ['users'],
982
+ getValue: row => row.users?.map(({ name }) => name),
983
+ };
984
+
985
+ export const RBAC_GROUPS = {
986
+ name: 'groups',
987
+ sort: ['groups'],
988
+
989
+ getValue: row => row.groups?.map(({ name }) => name),
990
+ };
991
+
992
+ export const RBAC_SERVICE_ACCOUNTS = {
993
+ name: 'serviceAccount',
994
+ sort: ['serviceAccount'],
995
+ getValue: row => row.serviceAccounts?.map(({ name }) => name),
996
+ };
package/config/types.js CHANGED
@@ -66,6 +66,8 @@ export const STORAGE_CLASS = 'storage.k8s.io.storageclass';
66
66
  export const CSI_DRIVER = 'storage.k8s.io.csidriver';
67
67
  export const OBJECT_META = 'io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta';
68
68
  export const NETWORK_ATTACHMENT = 'k8s.cni.cncf.io.networkattachmentdefinition';
69
+ export const USER = 'user';
70
+ export const GROUP = 'group';
69
71
 
70
72
  export const RBAC = {
71
73
  ROLE: 'rbac.authorization.k8s.io.role',
@@ -93,6 +95,11 @@ const {
93
95
 
94
96
  export const SCALABLE_WORKLOAD_TYPES = scalableWorkloads;
95
97
 
98
+ export const LIST_WORKLOAD_TYPES = {
99
+ ...WORKLOAD_TYPES,
100
+ POD
101
+ };
102
+
96
103
  export const METRIC = {
97
104
  NODE: 'metrics.k8s.io.nodemetrics',
98
105
  POD: 'metrics.k8s.io.podmetrics',
package/core/plugin.ts CHANGED
@@ -16,13 +16,15 @@ import {
16
16
  PluginRouteConfig, RegisterStore, UnregisterStore, CoreStoreSpecifics, CoreStoreConfig, OnNavToPackage, OnNavAwayFromPackage, OnLogOut
17
17
  } from '@shell/core/types';
18
18
 
19
+ export type ProductFunction = (plugin: IPlugin, store: any) => void;
20
+
19
21
  export class Plugin implements IPlugin {
20
22
  public id: string;
21
23
  public name: string;
22
24
  public types: any = {};
23
25
  public l10n: { [key: string]: Function[] } = {};
24
26
  public locales: { locale: string, label: string}[] = [];
25
- public products: Function[] = [];
27
+ public products: ProductFunction[] = [];
26
28
  public productNames: string[] = [];
27
29
  public routes: { parent?: string, route: RouteConfig }[] = [];
28
30
  public stores: { storeName: string, register: RegisterStore, unregister: UnregisterStore }[] = [];
@@ -83,7 +85,7 @@ export class Plugin implements IPlugin {
83
85
  return storeDSL;
84
86
  }
85
87
 
86
- addProduct(product: Function): void {
88
+ addProduct(product: ProductFunction): void {
87
89
  this.products.push(product);
88
90
  }
89
91