@rancher/shell 2.0.0 → 2.0.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 (73) hide show
  1. package/assets/translations/en-us.yaml +18 -3
  2. package/components/AlertTable.vue +17 -7
  3. package/components/GrafanaDashboard.vue +6 -4
  4. package/components/PromptRemove.vue +1 -0
  5. package/components/form/KeyValue.vue +1 -0
  6. package/components/form/Taints.vue +13 -7
  7. package/components/form/__tests__/Taints.test.ts +70 -0
  8. package/components/nav/Header.vue +1 -1
  9. package/components/nav/TopLevelMenu.vue +1 -4
  10. package/config/product/auth.js +1 -1
  11. package/config/router/navigation-guards/i18n.js +13 -0
  12. package/config/router/navigation-guards/index.js +2 -1
  13. package/creators/app/app.package.json +2 -1
  14. package/detail/__tests__/provisioning.cattle.io.cluster.test.ts +42 -0
  15. package/detail/provisioning.cattle.io.cluster.vue +4 -4
  16. package/dialog/DeactivateDriverDialog.vue +30 -11
  17. package/edit/auth/__tests__/oidc.test.ts +2 -2
  18. package/edit/token.vue +2 -1
  19. package/initialize/entry-helpers.js +10 -13
  20. package/list/management.cattle.io.feature.vue +4 -2
  21. package/middleware/authenticated.js +0 -19
  22. package/mixins/auth-config.js +1 -1
  23. package/models/driver.js +3 -2
  24. package/models/kontainerdriver.js +30 -13
  25. package/models/management.cattle.io.authconfig.js +2 -2
  26. package/models/nodedriver.js +30 -13
  27. package/package.json +3 -2
  28. package/pages/c/_cluster/apps/charts/install.vue +3 -2
  29. package/pages/c/_cluster/manager/drivers/kontainerDriver/index.vue +0 -3
  30. package/pages/c/_cluster/manager/drivers/nodeDriver/index.vue +1 -4
  31. package/pages/c/_cluster/uiplugins/InstallDialog.vue +2 -1
  32. package/promptRemove/pod.vue +15 -7
  33. package/scripts/publish-shell.sh +1 -0
  34. package/store/auth.js +1 -1
  35. package/store/index.js +1 -1
  36. package/utils/__tests__/kontainer.test.ts +89 -1
  37. package/utils/auth.js +1 -1
  38. package/utils/kontainer.ts +5 -1
  39. package/utils/version.js +2 -1
  40. package/rancher-components/components/Accordion/Accordion.test.ts +0 -45
  41. package/rancher-components/components/Accordion/Accordion.vue +0 -86
  42. package/rancher-components/components/Accordion/index.ts +0 -1
  43. package/rancher-components/components/BadgeState/BadgeState.test.ts +0 -12
  44. package/rancher-components/components/BadgeState/BadgeState.vue +0 -111
  45. package/rancher-components/components/BadgeState/index.ts +0 -1
  46. package/rancher-components/components/Banner/Banner.test.ts +0 -59
  47. package/rancher-components/components/Banner/Banner.vue +0 -244
  48. package/rancher-components/components/Banner/index.ts +0 -1
  49. package/rancher-components/components/Card/Card.test.ts +0 -37
  50. package/rancher-components/components/Card/Card.vue +0 -167
  51. package/rancher-components/components/Card/index.ts +0 -1
  52. package/rancher-components/components/Form/Checkbox/Checkbox.test.ts +0 -68
  53. package/rancher-components/components/Form/Checkbox/Checkbox.vue +0 -421
  54. package/rancher-components/components/Form/Checkbox/index.ts +0 -1
  55. package/rancher-components/components/Form/LabeledInput/LabeledInput.test.ts +0 -40
  56. package/rancher-components/components/Form/LabeledInput/LabeledInput.vue +0 -402
  57. package/rancher-components/components/Form/LabeledInput/index.ts +0 -1
  58. package/rancher-components/components/Form/Radio/RadioButton.test.ts +0 -33
  59. package/rancher-components/components/Form/Radio/RadioButton.vue +0 -293
  60. package/rancher-components/components/Form/Radio/RadioGroup.test.ts +0 -30
  61. package/rancher-components/components/Form/Radio/RadioGroup.vue +0 -259
  62. package/rancher-components/components/Form/Radio/index.ts +0 -2
  63. package/rancher-components/components/Form/TextArea/TextAreaAutoGrow.vue +0 -172
  64. package/rancher-components/components/Form/TextArea/index.ts +0 -1
  65. package/rancher-components/components/Form/ToggleSwitch/ToggleSwitch.test.ts +0 -94
  66. package/rancher-components/components/Form/ToggleSwitch/ToggleSwitch.vue +0 -152
  67. package/rancher-components/components/Form/ToggleSwitch/index.ts +0 -1
  68. package/rancher-components/components/Form/index.ts +0 -5
  69. package/rancher-components/components/LabeledTooltip/LabeledTooltip.vue +0 -156
  70. package/rancher-components/components/LabeledTooltip/index.ts +0 -1
  71. package/rancher-components/components/StringList/StringList.test.ts +0 -754
  72. package/rancher-components/components/StringList/StringList.vue +0 -650
  73. package/rancher-components/components/StringList/index.ts +0 -1
@@ -1,421 +0,0 @@
1
- <script lang="ts">
2
- import { PropType, defineComponent } from 'vue';
3
- import { _EDIT, _VIEW } from '@shell/config/query-params';
4
- import { addObject, removeObject } from '@shell/utils/array';
5
- import cloneDeep from 'lodash/cloneDeep';
6
-
7
- export default defineComponent({
8
- name: 'Checkbox',
9
-
10
- props: {
11
- /**
12
- * The checkbox value.
13
- */
14
- value: {
15
- type: [Boolean, Array, String] as PropType<boolean | boolean[] | string>,
16
- default: false
17
- },
18
-
19
- /**
20
- * The checkbox label.
21
- */
22
- label: {
23
- type: String,
24
- default: null
25
- },
26
-
27
- /**
28
- * The i18n key to use for the checkbox label.
29
- */
30
- labelKey: {
31
- type: String,
32
- default: null
33
- },
34
-
35
- /**
36
- * Random ID generated for binding label to input.
37
- */
38
- id: {
39
- type: String,
40
- default: String(Math.random() * 1000)
41
- },
42
-
43
- /**
44
- * Disable the checkbox.
45
- */
46
- disabled: {
47
- type: Boolean,
48
- default: false
49
- },
50
-
51
- /**
52
- * Display an indeterminate state. Useful for cases where a checkbox might
53
- * be the parent to child checkboxes, and we need to show that a subset of
54
- * children are checked.
55
- */
56
- indeterminate: {
57
- type: Boolean,
58
- default: false
59
- },
60
-
61
- /**
62
- * The checkbox editing mode.
63
- * @values _EDIT, _VIEW
64
- */
65
- mode: {
66
- type: String,
67
- default: _EDIT
68
- },
69
-
70
- /**
71
- * The contents of the checkbox tooltip.
72
- */
73
- tooltip: {
74
- type: [String, Object],
75
- default: null
76
- },
77
-
78
- /**
79
- * The i18n key to use for the checkbox tooltip.
80
- */
81
- tooltipKey: {
82
- type: String,
83
- default: null
84
- },
85
-
86
- /**
87
- * A custom value to use when the checkbox is checked.
88
- */
89
- valueWhenTrue: {
90
- type: [Boolean, String, Number],
91
- default: true
92
- },
93
-
94
- /**
95
- * The i18n key to use for the checkbox description.
96
- */
97
- descriptionKey: {
98
- type: String,
99
- default: null
100
- },
101
-
102
- /**
103
- * The checkbox description.
104
- */
105
- description: {
106
- type: String,
107
- default: null
108
- },
109
-
110
- /**
111
- * Primary checkbox displays label so that it stands out more
112
- */
113
- primary: {
114
- type: Boolean,
115
- default: false
116
- },
117
- },
118
-
119
- computed: {
120
- /**
121
- * Determines if the checkbox is disabled.
122
- * @returns boolean: True when the disabled prop is true or when mode is
123
- * View.
124
- */
125
- isDisabled(): boolean {
126
- return (this.disabled || this.mode === _VIEW);
127
- },
128
- /**
129
- * Determines if the checkbox is checked when using custom values or
130
- * multiple values.
131
- * @returns boolean: True when at least one value is true in a collection or
132
- * when value matches `this.valueWhenTrue`.
133
- */
134
- isChecked(): boolean {
135
- return this.isMulti(this.value) ? this.findTrueValues(this.value) : this.value === this.valueWhenTrue;
136
- }
137
- },
138
-
139
- methods: {
140
- /**
141
- * Toggles the checked state for the checkbox and emits an 'input' event.
142
- */
143
- clicked(event: MouseEvent | KeyboardEvent): boolean | void {
144
- if ((event.target as HTMLLinkElement).tagName === 'A' && (event.target as HTMLLinkElement).href) {
145
- // Ignore links inside the checkbox label so you can click them
146
- return true;
147
- }
148
-
149
- event.stopPropagation();
150
- event.preventDefault();
151
-
152
- if (this.isDisabled) {
153
- return;
154
- }
155
-
156
- const customEvent = {
157
- bubbles: true,
158
- cancelable: false,
159
- shiftKey: event.shiftKey,
160
- altKey: event.altKey,
161
- ctrlKey: event.ctrlKey,
162
- metaKey: event.metaKey
163
- };
164
-
165
- const click = new CustomEvent('click', customEvent);
166
-
167
- // Flip the value
168
- const value = cloneDeep(this.value);
169
-
170
- if (this.isMulti(value)) {
171
- if (this.isChecked) {
172
- removeObject(value, this.valueWhenTrue);
173
- } else {
174
- addObject(value, this.valueWhenTrue);
175
- }
176
- this.$emit('input', value);
177
- } else if (this.isString(this.valueWhenTrue)) {
178
- if (this.isChecked) {
179
- this.$emit('input', null);
180
- } else {
181
- this.$emit('input', this.valueWhenTrue);
182
- }
183
- } else {
184
- this.$emit('input', !value);
185
- this.$el.dispatchEvent(click);
186
- }
187
- },
188
-
189
- /**
190
- * Determines if there are multiple values for the checkbox.
191
- */
192
- isMulti(value: boolean | boolean[] | string): value is boolean[] {
193
- return Array.isArray(value);
194
- },
195
-
196
- isString(value: boolean | number | string): value is boolean {
197
- return typeof value === 'string';
198
- },
199
-
200
- /**
201
- * Finds the first true value for multiple checkboxes.
202
- * @param value A collection of values for the checkbox.
203
- */
204
- findTrueValues(value: boolean[]): boolean {
205
- return value.find((v) => v === this.valueWhenTrue) || false;
206
- }
207
- }
208
- });
209
- </script>
210
-
211
- <template>
212
- <div
213
- class="checkbox-outer-container"
214
- data-checkbox-ctrl
215
- >
216
- <label
217
- class="checkbox-container"
218
- :class="{ 'disabled': isDisabled}"
219
- :for="id"
220
- @keydown.enter.prevent="clicked($event)"
221
- @keydown.space.prevent="clicked($event)"
222
- @click="clicked($event)"
223
- >
224
- <input
225
- :checked="isChecked"
226
- :value="valueWhenTrue"
227
- type="checkbox"
228
- :tabindex="-1"
229
- :name="id"
230
- @click.stop.prevent
231
- >
232
- <span
233
- class="checkbox-custom"
234
- :class="{indeterminate: indeterminate}"
235
- :tabindex="isDisabled ? -1 : 0"
236
- :aria-label="label"
237
- :aria-checked="!!value"
238
- role="checkbox"
239
- />
240
- <span
241
- v-if="$slots.label || label || labelKey || tooltipKey || tooltip"
242
- class="checkbox-label"
243
- :class="{ 'checkbox-primary': primary }"
244
- >
245
- <slot name="label">
246
- <t
247
- v-if="labelKey"
248
- :k="labelKey"
249
- :raw="true"
250
- />
251
- <template v-else-if="label">{{ label }}</template>
252
- <i
253
- v-if="tooltipKey"
254
- v-clean-tooltip="t(tooltipKey)"
255
- class="checkbox-info icon icon-info icon-lg"
256
- />
257
- <i
258
- v-else-if="tooltip"
259
- v-clean-tooltip="tooltip"
260
- class="checkbox-info icon icon-info icon-lg"
261
- />
262
- </slot>
263
- </span>
264
- </label>
265
- <div
266
- v-if="descriptionKey || description"
267
- class="checkbox-outer-container-description"
268
- >
269
- <t
270
- v-if="descriptionKey"
271
- :k="descriptionKey"
272
- />
273
- <template v-else-if="description">
274
- {{ description }}
275
- </template>
276
- </div>
277
- </div>
278
- </template>
279
-
280
- <style lang='scss'>
281
- $fontColor: var(--input-label);
282
-
283
- .checkbox-outer-container {
284
- display: inline-flex;
285
- flex-direction: column;
286
- &-description {
287
- color: $fontColor;
288
- font-size: 14px;
289
- margin-left: 19px;
290
- margin-top: 5px;
291
- opacity: 0.8;
292
- }
293
- }
294
-
295
- // NOTE: SortableTable depends on the names of this class, do not arbitrarily change.
296
- .checkbox-container {
297
- position: relative;
298
- display: inline-flex;
299
- align-items: center;
300
- margin: 0;
301
- cursor: pointer;
302
- user-select: none;
303
- border-radius: var(--border-radius);
304
-
305
- .checkbox-label {
306
- color: var(--input-label);
307
- display: inline-flex;
308
- margin: 0px 10px 0px 5px;
309
-
310
- &.checkbox-primary {
311
- color: inherit;
312
- font-weight: 600;
313
- }
314
- }
315
-
316
- .checkbox-info {
317
- line-height: normal;
318
- margin-left: 2px;
319
- }
320
-
321
- .checkbox-custom {
322
- height: 14px;
323
- width: 14px;
324
- background-color: var(--body-bg);
325
- border-radius: var(--border-radius);
326
- transition: all 0.3s ease-out;
327
- border: 1px solid var(--border);
328
- flex-shrink: 0;
329
- }
330
-
331
- input {
332
- // display: none;
333
- opacity: 0;
334
- position: absolute;
335
- z-index: -1;
336
- }
337
-
338
- input:checked ~ .checkbox-custom {
339
- background-color:var(--primary);
340
- -webkit-transform: rotate(0deg) scale(1);
341
- -ms-transform: rotate(0deg) scale(1);
342
- transform: rotate(0deg) scale(1);
343
- opacity:1;
344
- border: 1px solid var(--primary);
345
- }
346
-
347
- // Custom Checkbox tick
348
- .checkbox-custom::after {
349
- position: absolute;
350
- content: "";
351
- left: 0px;
352
- top: 0px;
353
- height: 0px;
354
- width: 0px;
355
- border-radius: var(--border-radius);
356
- border: solid;
357
- border-color: var(--input-text);
358
- border-width: 0 3px 3px 0;
359
- -webkit-transform: rotate(0deg) scale(0);
360
- -ms-transform: rotate(0deg) scale(0);
361
- transform: rotate(0deg) scale(0);
362
- opacity:1;
363
- }
364
-
365
- input:checked ~ .checkbox-custom::after {
366
- -webkit-transform: rotate(45deg) scale(1);
367
- -ms-transform: rotate(45deg) scale(1);
368
- transform: rotate(45deg) scale(1);
369
- opacity:1;
370
- left: 4px;
371
- width: 4px;
372
- height: 10px;
373
- border: solid;
374
- border-color: var(--checkbox-tick);
375
- border-width: 0 2px 2px 0;
376
- background-color: transparent;
377
- }
378
-
379
- input:checked ~ .checkbox-custom.indeterminate::after {
380
- -webkit-transform: scale(1);
381
- -ms-transform: scale(1);
382
- transform: scale(1);
383
- opacity:1;
384
- left: 3px;
385
- top:2px;
386
- width: 6px;
387
- height: 5px;
388
- border: solid;
389
- border-color: var(--checkbox-tick);
390
- border-width: 0 0 2px 0;
391
- background-color: transparent;
392
- }
393
-
394
- // Disabled styles
395
- &.disabled {
396
- .checkbox-custom {
397
- background-color: var(--checkbox-disabled-bg);
398
- border-color: var(--checkbox-disabled-bg);
399
- }
400
- input:checked ~ .checkbox-custom {
401
- background-color: var(--checkbox-disabled-bg);
402
- border-color: var(--checkbox-disabled-bg);
403
- &::after {
404
- border-color: var(--checkbox-tick-disabled);
405
- }
406
- }
407
- }
408
-
409
- &.disabled {
410
- cursor: not-allowed;
411
- }
412
-
413
- .checkbox-view {
414
- display: flex;
415
- flex-direction: column;
416
- LABEL {
417
- color: $fontColor;
418
- }
419
- }
420
- }
421
- </style>
@@ -1 +0,0 @@
1
- export { default as Checkbox } from './Checkbox.vue';
@@ -1,40 +0,0 @@
1
- import { mount } from '@vue/test-utils';
2
- import { LabeledInput } from './index';
3
-
4
- describe('component: LabeledInput', () => {
5
- it('should emit input only once', () => {
6
- const value = '2';
7
- const delay = 1;
8
- const wrapper = mount(LabeledInput, {
9
- propsData: { delay },
10
- mocks: { $store: { getters: { 'i18n/t': jest.fn() } } }
11
- });
12
-
13
- jest.useFakeTimers();
14
- wrapper.find('input').setValue('1');
15
- wrapper.find('input').setValue(value);
16
- jest.advanceTimersByTime(delay);
17
- jest.useRealTimers();
18
-
19
- expect(wrapper.emitted('input')).toHaveLength(1);
20
- expect(wrapper.emitted('input')![0][0]).toBe(value);
21
- });
22
-
23
- it('using mode "multiline" should emit input value correctly', () => {
24
- const value = 'any-string';
25
- const delay = 1;
26
- const wrapper = mount(LabeledInput as any, {
27
- propsData: { delay, multiline: true },
28
- mocks: { $store: { getters: { 'i18n/t': jest.fn() } } }
29
- });
30
-
31
- jest.useFakeTimers();
32
- wrapper.find('input').setValue('1');
33
- wrapper.find('input').setValue(value);
34
- jest.advanceTimersByTime(delay);
35
- jest.useRealTimers();
36
-
37
- expect(wrapper.emitted('input')).toHaveLength(1);
38
- expect(wrapper.emitted('input')![0][0]).toBe(value);
39
- });
40
- });