@rancher/shell 0.1.21 → 0.2.1

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 (32) hide show
  1. package/assets/styles/global/_button.scss +1 -0
  2. package/assets/translations/en-us.yaml +48 -6
  3. package/assets/translations/zh-hans.yaml +18 -0
  4. package/components/HarvesterServiceAddOnConfig.vue +10 -10
  5. package/components/ResourceList/index.vue +34 -14
  6. package/components/ResourceTable.vue +19 -0
  7. package/components/SortableTable/THead.vue +311 -70
  8. package/components/SortableTable/advanced-filtering.js +272 -0
  9. package/components/SortableTable/filtering.js +90 -29
  10. package/components/SortableTable/index.vue +474 -271
  11. package/components/form/WorkloadPorts.vue +2 -2
  12. package/config/product/settings.js +1 -0
  13. package/config/product/uiplugins.js +1 -0
  14. package/config/uiplugins.js +13 -0
  15. package/creators/app/init +2 -2
  16. package/creators/app/package.json +1 -1
  17. package/creators/pkg/package.json +1 -1
  18. package/detail/provisioning.cattle.io.cluster.vue +1 -1
  19. package/edit/provisioning.cattle.io.cluster/ACE.vue +2 -1
  20. package/edit/provisioning.cattle.io.cluster/DrainOptions.vue +0 -1
  21. package/edit/provisioning.cattle.io.cluster/rke2.vue +25 -24
  22. package/edit/service.vue +1 -1
  23. package/models/management.cattle.io.cluster.js +9 -1
  24. package/package.json +1 -1
  25. package/pages/c/_cluster/apps/charts/install.vue +119 -31
  26. package/pages/c/_cluster/uiplugins/InstallDialog.vue +1 -1
  27. package/pages/c/_cluster/uiplugins/PluginInfoPanel.vue +5 -2
  28. package/pages/c/_cluster/uiplugins/UninstallDialog.vue +1 -1
  29. package/pages/c/_cluster/uiplugins/index.vue +48 -11
  30. package/promptRemove/mixin/roleDeletionCheck.js +15 -1
  31. package/scripts/record-deps.js +3 -3
  32. package/store/type-map.js +2 -0
@@ -6,7 +6,7 @@ import { sortBy } from '@shell/utils/sort';
6
6
  import { allHash } from '@shell/utils/promise';
7
7
  import { CATALOG, UI_PLUGIN, SERVICE } from '@shell/config/types';
8
8
  import { CATALOG as CATALOG_ANNOTATIONS } from '@shell/config/labels-annotations';
9
-
9
+ import { NAME as APP_PRODUCT } from '@shell/config/product/apps';
10
10
  import ActionMenu from '@shell/components/ActionMenu';
11
11
  import Tabbed from '@shell/components/Tabbed/index.vue';
12
12
  import Tab from '@shell/components/Tabbed/Tab.vue';
@@ -18,7 +18,14 @@ import DeveloperInstallDialog from './DeveloperInstallDialog.vue';
18
18
  import PluginInfoPanel from './PluginInfoPanel.vue';
19
19
  import SetupUIPlugins from './SetupUIPlugins';
20
20
  import RemoveUIPlugins from './RemoveUIPlugins';
21
- import { isUIPlugin, uiPluginHasAnnotation, isSupportedChartVersion, UI_PLUGIN_NAMESPACE } from '@shell/config/uiplugins';
21
+ import {
22
+ isUIPlugin,
23
+ uiPluginAnnotation,
24
+ uiPluginHasAnnotation,
25
+ isSupportedChartVersion,
26
+ UI_PLUGIN_NAMESPACE,
27
+ UI_PLUGIN_CHART_ANNOTATIONS
28
+ } from '@shell/config/uiplugins';
22
29
 
23
30
  const MAX_DESCRIPTION_LENGTH = 200;
24
31
 
@@ -100,17 +107,25 @@ export default {
100
107
  menuActions() {
101
108
  const menuActions = [];
102
109
 
110
+ // Add link to go to the Repos view of the local cluster
111
+ menuActions.push({
112
+ action: 'manageRepos',
113
+ label: this.t('plugins.manageRepos'),
114
+ enabled: true
115
+ });
116
+
103
117
  // Only show Developer Load action if the user has this enabled in preferences
104
118
  if (this.pluginDeveloper) {
119
+ menuActions.push( { divider: true });
105
120
  menuActions.push({
106
121
  action: 'devLoad',
107
122
  label: this.t('plugins.developer.label'),
108
123
  enabled: true
109
124
  });
110
- menuActions.push( { divider: true });
111
125
  }
112
126
 
113
127
  if (this.hasService) {
128
+ menuActions.push( { divider: true });
114
129
  menuActions.push({
115
130
  action: 'removePluginSupport',
116
131
  label: this.t('plugins.setup.remove.label'),
@@ -156,8 +171,11 @@ export default {
156
171
  all = all.filter(c => !uiPluginHasAnnotation(c, CATALOG_ANNOTATIONS.HIDDEN, 'true'));
157
172
 
158
173
  all = all.map((chart) => {
174
+ // Label can be overridden by chart annotation
175
+ const label = uiPluginAnnotation(UI_PLUGIN_CHART_ANNOTATIONS.DISPLAY_NAME) || chart.chartNameDisplay;
159
176
  const item = {
160
177
  name: chart.chartNameDisplay,
178
+ label,
161
179
  description: chart.chartDescription,
162
180
  id: chart.id,
163
181
  versions: [],
@@ -197,7 +215,9 @@ export default {
197
215
  // A pluign is loaded, but there is no chart, so add an item so that it shows up
198
216
  const item = {
199
217
  name: p.name,
218
+ label: p.name,
200
219
  description: p.metadata?.description,
220
+ icon: p.metadata?.icon,
201
221
  id: p.id,
202
222
  versions: [],
203
223
  displayVersion: p.metadata?.version || '-',
@@ -229,6 +249,7 @@ export default {
229
249
  // No chart, so add a card for the plugin based on its Custom resource being present
230
250
  const item = {
231
251
  name: p.name,
252
+ label: p.name,
232
253
  description: p.description || '-',
233
254
  id: `${ p.name }-${ p.version }`,
234
255
  versions: [],
@@ -317,11 +338,11 @@ export default {
317
338
 
318
339
  plugins(neu, old) {
319
340
  const installed = this.$store.getters['uiplugins/plugins'];
320
-
341
+ const shouldHaveLoaded = (installed || []).filter(p => !this.uiErrors[p.name] && !p.builtin);
321
342
  let changes = 0;
322
343
 
323
344
  // Did the user remove an extension
324
- if (neu?.length < installed.length) {
345
+ if (neu?.length < shouldHaveLoaded.length) {
325
346
  changes++;
326
347
  }
327
348
 
@@ -329,7 +350,9 @@ export default {
329
350
  const existing = installed.find(p => !p.removed && p.name === plugin.name && p.version === plugin.version);
330
351
 
331
352
  if (!existing && plugin.isCached) {
332
- changes++;
353
+ if (!this.uiErrors[plugin.name]) {
354
+ changes++;
355
+ }
333
356
 
334
357
  this.updatePluginInstallStatus(plugin.name, false);
335
358
  }
@@ -441,6 +464,17 @@ export default {
441
464
 
442
465
  reload() {
443
466
  this.$router.go();
467
+ },
468
+
469
+ manageRepos() {
470
+ this.$router.push({
471
+ name: 'c-cluster-product-resource',
472
+ params: {
473
+ cluster: 'local',
474
+ product: APP_PRODUCT,
475
+ resource: CATALOG.CLUSTER_REPO
476
+ }
477
+ });
444
478
  }
445
479
  }
446
480
  };
@@ -479,6 +513,7 @@ export default {
479
513
  @close="setMenu(false)"
480
514
  @devLoad="showDeveloperLoaddDialog"
481
515
  @removePluginSupport="removePluginSupport"
516
+ @manageRepos="manageRepos"
482
517
  />
483
518
  </div>
484
519
 
@@ -528,12 +563,9 @@ export default {
528
563
  </div>
529
564
  <div class="plugin-metadata">
530
565
  <div class="plugin-name">
531
- {{ plugin.name }}
566
+ {{ plugin.label }}
532
567
  </div>
533
568
  <div>{{ plugin.description }}</div>
534
- <div v-if="plugin.builtin" class="plugin-builtin">
535
- {{ t('plugins.labels.builtin') }}
536
- </div>
537
569
  <div class="plugin-version">
538
570
  <span v-if="plugin.installing === 'uninstall'" class="plugin-installing">
539
571
  -
@@ -543,7 +575,12 @@ export default {
543
575
  <span v-if="plugin.upgrade" v-tooltip="t('plugins.upgradeAvailable')"> -> {{ plugin.upgrade }}</span>
544
576
  </span>
545
577
  </div>
546
- <div class="plugin-badges">
578
+ <div v-if="plugin.builtin" class="plugin-badges">
579
+ <div class="plugin-builtin">
580
+ {{ t('plugins.labels.builtin') }}
581
+ </div>
582
+ </div>
583
+ <div v-else class="plugin-badges">
547
584
  <div v-if="!plugin.certified" v-tooltip="t('plugins.descriptions.third-party')">
548
585
  {{ t('plugins.labels.third-party') }}
549
586
  </div>
@@ -66,12 +66,26 @@ export default {
66
66
  method: 'get',
67
67
  }, { root: true });
68
68
 
69
+ // We need to fetch the users here in order to get an accurate count when selecting global roles.
70
+ const users = await this.$store.dispatch('management/request', {
71
+ url: `/v1/${ MANAGEMENT.USER }`,
72
+ method: 'get',
73
+ }, { root: true });
74
+
75
+ const userMap = users.data?.reduce((map, user) => {
76
+ if ( user.username ) {
77
+ map[user.id] = user;
78
+ }
79
+
80
+ return map;
81
+ }, {});
82
+
69
83
  if (request.data && request.data.length) {
70
84
  rolesToRemove.forEach((toRemove) => {
71
85
  const usedRoles = request.data.filter(item => item[propToMatch] === toRemove.id);
72
86
 
73
87
  if (usedRoles.length) {
74
- const uniqueUsers = [...new Set(usedRoles.map(item => item.userName))];
88
+ const uniqueUsers = [...new Set(usedRoles.map(item => item.userName).filter(user => userMap[user]))];
75
89
 
76
90
  if (uniqueUsers.length) {
77
91
  numberOfRolesWithBinds++;
@@ -2,7 +2,7 @@ const fs = require('fs');
2
2
  const path = require('path');
3
3
 
4
4
  // Script lives in shell/scripts, so work out top-level dir from there
5
- const topDir = path.resolve(__dirname, '..', '..')
5
+ const topDir = path.resolve(__dirname, '..', '..');
6
6
  const dir = process.cwd();
7
7
 
8
8
  // Read the package.json file
@@ -17,10 +17,10 @@ if (mainPkg._requires) {
17
17
  // Map each one to the same version as the main package
18
18
  const out = {};
19
19
 
20
- mainPkg._requires.forEach(name => {
20
+ mainPkg._requires.forEach((name) => {
21
21
  let ver = topPkg.dependencies?.[name] || topPkg.devDependencies?.[name];
22
22
 
23
- if (name === '@rancher/components') {
23
+ if (name === '@rancher/components') {
24
24
  const componentsPkgFile = path.join(topDir, 'pkg', 'rancher-components', 'package.json');
25
25
  const componentsPkg = JSON.parse(fs.readFileSync(componentsPkgFile));
26
26
 
package/store/type-map.js CHANGED
@@ -218,6 +218,8 @@ export function DSL(store, product, module = 'type-map') {
218
218
  headers.forEach((header) => {
219
219
  // If on the client, then use the value getter if there is one
220
220
  if (header.getValue) {
221
+ // we need to store the .value prop for the advanced filtering
222
+ header.valueProp = header.value;
221
223
  header.value = header.getValue;
222
224
  }
223
225