@rancher/shell 0.1.3 → 0.1.21
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/brand/suse/dark/rancher-logo.svg +1 -148
- package/assets/brand/suse/favicon.png +0 -0
- package/assets/brand/suse/rancher-logo.svg +1 -130
- package/assets/images/featured/img1.jpg +0 -0
- package/assets/images/featured.jpg +0 -0
- package/assets/images/generic-plugin.svg +1 -0
- package/assets/styles/themes/_dark.scss +3 -0
- package/assets/styles/themes/_light.scss +3 -0
- package/assets/styles/themes/_suse.scss +1 -1
- package/assets/translations/en-us.yaml +219 -47
- package/assets/translations/zh-hans.yaml +21 -24
- package/components/AsyncButton.vue +17 -2
- package/components/ButtonDropdown.vue +4 -0
- package/components/Carousel.vue +291 -0
- package/components/CommunityLinks.vue +64 -22
- package/components/CruResource.vue +11 -3
- package/components/Dialog.vue +102 -0
- package/components/ExplorerMembers.vue +2 -4
- package/components/ExplorerProjectsNamespaces.vue +25 -9
- package/components/IconMessage.vue +9 -1
- package/components/LazyImage.vue +21 -8
- package/components/LocaleSelector.vue +62 -29
- package/components/PromptRemove.vue +2 -2
- package/components/ResourceList/Masthead.vue +21 -1
- package/components/ResourceList/ResourceLoadingIndicator.vue +0 -8
- package/components/ResourceList/index.vue +9 -23
- package/components/ResourceTable.vue +7 -2
- package/components/SimpleBox.vue +6 -4
- package/components/SortableTable/index.vue +18 -25
- package/components/Tabbed/Tab.vue +5 -0
- package/components/Tabbed/index.vue +54 -9
- package/components/TypeDescription.vue +10 -1
- package/components/auth/Principal.vue +1 -0
- package/components/fleet/FleetBundles.vue +8 -3
- package/components/fleet/FleetClusters.vue +6 -0
- package/components/fleet/FleetRepos.vue +7 -1
- package/components/fleet/FleetSummary.vue +6 -0
- package/components/form/Command.vue +5 -0
- package/components/form/EnvVars.vue +5 -0
- package/components/form/KeyValue.vue +80 -58
- package/components/form/NameNsDescription.vue +13 -5
- package/components/form/NodeScheduling.vue +6 -1
- package/components/form/PodAffinity.vue +5 -0
- package/components/form/ResourceTabs/index.vue +5 -1
- package/components/form/ServiceNameSelect.vue +5 -0
- package/components/form/ValueFromResource.vue +7 -1
- package/components/formatter/ClusterLink.vue +3 -7
- package/components/nav/NamespaceFilter.vue +3 -3
- package/components/nav/TopLevelMenu.vue +12 -29
- package/config/home-links.js +155 -0
- package/config/labels-annotations.js +2 -1
- package/config/private-label.js +1 -1
- package/config/product/explorer.js +5 -4
- package/config/product/legacy.js +0 -47
- package/config/product/manager.js +0 -2
- package/config/product/multi-cluster-apps.js +0 -12
- package/config/product/settings.js +12 -1
- package/config/product/uiplugins.js +17 -0
- package/config/settings.js +23 -2
- package/config/types.js +5 -1
- package/config/uiplugins.js +117 -0
- package/config/version.js +17 -0
- package/content/docs/en-us/getting-started.md +1 -26
- package/core/plugin.ts +12 -0
- package/core/plugins.js +38 -2
- package/core/types.ts +6 -0
- package/creators/app/{.eslintignore → files/.eslintignore} +0 -0
- package/creators/app/{.eslintrc.js → files/.eslintrc.js} +0 -0
- package/creators/app/{.vscode → files/.vscode}/settings.json +0 -0
- package/creators/app/{babel.config.js → files/babel.config.js} +0 -0
- package/creators/app/{nuxt.config.js → files/nuxt.config.js} +0 -0
- package/creators/app/{tsconfig.json → files/tsconfig.json} +2 -1
- package/creators/app/init +16 -17
- package/creators/app/package.json +6 -0
- package/creators/pkg/{babel.config.js → files/babel.config.js} +0 -0
- package/creators/pkg/{index.ts → files/index.ts} +0 -0
- package/creators/pkg/{tsconfig.json → files/tsconfig.json} +13 -12
- package/creators/pkg/{vue.config.js → files/vue.config.js} +0 -0
- package/creators/pkg/init +1 -1
- package/creators/update/init +54 -0
- package/creators/update/package.json +20 -0
- package/creators/update/upgrade +56 -0
- package/creators/update/yarn-error.log +54 -0
- package/detail/provisioning.cattle.io.cluster.vue +3 -3
- package/detail/workload/index.vue +3 -2
- package/dialog/DiagnosticTimingsDialog.vue +116 -0
- package/dialog/RotateCertificatesDialog.vue +9 -3
- package/edit/auth/azuread.vue +28 -9
- package/edit/networking.k8s.io.ingress/index.vue +2 -2
- package/edit/persistentvolume/index.vue +51 -13
- package/edit/persistentvolumeclaim.vue +31 -13
- package/edit/pod.vue +27 -0
- package/edit/provisioning.cattle.io.cluster/rke2.vue +103 -24
- package/edit/service.vue +7 -5
- package/edit/workload/__tests__/Upgrading.test.ts +1 -0
- package/edit/workload/index.vue +32 -10
- package/edit/workload/mixins/workload.js +121 -126
- package/edit/workload/storage/ContainerMountPaths.vue +240 -0
- package/edit/workload/storage/Mount.vue +1 -0
- package/edit/workload/storage/awsElasticBlockStore.vue +20 -1
- package/edit/workload/storage/azureDisk.vue +22 -2
- package/edit/workload/storage/azureFile.vue +20 -2
- package/edit/workload/storage/csi/index.vue +23 -1
- package/edit/workload/storage/gcePersistentDisk.vue +20 -2
- package/edit/workload/storage/index.vue +33 -65
- package/edit/workload/storage/persistentVolumeClaim/index.vue +5 -0
- package/edit/workload/storage/secret.vue +6 -1
- package/edit/workload/storage/vsphereVolume.vue +11 -1
- package/layouts/default.vue +14 -8
- package/layouts/home.vue +9 -4
- package/layouts/plain.vue +10 -5
- package/list/catalog.cattle.io.app.vue +10 -9
- package/list/catalog.cattle.io.clusterrepo.vue +6 -61
- package/list/cis.cattle.io.clusterscan.vue +12 -12
- package/list/fleet.cattle.io.bundle.vue +33 -28
- package/list/fleet.cattle.io.cluster.vue +26 -22
- package/list/fleet.cattle.io.clustergroup.vue +6 -0
- package/list/fleet.cattle.io.clusterregistrationtoken.vue +28 -24
- package/list/fleet.cattle.io.gitrepo.vue +25 -14
- package/list/helm.cattle.io.projecthelmchart.vue +52 -33
- package/list/logging.banzaicloud.io.clusterflow.vue +7 -12
- package/list/logging.banzaicloud.io.flow.vue +7 -14
- package/list/management.cattle.io.cluster.vue +26 -15
- package/list/management.cattle.io.feature.vue +13 -8
- package/list/management.cattle.io.setting.vue +3 -3
- package/list/management.cattle.io.user.vue +38 -19
- package/list/monitoring.coreos.com.alertmanagerconfig.vue +8 -15
- package/list/namespace.vue +14 -1
- package/list/node.vue +13 -16
- package/list/persistentvolume.vue +16 -9
- package/list/persistentvolumeclaim.vue +5 -8
- package/list/provisioning.cattle.io.cluster.vue +35 -9
- package/list/service.vue +24 -12
- package/list/ui.cattle.io.navlink.vue +6 -0
- package/list/workload.vue +2 -2
- package/machine-config/harvester.vue +5 -3
- package/middleware/authenticated.js +6 -0
- package/mixins/resource-fetch.js +12 -18
- package/mixins/resource-manager.js +126 -0
- package/models/catalog.cattle.io.uiplugin.js +38 -0
- package/models/cluster/node.js +25 -2
- package/models/fleet.cattle.io.bundle.js +1 -1
- package/models/harvesterhci.io.management.cluster.js +11 -5
- package/models/pod.js +15 -5
- package/models/provisioning.cattle.io.cluster.js +16 -6
- package/models/workload.js +5 -3
- package/models/workload.service.js +10 -0
- package/nuxt.config.js +70 -25
- package/package.json +108 -109
- package/pages/auth/login.vue +11 -1
- package/pages/auth/verify.vue +9 -0
- package/pages/c/_cluster/apps/charts/index.vue +46 -1
- package/pages/c/_cluster/apps/charts/install.vue +10 -9
- package/pages/c/_cluster/explorer/index.vue +72 -9
- package/pages/c/_cluster/explorer/tools/index.vue +12 -5
- package/pages/c/_cluster/mcapps/index.vue +1 -1
- package/pages/c/_cluster/settings/DefaultLinksEditor.vue +108 -0
- package/pages/c/_cluster/settings/brand.vue +0 -40
- package/pages/c/_cluster/settings/links.vue +152 -0
- package/pages/c/_cluster/settings/performance.vue +90 -7
- package/pages/c/_cluster/uiplugins/DeveloperInstallDialog.vue +232 -0
- package/pages/c/_cluster/uiplugins/InstallDialog.vue +293 -0
- package/pages/c/_cluster/uiplugins/PluginInfoPanel.vue +300 -0
- package/pages/c/_cluster/uiplugins/RemoveUIPlugins.vue +125 -0
- package/pages/c/_cluster/uiplugins/SetupUIPlugins.vue +261 -0
- package/pages/c/_cluster/uiplugins/UninstallDialog.vue +122 -0
- package/pages/c/_cluster/uiplugins/index.vue +808 -0
- package/pages/diagnostic.vue +185 -101
- package/pages/docs/_doc.vue +3 -1
- package/pages/home.vue +21 -56
- package/pages/prefs.vue +108 -88
- package/pages/safeMode.vue +17 -0
- package/pages/support/index.vue +34 -137
- package/pkg/dynamic-importer.lib.js +4 -0
- package/plugins/dashboard-store/actions.js +19 -0
- package/plugins/dashboard-store/getters.js +20 -3
- package/plugins/dashboard-store/mutations.js +13 -7
- package/plugins/dashboard-store/resource-class.js +2 -2
- package/plugins/formatters.js +15 -0
- package/plugins/plugin.js +61 -6
- package/plugins/steve/getters.js +12 -0
- package/plugins/steve/mutations.js +1 -1
- package/plugins/steve/subscribe.js +94 -72
- package/plugins/steve/web-worker.steve-sub-worker.js +24 -15
- package/plugins/version.js +21 -0
- package/promptRemove/management.cattle.io.globalrole.vue +47 -0
- package/promptRemove/management.cattle.io.roletemplate.vue +47 -0
- package/promptRemove/mixin/roleDeletionCheck.js +97 -0
- package/rancher-components/Form/TextArea/TextAreaAutoGrow.vue +6 -7
- package/rancher-components/components/BadgeState/BadgeState.spec.ts +12 -0
- package/rancher-components/components/BadgeState/BadgeState.vue +107 -0
- package/rancher-components/components/BadgeState/index.ts +1 -0
- package/rancher-components/components/Banner/Banner.test.ts +13 -0
- package/rancher-components/components/Banner/Banner.vue +163 -0
- package/rancher-components/components/Banner/index.ts +1 -0
- package/rancher-components/components/Card/Card.vue +150 -0
- package/rancher-components/components/Card/index.ts +1 -0
- package/rancher-components/components/Form/Checkbox/Checkbox.test.ts +77 -0
- package/rancher-components/components/Form/Checkbox/Checkbox.vue +395 -0
- package/rancher-components/components/Form/Checkbox/index.ts +1 -0
- package/rancher-components/components/Form/LabeledInput/LabeledInput.test.ts +29 -0
- package/rancher-components/components/Form/LabeledInput/LabeledInput.vue +343 -0
- package/rancher-components/components/Form/LabeledInput/index.ts +1 -0
- package/rancher-components/components/Form/Radio/RadioButton.vue +270 -0
- package/rancher-components/components/Form/Radio/RadioGroup.vue +235 -0
- package/rancher-components/components/Form/Radio/index.ts +2 -0
- package/rancher-components/components/Form/TextArea/TextAreaAutoGrow.vue +168 -0
- package/rancher-components/components/Form/TextArea/index.ts +1 -0
- package/rancher-components/components/Form/ToggleSwitch/ToggleSwitch.test.ts +107 -0
- package/rancher-components/components/Form/ToggleSwitch/ToggleSwitch.vue +137 -0
- package/rancher-components/components/Form/ToggleSwitch/index.ts +1 -0
- package/rancher-components/components/Form/index.ts +5 -0
- package/rancher-components/components/LabeledTooltip/LabeledTooltip.vue +137 -0
- package/rancher-components/components/LabeledTooltip/index.ts +1 -0
- package/scripts/publish-shell.sh +40 -7
- package/scripts/record-deps.js +37 -0
- package/scripts/sync-shell-deps +37 -0
- package/scripts/test-plugins-build.sh +8 -5
- package/scripts/typegen.sh +84 -0
- package/store/auth.js +3 -0
- package/store/catalog.js +9 -8
- package/store/i18n.js +10 -1
- package/store/index.js +12 -3
- package/store/prefs.js +16 -0
- package/store/type-map.js +32 -5
- package/store/uiplugins.ts +15 -61
- package/types/shell/index.d.ts +3046 -0
- package/utils/__tests__/object.test.ts +0 -24
- package/utils/__tests__/selector.test.ts +1 -1
- package/utils/dynamic-importer.js +4 -0
- package/utils/favicon.js +8 -2
- package/utils/gc/gc-interval.ts +40 -0
- package/utils/gc/gc-root-store.js +76 -0
- package/utils/gc/gc-route-changed.ts +44 -0
- package/utils/gc/gc-types.ts +21 -0
- package/utils/gc/gc.ts +282 -0
- package/utils/grafana.js +2 -6
- package/utils/socket.js +41 -20
- package/utils/string.js +1 -7
- package/utils/validators/formRules/__tests__/index.test.ts +108 -0
- package/utils/validators/formRules/index.ts +9 -1
- package/config/footer.js +0 -19
- package/creators/pkg/nuxt.config.js +0 -6
- package/pages/plugins.vue +0 -387
- package/server/verdaccio-middleware.js +0 -56
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Vue, { VueConstructor } from 'vue';
|
|
3
|
+
import CompactInput from '@shell/mixins/compact-input';
|
|
4
|
+
import LabeledFormElement from '@shell/mixins/labeled-form-element';
|
|
5
|
+
import TextAreaAutoGrow from '@components/Form/TextArea/TextAreaAutoGrow.vue';
|
|
6
|
+
import LabeledTooltip from '@components/LabeledTooltip/LabeledTooltip.vue';
|
|
7
|
+
import { escapeHtml } from '@shell/utils/string';
|
|
8
|
+
import cronstrue from 'cronstrue';
|
|
9
|
+
import { isValidCron } from 'cron-validator';
|
|
10
|
+
import { debounce } from 'lodash';
|
|
11
|
+
|
|
12
|
+
export default (
|
|
13
|
+
Vue as VueConstructor<Vue & InstanceType<typeof LabeledFormElement> & InstanceType<typeof CompactInput>>
|
|
14
|
+
).extend({
|
|
15
|
+
components: { LabeledTooltip, TextAreaAutoGrow },
|
|
16
|
+
mixins: [LabeledFormElement, CompactInput],
|
|
17
|
+
|
|
18
|
+
props: {
|
|
19
|
+
/**
|
|
20
|
+
* The type of the Labeled Input.
|
|
21
|
+
* @values text, cron, multiline, multiline-password
|
|
22
|
+
*/
|
|
23
|
+
type: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: 'text'
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The status class of the Labeled Input and tooltip.
|
|
30
|
+
* @values info, success, warning, error
|
|
31
|
+
*/
|
|
32
|
+
status: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: null
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The sub-label for the Labeled Input.
|
|
39
|
+
*/
|
|
40
|
+
subLabel: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: null
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The tooltip to display for the Labeled Input.
|
|
47
|
+
*/
|
|
48
|
+
tooltip: {
|
|
49
|
+
default: null,
|
|
50
|
+
type: [String, Object]
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Renders the tooltip when hovering the cursor over the Labeled Input.
|
|
55
|
+
*/
|
|
56
|
+
hoverTooltip: {
|
|
57
|
+
type: Boolean,
|
|
58
|
+
default: true
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Disables the password manager prompt to save the contents of the Labeled
|
|
63
|
+
* Input.
|
|
64
|
+
*/
|
|
65
|
+
ignorePasswordManagers: {
|
|
66
|
+
default: false,
|
|
67
|
+
type: Boolean
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The max length of the Labeled Input.
|
|
72
|
+
*/
|
|
73
|
+
maxlength: {
|
|
74
|
+
type: Number,
|
|
75
|
+
default: null
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Hides arrows on the Labeled Input.
|
|
80
|
+
* @deprecated This doesn't appear to be in use for Labeled Input.
|
|
81
|
+
*/
|
|
82
|
+
hideArrows: {
|
|
83
|
+
type: Boolean,
|
|
84
|
+
default: false
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Optionally delay on input while typing.
|
|
89
|
+
*/
|
|
90
|
+
delay: {
|
|
91
|
+
type: Number,
|
|
92
|
+
default: 0
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
data() {
|
|
97
|
+
return {
|
|
98
|
+
updated: false,
|
|
99
|
+
validationErrors: ''
|
|
100
|
+
};
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
computed: {
|
|
104
|
+
/**
|
|
105
|
+
* Determines if the Labeled Input @input event should be debounced.
|
|
106
|
+
*/
|
|
107
|
+
onInput(): ((value: string) => void) | void {
|
|
108
|
+
return this.delay ? debounce(this.delayInput, this.delay) : this.delayInput;
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Determines if the Labeled Input should display a label.
|
|
113
|
+
*/
|
|
114
|
+
hasLabel(): boolean {
|
|
115
|
+
return this.isCompact ? false : !!this.label || !!this.labelKey || !!this.$slots.label;
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Determines if the Labeled Input should display a tooltip.
|
|
120
|
+
*/
|
|
121
|
+
hasTooltip(): boolean {
|
|
122
|
+
return !!this.tooltip || !!this.tooltipKey;
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
tooltipValue(): string | undefined {
|
|
126
|
+
if (this.hasTooltip) {
|
|
127
|
+
return this.tooltipKey ? this.t(this.tooltipKey) : this.tooltip
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return undefined;
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Determines if the Labeled Input makes use of the suffix slot.
|
|
135
|
+
*/
|
|
136
|
+
hasSuffix(): boolean {
|
|
137
|
+
return !!this.$slots.suffix;
|
|
138
|
+
},
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Determines if the Labeled Input should display a cron hint.
|
|
142
|
+
*/
|
|
143
|
+
cronHint(): string | undefined {
|
|
144
|
+
if (this.type !== 'cron' || !this.value) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
if (!isValidCron(this.value)) {
|
|
148
|
+
return this.t('generic.invalidCron');
|
|
149
|
+
}
|
|
150
|
+
try {
|
|
151
|
+
const hint = cronstrue.toString(this.value);
|
|
152
|
+
|
|
153
|
+
return hint;
|
|
154
|
+
} catch (e) {
|
|
155
|
+
return this.t('generic.invalidCron');
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* The placeholder value for the Labeled Input.
|
|
161
|
+
*/
|
|
162
|
+
_placeholder(): string {
|
|
163
|
+
if (this.placeholder) {
|
|
164
|
+
return this.placeholder.toString();
|
|
165
|
+
}
|
|
166
|
+
if (this.placeholderKey) {
|
|
167
|
+
return this.t(this.placeholderKey);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return '';
|
|
171
|
+
},
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* The max length for the Labeled Input.
|
|
175
|
+
*/
|
|
176
|
+
_maxlength(): number | null {
|
|
177
|
+
if (this.type === 'text' && this.maxlength) {
|
|
178
|
+
return this.maxlength;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return null;
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
|
|
185
|
+
methods: {
|
|
186
|
+
/**
|
|
187
|
+
* Attempts to give the Labeled Input focus.
|
|
188
|
+
*/
|
|
189
|
+
focus(): void {
|
|
190
|
+
const comp = this.$refs.value as HTMLInputElement;
|
|
191
|
+
|
|
192
|
+
if (comp) {
|
|
193
|
+
comp.focus();
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Attempts to select the Labeled Input.
|
|
199
|
+
* @deprecated
|
|
200
|
+
*/
|
|
201
|
+
select(): void {
|
|
202
|
+
const comp = this.$refs.value as HTMLInputElement;
|
|
203
|
+
|
|
204
|
+
if (comp) {
|
|
205
|
+
comp.select();
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Emit on input with delay. Note: Arrow function is avoided due context
|
|
211
|
+
* binding.
|
|
212
|
+
*/
|
|
213
|
+
delayInput(value: string): void {
|
|
214
|
+
this.$emit('input', value);
|
|
215
|
+
},
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Handles the behavior of the Labeled Input when given focus.
|
|
219
|
+
* @see labeled-form-element.ts mixin for onFocusLabeled()
|
|
220
|
+
*/
|
|
221
|
+
onFocus(): void {
|
|
222
|
+
this.onFocusLabeled();
|
|
223
|
+
},
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Handles the behavior of the Labeled Input when blurred and emits the blur
|
|
227
|
+
* event.
|
|
228
|
+
* @see labeled-form-element.ts mixin for onBlurLabeled()
|
|
229
|
+
*/
|
|
230
|
+
onBlur(event: string): void {
|
|
231
|
+
this.$emit('blur', event);
|
|
232
|
+
this.onBlurLabeled();
|
|
233
|
+
},
|
|
234
|
+
|
|
235
|
+
escapeHtml
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
</script>
|
|
239
|
+
|
|
240
|
+
<template>
|
|
241
|
+
<div
|
|
242
|
+
:class="{
|
|
243
|
+
'labeled-input': true,
|
|
244
|
+
focused,
|
|
245
|
+
[mode]: true,
|
|
246
|
+
disabled: isDisabled,
|
|
247
|
+
[status]: status,
|
|
248
|
+
suffix: hasSuffix,
|
|
249
|
+
'has-tooltip': hasTooltip,
|
|
250
|
+
'compact-input': isCompact,
|
|
251
|
+
hideArrows
|
|
252
|
+
}"
|
|
253
|
+
>
|
|
254
|
+
<slot name="label">
|
|
255
|
+
<label v-if="hasLabel">
|
|
256
|
+
<t v-if="labelKey" :k="labelKey" />
|
|
257
|
+
<template v-else-if="label">{{ label }}</template>
|
|
258
|
+
|
|
259
|
+
<span v-if="requiredField" class="required">*</span>
|
|
260
|
+
</label>
|
|
261
|
+
</slot>
|
|
262
|
+
|
|
263
|
+
<slot name="prefix" />
|
|
264
|
+
|
|
265
|
+
<slot name="field">
|
|
266
|
+
<TextAreaAutoGrow
|
|
267
|
+
v-if="type === 'multiline' || type === 'multiline-password'"
|
|
268
|
+
ref="value"
|
|
269
|
+
v-bind="$attrs"
|
|
270
|
+
:maxlength="_maxlength"
|
|
271
|
+
:disabled="isDisabled"
|
|
272
|
+
:value="value"
|
|
273
|
+
:placeholder="_placeholder"
|
|
274
|
+
autocapitalize="off"
|
|
275
|
+
:class="{ conceal: type === 'multiline-password' }"
|
|
276
|
+
@input="onInput($event)"
|
|
277
|
+
@focus="onFocus"
|
|
278
|
+
@blur="onBlur"
|
|
279
|
+
/>
|
|
280
|
+
<input
|
|
281
|
+
v-else
|
|
282
|
+
ref="value"
|
|
283
|
+
:class="{ 'no-label': !hasLabel }"
|
|
284
|
+
v-bind="$attrs"
|
|
285
|
+
:maxlength="_maxlength"
|
|
286
|
+
:disabled="isDisabled"
|
|
287
|
+
:type="type === 'cron' ? 'text' : type"
|
|
288
|
+
:value="value"
|
|
289
|
+
:placeholder="_placeholder"
|
|
290
|
+
autocomplete="off"
|
|
291
|
+
autocapitalize="off"
|
|
292
|
+
:data-lpignore="ignorePasswordManagers"
|
|
293
|
+
@input="onInput($event.target.value)"
|
|
294
|
+
@focus="onFocus"
|
|
295
|
+
@blur="onBlur"
|
|
296
|
+
/>
|
|
297
|
+
</slot>
|
|
298
|
+
|
|
299
|
+
<slot name="suffix" />
|
|
300
|
+
<LabeledTooltip
|
|
301
|
+
v-if="hasTooltip && !focused"
|
|
302
|
+
:hover="hoverTooltip"
|
|
303
|
+
:value="tooltipValue"
|
|
304
|
+
:status="status"
|
|
305
|
+
/>
|
|
306
|
+
<LabeledTooltip
|
|
307
|
+
v-if="!!validationMessage"
|
|
308
|
+
:hover="hoverTooltip"
|
|
309
|
+
:value="validationMessage"
|
|
310
|
+
/>
|
|
311
|
+
<label v-if="cronHint" class="cron-label">{{ cronHint }}</label>
|
|
312
|
+
<label v-if="subLabel" class="sub-label">{{ subLabel }}</label>
|
|
313
|
+
</div>
|
|
314
|
+
</template>
|
|
315
|
+
<style scoped lang="scss">
|
|
316
|
+
.labeled-input.view {
|
|
317
|
+
input {
|
|
318
|
+
text-overflow: ellipsis;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
.hideArrows {
|
|
323
|
+
/* Hide arrows on number input when it overlaps with the unit */
|
|
324
|
+
/* Chrome, Safari, Edge, Opera */
|
|
325
|
+
input::-webkit-outer-spin-button,
|
|
326
|
+
input::-webkit-inner-spin-button {
|
|
327
|
+
-webkit-appearance: none;
|
|
328
|
+
margin: 0;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/* Firefox */
|
|
332
|
+
input[type=number] {
|
|
333
|
+
-moz-appearance: textfield;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
</style>
|
|
337
|
+
<style>
|
|
338
|
+
.validation-message {
|
|
339
|
+
padding: 5px;
|
|
340
|
+
position: absolute;
|
|
341
|
+
bottom: -35px;
|
|
342
|
+
}
|
|
343
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as LabeledInput } from './LabeledInput.vue';
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Vue from 'vue';
|
|
3
|
+
import { _VIEW } from '@shell/config/query-params';
|
|
4
|
+
|
|
5
|
+
export default Vue.extend({
|
|
6
|
+
props: {
|
|
7
|
+
/**
|
|
8
|
+
* The name of the input, for grouping.
|
|
9
|
+
*/
|
|
10
|
+
name: {
|
|
11
|
+
type: String,
|
|
12
|
+
default: ''
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The value for this option.
|
|
17
|
+
*/
|
|
18
|
+
val: {
|
|
19
|
+
required: true,
|
|
20
|
+
validator: x => true
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The selected value.
|
|
25
|
+
*/
|
|
26
|
+
value: {
|
|
27
|
+
required: true,
|
|
28
|
+
validator: x => true
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The label shown next to the radio.
|
|
33
|
+
*/
|
|
34
|
+
label: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: ''
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Disable the radio.
|
|
41
|
+
*/
|
|
42
|
+
disabled: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: false
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The radio editing mode.
|
|
49
|
+
* @values _EDIT, _VIEW
|
|
50
|
+
*/
|
|
51
|
+
mode: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: 'edit'
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The i18n key to use for the radio description.
|
|
58
|
+
*/
|
|
59
|
+
descriptionKey: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: null
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The radio description.
|
|
66
|
+
*/
|
|
67
|
+
description: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: null
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
data() {
|
|
74
|
+
return { isChecked: this.value === this.val };
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
computed: {
|
|
78
|
+
/**
|
|
79
|
+
* Determines if the radio is disabled.
|
|
80
|
+
*/
|
|
81
|
+
isDisabled(): boolean {
|
|
82
|
+
return this.mode === _VIEW || this.disabled;
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Determines if the label for the radio should be muted.
|
|
87
|
+
*/
|
|
88
|
+
muteLabel(): boolean {
|
|
89
|
+
// Don't mute the label if the mode is view and the button is checked
|
|
90
|
+
return this.disabled && !(this.mode === _VIEW && this.isChecked);
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Determines if the description slot is in use.
|
|
95
|
+
*/
|
|
96
|
+
hasDescriptionSlot(): boolean {
|
|
97
|
+
return !!this.$slots.description;
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
watch: {
|
|
102
|
+
value(neu) {
|
|
103
|
+
this.isChecked = this.val === neu;
|
|
104
|
+
if (this.isChecked) {
|
|
105
|
+
(this.$refs.custom as HTMLElement).focus();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
methods: {
|
|
111
|
+
/**
|
|
112
|
+
* Emits the input event.
|
|
113
|
+
*/
|
|
114
|
+
clicked({ target }: { target?: HTMLElement }) {
|
|
115
|
+
if (this.isDisabled || target?.tagName === 'A') {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
this.$emit('input', this.val);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
</script>
|
|
124
|
+
|
|
125
|
+
<template>
|
|
126
|
+
<label
|
|
127
|
+
:class="{'disabled': isDisabled, 'radio-container': true}"
|
|
128
|
+
@keydown.enter="clicked($event)"
|
|
129
|
+
@keydown.space="clicked($event)"
|
|
130
|
+
@click.stop="clicked($event)"
|
|
131
|
+
>
|
|
132
|
+
<input
|
|
133
|
+
:id="_uid+'-radio'"
|
|
134
|
+
:disabled="isDisabled"
|
|
135
|
+
:name="name"
|
|
136
|
+
:value="''+val"
|
|
137
|
+
:checked="isChecked"
|
|
138
|
+
type="radio"
|
|
139
|
+
:tabindex="-1"
|
|
140
|
+
@click.stop.prevent
|
|
141
|
+
/>
|
|
142
|
+
<span
|
|
143
|
+
ref="custom"
|
|
144
|
+
:class="[ isDisabled ? 'text-muted' : '', 'radio-custom']"
|
|
145
|
+
:tabindex="isDisabled ? -1 : 0"
|
|
146
|
+
:aria-label="label"
|
|
147
|
+
:aria-checked="isChecked"
|
|
148
|
+
role="radio"
|
|
149
|
+
/>
|
|
150
|
+
<div class="labeling">
|
|
151
|
+
<label
|
|
152
|
+
v-if="label"
|
|
153
|
+
:class="[ muteLabel ? 'text-muted' : '', 'radio-label', 'm-0']"
|
|
154
|
+
:for="name"
|
|
155
|
+
v-html="label"
|
|
156
|
+
>
|
|
157
|
+
<slot name="label">{{ label }}</slot>
|
|
158
|
+
</label>
|
|
159
|
+
<div v-if="descriptionKey || description" class="radio-button-outer-container-description">
|
|
160
|
+
<t v-if="descriptionKey" :k="descriptionKey" />
|
|
161
|
+
<template v-else-if="description">
|
|
162
|
+
{{ description }}
|
|
163
|
+
</template>
|
|
164
|
+
</div>
|
|
165
|
+
<div
|
|
166
|
+
v-else-if="hasDescriptionSlot"
|
|
167
|
+
class="radio-button-outer-container-description"
|
|
168
|
+
>
|
|
169
|
+
<slot name="description" />
|
|
170
|
+
</div>
|
|
171
|
+
</div>
|
|
172
|
+
</label>
|
|
173
|
+
</template>
|
|
174
|
+
|
|
175
|
+
<style lang='scss'>
|
|
176
|
+
$fontColor: var(--input-label);
|
|
177
|
+
|
|
178
|
+
.radio-view {
|
|
179
|
+
display: flex;
|
|
180
|
+
flex-direction: column;
|
|
181
|
+
LABEL {
|
|
182
|
+
color: var(--input-label);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.radio-group {
|
|
187
|
+
.text-label {
|
|
188
|
+
display: block;
|
|
189
|
+
padding-bottom: 5px;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.radio-container {
|
|
194
|
+
position: relative;
|
|
195
|
+
display: inline-flex;
|
|
196
|
+
align-items: flex-start;
|
|
197
|
+
margin: 0;
|
|
198
|
+
user-select: none;
|
|
199
|
+
border-radius: var(--border-radius);
|
|
200
|
+
padding-bottom: 5px;
|
|
201
|
+
|
|
202
|
+
&,
|
|
203
|
+
.radio-label,
|
|
204
|
+
.radio-button-outer-container-description {
|
|
205
|
+
cursor: pointer;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
&.disabled,
|
|
209
|
+
&.disabled .radio-label,
|
|
210
|
+
&.disabled .radio-button-outer-container-description {
|
|
211
|
+
cursor: not-allowed
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.radio-custom {
|
|
215
|
+
height: 14px;
|
|
216
|
+
width: 14px;
|
|
217
|
+
min-height: 14px;
|
|
218
|
+
min-width: 14px;
|
|
219
|
+
background-color: var(--input-bg);
|
|
220
|
+
border-radius: 50%;
|
|
221
|
+
transition: all 0.3s ease-out;
|
|
222
|
+
border: 1.5px solid var(--border);
|
|
223
|
+
margin-top: 5px;
|
|
224
|
+
|
|
225
|
+
&:focus {
|
|
226
|
+
outline: none;
|
|
227
|
+
border-radius: 50%;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
input {
|
|
232
|
+
display: none;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.radio-custom {
|
|
236
|
+
&[aria-checked="true"] {
|
|
237
|
+
background-color: var(--primary);
|
|
238
|
+
-webkit-transform: rotate(0deg) scale(1);
|
|
239
|
+
-ms-transform: rotate(0deg) scale(1);
|
|
240
|
+
transform: rotate(0deg) scale(1);
|
|
241
|
+
opacity:1;
|
|
242
|
+
border: 1.5px solid var(--primary);
|
|
243
|
+
|
|
244
|
+
// Ensure that checked radio buttons are muted but still visibly selected when muted
|
|
245
|
+
&.text-muted {
|
|
246
|
+
opacity: .25;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
input:disabled ~ .radio-custom:not([aria-checked="true"]) {
|
|
252
|
+
background-color: var(--disabled-bg);
|
|
253
|
+
opacity: .25;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.radio-button-outer-container-description {
|
|
257
|
+
color: $fontColor;
|
|
258
|
+
font-size: 11px;
|
|
259
|
+
margin-top: 5px;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.labeling {
|
|
263
|
+
display: inline-flex;
|
|
264
|
+
flex-direction: column;
|
|
265
|
+
|
|
266
|
+
margin: 3px 10px 0px 5px;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
</style>
|