@rancher/shell 0.2.1 → 0.2.3

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 (56) hide show
  1. package/assets/translations/en-us.yaml +9 -5
  2. package/assets/translations/zh-hans.yaml +328 -117
  3. package/components/Carousel.vue +25 -9
  4. package/components/Import.vue +7 -1
  5. package/components/SortableTable/index.vue +7 -1
  6. package/components/form/MatchExpressions.vue +15 -3
  7. package/components/nav/Header.vue +14 -1
  8. package/detail/cis.cattle.io.clusterscan.vue +6 -2
  9. package/detail/provisioning.cattle.io.cluster.vue +2 -2
  10. package/edit/provisioning.cattle.io.cluster/ACE.vue +1 -2
  11. package/edit/provisioning.cattle.io.cluster/MachinePool.vue +5 -3
  12. package/list/node.vue +7 -2
  13. package/mixins/resource-manager.js +5 -0
  14. package/models/cluster.x-k8s.io.machinedeployment.js +8 -0
  15. package/models/management.cattle.io.cluster.js +6 -1
  16. package/nuxt.config.js +113 -108
  17. package/package.json +1 -1
  18. package/pages/c/_cluster/apps/charts/index.vue +1 -1
  19. package/pages/c/_cluster/apps/charts/install.vue +24 -38
  20. package/pages/c/_cluster/settings/performance.vue +11 -0
  21. package/pages/c/_cluster/uiplugins/InstallDialog.vue +15 -1
  22. package/pages/c/_cluster/uiplugins/RemoveUIPlugins.vue +28 -6
  23. package/pages/c/_cluster/uiplugins/index.vue +1 -1
  24. package/rancher-components/Form/TextArea/TextAreaAutoGrow.vue +7 -7
  25. package/scripts/publish-shell.sh +1 -1
  26. package/scripts/test-plugins-build.sh +1 -0
  27. package/scripts/typegen.sh +2 -2
  28. package/store/type-map.js +11 -2
  29. package/types/vue-shim.d +20 -0
  30. package/utils/create-yaml.js +30 -6
  31. package/creators/update/yarn-error.log +0 -54
  32. package/rancher-components/components/BadgeState/BadgeState.spec.ts +0 -12
  33. package/rancher-components/components/BadgeState/BadgeState.vue +0 -107
  34. package/rancher-components/components/BadgeState/index.ts +0 -1
  35. package/rancher-components/components/Banner/Banner.test.ts +0 -13
  36. package/rancher-components/components/Banner/Banner.vue +0 -163
  37. package/rancher-components/components/Banner/index.ts +0 -1
  38. package/rancher-components/components/Card/Card.vue +0 -150
  39. package/rancher-components/components/Card/index.ts +0 -1
  40. package/rancher-components/components/Form/Checkbox/Checkbox.test.ts +0 -77
  41. package/rancher-components/components/Form/Checkbox/Checkbox.vue +0 -395
  42. package/rancher-components/components/Form/Checkbox/index.ts +0 -1
  43. package/rancher-components/components/Form/LabeledInput/LabeledInput.test.ts +0 -29
  44. package/rancher-components/components/Form/LabeledInput/LabeledInput.vue +0 -343
  45. package/rancher-components/components/Form/LabeledInput/index.ts +0 -1
  46. package/rancher-components/components/Form/Radio/RadioButton.vue +0 -270
  47. package/rancher-components/components/Form/Radio/RadioGroup.vue +0 -235
  48. package/rancher-components/components/Form/Radio/index.ts +0 -2
  49. package/rancher-components/components/Form/TextArea/TextAreaAutoGrow.vue +0 -168
  50. package/rancher-components/components/Form/TextArea/index.ts +0 -1
  51. package/rancher-components/components/Form/ToggleSwitch/ToggleSwitch.test.ts +0 -107
  52. package/rancher-components/components/Form/ToggleSwitch/ToggleSwitch.vue +0 -137
  53. package/rancher-components/components/Form/ToggleSwitch/index.ts +0 -1
  54. package/rancher-components/components/Form/index.ts +0 -5
  55. package/rancher-components/components/LabeledTooltip/LabeledTooltip.vue +0 -137
  56. package/rancher-components/components/LabeledTooltip/index.ts +0 -1
@@ -1,235 +0,0 @@
1
- <script lang="ts">
2
- import Vue, { PropType } from 'vue';
3
- import { _VIEW } from '@shell/config/query-params';
4
- import RadioButton from '@components/Form/Radio/RadioButton.vue';
5
-
6
- interface Option {
7
- value: unknown,
8
- label: string
9
- }
10
-
11
- export default Vue.extend({
12
- components: { RadioButton },
13
- props: {
14
- /**
15
- * Name for the checkbox grouping, must be unique on page.
16
- */
17
- name: {
18
- type: String,
19
- required: true
20
- },
21
-
22
- /**
23
- * Options can be an array of {label, value}, or just values.
24
- */
25
- options: {
26
- type: Array as PropType<Option[] | string[]>,
27
- required: true
28
- },
29
-
30
- /**
31
- * If options are just values, then labels can be a corresponding display
32
- * value.
33
- */
34
- labels: {
35
- type: Array as PropType<string[]>,
36
- default: null
37
- },
38
-
39
- /**
40
- * The selected value.
41
- */
42
- value: {
43
- type: [Boolean, String, Object],
44
- default: null
45
- },
46
-
47
- /**
48
- * Disable the radio group.
49
- */
50
- disabled: {
51
- type: Boolean,
52
- default: false
53
- },
54
-
55
- /**
56
- * The radio group editing mode.
57
- * @values _EDIT, _VIEW
58
- */
59
- mode: {
60
- type: String,
61
- default: 'edit'
62
- },
63
-
64
- /**
65
- * Label for above the radios.
66
- */
67
- label: {
68
- type: String,
69
- default: null
70
- },
71
-
72
- /**
73
- * The i18n key to use for the radio group label.
74
- */
75
- labelKey: {
76
- type: String,
77
- default: null
78
- },
79
-
80
- /**
81
- * Radio group tooltip.
82
- */
83
- tooltip: {
84
- type: [String, Object],
85
- default: null
86
- },
87
-
88
- /**
89
- * The i18n key to use for the radio group tooltip.
90
- */
91
- tooltipKey: {
92
- type: String,
93
- default: null
94
- },
95
-
96
- /**
97
- * Show radio buttons in column or row.
98
- */
99
- row: {
100
- type: Boolean,
101
- default: false
102
- }
103
- },
104
-
105
- computed: {
106
- /**
107
- * Creates a collection of Options from the provided props.
108
- */
109
- normalizedOptions(): Option[] {
110
- const out: Option[] = [];
111
-
112
- for (let i = 0; i < this.options.length; i++) {
113
- const opt = this.options[i];
114
-
115
- if (typeof opt === 'object' && opt) {
116
- out.push(opt);
117
- } else if (this.labels) {
118
- out.push({
119
- label: this.labels[i],
120
- value: opt
121
- });
122
- } else {
123
- out.push({
124
- label: opt,
125
- value: opt
126
- });
127
- }
128
- }
129
-
130
- return out;
131
- },
132
-
133
- /**
134
- * Determines the view mode for the radio group.
135
- */
136
- isView(): boolean {
137
- return this.mode === _VIEW;
138
- },
139
-
140
- /**
141
- * Determines if the radio group is disabled.
142
- */
143
- isDisabled(): boolean {
144
- return (this.disabled || this.isView);
145
- }
146
- },
147
-
148
- methods: {
149
- /**
150
- * Keyboard left/right event listener to select next/previous option. Emits
151
- * the input event.
152
- */
153
- clickNext(direction: number): void {
154
- const opts = this.normalizedOptions;
155
- const selected = opts.find(x => x.value === this.value);
156
- let newIndex = (selected ? opts.indexOf(selected) : -1) + direction;
157
-
158
- if (newIndex >= opts.length) {
159
- newIndex = opts.length - 1;
160
- } else if (newIndex < 0) {
161
- newIndex = 0;
162
- }
163
-
164
- this.$emit('input', opts[newIndex].value);
165
- }
166
- }
167
- });
168
- </script>
169
-
170
- <template>
171
- <div>
172
- <div v-if="label || labelKey || tooltip || tooltipKey || $slots.label" class="radio-group label">
173
- <slot name="label">
174
- <h3>
175
- <t v-if="labelKey" :k="labelKey" />
176
- <template v-else-if="label">
177
- {{ label }}
178
- </template>
179
- <i v-if="tooltipKey" v-tooltip="t(tooltipKey)" class="icon icon-info icon-lg" />
180
- <i v-else-if="tooltip" v-tooltip="tooltip" class="icon icon-info icon-lg" />
181
- </h3>
182
- </slot>
183
- </div>
184
- <div
185
- class="radio-group"
186
- :class="{'row':row}"
187
- tabindex="0"
188
- @keyup.down.stop="clickNext(1)"
189
- @keyup.up.stop="clickNext(-1)"
190
- >
191
- <div
192
- v-for="(option, i) in normalizedOptions"
193
- :key="name+'-'+i"
194
- >
195
- <slot :listeners="$listeners" :option="option" :name="i">
196
- <RadioButton
197
- :key="name+'-'+i"
198
- :name="name"
199
- :value="value"
200
- :label="option.label"
201
- :description="option.description"
202
- :val="option.value"
203
- :disabled="isDisabled"
204
- :mode="mode"
205
- v-on="$listeners"
206
- />
207
- </slot>
208
- </div>
209
- </div>
210
- </div>
211
- </template>
212
-
213
- <style lang='scss'>
214
- .radio-group {
215
- &:focus {
216
- border:none;
217
- outline:none;
218
- }
219
-
220
- h3 {
221
- position: relative;
222
- }
223
-
224
- &.row {
225
- display: flex;
226
- .radio-container {
227
- margin-right: 10px;
228
- }
229
- }
230
-
231
- .label{
232
- font-size: 14px !important;
233
- }
234
- }
235
- </style>
@@ -1,2 +0,0 @@
1
- export { default as RadioButton } from './RadioButton.vue';
2
- export { default as RadioGroup } from './RadioGroup.vue';
@@ -1,168 +0,0 @@
1
- <script lang="ts">
2
- import Vue, { VueConstructor } from 'vue';
3
- import debounce from 'lodash/debounce';
4
- import { _EDIT, _VIEW } from '@shell/config/query-params';
5
-
6
- interface TextAreaResize {
7
- queueResize(): void;
8
- }
9
-
10
- export default (
11
- Vue as VueConstructor<Vue & TextAreaResize>
12
- ).extend({
13
- inheritAttrs: false,
14
-
15
- props: {
16
- /**
17
- * Sets the edit mode for Text Area.
18
- * @values _EDIT, _VIEW
19
- */
20
- mode: {
21
- type: String,
22
- default: _EDIT
23
- },
24
-
25
- /**
26
- * Sets the Minimum height for Text Area. Prevents the height from becoming
27
- * smaller than the value specified in minHeight.
28
- */
29
- minHeight: {
30
- type: Number,
31
- default: 25
32
- },
33
-
34
- /**
35
- * Sets the maximum height for Text Area. Prevents the height from becoming
36
- * larger than the value specified in maxHeight.
37
- */
38
- maxHeight: {
39
- type: Number,
40
- default: 200
41
- },
42
-
43
- /**
44
- * Text that appears in the Text Area when it has no value set.
45
- */
46
- placeholder: {
47
- type: String,
48
- default: ''
49
- },
50
-
51
- /**
52
- * Specifies whether Text Area is subject to spell checking by the
53
- * underlying browser/OS.
54
- */
55
- spellcheck: {
56
- type: Boolean,
57
- default: true
58
- },
59
-
60
- /**
61
- * Disables the Text Area.
62
- */
63
- disabled: {
64
- type: Boolean,
65
- default: false
66
- }
67
- },
68
-
69
- data() {
70
- return {
71
- curHeight: this.minHeight,
72
- overflow: 'hidden'
73
- };
74
- },
75
-
76
- computed: {
77
- /**
78
- * Determines if the Text Area should be disabled.
79
- */
80
- isDisabled(): boolean {
81
- return this.disabled || this.mode === _VIEW;
82
- },
83
-
84
- /**
85
- * Sets the height to one-line for SSR pageload so that it's already right
86
- * (unless the input is long)
87
- */
88
- style(): string {
89
- return `height: ${ this.curHeight }px; overflow: ${ this.overflow };`;
90
- }
91
- },
92
-
93
- watch: {
94
- $attrs: {
95
- deep: true,
96
- handler() {
97
- this.queueResize();
98
- }
99
- }
100
- },
101
-
102
- created() {
103
- this.queueResize = debounce(this.autoSize, 100);
104
- },
105
-
106
- mounted() {
107
- (this.$refs.ta as HTMLElement).style.height = `${ this.curHeight }px`;
108
- this.$nextTick(() => {
109
- this.autoSize();
110
- });
111
- },
112
-
113
- methods: {
114
- /**
115
- * Emits the input event and resizes the Text Area.
116
- */
117
- onInput(val: string): void {
118
- this.$emit('input', val);
119
- this.queueResize();
120
- },
121
-
122
- /**
123
- * Gives focus to the Text Area.
124
- */
125
- focus(): void {
126
- (this.$refs?.ta as HTMLElement).focus();
127
- },
128
-
129
- /**
130
- * Sets the overflowY and height of the Text Area based on the content
131
- * entered (calculated via scroll height).
132
- */
133
- autoSize(): void {
134
- const el = this.$refs.ta as HTMLElement;
135
-
136
- if (!el) {
137
- return;
138
- }
139
-
140
- el.style.height = '1px';
141
-
142
- const border = parseInt(getComputedStyle(el).getPropertyValue('borderTopWidth'), 10) || 0 + parseInt(getComputedStyle(el).getPropertyValue('borderBottomWidth'), 10) || 0;
143
- const neu = Math.max(this.minHeight, Math.min(el.scrollHeight + border, this.maxHeight));
144
-
145
- el.style.overflowY = el.scrollHeight > neu ? 'auto' : 'hidden';
146
- el.style.height = `${ neu }px`;
147
-
148
- this.curHeight = neu;
149
- }
150
- }
151
- });
152
- </script>
153
-
154
- <template>
155
- <textarea
156
- ref="ta"
157
- :disabled="isDisabled"
158
- :style="style"
159
- :placeholder="placeholder"
160
- class="no-resize no-ease"
161
- v-bind="$attrs"
162
- :spellcheck="spellcheck"
163
- @paste="$emit('paste', $event)"
164
- @input="onInput($event.target.value)"
165
- @focus="$emit('focus', $event)"
166
- @blur="$emit('blur', $event)"
167
- />
168
- </template>
@@ -1 +0,0 @@
1
- export { default as TextAreaAutoGrow } from './TextAreaAutoGrow.vue';
@@ -1,107 +0,0 @@
1
- import { shallowMount } from '@vue/test-utils';
2
- import { ToggleSwitch } from './index';
3
-
4
- describe('ToggleSwitch.vue', () => {
5
- it('renders falsy by default', () => {
6
- const wrapper = shallowMount(ToggleSwitch);
7
-
8
- const toggleInput = wrapper.find('input[type="checkbox"]').element as HTMLInputElement
9
-
10
- expect(toggleInput.checked).toBeFalsy();
11
- });
12
-
13
- it('renders a true value', () => {
14
- const wrapper = shallowMount(
15
- ToggleSwitch,
16
- {
17
- propsData: {
18
- value: true
19
- }
20
- });
21
-
22
- const toggleInput = wrapper.find('input[type="checkbox"]').element as HTMLInputElement
23
-
24
- expect(toggleInput.checked).toBe(true);
25
- });
26
-
27
- it('updates from falsy to truthy when props change', async () => {
28
- const wrapper = shallowMount(ToggleSwitch);
29
-
30
- const toggleInput = wrapper.find('input[type="checkbox"]').element as HTMLInputElement
31
-
32
- expect(toggleInput.checked).toBe(false);
33
-
34
- await wrapper.setProps({ value: true });
35
-
36
- expect(toggleInput.checked).toBe(true);
37
- });
38
-
39
- it('emits an input event with a true value', async () => {
40
- const wrapper = shallowMount(ToggleSwitch);
41
-
42
- (wrapper.vm as any).toggle(true);
43
-
44
- await wrapper.vm.$nextTick();
45
-
46
- expect(wrapper.emitted().input?.length).toBe(1);
47
- expect(wrapper.emitted().input?.[0][0]).toBe(true);
48
-
49
- });
50
-
51
- it('emits an input event with a false value', async () => {
52
- const wrapper = shallowMount(
53
- ToggleSwitch,
54
- {
55
- propsData: {
56
- value: true
57
- }
58
- }
59
- );
60
-
61
- (wrapper.vm as any).toggle(false);
62
-
63
- await wrapper.vm.$nextTick();
64
-
65
- expect(wrapper.emitted().input?.length).toBe(1);
66
- expect(wrapper.emitted().input?.[0][0]).toBe(false);
67
- })
68
-
69
- it('emits an input event with a custom onValue', async () => {
70
- const onValue = 'THE TRUTH';
71
-
72
- const wrapper = shallowMount(
73
- ToggleSwitch,
74
- {
75
- propsData: {
76
- onValue,
77
- }
78
- });
79
-
80
- (wrapper.vm as any).toggle(true);
81
-
82
- await wrapper.vm.$nextTick();
83
-
84
- expect(wrapper.emitted().input?.length).toBe(1);
85
- expect(wrapper.emitted().input?.[0][0]).toBe(onValue);
86
- });
87
-
88
- it('emits an input event with a custom offValue', async () => {
89
- const offValue = 'NOT THE TRUTH';
90
-
91
- const wrapper = shallowMount(
92
- ToggleSwitch,
93
- {
94
- propsData: {
95
- value: true,
96
- offValue,
97
- }
98
- });
99
-
100
- (wrapper.vm as any).toggle(false);
101
-
102
- await wrapper.vm.$nextTick();
103
-
104
- expect(wrapper.emitted().input?.length).toBe(1);
105
- expect(wrapper.emitted().input?.[0][0]).toBe(offValue);
106
- })
107
- });
@@ -1,137 +0,0 @@
1
- <script lang="ts">
2
- import Vue from 'vue';
3
- export default Vue.extend({
4
- props: {
5
- value: {
6
- type: [Boolean, String, Number],
7
- default: false
8
- },
9
-
10
- offValue: {
11
- type: [Boolean, String, Number],
12
- default: false,
13
- },
14
-
15
- onValue: {
16
- type: [Boolean, String, Number],
17
- default: true,
18
- },
19
-
20
- offLabel: {
21
- type: String,
22
- default: '',
23
- },
24
-
25
- onLabel: {
26
- type: String,
27
- default: '',
28
- },
29
- },
30
- data() {
31
- return { state: false as boolean | string | number };
32
- },
33
-
34
- methods: {
35
- toggle(neu: boolean | string | number) {
36
- this.state = neu === null ? !this.state : neu;
37
- this.$emit('input', this.state ? this.onValue : this.offValue);
38
- }
39
- },
40
-
41
- watch: {
42
- value: {
43
- handler() {
44
- this.state = this.value === this.onValue;
45
- },
46
- immediate: true
47
- }
48
- }
49
- });
50
- </script>
51
-
52
- <template>
53
- <span class="toggle-container">
54
- <span class="label no-select hand" :class="{ active: !state}" @click="toggle(false)">{{ offLabel }}</span>
55
- <label class="switch hand">
56
- <input type="checkbox" :checked="state" @input="toggle(null)">
57
- <span class="slider round"></span>
58
- </label>
59
- <span class="label no-select hand" :class="{ active: state}" @click="toggle(true)">{{ onLabel }}</span>
60
- </span>
61
- </template>
62
-
63
- <style lang="scss" scoped>
64
- $toggle-height: 16px;
65
-
66
- .toggle-container {
67
- align-items: center;
68
- display: flex;
69
-
70
- span:first-child {
71
- padding-right: 6px;
72
- }
73
- span:last-child {
74
- padding-left: 6px;
75
- }
76
- }
77
- /* The switch - the box around the slider */
78
- .switch {
79
- position: relative;
80
- display: inline-block;
81
- width: 48px;
82
- height: $toggle-height + 8px;
83
- }
84
-
85
- /* Hide default HTML checkbox */
86
- .switch input {
87
- opacity: 0;
88
- width: 0;
89
- height: 0;
90
- }
91
-
92
- /* The slider */
93
- .slider {
94
- position: absolute;
95
- cursor: pointer;
96
- top: 0;
97
- left: 0;
98
- right: 0;
99
- bottom: 0;
100
- background-color: var(--checkbox-disabled-bg);
101
- -webkit-transition: .4s;
102
- transition: .4s;
103
- }
104
-
105
- .slider:before {
106
- position: absolute;
107
- content: "";
108
- height: $toggle-height;
109
- width: $toggle-height;
110
- left: 4px;
111
- bottom: 4px;
112
- background-color: var(--checkbox-tick);
113
- -webkit-transition: .4s;
114
- transition: .4s;
115
- }
116
-
117
- input:checked + .slider {
118
- background-color: var(--checkbox-ticked-bg);
119
- }
120
-
121
- input:focus + .slider {
122
- box-shadow: 0 0 1px var(--checkbox-ticked-bg);
123
- }
124
-
125
- input:checked + .slider:before {
126
- transform: translateX(24px);
127
- }
128
-
129
- /* Rounded sliders */
130
- .slider.round {
131
- border-radius: 34px;
132
- }
133
-
134
- .slider.round:before {
135
- border-radius: 50%;
136
- }
137
- </style>
@@ -1 +0,0 @@
1
- export { default as ToggleSwitch } from './ToggleSwitch.vue';
@@ -1,5 +0,0 @@
1
- export * from './Checkbox';
2
- export * from './LabeledInput';
3
- export * from './Radio';
4
- export * from './TextArea';
5
- export * from './ToggleSwitch';