@rancher/shell 3.0.2 → 3.0.4
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/styles/themes/_light.scss +1 -2
- package/assets/styles/themes/_suse.scss +1 -0
- package/assets/translations/en-us.yaml +19 -3
- package/chart/monitoring/prometheus/index.vue +13 -10
- package/components/ButtonGroup.vue +4 -0
- package/components/LocaleSelector.vue +2 -0
- package/components/PromptRemove.vue +1 -1
- package/components/SortableTable/THead.vue +2 -0
- package/components/SortableTable/index.vue +68 -12
- package/components/StatusBadge.vue +10 -4
- package/components/auth/Principal.vue +9 -3
- package/components/form/ArrayList.vue +9 -0
- package/components/form/KeyValue.vue +1 -1
- package/components/form/MatchExpressions.vue +4 -0
- package/components/form/Select.vue +11 -2
- package/components/nav/Favorite.vue +5 -1
- package/components/nav/Group.vue +4 -0
- package/components/nav/Jump.vue +7 -0
- package/components/nav/Pinned.vue +1 -1
- package/components/nav/Type.vue +1 -0
- package/config/router/routes.js +1 -0
- package/core/plugin-routes.ts +5 -115
- package/core/plugins.js +1 -1
- package/core/types.ts +18 -2
- package/detail/__tests__/autoscaling.horizontalpodautoscaler.test.ts +84 -23
- package/detail/autoscaling.horizontalpodautoscaler/index.vue +13 -3
- package/dialog/DeactivateDriverDialog.vue +4 -4
- package/dialog/GitRepoForceUpdateDialog.vue +1 -1
- package/edit/auth/ldap/__tests__/config.test.ts +0 -14
- package/edit/auth/ldap/config.vue +0 -24
- package/edit/autoscaling.horizontalpodautoscaler/metric-identifier.vue +5 -2
- package/edit/fleet.cattle.io.clustergroup.vue +5 -3
- package/edit/fleet.cattle.io.gitrepo.vue +2 -0
- package/edit/logging-flow/Match.vue +1 -1
- package/edit/provisioning.cattle.io.cluster/tabs/Advanced.vue +5 -2
- package/edit/provisioning.cattle.io.cluster/tabs/etcd/index.vue +1 -1
- package/machine-config/__tests__/vmwarevsphere.test.ts +48 -3
- package/machine-config/vmwarevsphere.vue +16 -0
- package/models/__tests__/logging.banzaicloud.io.flow.test.ts +88 -0
- package/models/logging.banzaicloud.io.flow.js +2 -1
- package/package.json +2 -2
- package/pages/about.vue +16 -8
- package/promptRemove/management.cattle.io.fleetworkspace.vue +1 -1
- package/promptRemove/management.cattle.io.globalrole.vue +1 -1
- package/promptRemove/management.cattle.io.project.vue +2 -2
- package/promptRemove/management.cattle.io.roletemplate.vue +1 -1
- package/promptRemove/pod.vue +1 -1
- package/rancher-components/Form/Checkbox/Checkbox.vue +9 -1
- package/rancher-components/Form/LabeledInput/LabeledInput.vue +7 -2
- package/rancher-components/Form/ToggleSwitch/ToggleSwitch.vue +3 -3
- package/rancher-components/RcDropdown/RcDropdown.vue +3 -3
- package/rancher-components/RcDropdown/RcDropdownMenu.vue +4 -2
- package/rancher-components/RcDropdown/RcDropdownTrigger.vue +2 -2
- package/scripts/test-plugins-build.sh +4 -6
- package/types/shell/index.d.ts +1 -1
- package/utils/__tests__/string.test.ts +2 -2
- package/utils/color.js +9 -8
- package/utils/string.js +1 -3
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import LogFlow from '@shell/models/logging.banzaicloud.io.flow';
|
|
2
|
+
|
|
3
|
+
describe('class LogFlow', () => {
|
|
4
|
+
it('prop "outputs" should take namespace in consideration when filtering logging v2 "outputs"', () => {
|
|
5
|
+
const logOutputs = [
|
|
6
|
+
{
|
|
7
|
+
apiVersion: 'logging.banzaicloud.io/v1beta1',
|
|
8
|
+
kind: 'Output',
|
|
9
|
+
metadata: {
|
|
10
|
+
creationTimestamp: '2025-03-17T10:51:55Z',
|
|
11
|
+
namespace: 'default',
|
|
12
|
+
name: 'output1',
|
|
13
|
+
uid: '927b4a2e-6be0-476f-9bdd-cf30c4a27d8b'
|
|
14
|
+
},
|
|
15
|
+
name: 'output1',
|
|
16
|
+
spec: { awsElasticsearch: { endpoint: {} } },
|
|
17
|
+
status: { active: false }
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
apiVersion: 'logging.banzaicloud.io/v1beta1',
|
|
21
|
+
kind: 'Output',
|
|
22
|
+
metadata: {
|
|
23
|
+
creationTimestamp: '2025-03-17T10:51:55Z',
|
|
24
|
+
namespace: 'cattle-fleet-system',
|
|
25
|
+
name: 'output2',
|
|
26
|
+
uid: '927b4a2e-6be0-476f-9bdd-cf30c4a27d8c'
|
|
27
|
+
},
|
|
28
|
+
name: 'output2',
|
|
29
|
+
spec: { awsElasticsearch: { endpoint: {} } },
|
|
30
|
+
status: { active: false }
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
apiVersion: 'logging.banzaicloud.io/v1beta1',
|
|
34
|
+
kind: 'Output',
|
|
35
|
+
metadata: {
|
|
36
|
+
creationTimestamp: '2025-03-17T10:51:55Z',
|
|
37
|
+
namespace: 'cattle-fleet-system',
|
|
38
|
+
name: 'output3',
|
|
39
|
+
uid: '927b4a2e-6be0-476f-9bdd-cf30c4a27d8d'
|
|
40
|
+
},
|
|
41
|
+
name: 'output3',
|
|
42
|
+
spec: { awsElasticsearch: { endpoint: {} } },
|
|
43
|
+
status: { active: false }
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
apiVersion: 'logging.banzaicloud.io/v1beta1',
|
|
47
|
+
kind: 'Output',
|
|
48
|
+
metadata: {
|
|
49
|
+
creationTimestamp: '2025-03-17T10:51:55Z',
|
|
50
|
+
namespace: 'kube-system',
|
|
51
|
+
name: 'output4',
|
|
52
|
+
uid: '927b4a2e-6be0-476f-9bdd-cf30c4a27d8e'
|
|
53
|
+
},
|
|
54
|
+
name: 'output4',
|
|
55
|
+
spec: { awsElasticsearch: { endpoint: {} } },
|
|
56
|
+
status: { active: false }
|
|
57
|
+
},
|
|
58
|
+
];
|
|
59
|
+
|
|
60
|
+
const logFlowData = {
|
|
61
|
+
apiVersion: 'logging.banzaicloud.io/v1beta1',
|
|
62
|
+
kind: 'Flow',
|
|
63
|
+
metadata: {
|
|
64
|
+
name: 'flow2',
|
|
65
|
+
creationTimestamp: '2025-03-17T10:53:02Z',
|
|
66
|
+
generation: 1,
|
|
67
|
+
namespace: 'cattle-fleet-system',
|
|
68
|
+
resourceVersion: '4070',
|
|
69
|
+
uid: 'fdf7d553-d101-4c37-91b0-784f95dc950a',
|
|
70
|
+
fields: [
|
|
71
|
+
'flow2', true, null
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
spec: {
|
|
75
|
+
localOutputRefs: [
|
|
76
|
+
'output2',
|
|
77
|
+
'output3'
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const logFlow = new LogFlow(logFlowData);
|
|
83
|
+
|
|
84
|
+
jest.spyOn(logFlow, 'allOutputs', 'get').mockReturnValue(logOutputs);
|
|
85
|
+
|
|
86
|
+
expect(logFlow.outputs).toStrictEqual([logOutputs[1], logOutputs[2]]);
|
|
87
|
+
});
|
|
88
|
+
});
|
|
@@ -64,7 +64,8 @@ export default class LogFlow extends SteveModel {
|
|
|
64
64
|
get outputs() {
|
|
65
65
|
const localOutputRefs = this.spec?.localOutputRefs || [];
|
|
66
66
|
|
|
67
|
-
return this.allOutputs.filter((output) => localOutputRefs.includes(output.name)
|
|
67
|
+
return this.allOutputs.filter((output) => localOutputRefs.includes(output.name) &&
|
|
68
|
+
output.metadata?.namespace === this.metadata?.namespace);
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
get outputsSortable() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rancher/shell",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.4",
|
|
4
4
|
"description": "Rancher Dashboard Shell",
|
|
5
5
|
"repository": "https://github.com/rancherlabs/dashboard",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"add": "2.0.6",
|
|
52
52
|
"ansi_up": "5.0.0",
|
|
53
53
|
"axios-retry": "3.1.9",
|
|
54
|
-
"axios": "
|
|
54
|
+
"axios": "1.8.4",
|
|
55
55
|
"babel-eslint": "10.1.0",
|
|
56
56
|
"babel-plugin-module-resolver": "4.0.0",
|
|
57
57
|
"babel-preset-vue": "2.0.2",
|
package/pages/about.vue
CHANGED
|
@@ -119,8 +119,12 @@ export default {
|
|
|
119
119
|
<table>
|
|
120
120
|
<thead>
|
|
121
121
|
<tr>
|
|
122
|
-
<th
|
|
123
|
-
|
|
122
|
+
<th class="custom-th">
|
|
123
|
+
{{ t('about.versions.component') }}
|
|
124
|
+
</th>
|
|
125
|
+
<th class="custom-th">
|
|
126
|
+
{{ t('about.versions.version') }}
|
|
127
|
+
</th>
|
|
124
128
|
</tr>
|
|
125
129
|
</thead>
|
|
126
130
|
<tr v-if="rancherVersion">
|
|
@@ -210,11 +214,11 @@ export default {
|
|
|
210
214
|
v-for="(d, i) in downloadImageList"
|
|
211
215
|
:key="i"
|
|
212
216
|
>
|
|
213
|
-
<
|
|
217
|
+
<th>
|
|
214
218
|
<div class="os">
|
|
215
219
|
<i :class="`icon ${d.icon} mr-5`" /> {{ t(d.label) }}
|
|
216
220
|
</div>
|
|
217
|
-
</
|
|
221
|
+
</th>
|
|
218
222
|
<td>
|
|
219
223
|
<a
|
|
220
224
|
v-if="d.imageList"
|
|
@@ -241,11 +245,11 @@ export default {
|
|
|
241
245
|
:key="i"
|
|
242
246
|
class="link"
|
|
243
247
|
>
|
|
244
|
-
<
|
|
248
|
+
<th>
|
|
245
249
|
<div class="os">
|
|
246
250
|
<i :class="`icon ${d.icon} mr-5`" /> {{ t(d.label) }}
|
|
247
251
|
</div>
|
|
248
|
-
</
|
|
252
|
+
</th>
|
|
249
253
|
<td>
|
|
250
254
|
<a
|
|
251
255
|
v-if="d.cliLink"
|
|
@@ -273,7 +277,7 @@ export default {
|
|
|
273
277
|
overflow: hidden;
|
|
274
278
|
border-radius: var(--border-radius);
|
|
275
279
|
|
|
276
|
-
tr >
|
|
280
|
+
tr > th:first-of-type {
|
|
277
281
|
width: 20%;
|
|
278
282
|
}
|
|
279
283
|
|
|
@@ -284,11 +288,15 @@ export default {
|
|
|
284
288
|
text-align: left;
|
|
285
289
|
}
|
|
286
290
|
|
|
287
|
-
th {
|
|
291
|
+
th.custom-th {
|
|
288
292
|
background-color: var(--sortable-table-top-divider);
|
|
289
293
|
border-bottom: 1px solid var(--sortable-table-top-divider);
|
|
290
294
|
}
|
|
291
295
|
|
|
296
|
+
th:not(.custom-th) {
|
|
297
|
+
font-weight: normal;
|
|
298
|
+
}
|
|
299
|
+
|
|
292
300
|
a {
|
|
293
301
|
cursor: pointer;
|
|
294
302
|
}
|
|
@@ -21,7 +21,7 @@ export default {
|
|
|
21
21
|
|
|
22
22
|
<template>
|
|
23
23
|
<div>
|
|
24
|
-
{{ t('promptRemove.attemptingToRemove', { type }) }} <span v-clean-html="resourceNames(names, t)" />
|
|
24
|
+
{{ t('promptRemove.attemptingToRemove', { type }) }} <span v-clean-html="resourceNames(names, null, t)" />
|
|
25
25
|
<div
|
|
26
26
|
v-if="info"
|
|
27
27
|
class="text info mb-10 mt-20"
|
|
@@ -94,7 +94,7 @@ export default {
|
|
|
94
94
|
<template v-if="!canSeeProjectlessNamespaces">
|
|
95
95
|
<span class="delete-warning"> {{ t('promptRemove.willDeleteAssociatedNamespaces') }}</span> <br>
|
|
96
96
|
<div
|
|
97
|
-
v-clean-html="resourceNames(names, t)"
|
|
97
|
+
v-clean-html="resourceNames(names, null, t)"
|
|
98
98
|
class="mt-10"
|
|
99
99
|
/>
|
|
100
100
|
</template>
|
|
@@ -108,7 +108,7 @@ export default {
|
|
|
108
108
|
:label="t('promptRemove.deleteAssociatedNamespaces')"
|
|
109
109
|
/>
|
|
110
110
|
<div class="mt-10 ml-20">
|
|
111
|
-
<span v-clean-html="resourceNames(names, t)" />
|
|
111
|
+
<span v-clean-html="resourceNames(names, null, t)" />
|
|
112
112
|
</div>
|
|
113
113
|
</div>
|
|
114
114
|
</div>
|
package/promptRemove/pod.vue
CHANGED
|
@@ -128,6 +128,10 @@ export default defineComponent({
|
|
|
128
128
|
|
|
129
129
|
emits: ['update:value'],
|
|
130
130
|
|
|
131
|
+
data() {
|
|
132
|
+
return { describedById: `described-by-${ generateRandomAlphaString(12) }` };
|
|
133
|
+
},
|
|
134
|
+
|
|
131
135
|
computed: {
|
|
132
136
|
/**
|
|
133
137
|
* Determines if the checkbox is disabled.
|
|
@@ -270,6 +274,7 @@ export default defineComponent({
|
|
|
270
274
|
:aria-label="replacementLabel"
|
|
271
275
|
:aria-checked="!!value"
|
|
272
276
|
:aria-labelledby="labelKey || label ? idForLabel : undefined"
|
|
277
|
+
:aria-describedby="descriptionKey || description ? describedById : undefined"
|
|
273
278
|
role="checkbox"
|
|
274
279
|
/>
|
|
275
280
|
<span
|
|
@@ -311,10 +316,13 @@ export default defineComponent({
|
|
|
311
316
|
>
|
|
312
317
|
<t
|
|
313
318
|
v-if="descriptionKey"
|
|
319
|
+
:id="describedById"
|
|
314
320
|
:k="descriptionKey"
|
|
315
321
|
/>
|
|
316
322
|
<template v-else-if="description">
|
|
317
|
-
|
|
323
|
+
<p :id="describedById">
|
|
324
|
+
{{ description }}
|
|
325
|
+
</p>
|
|
318
326
|
</template>
|
|
319
327
|
</div>
|
|
320
328
|
<div class="checkbox-outer-container-extra">
|
|
@@ -148,7 +148,8 @@ export default defineComponent({
|
|
|
148
148
|
return {
|
|
149
149
|
updated: false,
|
|
150
150
|
validationErrors: '',
|
|
151
|
-
inputId: `input-${ generateRandomAlphaString(12) }
|
|
151
|
+
inputId: `input-${ generateRandomAlphaString(12) }`,
|
|
152
|
+
describedById: `described-by-${ generateRandomAlphaString(12) }`
|
|
152
153
|
};
|
|
153
154
|
},
|
|
154
155
|
|
|
@@ -380,6 +381,7 @@ export default defineComponent({
|
|
|
380
381
|
:placeholder="_placeholder"
|
|
381
382
|
autocapitalize="off"
|
|
382
383
|
:class="{ conceal: type === 'multiline-password' }"
|
|
384
|
+
:aria-describedby="cronHint || subLabel ? describedById : undefined"
|
|
383
385
|
@update:value="onInput"
|
|
384
386
|
@focus="onFocus"
|
|
385
387
|
@blur="onBlur"
|
|
@@ -400,6 +402,7 @@ export default defineComponent({
|
|
|
400
402
|
autocomplete="off"
|
|
401
403
|
autocapitalize="off"
|
|
402
404
|
:data-lpignore="ignorePasswordManagers"
|
|
405
|
+
:aria-describedby="cronHint || subLabel ? describedById : undefined"
|
|
403
406
|
@input="onInput"
|
|
404
407
|
@focus="onFocus"
|
|
405
408
|
@blur="onBlur"
|
|
@@ -428,13 +431,15 @@ export default defineComponent({
|
|
|
428
431
|
>
|
|
429
432
|
<div
|
|
430
433
|
v-if="cronHint"
|
|
434
|
+
:id="describedById"
|
|
431
435
|
role="alert"
|
|
432
436
|
:aria-label="cronHint"
|
|
433
437
|
>
|
|
434
438
|
{{ cronHint }}
|
|
435
439
|
</div>
|
|
436
440
|
<div
|
|
437
|
-
v-if="subLabel"
|
|
441
|
+
v-else-if="subLabel"
|
|
442
|
+
:id="describedById"
|
|
438
443
|
v-clean-html="subLabel"
|
|
439
444
|
/>
|
|
440
445
|
</div>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { defineComponent, onMounted, onBeforeUnmount,
|
|
2
|
+
import { defineComponent, onMounted, onBeforeUnmount, ref } from 'vue';
|
|
3
3
|
|
|
4
4
|
type StateType = boolean | 'true' | 'false' | undefined;
|
|
5
5
|
|
|
@@ -34,7 +34,7 @@ export default defineComponent({
|
|
|
34
34
|
emits: ['update:value'],
|
|
35
35
|
|
|
36
36
|
setup() {
|
|
37
|
-
const switchChrome =
|
|
37
|
+
const switchChrome = ref<HTMLElement | null>(null);
|
|
38
38
|
const focus = () => {
|
|
39
39
|
switchChrome.value?.classList.add('focus');
|
|
40
40
|
};
|
|
@@ -43,7 +43,7 @@ export default defineComponent({
|
|
|
43
43
|
switchChrome.value?.classList.remove('focus');
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
const switchInput =
|
|
46
|
+
const switchInput = ref<HTMLInputElement | null>(null);
|
|
47
47
|
|
|
48
48
|
onMounted(() => {
|
|
49
49
|
switchInput.value?.addEventListener('focus', focus);
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* </template>
|
|
21
21
|
* </rc-dropdown>
|
|
22
22
|
*/
|
|
23
|
-
import {
|
|
23
|
+
import { ref } from 'vue';
|
|
24
24
|
import { useClickOutside } from '@shell/composables/useClickOutside';
|
|
25
25
|
import { useDropdownContext } from '@components/RcDropdown/useDropdownContext';
|
|
26
26
|
|
|
@@ -42,8 +42,8 @@ const {
|
|
|
42
42
|
|
|
43
43
|
provideDropdownContext();
|
|
44
44
|
|
|
45
|
-
const popperContainer =
|
|
46
|
-
const dropdownTarget =
|
|
45
|
+
const popperContainer = ref(null);
|
|
46
|
+
const dropdownTarget = ref(null);
|
|
47
47
|
|
|
48
48
|
useClickOutside(dropdownTarget, () => showMenu(false));
|
|
49
49
|
|
|
@@ -8,8 +8,10 @@ import {
|
|
|
8
8
|
import { RcDropdownMenuComponentProps, DropdownOption } from './types';
|
|
9
9
|
import IconOrSvg from '@shell/components/IconOrSvg';
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
withDefaults(defineProps<RcDropdownMenuComponentProps>(), {
|
|
12
|
+
buttonRole: 'primary',
|
|
13
|
+
buttonSize: undefined,
|
|
14
|
+
});
|
|
13
15
|
|
|
14
16
|
const emit = defineEmits(['update:open', 'select']);
|
|
15
17
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* A button that opens a menu. Used in conjunction with `RcDropdown.vue`.
|
|
4
4
|
*/
|
|
5
|
-
import { inject, onMounted,
|
|
5
|
+
import { inject, onMounted, ref } from 'vue';
|
|
6
6
|
import { RcButton, RcButtonType } from '@components/RcButton';
|
|
7
7
|
import { DropdownContext, defaultContext } from './types';
|
|
8
8
|
|
|
@@ -13,7 +13,7 @@ const {
|
|
|
13
13
|
handleKeydown,
|
|
14
14
|
} = inject<DropdownContext>('dropdownContext') || defaultContext;
|
|
15
15
|
|
|
16
|
-
const dropdownTrigger =
|
|
16
|
+
const dropdownTrigger = ref<RcButtonType | null>(null);
|
|
17
17
|
|
|
18
18
|
onMounted(() => {
|
|
19
19
|
registerTrigger(dropdownTrigger.value);
|
|
@@ -238,11 +238,9 @@ function clone_repo_test_extension_build() {
|
|
|
238
238
|
# Don't forget to add the unit tests exception to clone_repo_test_extension_build function if a new extension has those
|
|
239
239
|
clone_repo_test_extension_build "rancher" "kubewarden-ui" "kubewarden"
|
|
240
240
|
clone_repo_test_extension_build "rancher" "elemental-ui" "elemental"
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
# clone_repo_test_extension_build "StackVista" "rancher-extension-stackstate" "observability"
|
|
246
|
-
# clone_repo_test_extension_build "harvester" "harvester-ui-extension" "harvester"
|
|
241
|
+
clone_repo_test_extension_build "neuvector" "manager-ext" "neuvector-ui-ext"
|
|
242
|
+
clone_repo_test_extension_build "rancher" "capi-ui-extension" "capi"
|
|
243
|
+
clone_repo_test_extension_build "StackVista" "rancher-extension-stackstate" "observability"
|
|
244
|
+
clone_repo_test_extension_build "harvester" "harvester-ui-extension" "harvester"
|
|
247
245
|
|
|
248
246
|
echo "All done"
|
package/types/shell/index.d.ts
CHANGED
|
@@ -4361,7 +4361,7 @@ export function random32(count: any): number | number[];
|
|
|
4361
4361
|
export function randomStr(length?: number, chars?: string): any;
|
|
4362
4362
|
export function formatPercent(value: any, maxPrecision?: number): string;
|
|
4363
4363
|
export function pluralize(str: any): any;
|
|
4364
|
-
export function resourceNames(names: any, t: any,
|
|
4364
|
+
export function resourceNames(names: any, plusMore: any, t: any, endString: any): any;
|
|
4365
4365
|
export function indent(lines: any, count?: number, token?: string, afterRegex?: any): any;
|
|
4366
4366
|
export function decamelize(str: any): any;
|
|
4367
4367
|
export function dasherize(str: any): any;
|
|
@@ -81,9 +81,9 @@ describe('fx: resourceNames', () => {
|
|
|
81
81
|
it.each(args)(`having: %p`, (
|
|
82
82
|
names,
|
|
83
83
|
expectation,
|
|
84
|
-
options,
|
|
84
|
+
options: any,
|
|
85
85
|
) => {
|
|
86
|
-
const result = resourceNames(names, t, options);
|
|
86
|
+
const result = resourceNames(names, options.plusMore, t, options.endString);
|
|
87
87
|
|
|
88
88
|
expect(result).toStrictEqual(expectation);
|
|
89
89
|
});
|
package/utils/color.js
CHANGED
|
@@ -19,14 +19,15 @@ export function createCssVars(color, theme = 'light', name = 'primary') {
|
|
|
19
19
|
const contrastOpts = theme === 'light' ? LIGHT_CONTRAST_COLORS : DARK_CONTRAST_COLORS;
|
|
20
20
|
|
|
21
21
|
return {
|
|
22
|
-
[`--${ name }`]:
|
|
23
|
-
[`--${ name }-text `]:
|
|
24
|
-
[`--${ name }-hover-bg`]:
|
|
25
|
-
[`--${ name }-active-bg`]:
|
|
26
|
-
[`--${ name }-active-text`]:
|
|
27
|
-
[`--${ name }-border`]:
|
|
28
|
-
[`--${ name }-banner-bg`]:
|
|
29
|
-
[`--${ name }-light-bg`]:
|
|
22
|
+
[`--${ name }`]: color,
|
|
23
|
+
[`--${ name }-text `]: contrastColor(color, contrastOpts),
|
|
24
|
+
[`--${ name }-hover-bg`]: lighten(color, -10),
|
|
25
|
+
[`--${ name }-active-bg`]: lighten(color, -25),
|
|
26
|
+
[`--${ name }-active-text`]: contrastColor(lighten(color, -25), contrastOpts),
|
|
27
|
+
[`--${ name }-border`]: color,
|
|
28
|
+
[`--${ name }-banner-bg`]: opacity(color, 0.15),
|
|
29
|
+
[`--${ name }-light-bg`]: opacity(color, 0.05),
|
|
30
|
+
[`--${ name }-keyboard-focus`]: lighten(color, -10),
|
|
30
31
|
};
|
|
31
32
|
}
|
|
32
33
|
|
package/utils/string.js
CHANGED
|
@@ -151,11 +151,9 @@ export function pluralize(str) {
|
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
export function resourceNames(names, t,
|
|
154
|
+
export function resourceNames(names, plusMore, t, endString) {
|
|
155
155
|
const MAX_NAMES_COUNT = 5;
|
|
156
156
|
|
|
157
|
-
let { plusMore, endString } = options;
|
|
158
|
-
|
|
159
157
|
// plusMore default value
|
|
160
158
|
if (!plusMore) {
|
|
161
159
|
plusMore = t('promptRemove.andOthers', { count: names.length > MAX_NAMES_COUNT ? names.length - MAX_NAMES_COUNT : 0 });
|