@rancher/shell 0.3.11 → 0.3.13

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 (95) hide show
  1. package/assets/translations/en-us.yaml +51 -5
  2. package/chart/monitoring/StorageClassSelector.vue +1 -0
  3. package/chart/monitoring/index.vue +4 -0
  4. package/chart/monitoring/prometheus/index.vue +6 -3
  5. package/components/ActionMenu.vue +1 -1
  6. package/components/DetailTop.vue +0 -2
  7. package/components/ExplorerMembers.vue +22 -10
  8. package/components/ExplorerProjectsNamespaces.vue +1 -0
  9. package/components/GrafanaDashboard.vue +2 -2
  10. package/components/Inactivity.vue +1 -0
  11. package/components/ModalWithCard.vue +1 -0
  12. package/components/Tabbed/index.vue +2 -0
  13. package/components/Wizard.vue +4 -3
  14. package/components/form/KeyValue.vue +12 -7
  15. package/components/form/NodeAffinity.vue +29 -7
  16. package/components/form/PodAffinity.vue +27 -7
  17. package/components/form/Taints.vue +6 -0
  18. package/components/formatter/ExtensionCache.vue +74 -0
  19. package/components/nav/Header.vue +1 -0
  20. package/components/nav/WindowManager/ContainerShell.vue +10 -0
  21. package/components/nav/WindowManager/index.vue +1 -0
  22. package/config/product/explorer.js +1 -10
  23. package/config/product/monitoring.js +2 -1
  24. package/config/router.js +3 -3
  25. package/config/table-headers.js +32 -24
  26. package/config/uiplugins.js +11 -0
  27. package/config/workload.ts +1 -0
  28. package/core/types.ts +25 -7
  29. package/creators/pkg/files/.github/workflows/build-container.yml +64 -0
  30. package/creators/pkg/init +13 -6
  31. package/detail/node.vue +2 -2
  32. package/detail/workload/index.vue +1 -1
  33. package/edit/__tests__/management.cattle.io.setting.test.ts +1 -1
  34. package/edit/__tests__/namespace.test.ts +46 -0
  35. package/edit/autoscaling.horizontalpodautoscaler/metric-target.vue +0 -2
  36. package/edit/logging.banzaicloud.io.output/__tests__/logging.banzaicloud.io.output.test.ts +43 -0
  37. package/edit/logging.banzaicloud.io.output/index.vue +8 -5
  38. package/edit/logging.banzaicloud.io.output/providers/__tests__/loki.test.ts +13 -0
  39. package/edit/logging.banzaicloud.io.output/providers/loki.vue +1 -0
  40. package/edit/monitoring.coreos.com.alertmanagerconfig/receiverConfig.vue +0 -2
  41. package/edit/monitoring.coreos.com.receiver/index.vue +32 -1
  42. package/edit/monitoring.coreos.com.receiver/types/email.vue +12 -4
  43. package/edit/namespace.vue +2 -1
  44. package/edit/provisioning.cattle.io.cluster/MachinePool.vue +36 -6
  45. package/edit/provisioning.cattle.io.cluster/__tests__/rke2.test.ts +2 -2
  46. package/edit/provisioning.cattle.io.cluster/rke2.vue +58 -13
  47. package/middleware/authenticated.js +1 -0
  48. package/models/__tests__/batch.cronjob.test.ts +88 -0
  49. package/models/cluster/node.js +8 -0
  50. package/models/management.cattle.io.clusterroletemplatebinding.js +5 -1
  51. package/models/projectroletemplatebinding.js +9 -1
  52. package/models/workload.js +1 -1
  53. package/package.json +1 -1
  54. package/pages/__tests__/prefs.test.ts +96 -0
  55. package/pages/auth/setup.vue +13 -13
  56. package/pages/c/_cluster/apps/charts/chart.vue +1 -1
  57. package/pages/c/_cluster/apps/charts/install.vue +5 -2
  58. package/pages/c/_cluster/monitoring/index.vue +10 -5
  59. package/pages/c/_cluster/settings/performance.vue +2 -0
  60. package/pages/c/_cluster/uiplugins/CatalogList/CatalogLoadDialog.vue +601 -0
  61. package/pages/c/_cluster/uiplugins/CatalogList/index.vue +183 -0
  62. package/pages/c/_cluster/uiplugins/UninstallDialog.vue +50 -9
  63. package/pages/c/_cluster/uiplugins/index.vue +329 -224
  64. package/pages/fail-whale.vue +1 -1
  65. package/pages/home.vue +11 -0
  66. package/pages/prefs.vue +20 -1
  67. package/plugins/plugin.js +1 -1
  68. package/public/index.html +6 -1
  69. package/rancher-components/components/Card/Card.vue +1 -0
  70. package/rancher-components/components/Form/Radio/RadioGroup.vue +1 -0
  71. package/scripts/extension/bundle +20 -4
  72. package/scripts/extension/helm/charts/ui-plugin-server/.helmignore +23 -0
  73. package/scripts/extension/helm/charts/ui-plugin-server/Chart.yaml +20 -0
  74. package/scripts/extension/helm/charts/ui-plugin-server/templates/_helpers.tpl +52 -0
  75. package/scripts/extension/helm/charts/ui-plugin-server/templates/cr.yaml +12 -0
  76. package/scripts/extension/helm/charts/ui-plugin-server/values.yaml +6 -0
  77. package/scripts/extension/helm/package/Dockerfile +27 -0
  78. package/scripts/extension/helm/package/nginx.conf +17 -0
  79. package/scripts/extension/helm/scripts/package +23 -0
  80. package/scripts/extension/helm/scripts/patch +101 -0
  81. package/scripts/extension/helm/scripts/version +31 -0
  82. package/scripts/extension/helmpatch +3 -25
  83. package/scripts/extension/publish +50 -33
  84. package/types/shell/index.d.ts +39 -33
  85. package/utils/__tests__/grafana.test.ts +2 -2
  86. package/utils/error.js +11 -0
  87. package/utils/grafana.js +5 -4
  88. package/vue.config.js +3 -17
  89. package/components/.DS_Store +0 -0
  90. package/components/__tests__/.DS_Store +0 -0
  91. package/creators/pkg/package-lock.json +0 -37
  92. package/rancher-components/StringList/StringList.test.ts +0 -80
  93. package/rancher-components/StringList/StringList.vue +0 -593
  94. package/rancher-components/StringList/index.ts +0 -1
  95. package/yarn-error.log +0 -196
@@ -1,593 +0,0 @@
1
- <script lang="ts">
2
- import Vue, { PropType } from 'vue';
3
-
4
- import LabeledInput from '@components/Form/LabeledInput/LabeledInput.vue';
5
- import { findStringIndex, hasDuplicatedStrings } from '@shell/utils/array';
6
-
7
- type Error = 'duplicate';
8
- type ErrorMessages = Record<Error, string>;
9
-
10
- type Arrow = 'up' | 'down';
11
-
12
- const DIRECTION: Record<Arrow, number> = {
13
- up: -1,
14
- down: 1,
15
- };
16
-
17
- const INPUT = {
18
- create: 'item-create',
19
- edit: 'item-edit',
20
- };
21
-
22
- const BOX = 'box';
23
-
24
- const CLASS = {
25
- item: 'item',
26
- error: 'error',
27
- };
28
-
29
- /**
30
- * Manage a list of strings
31
- */
32
- export default Vue.extend({
33
- components: { LabeledInput },
34
-
35
- name: 'StringList',
36
-
37
- props: {
38
- /**
39
- * The items source
40
- */
41
- items: {
42
- type: Array as PropType<string[]>,
43
- default() {
44
- return [];
45
- },
46
- },
47
- /**
48
- * Determines if items with same text will be treated differently, depending on the letters case
49
- * It is used to compare items during create/edit actions and detect duplicates.
50
- */
51
- caseSensitive: {
52
- type: Boolean,
53
- default: false,
54
- },
55
- /**
56
- * Determines if the list of items is editable or view-only
57
- */
58
- readonly: {
59
- type: Boolean,
60
- default: false,
61
- },
62
- /**
63
- * The placeholder to show in input field when create or edit items
64
- */
65
- placeholder: {
66
- type: String,
67
- default: null,
68
- },
69
- /**
70
- * Determines the action buttons position at the bottom of the main box
71
- */
72
- actionsPosition: {
73
- type: String,
74
- default: 'right',
75
- },
76
- /**
77
- * Custom Error messages
78
- */
79
- errorMessages: {
80
- type: Object as PropType<ErrorMessages>,
81
- default() {
82
- return {} as ErrorMessages;
83
- },
84
- },
85
- },
86
- data() {
87
- return {
88
- value: null as string | null,
89
- selected: null as string | null,
90
- editedItem: null as string | null,
91
- isCreateItem: false,
92
- errors: { duplicate: false } as Record<Error, boolean>
93
- };
94
- },
95
-
96
- computed: {
97
-
98
- /**
99
- * Create an array of error messages, one for each current error
100
- */
101
- errorMessagesArray(): string[] {
102
- return (Object.keys(this.errors) as Error[])
103
- .filter(f => this.errors[f] && this.errorMessages[f])
104
- .map(k => this.errorMessages[k]);
105
- },
106
- },
107
-
108
- watch: {
109
- /**
110
- * Shutdown any user actions on the component when it becomes readonly
111
- */
112
- readonly() {
113
- this.toggleEditMode(false);
114
- this.toggleCreateMode(false);
115
- },
116
- errors: {
117
- handler(val) {
118
- this.$emit('errors', val);
119
- },
120
- deep: true
121
- }
122
- },
123
-
124
- methods: {
125
- onChange(value: string) {
126
- this.value = value;
127
-
128
- const items = [
129
- ...this.items,
130
- this.value
131
- ];
132
-
133
- this.toggleError(
134
- 'duplicate',
135
- hasDuplicatedStrings(items, this.caseSensitive),
136
- this.isCreateItem ? INPUT.create : INPUT.edit
137
- );
138
- },
139
-
140
- onSelect(item: string) {
141
- if (this.readonly || this.isCreateItem || this.editedItem === item) {
142
- return;
143
- }
144
- this.selected = item;
145
- },
146
-
147
- onSelectNext(arrow: Arrow) {
148
- const index = findStringIndex(
149
- this.items,
150
- this.selected as string,
151
- );
152
-
153
- if (index !== -1) {
154
- /**
155
- * Select next item in the arrow's direction if it exists,
156
- * else select again this.selected (do nothing)
157
- */
158
- const item = (this.items[index + DIRECTION[arrow]] || this.selected) as string;
159
-
160
- this.onSelect(item);
161
- this.moveScrollbar(arrow);
162
- }
163
- },
164
-
165
- onSelectLeave(item?: string) {
166
- if (item === this.selected) {
167
- this.selected = null;
168
- }
169
- },
170
-
171
- onClickEmptyBody() {
172
- if (!this.isCreateItem && !this.editedItem) {
173
- this.toggleCreateMode(true);
174
- }
175
- },
176
-
177
- onClickPlusButton() {
178
- this.onSelectLeave();
179
- this.toggleCreateMode(true);
180
- },
181
-
182
- onClickMinusButton() {
183
- if (this.isCreateItem) {
184
- this.toggleCreateMode(false);
185
-
186
- return;
187
- }
188
- if (this.editedItem) {
189
- this.toggleEditMode(false);
190
-
191
- return;
192
- }
193
- if (this.selected) {
194
- const index = findStringIndex(this.items, this.selected, false);
195
-
196
- if (index !== -1) {
197
- /**
198
- * Select the next item in the list when an item is to be deleted.
199
- */
200
- const item = (this.items[index + 1] || this.items[index - 1]);
201
-
202
- this.onSelect(item);
203
- this.setFocus(item);
204
-
205
- this.deleteItem(this.items[index]);
206
- }
207
- }
208
- },
209
-
210
- setFocus(refId: string) {
211
- this.$nextTick(() => this.getElemByRef(refId)?.focus());
212
- },
213
-
214
- /**
215
- * Move scrollbar when the selected item is over the top or bottom side of the box
216
- */
217
- moveScrollbar(arrow: Arrow, value?: number) {
218
- const box = this.getElemByRef(BOX);
219
- const item = this.getElemByRef(this.selected || '');
220
-
221
- if (box && item && item.className.includes(CLASS.item)) {
222
- const boxRect = box.getClientRects()[0];
223
- const itemRect = item.getClientRects()[0];
224
-
225
- if (
226
- (arrow === 'down' && itemRect.bottom > boxRect.bottom) ||
227
- (arrow === 'up' && itemRect.top < boxRect.top)
228
- ) {
229
- const top = (value ?? itemRect.height) * DIRECTION[arrow];
230
-
231
- box.scrollBy({ top });
232
- }
233
- }
234
- },
235
-
236
- /**
237
- * Set an error and eventually assign an error class to the element
238
- */
239
- toggleError(type: Error, val: boolean, refId?: string) {
240
- this.errors[type] = val;
241
-
242
- if (refId) {
243
- this.toggleErrorClass(refId, val);
244
- }
245
- },
246
-
247
- toggleErrorClass(refId: string, val: boolean) {
248
- const input = this.getElemByRef(refId)?.$el;
249
-
250
- if (input) {
251
- if (val) {
252
- input.classList.add(CLASS.error);
253
- } else {
254
- input.classList.remove(CLASS.error);
255
- }
256
- }
257
- },
258
-
259
- /**
260
- * Show/Hide the input line to create new item
261
- */
262
- toggleCreateMode(show: boolean) {
263
- if (this.readonly) {
264
- return;
265
- }
266
- if (show) {
267
- this.toggleEditMode(false);
268
- this.value = '';
269
-
270
- this.isCreateItem = true;
271
- this.setFocus(INPUT.create);
272
- } else {
273
- this.value = null;
274
- this.toggleError('duplicate', false);
275
- this.onSelectLeave();
276
-
277
- this.isCreateItem = false;
278
- }
279
- },
280
-
281
- /**
282
- * Show/Hide the in-line editing to edit an existing item
283
- */
284
- toggleEditMode(show: boolean, item?: string) {
285
- if (this.readonly) {
286
- return;
287
- }
288
- if (show) {
289
- this.toggleCreateMode(false);
290
- this.value = this.editedItem;
291
-
292
- this.editedItem = item || '';
293
- this.setFocus(INPUT.edit);
294
- } else {
295
- this.value = null;
296
- this.toggleError('duplicate', false);
297
- this.onSelectLeave();
298
-
299
- this.editedItem = null;
300
- }
301
- },
302
-
303
- getElemByRef(id: string) {
304
- const ref = this.$refs[id];
305
-
306
- return (Array.isArray(ref) ? ref[0] : ref) as any;
307
- },
308
-
309
- /**
310
- * Create a new item and insert in the items list
311
- */
312
- saveItem(closeInput = true) {
313
- const value = this.value?.trim();
314
-
315
- if (value) {
316
- const items = [
317
- ...this.items,
318
- value,
319
- ];
320
-
321
- if (!hasDuplicatedStrings(items, this.caseSensitive)) {
322
- this.updateItems(items);
323
- }
324
- }
325
-
326
- if (closeInput) {
327
- this.toggleCreateMode(false);
328
- }
329
- },
330
-
331
- /**
332
- * Update an existing item in the items list
333
- */
334
- updateItem(item: string, closeInput = true) {
335
- const value = this.value?.trim();
336
-
337
- if (value) {
338
- const items = [...this.items];
339
- const index = findStringIndex(items, item, false);
340
-
341
- if (index !== -1) {
342
- items[index] = value;
343
- }
344
-
345
- if (!hasDuplicatedStrings(items, this.caseSensitive)) {
346
- this.updateItems(items);
347
- }
348
- }
349
-
350
- if (closeInput) {
351
- this.toggleEditMode(false);
352
- }
353
- },
354
-
355
- /**
356
- * Remove an item from items list
357
- */
358
- deleteItem(item?: string) {
359
- const items = this.items.filter(f => f !== item);
360
-
361
- this.updateItems(items);
362
- },
363
-
364
- /**
365
- * Update items list and emit to parent component
366
- */
367
- updateItems(items: string[]) {
368
- this.$emit('change', items);
369
- },
370
- },
371
-
372
- });
373
- </script>
374
-
375
- <template>
376
- <div
377
- class="string-list"
378
- :class="{ readonly }"
379
- >
380
- <div
381
- ref="box"
382
- data-testid="div-string-list-box"
383
- class="string-list-box"
384
- tabindex="0"
385
- @dblclick="onClickEmptyBody()"
386
- >
387
- <div
388
- v-for="item in items"
389
- :key="item"
390
- :ref="item"
391
- :class="{
392
- selected: selected === item,
393
- readonly
394
- }"
395
- :data-testid="`div-item-${item}`"
396
- class="item static"
397
- tabindex="0"
398
- @mousedown="onSelect(item)"
399
- @dblclick.stop="toggleEditMode(true, item)"
400
- @keydown.down.prevent="onSelectNext('down')"
401
- @keydown.up.prevent="onSelectNext('up')"
402
- @blur="onSelectLeave(item)"
403
- >
404
- <span
405
- v-if="!editedItem || editedItem !== item"
406
- class="label static"
407
- >
408
- {{ item }}
409
- </span>
410
- <LabeledInput
411
- v-if="editedItem && editedItem === item"
412
- ref="item-edit"
413
- class="edit-input static"
414
- :value="value != null ? value : item"
415
- @input="onChange($event)"
416
- @blur.prevent="updateItem(item)"
417
- @keydown.native.enter="updateItem(item, !errors.duplicate)"
418
- />
419
- </div>
420
- <div
421
- v-if="isCreateItem"
422
- class="create-field static"
423
- >
424
- <LabeledInput
425
- ref="item-create"
426
- class="create-input static"
427
- type="text"
428
- :value="value"
429
- :placeholder="placeholder"
430
- @input="onChange($event)"
431
- @blur.prevent="saveItem"
432
- @keydown.native.enter="saveItem(!errors.duplicate)"
433
- />
434
- </div>
435
- </div>
436
- <div
437
- v-if="!readonly"
438
- class="string-list-footer"
439
- :class="{[actionsPosition]: true }"
440
- >
441
- <div
442
- data-testid="div-action-buttons"
443
- class="action-buttons"
444
- >
445
- <button
446
- class="btn btn-sm role-tertiary remove-button"
447
- :disabled="!selected && !isCreateItem && !editedItem"
448
- @mousedown.prevent="onClickMinusButton"
449
- >
450
- <span class="icon icon-minus icon-sm" />
451
- </button>
452
- <button
453
- class="btn btn-sm role-tertiary add-button"
454
- :disabled="isCreateItem || editedItem"
455
- @click.prevent="onClickPlusButton"
456
- >
457
- <span class="icon icon-plus icon-sm" />
458
- </button>
459
- </div>
460
- <div class="messages">
461
- <i v-if="errorMessagesArray.length > 0" class="icon icon-warning icon-lg" />
462
- <span
463
- v-for="(msg, idx) in errorMessagesArray"
464
- :key="idx"
465
- class="error"
466
- >
467
- {{ idx > 0 ? '; ' : '' }}
468
- {{ msg }}
469
- </span>
470
- </div>
471
- </div>
472
- </div>
473
- </template>
474
-
475
- <style lang="scss" scoped>
476
-
477
- .string-list {
478
- display: flex;
479
- flex-direction: column;
480
- width: auto;
481
-
482
- &.readonly {
483
- cursor: default;
484
- opacity: 0.4;
485
- }
486
-
487
- .string-list-box {
488
- min-height: 200px;
489
- height: 100%;
490
- outline: none;
491
- overflow-y: auto;
492
- overflow-x: hidden;
493
- border: solid var(--border-width) var(--input-border);
494
- padding-top: 3px;
495
-
496
- .static {
497
- height: 25px;
498
- padding: 3px;
499
- }
500
-
501
- .item {
502
- outline: none;
503
-
504
- &.selected {
505
- background: var(--primary);
506
- color: var(--primary-hover-text);
507
- }
508
-
509
- &.readonly {
510
- pointer-events: none;
511
- }
512
-
513
- .label {
514
- display: block;
515
- width: auto;
516
- user-select: none;
517
- overflow: hidden;
518
- text-overflow: ellipsis;
519
- padding-top: 1px;
520
- }
521
- }
522
-
523
- .create-field {
524
- padding-top: 1px;
525
- margin-bottom: 7px;
526
- }
527
-
528
- .labeled-input {
529
- padding-top: 0;
530
- padding-bottom: 0;
531
- border-radius: 0;
532
- &.error {
533
- border: none;
534
- box-shadow: 0 0 0 var(--outline-width) var(--error);
535
- }
536
- }
537
- }
538
-
539
- .string-list-footer {
540
- --footer-height: 28px;
541
- height: var(--footer-height);
542
- margin-top: 5px;
543
- display: flex;
544
- justify-content: space-between;
545
- gap: 0.5rem;
546
-
547
- &.left {
548
- flex-direction: row;
549
- }
550
-
551
- &.right {
552
- flex-direction: row-reverse;
553
- }
554
-
555
- .action-buttons {
556
- display: flex;
557
- flex-direction: row-reverse;
558
- gap: 0.5rem;
559
-
560
- .btn {
561
- min-height: var(--footer-height);
562
- line-height: 0;
563
- border-radius: 2px;
564
-
565
- &:disabled {
566
- cursor: default;
567
- pointer-events: none;
568
- }
569
- }
570
- }
571
-
572
- .messages {
573
- line-height: var(--footer-height);
574
-
575
- .error, .icon-warning {
576
- color: var(--error);
577
- line-height: inherit;
578
- }
579
- }
580
- }
581
- }
582
-
583
- ::v-deep {
584
- .labeled-input INPUT.no-label,
585
- .labeled-input INPUT:hover.no-label,
586
- .labeled-input INPUT:focus.no-label {
587
- padding: 1px 0px 0px 0px;
588
- }
589
- .labeled-input.compact-input {
590
- min-height: 0;
591
- }
592
- }
593
- </style>
@@ -1 +0,0 @@
1
- export { default as StringList } from './StringList.vue';