@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,111 +0,0 @@
1
- <script lang="ts">
2
- import { PropType, defineComponent } from 'vue';
3
-
4
- interface Badge {
5
- stateBackground: string;
6
- stateDisplay: string;
7
- }
8
-
9
- /**
10
- * Badge state component.
11
- * <p>Represents a badge whose label and color is either taken from the value property or
12
- * from the label and color properties. The state property takes precedence.</p>
13
- */
14
- export default defineComponent({
15
- props: {
16
- /**
17
- * A value having the properties `stateBackground` and `stateDisplay`
18
- */
19
- value: {
20
- type: Object as PropType<Badge>,
21
- default: null
22
- },
23
-
24
- /**
25
- * Badge color. `stateBackground` of the value property takes precedence if supplied
26
- */
27
- color: {
28
- type: String,
29
- default: null
30
- },
31
-
32
- /**
33
- * Optional icon to be shown before the label
34
- */
35
- icon: {
36
- type: String,
37
- default: null
38
- },
39
-
40
- /**
41
- * Label to display in the badge. `stateDisplay` of the value property takes precedence if supplied
42
- */
43
- label: {
44
- type: String,
45
- default: null
46
- }
47
- },
48
-
49
- computed: {
50
- bg(): string | null {
51
- return this.value?.stateBackground || this.color;
52
- },
53
-
54
- msg(): string | null {
55
- return this.value?.stateDisplay || this.label;
56
- }
57
- }
58
- });
59
- </script>
60
-
61
- <template>
62
- <span :class="['badge-state', bg]">
63
- <i
64
- v-if="icon"
65
- class="icon"
66
- :class="{[icon]: true, 'mr-5': !!msg}"
67
- />{{ msg }}
68
- </span>
69
- </template>
70
-
71
- <style lang="scss" scoped>
72
- .badge-state {
73
- align-items: center;
74
- display: inline-flex;
75
- padding: 2px 10px;
76
- border: 1px solid transparent;
77
- border-radius: 20px;
78
-
79
- &.bg-info {
80
- border-color: var(--primary);
81
- }
82
-
83
- &.bg-error {
84
- border-color: var(--error);
85
- }
86
-
87
- &.bg-warning {
88
- border-color: var(--warning);
89
- }
90
-
91
- // Successful states are de-emphasized by using [text-]color instead of background-color
92
- &.bg-success {
93
- color: var(--success);
94
- background: transparent;
95
- border-color: var(--success);
96
- }
97
- }
98
- </style>
99
- <style lang="scss">
100
- // TODO: #6005
101
- // Investigate why this is here.. I don't think that styles for sortable table should belong here
102
- .sortable-table TD .badge-state {
103
- @include clip;
104
- display: inline-block;
105
- max-width: 100%;
106
- position: relative;
107
- max-width: 110px;
108
- font-size: .85em;
109
- vertical-align: middle;
110
- }
111
- </style>
@@ -1 +0,0 @@
1
- export { default as BadgeState } from './BadgeState.vue';
@@ -1,59 +0,0 @@
1
- import { mount } from '@vue/test-utils';
2
- import { Banner } from './index';
3
-
4
- describe('component: Banner', () => {
5
- it('should display text based on label', () => {
6
- const label = 'test';
7
- const wrapper = mount(
8
- Banner,
9
- { propsData: { label } });
10
-
11
- const element = wrapper.find('span').element;
12
-
13
- expect(element.textContent).toBe(label);
14
- });
15
-
16
- it('should display an icon', () => {
17
- const icon = 'my-icon';
18
- const wrapper = mount(Banner, { propsData: { icon } });
19
-
20
- const element = wrapper.find(`.${ icon }`).element;
21
-
22
- expect(element.classList).toContain(icon);
23
- });
24
-
25
- it('should not display an icon', () => {
26
- const wrapper = mount(Banner);
27
-
28
- const element = wrapper.find(`[data-testid="banner-icon"]`).element;
29
-
30
- expect(element).not.toBeDefined();
31
- });
32
-
33
- it('should emit close event', () => {
34
- const wrapper = mount(Banner, { propsData: { closable: true } });
35
- const element = wrapper.find(`[data-testid="banner-close"]`).element;
36
-
37
- element.click();
38
-
39
- expect(wrapper.emitted('close')).toHaveLength(1);
40
- });
41
-
42
- it('should add the right color', () => {
43
- const color = 'red';
44
- const wrapper = mount(Banner, { propsData: { color } });
45
-
46
- const element = wrapper.element;
47
-
48
- expect(element.classList).toContain(color);
49
- });
50
-
51
- it('should stack the banner messages', () => {
52
- const stacked = true;
53
- const wrapper = mount(Banner, { propsData: { stacked } });
54
-
55
- const element = wrapper.find(`[data-testid="banner-content"]`).element;
56
-
57
- expect(element.classList).toContain('stacked');
58
- });
59
- });
@@ -1,244 +0,0 @@
1
- <script lang="ts">
2
- import { defineComponent } from 'vue';
3
- import { nlToBr } from '@shell/utils/string';
4
- import { stringify } from '@shell/utils/error';
5
-
6
- export default defineComponent({
7
- props: {
8
- /**
9
- * A color class that represents the color of the banner.
10
- * @values primary, secondary, success, warning, error, info
11
- */
12
- color: {
13
- type: String,
14
- default: 'secondary'
15
- },
16
- /**
17
- * The label to display as the banner's default content.
18
- */
19
- label: {
20
- type: [String, Error, Object],
21
- default: null
22
- },
23
- /**
24
- * The i18n key for the label to display as the banner's default content.
25
- */
26
- labelKey: {
27
- type: String,
28
- default: null
29
- },
30
- /**
31
- * Add icon for the banner
32
- */
33
- icon: {
34
- type: String,
35
- default: null
36
- },
37
- /**
38
- * Toggles the banner's close button.
39
- */
40
- closable: {
41
- type: Boolean,
42
- default: false
43
- },
44
- /**
45
- * Toggles the stacked class for the banner.
46
- */
47
- stacked: {
48
- type: Boolean,
49
- default: false
50
- }
51
- },
52
- computed: {
53
- /**
54
- * Return message text as label.
55
- */
56
- messageLabel(): string | void {
57
- return !(typeof this.label === 'string') ? stringify(this.label) : undefined;
58
- }
59
- },
60
- methods: { nlToBr }
61
- });
62
- </script>
63
- <template>
64
- <div
65
- class="banner"
66
- :class="{
67
- [color]: true,
68
- }"
69
- >
70
- <div
71
- v-if="icon"
72
- class="banner__icon"
73
- data-testid="banner-icon"
74
- >
75
- <i
76
- class="icon icon-2x"
77
- :class="icon"
78
- />
79
- </div>
80
- <div
81
- class="banner__content"
82
- data-testid="banner-content"
83
- :class="{
84
- closable,
85
- stacked,
86
- icon
87
- }"
88
- >
89
- <slot>
90
- <t
91
- v-if="labelKey"
92
- :k="labelKey"
93
- :raw="true"
94
- />
95
- <span v-else-if="messageLabel">{{ messageLabel }}</span>
96
- <span
97
- v-else
98
- v-clean-html="nlToBr(label)"
99
- />
100
- </slot>
101
- <div
102
- v-if="closable"
103
- class="banner__content__closer"
104
- @click="$emit('close')"
105
- >
106
- <i
107
- data-testid="banner-close"
108
- class="icon icon-close closer-icon"
109
- />
110
- </div>
111
- </div>
112
- </div>
113
- </template>
114
-
115
- <style lang="scss" scoped>
116
- $left-border-size: 4px;
117
- $icon-size: 24px;
118
-
119
- .banner {
120
- display: flex;
121
- margin: 15px 0;
122
- position: relative;
123
- width: 100%;
124
- color: var(--body-text);
125
-
126
- &__icon {
127
- width: $icon-size * 2;
128
- flex-grow: 1;
129
- display: flex;
130
- justify-content: center;
131
- align-items: center;
132
- box-sizing: content-box;
133
-
134
- .primary & {
135
- background: var(--primary);
136
- }
137
-
138
- .secondary & {
139
- background: var(--default);
140
- }
141
-
142
- .success & {
143
- background: var(--success);
144
- }
145
-
146
- .info & {
147
- background: var(--info);
148
- }
149
-
150
- .warning & {
151
- background: var(--warning);
152
- }
153
-
154
- .error & {
155
- background: var(--error);
156
- color: var(--primary-text);
157
- }
158
- }
159
-
160
- &__content {
161
- padding: 10px;
162
- transition: all 0.2s ease;
163
- line-height: 20px;
164
- width: 100%;
165
- border-left: solid $left-border-size transparent;
166
- display: flex;
167
- gap: 3px;
168
-
169
- .primary & {
170
- background: var(--primary);
171
- border-color: var(--primary);
172
- }
173
-
174
- .secondary & {
175
- background: var(--default-banner-bg);
176
- border-color: var(--default);
177
- }
178
-
179
- .success & {
180
- background: var(--success-banner-bg);
181
- border-color: var(--success);
182
- }
183
-
184
- .info & {
185
- background: var(--info-banner-bg);
186
- border-color: var(--info);
187
- }
188
-
189
- .warning & {
190
- background: var(--warning-banner-bg);
191
- border-color: var(--warning);
192
- }
193
-
194
- .error & {
195
- background: var(--error-banner-bg);
196
- border-color: var(--error);
197
- color: var(--error);
198
- }
199
-
200
- &.stacked {
201
- padding: 0 10px;
202
- margin: 0;
203
- transition: none;
204
- &:first-child {
205
- padding-top: 10px;
206
- }
207
- &:last-child {
208
- padding-bottom: 10px;
209
- }
210
- }
211
-
212
- &.closable {
213
- padding-right: $icon-size * 2;
214
- }
215
-
216
- &__closer {
217
- display: flex;
218
- align-items: center;
219
-
220
- cursor: pointer;
221
- position: absolute;
222
- top: 0;
223
- right: 0;
224
- bottom: 0;
225
- width: $icon-size;
226
- line-height: $icon-size;
227
- text-align: center;
228
-
229
- .closer-icon {
230
- opacity: 0.7;
231
-
232
- &:hover {
233
- opacity: 1;
234
- color: var(--link);
235
- }
236
- }
237
- }
238
-
239
- &.icon {
240
- border-left: none;
241
- }
242
- }
243
- }
244
- </style>
@@ -1 +0,0 @@
1
- export { default as Banner } from './Banner.vue';
@@ -1,37 +0,0 @@
1
- import { mount } from '@vue/test-utils';
2
- import { Card } from './index';
3
-
4
- describe('component: Card', () => {
5
- const title = 'Card title';
6
- const body = 'Card body';
7
-
8
- it('should have a card title', () => {
9
- const wrapper = mount(Card, {
10
- propsData: { title },
11
- slots: { title: '<div>Card title</div>' }
12
- });
13
-
14
- const element = wrapper.find('[data-testid="card-title-slot"]');
15
-
16
- expect(element.exists()).toBe(true);
17
- expect(element.text()).toBe(title);
18
- });
19
-
20
- it('should have a card body', () => {
21
- const wrapper = mount(Card, {
22
- propsData: { body },
23
- slots: { body: '<div>Card body</div>' }
24
- });
25
- const element = wrapper.find('[data-testid="card-body-slot"]');
26
-
27
- expect(element.exists()).toBe(true);
28
- expect(element.text()).toBe(body);
29
- });
30
-
31
- it('should display the default card actions', () => {
32
- const wrapper = mount(Card);
33
- const element = wrapper.find('[data-testid="card-actions-slot"]');
34
-
35
- expect(element.exists()).toBe(true);
36
- });
37
- });
@@ -1,167 +0,0 @@
1
- <script lang="ts">
2
- import { defineComponent, PropType } from 'vue';
3
-
4
- export default defineComponent({
5
- name: 'Card',
6
- props: {
7
- /**
8
- * The card's title.
9
- */
10
- title: {
11
- type: String,
12
- default: ''
13
- },
14
- /**
15
- * The text content for the card's body.
16
- */
17
- content: {
18
- type: String,
19
- default: ''
20
- },
21
- /**
22
- * The function to invoke when the default action button is clicked.
23
- */
24
- buttonAction: {
25
- type: Function as PropType<(event: MouseEvent) => void>,
26
- default: (): void => { }
27
- },
28
- /**
29
- * The text for the default action button.
30
- */
31
- buttonText: {
32
- type: String,
33
- default: 'go'
34
- },
35
- /**
36
- * Toggles the card's highlight-border class.
37
- */
38
- showHighlightBorder: {
39
- type: Boolean,
40
- default: true
41
- },
42
- /**
43
- * Toggles the card's Actions section.
44
- */
45
- showActions: {
46
- type: Boolean,
47
- default: true
48
- },
49
- sticky: {
50
- type: Boolean,
51
- default: false,
52
- },
53
- }
54
- });
55
- </script>
56
-
57
- <template>
58
- <div
59
- class="card-container"
60
- :class="{'highlight-border': showHighlightBorder, 'card-sticky': sticky}"
61
- data-testid="card"
62
- >
63
- <div class="card-wrap">
64
- <div
65
- class="card-title"
66
- data-testid="card-title-slot"
67
- >
68
- <slot name="title">
69
- {{ title }}
70
- </slot>
71
- </div>
72
- <hr>
73
- <div
74
- class="card-body"
75
- data-testid="card-body-slot"
76
- >
77
- <slot name="body">
78
- {{ content }}
79
- </slot>
80
- </div>
81
- <div
82
- v-if="showActions"
83
- class="card-actions"
84
- data-testid="card-actions-slot"
85
- >
86
- <slot name="actions">
87
- <button
88
- class="btn role-primary"
89
- @click="buttonAction"
90
- >
91
- {{ buttonText }}
92
- </button>
93
- </slot>
94
- </div>
95
- </div>
96
- </div>
97
- </template>
98
-
99
- <style lang='scss'>
100
- .card-container {
101
- &.highlight-border {
102
- border-left: 5px solid var(--primary);
103
- }
104
- border-radius: var(--border-radius);
105
- display: flex;
106
- flex-basis: 40%;
107
- margin: 10px;
108
- min-height: 100px;
109
- padding: 10px;
110
- box-shadow: 0 0 20px var(--shadow);
111
- &:not(.top) {
112
- align-items: top;
113
- flex-direction: row;
114
- justify-content: start;
115
- }
116
- .card-wrap {
117
- width: 100%;
118
- }
119
- & .card-body {
120
- color: var(--input-label);
121
- display: flex;
122
- flex-direction: column;
123
- justify-content: center;
124
- }
125
- & .card-actions {
126
- align-self: end;
127
- display: flex;
128
- padding-top: 20px;
129
- }
130
- & .card-title {
131
- align-items: center;
132
- display: flex;
133
- width: 100%;
134
- h5 {
135
- margin: 0;
136
- }
137
- .flex-right {
138
- margin-left: auto;
139
- }
140
- }
141
-
142
- // Sticky mode will stick header and footer to top and bottom with content in the middle scrolling
143
- &.card-sticky {
144
- // display: flex;
145
- // flex-direction: column;
146
- overflow: hidden;
147
-
148
- .card-wrap {
149
- display: flex;
150
- flex-direction: column;
151
-
152
- .card-body {
153
- justify-content: flex-start;
154
- overflow: auto;
155
- }
156
-
157
- > * {
158
- flex: 0;
159
- }
160
-
161
- .card-body {
162
- flex: 1;
163
- }
164
- }
165
- }
166
- }
167
- </style>
@@ -1 +0,0 @@
1
- export { default as Card } from './Card.vue';
@@ -1,68 +0,0 @@
1
- import { shallowMount, Wrapper } from '@vue/test-utils';
2
- import { Checkbox } from './index';
3
-
4
- describe('checkbox.vue', () => {
5
- const event = {
6
- target: { tagName: 'input', href: null },
7
- stopPropagation: () => { },
8
- preventDefault: () => { }
9
- } as unknown as MouseEvent;
10
-
11
- it('is unchecked by default', () => {
12
- const wrapper = shallowMount(Checkbox);
13
- const cbInput = wrapper.find('input[type="checkbox"]').element as HTMLInputElement;
14
-
15
- expect(cbInput.checked).toBe(false);
16
- });
17
-
18
- it('renders a true value', () => {
19
- const wrapper = shallowMount(Checkbox, { propsData: { value: true } });
20
- const cbInput = wrapper.find('input[type="checkbox"]').element as HTMLInputElement;
21
-
22
- expect(cbInput.checked).toBe(true);
23
- });
24
-
25
- it('updates from false to true when props change', async() => {
26
- const wrapper = shallowMount(Checkbox);
27
- const cbInput = wrapper.find('input[type="checkbox"]').element as HTMLInputElement;
28
-
29
- expect(cbInput.checked).toBe(false);
30
-
31
- await wrapper.setProps({ value: true });
32
-
33
- expect(cbInput.checked).toBe(true);
34
- });
35
-
36
- it('emits an input event with a true value', async() => {
37
- const wrapper: Wrapper<InstanceType<typeof Checkbox>> = shallowMount(Checkbox);
38
-
39
- wrapper.vm.clicked(event);
40
- await wrapper.vm.$nextTick();
41
-
42
- expect(wrapper.emitted().input?.length).toBe(1);
43
- expect(wrapper.emitted().input?.[0][0]).toBe(true);
44
- });
45
-
46
- it('emits an input event with a custom valueWhenTrue', async() => {
47
- const valueWhenTrue = 'BIG IF TRUE';
48
-
49
- const wrapper: Wrapper<InstanceType<typeof Checkbox>> = shallowMount(Checkbox, { propsData: { value: false, valueWhenTrue } });
50
-
51
- wrapper.vm.clicked(event);
52
- await wrapper.vm.$nextTick();
53
-
54
- expect(wrapper.emitted().input?.length).toBe(1);
55
- expect(wrapper.emitted().input?.[0][0]).toBe(valueWhenTrue);
56
- });
57
-
58
- it('updates from valueWhenTrue to falsy', async() => {
59
- const valueWhenTrue = 'REAL HUGE IF FALSE';
60
-
61
- const wrapper: Wrapper<InstanceType<typeof Checkbox>> = shallowMount(Checkbox, { propsData: { value: valueWhenTrue, valueWhenTrue } });
62
-
63
- wrapper.vm.clicked(event);
64
- await wrapper.vm.$nextTick();
65
-
66
- expect(wrapper.emitted().input?.[0][0]).toBeNull();
67
- });
68
- });