@rancher/shell 0.3.26 → 0.3.28
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.
- package/assets/translations/en-us.yaml +8 -23
- package/assets/translations/zh-hans.yaml +2 -26
- package/chart/gatekeeper.vue +2 -11
- package/chart/istio.vue +1 -10
- package/chart/logging/index.vue +2 -11
- package/chart/monitoring/index.vue +1 -9
- package/chart/rancher-backup/index.vue +1 -9
- package/components/AlertTable.vue +8 -6
- package/components/Carousel.vue +2 -1
- package/components/EmberPage.vue +2 -2
- package/components/EtcdInfoBanner.vue +12 -2
- package/components/GlobalRoleBindings.vue +10 -0
- package/components/GrafanaDashboard.vue +8 -3
- package/components/Wizard.vue +17 -1
- package/components/auth/RoleDetailEdit.vue +17 -1
- package/components/form/ArrayList.vue +20 -11
- package/components/form/__tests__/ArrayList.test.ts +44 -0
- package/components/formatter/ClusterProvider.vue +1 -18
- package/components/nav/Header.vue +5 -4
- package/components/nav/TopLevelMenu.vue +38 -15
- package/components/nav/WindowManager/ContainerLogs.vue +22 -19
- package/components/nav/__tests__/TopLevelMenu.test.ts +120 -0
- package/components/nav/__tests__/Type.test.ts +139 -0
- package/config/private-label.js +1 -1
- package/config/product/manager.js +0 -13
- package/config/settings.ts +0 -2
- package/config/types.js +0 -4
- package/core/types.ts +11 -4
- package/edit/management.cattle.io.project.vue +1 -52
- package/edit/management.cattle.io.setting.vue +31 -2
- package/edit/provisioning.cattle.io.cluster/Basics.vue +19 -107
- package/edit/provisioning.cattle.io.cluster/CustomCommand.vue +1 -1
- package/edit/provisioning.cattle.io.cluster/__tests__/Basics.tests.ts +0 -3
- package/edit/provisioning.cattle.io.cluster/rke2.vue +3 -128
- package/edit/workload/mixins/workload.js +14 -4
- package/middleware/authenticated.js +4 -2
- package/models/__tests__/management.cattle.io.cluster.test.ts +19 -0
- package/models/__tests__/provisioning.cattle.io.cluster.test.ts +90 -0
- package/models/cluster.x-k8s.io.machine.js +1 -1
- package/models/fleet.cattle.io.cluster.js +11 -1
- package/models/management.cattle.io.cluster.js +4 -0
- package/models/management.cattle.io.project.js +0 -36
- package/models/management.cattle.io.setting.js +11 -7
- package/models/provisioning.cattle.io.cluster.js +16 -4
- package/package.json +1 -1
- package/pages/auth/setup.vue +38 -1
- package/pages/c/_cluster/apps/charts/__tests__/install.helper.test.ts +2 -17
- package/pages/c/_cluster/apps/charts/index.vue +0 -15
- package/pages/c/_cluster/apps/charts/install.helpers.js +2 -13
- package/pages/c/_cluster/apps/charts/install.vue +1 -1
- package/pages/c/_cluster/auth/roles/index.vue +11 -1
- package/pages/c/_cluster/explorer/index.vue +7 -49
- package/pages/c/_cluster/manager/pages/_page.vue +4 -5
- package/pages/c/_cluster/monitoring/index.vue +26 -39
- package/pages/support/index.vue +1 -8
- package/promptRemove/management.cattle.io.project.vue +6 -9
- package/rancher-components/BadgeState/BadgeState.vue +1 -5
- package/rancher-components/Banner/Banner.test.ts +1 -51
- package/rancher-components/Banner/Banner.vue +53 -134
- package/rancher-components/Card/Card.vue +7 -24
- package/rancher-components/Form/Checkbox/Checkbox.test.ts +29 -20
- package/rancher-components/Form/Checkbox/Checkbox.vue +20 -45
- package/rancher-components/Form/LabeledInput/LabeledInput.test.ts +8 -2
- package/rancher-components/Form/LabeledInput/LabeledInput.vue +10 -22
- package/rancher-components/Form/Radio/RadioButton.vue +13 -30
- package/rancher-components/Form/Radio/RadioGroup.vue +7 -26
- package/rancher-components/Form/TextArea/TextAreaAutoGrow.vue +6 -7
- package/rancher-components/Form/ToggleSwitch/ToggleSwitch.test.ts +38 -25
- package/rancher-components/Form/ToggleSwitch/ToggleSwitch.vue +11 -23
- package/rancher-components/LabeledTooltip/LabeledTooltip.vue +5 -19
- package/rancher-components/StringList/StringList.test.ts +49 -453
- package/rancher-components/StringList/StringList.vue +58 -92
- package/rancher-components/components/Form/Radio/RadioGroup.test.ts +30 -0
- package/rancher-components/components/Form/Radio/RadioGroup.vue +4 -0
- package/rancher-components/components/StringList/StringList.test.ts +270 -0
- package/rancher-components/components/StringList/StringList.vue +57 -18
- package/store/features.js +1 -0
- package/store/prefs.js +0 -3
- package/types/shell/index.d.ts +26 -17
- package/utils/__tests__/object.test.ts +67 -1
- package/utils/__tests__/version.test.ts +13 -23
- package/utils/cluster.js +1 -1
- package/utils/custom-validators.js +0 -2
- package/utils/error.js +16 -1
- package/utils/grafana.js +1 -2
- package/utils/monitoring.js +25 -1
- package/utils/object.js +4 -3
- package/utils/sort.js +1 -1
- package/utils/validators/formRules/__tests__/index.test.ts +49 -4
- package/utils/validators/formRules/index.ts +13 -10
- package/utils/validators/role-template.js +1 -1
- package/utils/validators/setting.js +6 -10
- package/utils/version.js +0 -13
- package/components/ChartPsp.vue +0 -76
- package/components/__tests__/ChartPsp.test.ts +0 -75
- package/components/formatter/__tests__/ClusterProvider.test.ts +0 -28
- package/rancher-components/Card/Card.test.ts +0 -37
- package/rancher-components/Form/Radio/RadioButton.test.ts +0 -31
- package/yarn-error.log +0 -200
|
@@ -27,13 +27,6 @@ export default Vue.extend({
|
|
|
27
27
|
type: String,
|
|
28
28
|
default: null
|
|
29
29
|
},
|
|
30
|
-
/**
|
|
31
|
-
* Add icon for the banner
|
|
32
|
-
*/
|
|
33
|
-
icon: {
|
|
34
|
-
type: String,
|
|
35
|
-
default: null
|
|
36
|
-
},
|
|
37
30
|
/**
|
|
38
31
|
* Toggles the banner's close button.
|
|
39
32
|
*/
|
|
@@ -65,137 +58,31 @@ export default Vue.extend({
|
|
|
65
58
|
class="banner"
|
|
66
59
|
:class="{
|
|
67
60
|
[color]: true,
|
|
61
|
+
closable,
|
|
62
|
+
stacked
|
|
68
63
|
}"
|
|
69
64
|
>
|
|
70
|
-
<
|
|
71
|
-
v-if="
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
>
|
|
75
|
-
|
|
76
|
-
|
|
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>
|
|
65
|
+
<slot>
|
|
66
|
+
<t v-if="labelKey" :k="labelKey" :raw="true" />
|
|
67
|
+
<span v-else-if="messageLabel">{{ messageLabel }}</span>
|
|
68
|
+
<span v-else v-html="nlToBr(label)" />
|
|
69
|
+
</slot>
|
|
70
|
+
<div v-if="closable" class="closer" @click="$emit('close')">
|
|
71
|
+
<i class="icon icon-2x icon-close closer-icon" />
|
|
111
72
|
</div>
|
|
112
73
|
</div>
|
|
113
74
|
</template>
|
|
114
75
|
|
|
115
76
|
<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
|
-
}
|
|
77
|
+
$left-border-size: 4px;
|
|
145
78
|
|
|
146
|
-
|
|
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 {
|
|
79
|
+
.banner {
|
|
161
80
|
padding: 10px;
|
|
81
|
+
margin: 15px 0;
|
|
82
|
+
width: 100%;
|
|
162
83
|
transition: all 0.2s ease;
|
|
84
|
+
position: relative;
|
|
163
85
|
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
86
|
|
|
200
87
|
&.stacked {
|
|
201
88
|
padding: 0 10px;
|
|
@@ -210,10 +97,10 @@ $icon-size: 24px;
|
|
|
210
97
|
}
|
|
211
98
|
|
|
212
99
|
&.closable {
|
|
213
|
-
padding-right:
|
|
100
|
+
padding-right: 40px;
|
|
214
101
|
}
|
|
215
102
|
|
|
216
|
-
|
|
103
|
+
.closer {
|
|
217
104
|
display: flex;
|
|
218
105
|
align-items: center;
|
|
219
106
|
|
|
@@ -222,11 +109,12 @@ $icon-size: 24px;
|
|
|
222
109
|
top: 0;
|
|
223
110
|
right: 0;
|
|
224
111
|
bottom: 0;
|
|
225
|
-
width:
|
|
226
|
-
line-height:
|
|
112
|
+
width: 40px;
|
|
113
|
+
line-height: 42px;
|
|
227
114
|
text-align: center;
|
|
228
115
|
|
|
229
116
|
.closer-icon {
|
|
117
|
+
font-size: 22px;
|
|
230
118
|
opacity: 0.7;
|
|
231
119
|
|
|
232
120
|
&:hover {
|
|
@@ -236,9 +124,40 @@ $icon-size: 24px;
|
|
|
236
124
|
}
|
|
237
125
|
}
|
|
238
126
|
|
|
239
|
-
&.
|
|
240
|
-
|
|
127
|
+
&.primary {
|
|
128
|
+
background: var(--primary);
|
|
129
|
+
border-left: solid $left-border-size var(--primary);
|
|
130
|
+
color: var(--body-text);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
&.secondary {
|
|
134
|
+
background: var(--default-banner-bg);
|
|
135
|
+
border-left: solid $left-border-size var(--default);
|
|
136
|
+
color: var(--body-text);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
&.success {
|
|
140
|
+
background: var(--success-banner-bg);
|
|
141
|
+
border-left: solid $left-border-size var(--success);
|
|
142
|
+
color: var(--body-text);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
&.info {
|
|
146
|
+
background: var(--info-banner-bg);
|
|
147
|
+
border-left: solid $left-border-size var(--info);
|
|
148
|
+
color: var(--body-text);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
&.warning {
|
|
152
|
+
background: var(--warning-banner-bg);
|
|
153
|
+
border-left: solid $left-border-size var(--warning);
|
|
154
|
+
color: var(--body-text);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
&.error {
|
|
158
|
+
background: var(--error-banner-bg);
|
|
159
|
+
border-left: solid $left-border-size var(--error);
|
|
160
|
+
color: var(--error);
|
|
241
161
|
}
|
|
242
162
|
}
|
|
243
|
-
}
|
|
244
163
|
</style>
|
|
@@ -49,45 +49,28 @@ export default Vue.extend({
|
|
|
49
49
|
sticky: {
|
|
50
50
|
type: Boolean,
|
|
51
51
|
default: false,
|
|
52
|
-
},
|
|
52
|
+
},
|
|
53
53
|
}
|
|
54
54
|
});
|
|
55
55
|
</script>
|
|
56
56
|
|
|
57
57
|
<template>
|
|
58
|
-
<div
|
|
59
|
-
class="card-container"
|
|
60
|
-
:class="{'highlight-border': showHighlightBorder, 'card-sticky': sticky}"
|
|
61
|
-
data-testid="card"
|
|
62
|
-
>
|
|
58
|
+
<div class="card-container" :class="{'highlight-border': showHighlightBorder, 'card-sticky': sticky}">
|
|
63
59
|
<div class="card-wrap">
|
|
64
|
-
<div
|
|
65
|
-
class="card-title"
|
|
66
|
-
data-testid="card-title-slot"
|
|
67
|
-
>
|
|
60
|
+
<div class="card-title">
|
|
68
61
|
<slot name="title">
|
|
69
62
|
{{ title }}
|
|
70
63
|
</slot>
|
|
71
64
|
</div>
|
|
72
|
-
<hr
|
|
73
|
-
<div
|
|
74
|
-
class="card-body"
|
|
75
|
-
data-testid="card-body-slot"
|
|
76
|
-
>
|
|
65
|
+
<hr />
|
|
66
|
+
<div class="card-body">
|
|
77
67
|
<slot name="body">
|
|
78
68
|
{{ content }}
|
|
79
69
|
</slot>
|
|
80
70
|
</div>
|
|
81
|
-
<div
|
|
82
|
-
v-if="showActions"
|
|
83
|
-
class="card-actions"
|
|
84
|
-
data-testid="card-actions-slot"
|
|
85
|
-
>
|
|
71
|
+
<div v-if="showActions" class="card-actions">
|
|
86
72
|
<slot name="actions">
|
|
87
|
-
<button
|
|
88
|
-
class="btn role-primary"
|
|
89
|
-
@click="buttonAction"
|
|
90
|
-
>
|
|
73
|
+
<button class="btn role-primary" @click="buttonAction">
|
|
91
74
|
{{ buttonText }}
|
|
92
75
|
</button>
|
|
93
76
|
</slot>
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
import { shallowMount
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
2
|
import { Checkbox } from './index';
|
|
3
3
|
|
|
4
|
-
describe('
|
|
5
|
-
const event = {
|
|
6
|
-
target: { tagName: 'input', href: null },
|
|
7
|
-
stopPropagation: () => { },
|
|
8
|
-
preventDefault: () => { }
|
|
9
|
-
} as unknown as MouseEvent;
|
|
10
|
-
|
|
4
|
+
describe('Checkbox.vue', () => {
|
|
11
5
|
it('is unchecked by default', () => {
|
|
12
6
|
const wrapper = shallowMount(Checkbox);
|
|
13
7
|
const cbInput = wrapper.find('input[type="checkbox"]').element as HTMLInputElement;
|
|
@@ -22,7 +16,7 @@ describe('checkbox.vue', () => {
|
|
|
22
16
|
expect(cbInput.checked).toBe(true);
|
|
23
17
|
});
|
|
24
18
|
|
|
25
|
-
it('updates from false to true when props change', async() => {
|
|
19
|
+
it('updates from false to true when props change', async () => {
|
|
26
20
|
const wrapper = shallowMount(Checkbox);
|
|
27
21
|
const cbInput = wrapper.find('input[type="checkbox"]').element as HTMLInputElement;
|
|
28
22
|
|
|
@@ -33,36 +27,51 @@ describe('checkbox.vue', () => {
|
|
|
33
27
|
expect(cbInput.checked).toBe(true);
|
|
34
28
|
});
|
|
35
29
|
|
|
36
|
-
it('emits an input event with a true value', async() => {
|
|
37
|
-
const wrapper
|
|
30
|
+
it('emits an input event with a true value', async () => {
|
|
31
|
+
const wrapper = shallowMount(Checkbox);
|
|
32
|
+
const event = {
|
|
33
|
+
target: { tagName: 'input', href: null },
|
|
34
|
+
stopPropagation: () => { },
|
|
35
|
+
preventDefault: () => { }
|
|
36
|
+
};
|
|
38
37
|
|
|
39
|
-
wrapper.vm.clicked(event);
|
|
38
|
+
(wrapper.vm as any).clicked(event);
|
|
40
39
|
await wrapper.vm.$nextTick();
|
|
41
40
|
|
|
42
41
|
expect(wrapper.emitted().input?.length).toBe(1);
|
|
43
42
|
expect(wrapper.emitted().input?.[0][0]).toBe(true);
|
|
44
43
|
});
|
|
45
44
|
|
|
46
|
-
it('emits an input event with a custom valueWhenTrue', async() => {
|
|
45
|
+
it('emits an input event with a custom valueWhenTrue', async () => {
|
|
47
46
|
const valueWhenTrue = 'BIG IF TRUE';
|
|
47
|
+
const event = {
|
|
48
|
+
target: { tagName: 'input', href: null },
|
|
49
|
+
stopPropagation: () => { },
|
|
50
|
+
preventDefault: () => { }
|
|
51
|
+
};
|
|
48
52
|
|
|
49
|
-
const wrapper
|
|
53
|
+
const wrapper = shallowMount(Checkbox, { propsData: { value: false, valueWhenTrue } });
|
|
50
54
|
|
|
51
|
-
wrapper.vm.clicked(event);
|
|
55
|
+
(wrapper.vm as any).clicked(event);
|
|
52
56
|
await wrapper.vm.$nextTick();
|
|
53
57
|
|
|
54
58
|
expect(wrapper.emitted().input?.length).toBe(1);
|
|
55
59
|
expect(wrapper.emitted().input?.[0][0]).toBe(valueWhenTrue);
|
|
56
60
|
});
|
|
57
61
|
|
|
58
|
-
it('updates from valueWhenTrue to falsy', async() => {
|
|
62
|
+
it('updates from valueWhenTrue to falsy', async () => {
|
|
59
63
|
const valueWhenTrue = 'REAL HUGE IF FALSE';
|
|
64
|
+
const event = {
|
|
65
|
+
target: { tagName: 'input', href: null },
|
|
66
|
+
stopPropagation: () => { },
|
|
67
|
+
preventDefault: () => { }
|
|
68
|
+
};
|
|
60
69
|
|
|
61
|
-
const wrapper
|
|
70
|
+
const wrapper = shallowMount(Checkbox, { propsData: { value: valueWhenTrue, valueWhenTrue } });
|
|
62
71
|
|
|
63
|
-
wrapper.vm.clicked(event);
|
|
72
|
+
(wrapper.vm as any).clicked(event);
|
|
64
73
|
await wrapper.vm.$nextTick();
|
|
65
74
|
|
|
66
|
-
expect(wrapper.emitted().input?.[0][0]).
|
|
67
|
-
})
|
|
75
|
+
expect(wrapper.emitted().input?.[0][0]).toBe(null);
|
|
76
|
+
})
|
|
68
77
|
});
|
|
@@ -2,11 +2,8 @@
|
|
|
2
2
|
import Vue, { PropType } from 'vue';
|
|
3
3
|
import { _EDIT, _VIEW } from '@shell/config/query-params';
|
|
4
4
|
import { addObject, removeObject } from '@shell/utils/array';
|
|
5
|
-
import cloneDeep from 'lodash/cloneDeep';
|
|
6
5
|
|
|
7
6
|
export default Vue.extend({
|
|
8
|
-
name: 'Checkbox',
|
|
9
|
-
|
|
10
7
|
props: {
|
|
11
8
|
/**
|
|
12
9
|
* The checkbox value.
|
|
@@ -49,8 +46,8 @@ export default Vue.extend({
|
|
|
49
46
|
},
|
|
50
47
|
|
|
51
48
|
/**
|
|
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
|
|
49
|
+
* Display an indeterminate state. Useful for cases where a checkbox might
|
|
50
|
+
* be the parent to child checkboxes, and we need to show that a subset of
|
|
54
51
|
* children are checked.
|
|
55
52
|
*/
|
|
56
53
|
indeterminate: {
|
|
@@ -113,22 +110,22 @@ export default Vue.extend({
|
|
|
113
110
|
primary: {
|
|
114
111
|
type: Boolean,
|
|
115
112
|
default: false
|
|
116
|
-
},
|
|
113
|
+
},
|
|
117
114
|
},
|
|
118
115
|
|
|
119
116
|
computed: {
|
|
120
117
|
/**
|
|
121
118
|
* Determines if the checkbox is disabled.
|
|
122
|
-
* @returns boolean: True when the disabled prop is true or when mode is
|
|
119
|
+
* @returns boolean: True when the disabled prop is true or when mode is
|
|
123
120
|
* View.
|
|
124
121
|
*/
|
|
125
122
|
isDisabled(): boolean {
|
|
126
123
|
return (this.disabled || this.mode === _VIEW);
|
|
127
124
|
},
|
|
128
125
|
/**
|
|
129
|
-
* Determines if the checkbox is checked when using custom values or
|
|
126
|
+
* Determines if the checkbox is checked when using custom values or
|
|
130
127
|
* multiple values.
|
|
131
|
-
* @returns boolean: True when at least one value is true in a collection or
|
|
128
|
+
* @returns boolean: True when at least one value is true in a collection or
|
|
132
129
|
* when value matches `this.valueWhenTrue`.
|
|
133
130
|
*/
|
|
134
131
|
isChecked(): boolean {
|
|
@@ -165,15 +162,13 @@ export default Vue.extend({
|
|
|
165
162
|
const click = new CustomEvent('click', customEvent);
|
|
166
163
|
|
|
167
164
|
// Flip the value
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
if (this.isMulti(value)) {
|
|
165
|
+
if (this.isMulti(this.value)) {
|
|
171
166
|
if (this.isChecked) {
|
|
172
|
-
removeObject(value, this.valueWhenTrue);
|
|
167
|
+
removeObject(this.value, this.valueWhenTrue);
|
|
173
168
|
} else {
|
|
174
|
-
addObject(value, this.valueWhenTrue);
|
|
169
|
+
addObject(this.value, this.valueWhenTrue);
|
|
175
170
|
}
|
|
176
|
-
this.$emit('input', value);
|
|
171
|
+
this.$emit('input', this.value);
|
|
177
172
|
} else if (this.isString(this.valueWhenTrue)) {
|
|
178
173
|
if (this.isChecked) {
|
|
179
174
|
this.$emit('input', null);
|
|
@@ -181,7 +176,7 @@ export default Vue.extend({
|
|
|
181
176
|
this.$emit('input', this.valueWhenTrue);
|
|
182
177
|
}
|
|
183
178
|
} else {
|
|
184
|
-
this.$emit('input', !value);
|
|
179
|
+
this.$emit('input', !this.value);
|
|
185
180
|
this.$el.dispatchEvent(click);
|
|
186
181
|
}
|
|
187
182
|
},
|
|
@@ -202,17 +197,14 @@ export default Vue.extend({
|
|
|
202
197
|
* @param value A collection of values for the checkbox.
|
|
203
198
|
*/
|
|
204
199
|
findTrueValues(value: boolean[]): boolean {
|
|
205
|
-
return value.find(
|
|
200
|
+
return value.find(v => v === this.valueWhenTrue) || false;
|
|
206
201
|
}
|
|
207
202
|
}
|
|
208
203
|
});
|
|
209
204
|
</script>
|
|
210
205
|
|
|
211
206
|
<template>
|
|
212
|
-
<div
|
|
213
|
-
class="checkbox-outer-container"
|
|
214
|
-
data-checkbox-ctrl
|
|
215
|
-
>
|
|
207
|
+
<div class="checkbox-outer-container" data-checkbox-ctrl>
|
|
216
208
|
<label
|
|
217
209
|
class="checkbox-container"
|
|
218
210
|
:class="{ 'disabled': isDisabled}"
|
|
@@ -222,13 +214,14 @@ export default Vue.extend({
|
|
|
222
214
|
@click="clicked($event)"
|
|
223
215
|
>
|
|
224
216
|
<input
|
|
217
|
+
v-model="value"
|
|
225
218
|
:checked="isChecked"
|
|
226
219
|
:value="valueWhenTrue"
|
|
227
220
|
type="checkbox"
|
|
228
221
|
:tabindex="-1"
|
|
229
222
|
:name="id"
|
|
230
223
|
@click.stop.prevent
|
|
231
|
-
|
|
224
|
+
/>
|
|
232
225
|
<span
|
|
233
226
|
class="checkbox-custom"
|
|
234
227
|
:class="{indeterminate: indeterminate}"
|
|
@@ -243,33 +236,15 @@ export default Vue.extend({
|
|
|
243
236
|
:class="{ 'checkbox-primary': primary }"
|
|
244
237
|
>
|
|
245
238
|
<slot name="label">
|
|
246
|
-
<t
|
|
247
|
-
v-if="labelKey"
|
|
248
|
-
:k="labelKey"
|
|
249
|
-
:raw="true"
|
|
250
|
-
/>
|
|
239
|
+
<t v-if="labelKey" :k="labelKey" :raw="true" />
|
|
251
240
|
<template v-else-if="label">{{ label }}</template>
|
|
252
|
-
<i
|
|
253
|
-
|
|
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
|
-
/>
|
|
241
|
+
<i v-if="tooltipKey" v-tooltip="t(tooltipKey)" class="checkbox-info icon icon-info icon-lg" />
|
|
242
|
+
<i v-else-if="tooltip" v-tooltip="tooltip" class="checkbox-info icon icon-info icon-lg" />
|
|
262
243
|
</slot>
|
|
263
244
|
</span>
|
|
264
245
|
</label>
|
|
265
|
-
<div
|
|
266
|
-
v-if="descriptionKey
|
|
267
|
-
class="checkbox-outer-container-description"
|
|
268
|
-
>
|
|
269
|
-
<t
|
|
270
|
-
v-if="descriptionKey"
|
|
271
|
-
:k="descriptionKey"
|
|
272
|
-
/>
|
|
246
|
+
<div v-if="descriptionKey || description" class="checkbox-outer-container-description">
|
|
247
|
+
<t v-if="descriptionKey" :k="descriptionKey" />
|
|
273
248
|
<template v-else-if="description">
|
|
274
249
|
{{ description }}
|
|
275
250
|
</template>
|
|
@@ -6,9 +6,15 @@ describe('component: LabeledInput', () => {
|
|
|
6
6
|
it('should emit input only once', () => {
|
|
7
7
|
const value = '2';
|
|
8
8
|
const delay = 1;
|
|
9
|
-
const wrapper = mount(LabeledInput, {
|
|
9
|
+
const wrapper = mount(LabeledInput, {
|
|
10
10
|
propsData: { delay },
|
|
11
|
-
mocks:
|
|
11
|
+
mocks: {
|
|
12
|
+
$store: {
|
|
13
|
+
getters: {
|
|
14
|
+
'i18n/t': jest.fn()
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
12
18
|
});
|
|
13
19
|
|
|
14
20
|
jest.useFakeTimers();
|
|
@@ -27,7 +27,7 @@ export default (
|
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* The status class of the Labeled Input and tooltip.
|
|
30
|
-
* @values info, success, warning, error
|
|
30
|
+
* @values info, success, warning, error
|
|
31
31
|
*/
|
|
32
32
|
status: {
|
|
33
33
|
type: String,
|
|
@@ -59,7 +59,7 @@ export default (
|
|
|
59
59
|
},
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
|
-
* Disables the password manager prompt to save the contents of the Labeled
|
|
62
|
+
* Disables the password manager prompt to save the contents of the Labeled
|
|
63
63
|
* Input.
|
|
64
64
|
*/
|
|
65
65
|
ignorePasswordManagers: {
|
|
@@ -124,7 +124,7 @@ export default (
|
|
|
124
124
|
|
|
125
125
|
tooltipValue(): string | undefined {
|
|
126
126
|
if (this.hasTooltip) {
|
|
127
|
-
return this.tooltipKey ? this.t(this.tooltipKey) : this.tooltip
|
|
127
|
+
return this.tooltipKey ? this.t(this.tooltipKey) : this.tooltip
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
return undefined;
|
|
@@ -207,7 +207,7 @@ export default (
|
|
|
207
207
|
},
|
|
208
208
|
|
|
209
209
|
/**
|
|
210
|
-
* Emit on input with delay. Note: Arrow function is avoided due context
|
|
210
|
+
* Emit on input with delay. Note: Arrow function is avoided due context
|
|
211
211
|
* binding.
|
|
212
212
|
*/
|
|
213
213
|
delayInput(value: string): void {
|
|
@@ -223,7 +223,7 @@ export default (
|
|
|
223
223
|
},
|
|
224
224
|
|
|
225
225
|
/**
|
|
226
|
-
* Handles the behavior of the Labeled Input when blurred and emits the blur
|
|
226
|
+
* Handles the behavior of the Labeled Input when blurred and emits the blur
|
|
227
227
|
* event.
|
|
228
228
|
* @see labeled-form-element.ts mixin for onBlurLabeled()
|
|
229
229
|
*/
|
|
@@ -253,16 +253,10 @@ export default (
|
|
|
253
253
|
>
|
|
254
254
|
<slot name="label">
|
|
255
255
|
<label v-if="hasLabel">
|
|
256
|
-
<t
|
|
257
|
-
v-if="labelKey"
|
|
258
|
-
:k="labelKey"
|
|
259
|
-
/>
|
|
256
|
+
<t v-if="labelKey" :k="labelKey" />
|
|
260
257
|
<template v-else-if="label">{{ label }}</template>
|
|
261
258
|
|
|
262
|
-
<span
|
|
263
|
-
v-if="requiredField"
|
|
264
|
-
class="required"
|
|
265
|
-
>*</span>
|
|
259
|
+
<span v-if="requiredField" class="required">*</span>
|
|
266
260
|
</label>
|
|
267
261
|
</slot>
|
|
268
262
|
|
|
@@ -299,7 +293,7 @@ export default (
|
|
|
299
293
|
@input="onInput($event.target.value)"
|
|
300
294
|
@focus="onFocus"
|
|
301
295
|
@blur="onBlur"
|
|
302
|
-
|
|
296
|
+
/>
|
|
303
297
|
</slot>
|
|
304
298
|
|
|
305
299
|
<slot name="suffix" />
|
|
@@ -314,14 +308,8 @@ export default (
|
|
|
314
308
|
:hover="hoverTooltip"
|
|
315
309
|
:value="validationMessage"
|
|
316
310
|
/>
|
|
317
|
-
<label
|
|
318
|
-
|
|
319
|
-
class="cron-label"
|
|
320
|
-
>{{ cronHint }}</label>
|
|
321
|
-
<label
|
|
322
|
-
v-if="subLabel"
|
|
323
|
-
class="sub-label"
|
|
324
|
-
>{{ subLabel }}</label>
|
|
311
|
+
<label v-if="cronHint" class="cron-label">{{ cronHint }}</label>
|
|
312
|
+
<label v-if="subLabel" class="sub-label">{{ subLabel }}</label>
|
|
325
313
|
</div>
|
|
326
314
|
</template>
|
|
327
315
|
<style scoped lang="scss">
|