@rancher/shell 0.5.3 → 1.2.0
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/.DS_Store +0 -0
- package/assets/images/providers/aks-black.svg +28 -0
- package/assets/images/providers/aks.svg +31 -0
- package/assets/styles/global/_labeled-input.scss +1 -0
- package/assets/styles/global/_layout.scss +0 -99
- package/assets/translations/en-us.yaml +76 -74
- package/assets/translations/zh-hans.yaml +25 -23
- package/babel.config.js +1 -7
- package/chart/gatekeeper.vue +11 -2
- package/chart/istio.vue +10 -1
- package/chart/logging/index.vue +11 -2
- package/chart/monitoring/alerting/index.vue +21 -7
- package/chart/monitoring/grafana/index.vue +2 -57
- package/chart/monitoring/index.vue +26 -52
- package/chart/monitoring/prometheus/index.vue +43 -37
- package/chart/rancher-backup/index.vue +10 -3
- package/cloud-credential/azure.vue +17 -4
- package/components/AsyncButton.vue +0 -9
- package/components/Carousel.vue +0 -1
- package/components/ChartPsp.vue +76 -0
- package/components/ClusterIconMenu.vue +9 -24
- package/components/CodeMirror.vue +16 -75
- package/components/CopyCode.vue +2 -6
- package/components/CopyToClipboard.vue +1 -2
- package/components/CopyToClipboardText.vue +9 -14
- package/components/CruResource.vue +0 -1
- package/components/EtcdInfoBanner.vue +5 -5
- package/components/ExplorerProjectsNamespaces.vue +1 -25
- package/components/FixedBanner.vue +0 -1
- package/components/IconOrSvg.vue +1 -1
- package/components/Markdown.vue +12 -16
- package/components/Questions/index.vue +1 -1
- package/components/ResourceDetail/Masthead.vue +9 -25
- package/components/ResourceDetail/index.vue +4 -1
- package/components/ResourceList/Masthead.vue +18 -1
- package/components/ResourceTable.vue +2 -14
- package/components/ResourceYaml.vue +5 -34
- package/components/SideNav.vue +65 -43
- package/components/SortableTable/THead.vue +9 -7
- package/components/SortableTable/index.vue +2 -1
- package/components/StatusTable.vue +1 -5
- package/components/TabTitle.vue +84 -0
- package/components/Tabbed/index.vue +0 -12
- package/components/YamlEditor.vue +0 -1
- package/components/__tests__/ChartPsp.test.ts +75 -0
- package/components/__tests__/CopyCode.test.ts +4 -5
- package/components/fleet/FleetBundles.vue +11 -5
- package/components/fleet/FleetRepos.vue +27 -62
- package/components/fleet/FleetResources.vue +1 -6
- package/components/fleet/FleetStatus.vue +3 -3
- package/components/fleet/FleetSummary.vue +30 -35
- package/components/form/ArrayList.vue +8 -1
- package/components/form/ArrayListSelect.vue +9 -9
- package/components/form/BannerSettings.vue +0 -3
- package/components/form/FileSelector.vue +0 -1
- package/components/form/KeyValue.vue +0 -2
- package/components/form/LabeledSelect.vue +0 -4
- package/components/form/Password.vue +1 -3
- package/components/form/Select.vue +1 -1
- package/components/form/SelectOrCreateAuthSecret.vue +4 -4
- package/components/form/__tests__/KeyValue.test.ts +1 -1
- package/components/formatter/Checked.vue +3 -11
- package/components/formatter/ClusterProvider.vue +18 -1
- package/components/formatter/FleetSummaryGraph.vue +11 -23
- package/components/formatter/LiveDate.vue +16 -0
- package/components/formatter/LiveDuration.vue +1 -1
- package/components/formatter/PercentageBar.vue +1 -1
- package/components/formatter/WorkloadDetailEndpoints.vue +22 -12
- package/components/formatter/__tests__/ClusterProvider.test.ts +28 -0
- package/components/nav/Group.vue +2 -2
- package/components/nav/Header.vue +2 -2
- package/components/nav/Jump.vue +9 -19
- package/components/nav/TopLevelMenu.vue +18 -66
- package/components/nav/Type.vue +7 -16
- package/components/nav/WindowManager/ContainerLogs.vue +19 -120
- package/components/nav/WindowManager/ContainerShell.vue +1 -6
- package/components/nav/WindowManager/index.vue +10 -11
- package/components/nav/__tests__/TopLevelMenu.test.ts +1 -34
- package/components/nav/__tests__/Type.test.ts +1 -31
- package/components/nuxt/nuxt-child.js +78 -14
- package/components/nuxt/nuxt.js +1 -1
- package/components/user.retention/user-retention-header.vue +34 -0
- package/composables/useI18n.ts +26 -0
- package/composables/useStore.ts +16 -0
- package/config/harvester-manager-types.js +0 -2
- package/config/home-links.js +32 -2
- package/config/private-label.js +0 -22
- package/config/product/explorer.js +4 -4
- package/config/product/fleet.js +1 -6
- package/config/product/legacy.js +1 -84
- package/config/product/manager.js +15 -8
- package/config/query-params.js +0 -1
- package/config/router.js +368 -385
- package/config/settings.ts +9 -2
- package/config/store.js +1 -1
- package/config/system-namespaces.js +0 -3
- package/config/table-headers.js +27 -47
- package/config/types.js +5 -0
- package/config/uiplugins.js +1 -1
- package/core/plugin-helpers.js +5 -3
- package/core/plugin-routes.ts +114 -56
- package/core/plugin.ts +10 -16
- package/core/plugins-loader.js +9 -7
- package/core/plugins.js +3 -0
- package/core/types-provisioning.ts +0 -7
- package/creators/app/init +0 -19
- package/detail/fleet.cattle.io.bundle.vue +1 -1
- package/detail/fleet.cattle.io.cluster.vue +1 -11
- package/detail/node.vue +0 -42
- package/detail/pod.vue +1 -68
- package/detail/provisioning.cattle.io.cluster.vue +8 -25
- package/detail/workload/index.vue +1 -15
- package/dialog/ScaleMachineDownDialog.vue +17 -34
- package/edit/auth/googleoauth.vue +5 -1
- package/edit/catalog.cattle.io.clusterrepo.vue +7 -20
- package/edit/cloudcredential.vue +0 -2
- package/edit/fleet.cattle.io.gitrepo.vue +4 -3
- package/edit/management.cattle.io.project.vue +52 -1
- package/edit/management.cattle.io.setting.vue +2 -32
- package/edit/monitoring.coreos.com.alertmanagerconfig/types/opsgenie.vue +1 -1
- package/edit/monitoring.coreos.com.alertmanagerconfig/types/pagerduty.vue +2 -1
- package/edit/monitoring.coreos.com.alertmanagerconfig/types/slack.vue +1 -1
- package/edit/monitoring.coreos.com.prometheusrule/AlertingRule.vue +3 -12
- package/edit/monitoring.coreos.com.prometheusrule/GroupRules.vue +1 -2
- package/edit/networking.k8s.io.networkpolicy/__tests__/PolicyRuleTarget.spec.ts +1 -1
- package/edit/provisioning.cattle.io.cluster/{tabs/Basics.vue → Basics.vue} +125 -106
- package/edit/provisioning.cattle.io.cluster/{tabs/MachinePool.vue → MachinePool.vue} +7 -1
- package/edit/provisioning.cattle.io.cluster/SelectCredential.vue +7 -15
- package/edit/provisioning.cattle.io.cluster/__tests__/Basics.tests.ts +237 -0
- package/edit/provisioning.cattle.io.cluster/__tests__/{CustomCommand.test.ts → CustomCommand.tests.ts} +0 -6
- package/edit/provisioning.cattle.io.cluster/__tests__/DrainOptions.test.ts +1 -1
- package/edit/provisioning.cattle.io.cluster/__tests__/rke2.test.ts +1 -7
- package/edit/provisioning.cattle.io.cluster/import.vue +2 -2
- package/edit/provisioning.cattle.io.cluster/index.vue +40 -109
- package/edit/provisioning.cattle.io.cluster/rke2.vue +689 -152
- package/edit/service.vue +0 -12
- package/edit/token.vue +0 -1
- package/edit/workload/Upgrading.vue +2 -3
- package/edit/workload/index.vue +1 -2
- package/edit/workload/mixins/workload.js +1 -1
- package/initialize/App.js +71 -25
- package/initialize/client.js +162 -21
- package/initialize/index.js +124 -47
- package/initialize/layouts.ts +26 -0
- package/{components/templates → layouts}/blank.vue +1 -1
- package/{components/templates → layouts}/default.vue +98 -8
- package/{components/templates → layouts}/error.vue +19 -10
- package/{components/templates → layouts}/home.vue +1 -4
- package/{components/templates → layouts}/plain.vue +1 -4
- package/{components/templates → layouts}/standalone.vue +1 -1
- package/{components/templates → layouts}/unauthenticated.vue +1 -1
- package/list/catalog.cattle.io.app.vue +0 -1
- package/list/management.cattle.io.feature.vue +7 -1
- package/list/management.cattle.io.setting.vue +0 -1
- package/list/management.cattle.io.user.vue +25 -1
- package/list/node.vue +0 -1
- package/machine-config/__tests__/vmwarevsphere.test.ts +161 -56
- package/machine-config/azure.vue +37 -21
- package/machine-config/vmwarevsphere.vue +47 -42
- package/middleware/authenticated.js +19 -14
- package/mixins/auth-config.js +7 -2
- package/mixins/brand.js +41 -29
- package/mixins/fetch.server.js +73 -0
- package/mixins/labeled-form-element.ts +1 -6
- package/models/__tests__/management.cattle.io.node.ts +0 -85
- package/models/__tests__/namespace.test.ts +9 -49
- package/models/cluster/node.js +4 -4
- package/models/cluster.x-k8s.io.machine.js +1 -1
- package/models/cluster.x-k8s.io.machinedeployment.js +0 -14
- package/models/fleet.cattle.io.cluster.js +0 -4
- package/models/fleet.cattle.io.gitrepo.js +13 -56
- package/models/management.cattle.io.cluster.js +3 -11
- package/models/management.cattle.io.kontainerdriver.js +0 -1
- package/models/management.cattle.io.node.js +14 -18
- package/models/management.cattle.io.nodepool.js +0 -17
- package/models/management.cattle.io.project.js +36 -0
- package/models/management.cattle.io.setting.js +7 -11
- package/models/management.cattle.io.user.js +65 -0
- package/models/namespace.js +1 -1
- package/models/pod.js +0 -20
- package/models/provisioning.cattle.io.cluster.js +9 -91
- package/models/secret.js +18 -126
- package/models/storage.k8s.io.storageclass.js +1 -1
- package/models/workload.js +0 -16
- package/models/workload.service.js +0 -18
- package/package.json +10 -12
- package/pages/about.vue +1 -0
- package/pages/account/create-key.vue +1 -0
- package/pages/account/index.vue +1 -0
- package/pages/auth/login.vue +1 -0
- package/pages/auth/logout.vue +2 -0
- package/pages/auth/setup.vue +4 -37
- package/pages/auth/verify.vue +8 -14
- package/pages/c/_cluster/apps/charts/__tests__/install.helper.test.ts +17 -2
- package/pages/c/_cluster/apps/charts/index.vue +58 -64
- package/pages/c/_cluster/apps/charts/install.helpers.js +13 -2
- package/pages/c/_cluster/apps/charts/install.vue +5 -5
- package/pages/c/_cluster/apps/index.vue +2 -0
- package/pages/c/_cluster/auth/index.vue +2 -0
- package/pages/c/_cluster/auth/user.retention/index.vue +384 -0
- package/pages/c/_cluster/ecm/index.vue +2 -0
- package/pages/c/_cluster/explorer/index.vue +53 -56
- package/pages/c/_cluster/explorer/tools/index.vue +3 -171
- package/pages/c/_cluster/fleet/index.vue +1 -1
- package/pages/c/_cluster/index.vue +2 -0
- package/pages/c/_cluster/manager/pages/_page.vue +5 -4
- package/pages/c/_cluster/monitoring/index.vue +1 -17
- package/pages/c/_cluster/settings/DefaultLinksEditor.vue +1 -1
- package/pages/c/_cluster/settings/banners.vue +2 -0
- package/pages/c/_cluster/settings/brand.vue +2 -3
- package/pages/c/_cluster/settings/index.vue +2 -0
- package/pages/c/_cluster/settings/links.vue +3 -2
- package/pages/c/_cluster/settings/performance.vue +1 -0
- package/pages/c/_cluster/uiplugins/CatalogList/CatalogLoadDialog.vue +1 -2
- package/pages/c/_cluster/uiplugins/CatalogList/index.vue +46 -10
- package/pages/c/_cluster/uiplugins/index.vue +2 -0
- package/pages/c/index.vue +9 -0
- package/pages/diagnostic.vue +2 -1
- package/pages/fail-whale.vue +1 -0
- package/pages/prefs.vue +1 -0
- package/pages/rio/mesh.vue +508 -0
- package/pages/support/index.vue +8 -2
- package/pkg/auto-import.js +1 -1
- package/plugins/axios.js +36 -0
- package/plugins/back-button.js +5 -3
- package/plugins/clean-html-directive.js +19 -1
- package/plugins/clean-tooltip-directive.js +1 -1
- package/plugins/codemirror-loader.js +1 -1
- package/plugins/codemirror.js +0 -41
- package/plugins/dashboard-store/__tests__/{mutations.test.ts → mutations.spec.ts} +1 -1
- package/plugins/dashboard-store/actions.js +17 -16
- package/plugins/dashboard-store/classify.js +18 -1
- package/plugins/dashboard-store/getters.js +7 -70
- package/plugins/dashboard-store/index.js +12 -0
- package/plugins/dashboard-store/mutations.js +4 -0
- package/plugins/dashboard-store/resource-class.js +20 -65
- package/plugins/i18n.js +1 -1
- package/plugins/steve/__tests__/getters.spec.ts +48 -26
- package/plugins/steve/__tests__/subscribe.spec.ts +106 -0
- package/plugins/steve/actions.js +37 -3
- package/plugins/steve/getters.js +24 -7
- package/plugins/steve/mutations.js +5 -2
- package/plugins/steve/norman-class.js +0 -19
- package/plugins/steve/steve-class.js +0 -22
- package/plugins/steve/subscribe.js +34 -13
- package/plugins/transitions.js +4 -0
- package/plugins/vue-clipboard2.js +4 -0
- package/rancher-components/Accordion/Accordion.vue +3 -2
- package/rancher-components/BadgeState/BadgeState.vue +3 -3
- package/rancher-components/Banner/Banner.test.ts +1 -5
- package/rancher-components/Banner/Banner.vue +2 -2
- package/rancher-components/Card/Card.vue +4 -4
- package/rancher-components/Form/Checkbox/Checkbox.vue +4 -3
- package/rancher-components/Form/LabeledInput/LabeledInput.test.ts +1 -1
- package/rancher-components/Form/LabeledInput/LabeledInput.vue +55 -24
- package/rancher-components/Form/Radio/RadioButton.test.ts +1 -3
- package/rancher-components/Form/Radio/RadioButton.vue +13 -7
- package/rancher-components/Form/Radio/RadioGroup.vue +4 -3
- package/rancher-components/Form/TextArea/TextAreaAutoGrow.vue +7 -5
- package/rancher-components/Form/ToggleSwitch/ToggleSwitch.vue +7 -4
- package/rancher-components/LabeledTooltip/LabeledTooltip.vue +9 -4
- package/rancher-components/StringList/StringList.vue +8 -8
- package/rancher-components/components/Accordion/Accordion.vue +3 -2
- package/rancher-components/components/BadgeState/BadgeState.test.ts +12 -0
- package/rancher-components/components/Form/LabeledInput/LabeledInput.test.ts +2 -19
- package/rancher-components/components/Form/LabeledInput/LabeledInput.vue +14 -11
- package/rancher-components/components/Form/TextArea/TextAreaAutoGrow.vue +1 -1
- package/rancher-components/components/StringList/StringList.test.ts +0 -270
- package/rancher-components/components/StringList/StringList.vue +18 -57
- package/scripts/extension/bundle +7 -19
- package/scripts/extension/helm/scripts/package +3 -11
- package/scripts/extension/parse-tag-name +4 -4
- package/scripts/extension/publish +9 -20
- package/scripts/publish-shell.sh +1 -11
- package/scripts/test-plugins-build.sh +9 -85
- package/store/catalog.js +1 -1
- package/store/features.js +0 -1
- package/store/i18n.js +0 -11
- package/store/index.js +13 -11
- package/store/prefs.js +38 -33
- package/store/type-map.js +82 -157
- package/tsconfig.default.json +46 -0
- package/tsconfig.json +9 -35
- package/types/shell/index.d.ts +404 -465
- package/utils/axios.js +19 -0
- package/utils/create-yaml.js +1 -5
- package/utils/custom-validators.js +2 -0
- package/utils/error.js +1 -16
- package/utils/monitoring.js +2 -37
- package/utils/nuxt.js +39 -18
- package/utils/object.js +0 -24
- package/utils/router.scrollBehavior.js +14 -12
- package/utils/socket.js +1 -0
- package/utils/time.js +1 -1
- package/utils/title.ts +3 -0
- package/utils/url.ts +1 -1
- package/utils/validators/formRules/__tests__/index.test.ts +4 -49
- package/utils/validators/formRules/index.ts +9 -12
- package/utils/validators/setting.js +10 -6
- package/vue.config.js +3 -24
- package/chart/monitoring/steps/uninstall-v1.vue +0 -135
- package/components/Certificates.vue +0 -164
- package/components/__tests__/CodeMirror.spec.ts +0 -99
- package/components/fleet/__tests__/FleetSummary.test.ts +0 -316
- package/components/formatter/FleetClusterSummaryGraph.vue +0 -27
- package/components/formatter/__tests__/Checked.test.ts +0 -19
- package/components/formatter/__tests__/WorkloadDetailEndpoints.test.ts +0 -81
- package/components/nav/WindowManager/__tests__/ContainerLogs.test.ts +0 -186
- package/composables/useCompactInput.ts +0 -20
- package/composables/useLabeledFormElement.ts +0 -138
- package/creators/app/files/.gitlab-ci.yml +0 -14
- package/detail/__tests__/provisioning.cattle.io.cluster.test.ts +0 -77
- package/edit/__tests__/service.test.ts +0 -89
- package/edit/provisioning.cattle.io.cluster/__tests__/Advanced.test.ts +0 -112
- package/edit/provisioning.cattle.io.cluster/__tests__/Basics.test.ts +0 -473
- package/edit/provisioning.cattle.io.cluster/__tests__/index.test.ts +0 -73
- package/edit/provisioning.cattle.io.cluster/__tests__/utils/cluster.ts +0 -386
- package/edit/provisioning.cattle.io.cluster/tabs/AddOnConfig.vue +0 -137
- package/edit/provisioning.cattle.io.cluster/tabs/Advanced.vue +0 -157
- package/edit/provisioning.cattle.io.cluster/tabs/etcd/index.vue +0 -135
- package/edit/provisioning.cattle.io.cluster/tabs/networking/index.vue +0 -189
- package/edit/provisioning.cattle.io.cluster/tabs/registries/index.vue +0 -147
- package/edit/provisioning.cattle.io.cluster/tabs/upgrade/index.vue +0 -76
- package/mixins/v1-workload-metrics.js +0 -43
- package/models/__tests__/management.cattle.io.cluster.test.ts +0 -23
- package/models/__tests__/management.cattle.io.nodepool.ts +0 -83
- package/models/__tests__/provisioning.cattle.io.cluster.test.ts +0 -241
- package/models/__tests__/secret.test.ts +0 -37
- package/models/__tests__/storage.k8s.io.storageclass.test.ts +0 -22
- package/models/__tests__/workload.test.ts +0 -91
- package/plugins/clean-html.js +0 -53
- package/plugins/dashboard-store/__tests__/resource-class.test.ts +0 -49
- package/plugins/dashboard-store/__tests__/utils/store-mocks.ts +0 -7
- package/plugins/index.js +0 -11
- package/plugins/steve/__tests__/resource-utils.test.ts +0 -159
- package/plugins/steve/__tests__/steve-class.spec.ts +0 -59
- package/plugins/steve/__tests__/utils/steve-mocks.ts +0 -31
- package/plugins/steve/resource-utils.ts +0 -38
- package/scripts/.gitlab/workflows/build-extension-catalog.gitlab-ci.yml +0 -50
- package/server/har-file.js +0 -183
- package/store/__tests__/type-map.test.ts +0 -1122
- package/tsconfig.paths.json +0 -18
- package/utils/azure.js +0 -24
- package/utils/clipboard.js +0 -5
- /package/components/form/__tests__/{NameNsDescription.test.ts → NameNsDescription.ts} +0 -0
- /package/edit/networking.k8s.io.networkpolicy/__tests__/utils/{selectors.test.ts → selectors.ts} +0 -0
- /package/edit/provisioning.cattle.io.cluster/{tabs/networking/ACE.vue → ACE.vue} +0 -0
- /package/edit/provisioning.cattle.io.cluster/{tabs/AgentConfiguration.vue → AgentConfiguration.vue} +0 -0
- /package/edit/provisioning.cattle.io.cluster/{tabs/upgrade/DrainOptions.vue → DrainOptions.vue} +0 -0
- /package/edit/provisioning.cattle.io.cluster/{tabs/MemberRoles.vue → MemberRoles.vue} +0 -0
- /package/edit/provisioning.cattle.io.cluster/{tabs/registries/RegistryConfigs.vue → RegistryConfigs.vue} +0 -0
- /package/edit/provisioning.cattle.io.cluster/{tabs/registries/RegistryMirrors.vue → RegistryMirrors.vue} +0 -0
- /package/edit/provisioning.cattle.io.cluster/{tabs/etcd/S3Config.vue → S3Config.vue} +0 -0
- /package/plugins/dashboard-store/__tests__/{actions.test.ts → actions.spec.ts} +0 -0
- /package/plugins/dashboard-store/__tests__/{getters.test.ts → getters.spec.ts} +0 -0
- /package/rancher-components/BadgeState/{BadgeState.spec.ts → BadgeState.test.ts} +0 -0
package/plugins/steve/actions.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import https from 'https';
|
|
2
2
|
import { addParam, parse as parseUrl, stringify as unParseUrl } from '@shell/utils/url';
|
|
3
3
|
import { handleSpoofedRequest, loadSchemas } from '@shell/plugins/dashboard-store/actions';
|
|
4
|
-
import {
|
|
4
|
+
import { set } from '@shell/utils/object';
|
|
5
5
|
import { deferred } from '@shell/utils/promise';
|
|
6
6
|
import { streamJson, streamingSupported } from '@shell/utils/stream';
|
|
7
7
|
import isObject from 'lodash/isObject';
|
|
8
8
|
import { classify } from '@shell/plugins/dashboard-store/classify';
|
|
9
9
|
import { NAMESPACE } from '@shell/config/types';
|
|
10
|
+
import jsyaml from 'js-yaml';
|
|
10
11
|
import { handleKubeApiHeaderWarnings } from '@shell/plugins/steve/header-warnings';
|
|
11
|
-
import { steveCleanForDownload } from '@shell/plugins/steve/resource-utils';
|
|
12
12
|
|
|
13
13
|
export default {
|
|
14
14
|
|
|
@@ -330,7 +330,31 @@ export default {
|
|
|
330
330
|
|
|
331
331
|
// remove fields added by steve before showing/downloading yamls
|
|
332
332
|
cleanForDownload(ctx, yaml) {
|
|
333
|
-
|
|
333
|
+
if (!yaml) {
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
const rootKeys = [
|
|
337
|
+
'id',
|
|
338
|
+
'links',
|
|
339
|
+
'type',
|
|
340
|
+
'actions'
|
|
341
|
+
];
|
|
342
|
+
const metadataKeys = [
|
|
343
|
+
'fields',
|
|
344
|
+
'relationships',
|
|
345
|
+
'state',
|
|
346
|
+
];
|
|
347
|
+
const conditionKeys = [
|
|
348
|
+
'error',
|
|
349
|
+
'transitioning',
|
|
350
|
+
];
|
|
351
|
+
const obj = jsyaml.load(yaml);
|
|
352
|
+
|
|
353
|
+
dropKeys(obj, rootKeys);
|
|
354
|
+
dropKeys(obj?.metadata, metadataKeys);
|
|
355
|
+
(obj?.status?.conditions || []).forEach((condition) => dropKeys(condition, conditionKeys));
|
|
356
|
+
|
|
357
|
+
return jsyaml.dump(obj);
|
|
334
358
|
}
|
|
335
359
|
};
|
|
336
360
|
|
|
@@ -374,6 +398,16 @@ function dropUnderscores(obj) {
|
|
|
374
398
|
}
|
|
375
399
|
}
|
|
376
400
|
|
|
401
|
+
function dropKeys(obj, keys) {
|
|
402
|
+
if ( !obj ) {
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
for ( const k of keys ) {
|
|
407
|
+
delete obj[k];
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
|
|
377
411
|
function dropCattleKeys(obj) {
|
|
378
412
|
if ( !obj ) {
|
|
379
413
|
return;
|
package/plugins/steve/getters.js
CHANGED
|
@@ -24,14 +24,11 @@ const GC_IGNORE_TYPES = {
|
|
|
24
24
|
[UI.NAV_LINK]: true,
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
// Include calls to /v1 AND /k8s/clusters/<cluster id>/v1
|
|
28
|
-
const steveRegEx = new RegExp('(/v1)|(\/k8s\/clusters\/[a-z0-9-]+\/v1)');
|
|
29
|
-
|
|
30
27
|
export default {
|
|
31
28
|
urlOptions: () => (url, opt) => {
|
|
32
29
|
opt = opt || {};
|
|
33
30
|
const parsedUrl = parse(url);
|
|
34
|
-
const isSteve =
|
|
31
|
+
const isSteve = parsedUrl.path.startsWith('/v1');
|
|
35
32
|
|
|
36
33
|
// labelSelector
|
|
37
34
|
if ( opt.labelSelector ) {
|
|
@@ -126,10 +123,30 @@ export default {
|
|
|
126
123
|
// `namespaced` is either
|
|
127
124
|
// - a string representing a single namespace - add restriction to the url
|
|
128
125
|
// - an array of namespaces or projects - add restriction as a param
|
|
129
|
-
if (opt?.namespaced && !pAndNFiltering.isApplicable(opt)) {
|
|
130
|
-
|
|
126
|
+
if (!opt?.url && opt?.namespaced && !pAndNFiltering.isApplicable(opt)) {
|
|
127
|
+
// Update path to include `namespace`, but take into account
|
|
128
|
+
// - if there is an id
|
|
129
|
+
// - if there are query params
|
|
130
|
+
|
|
131
|
+
// Construct a url so query params / fragments are avoided
|
|
132
|
+
const urlObj = new URL(url);
|
|
133
|
+
const path = urlObj.pathname;
|
|
134
|
+
|
|
135
|
+
if (!!path?.length && path[path.length - 1] === '/') {
|
|
136
|
+
urlObj.pathname = path.substring(0, path.length - 1);
|
|
137
|
+
}
|
|
138
|
+
const parts = urlObj.pathname.split('/');
|
|
139
|
+
|
|
140
|
+
if (id) {
|
|
141
|
+
// namespace should go before the id in the path
|
|
142
|
+
parts.splice(parts.length - 1, 0, opt.namespaced);
|
|
143
|
+
urlObj.pathname = parts.join('/');
|
|
144
|
+
} else {
|
|
145
|
+
// namespace should go at the end of the path
|
|
146
|
+
urlObj.pathname = `${ urlObj.pathname.split('/').join('/') }/${ opt.namespaced }`;
|
|
147
|
+
}
|
|
131
148
|
|
|
132
|
-
url =
|
|
149
|
+
url = urlObj.toString();
|
|
133
150
|
}
|
|
134
151
|
|
|
135
152
|
return url;
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
batchChanges,
|
|
10
10
|
replace
|
|
11
11
|
} from '@shell/plugins/dashboard-store/mutations';
|
|
12
|
-
import { keyForSubscribe } from '@shell/plugins/steve/resourceWatcher';
|
|
13
12
|
import { perfLoadAll } from '@shell/plugins/steve/performanceTesting';
|
|
14
13
|
import Vue from 'vue';
|
|
15
14
|
import { classify } from '@shell/plugins/dashboard-store/classify';
|
|
@@ -151,7 +150,11 @@ export default {
|
|
|
151
150
|
|
|
152
151
|
forgetType(state, type) {
|
|
153
152
|
if ( forgetType(state, type) ) {
|
|
154
|
-
|
|
153
|
+
Object.keys(state.inError).forEach((key) => {
|
|
154
|
+
if (key.startsWith(type)) {
|
|
155
|
+
delete state.inError[key];
|
|
156
|
+
}
|
|
157
|
+
});
|
|
155
158
|
}
|
|
156
159
|
},
|
|
157
160
|
|
|
@@ -3,7 +3,6 @@ import pickBy from 'lodash/pickBy';
|
|
|
3
3
|
import Vue from 'vue';
|
|
4
4
|
import { matchesSomeRegex } from '@shell/utils/string';
|
|
5
5
|
import Resource from '@shell/plugins/dashboard-store/resource-class';
|
|
6
|
-
import { findBy } from '@shell/utils/array';
|
|
7
6
|
|
|
8
7
|
export default class NormanModel extends Resource {
|
|
9
8
|
setLabels(val) {
|
|
@@ -57,22 +56,4 @@ export default class NormanModel extends Resource {
|
|
|
57
56
|
Vue.set(this, key, { ...spec[key] });
|
|
58
57
|
});
|
|
59
58
|
}
|
|
60
|
-
|
|
61
|
-
isCondition(condition, withStatus = 'True') {
|
|
62
|
-
if ( !this.conditions ) {
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const entry = findBy((this.conditions || []), 'type', condition);
|
|
67
|
-
|
|
68
|
-
if ( !entry ) {
|
|
69
|
-
return false;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if ( !withStatus ) {
|
|
73
|
-
return true;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return (entry.status || '').toLowerCase() === `${ withStatus }`.toLowerCase();
|
|
77
|
-
}
|
|
78
59
|
}
|
|
@@ -1,17 +1,5 @@
|
|
|
1
1
|
import { DESCRIPTION } from '@shell/config/labels-annotations';
|
|
2
2
|
import HybridModel from './hybrid-class';
|
|
3
|
-
import { NEVER_ADD } from '@shell/utils/create-yaml';
|
|
4
|
-
import { deleteProperty } from '@shell/utils/object';
|
|
5
|
-
|
|
6
|
-
// Some fields that are removed for YAML (NEVER_ADD) are required via API
|
|
7
|
-
const STEVE_ADD = [
|
|
8
|
-
'metadata.resourceVersion',
|
|
9
|
-
'metadata.fields',
|
|
10
|
-
'metadata.clusterName',
|
|
11
|
-
'metadata.deletionGracePeriodSeconds',
|
|
12
|
-
'metadata.generateName',
|
|
13
|
-
];
|
|
14
|
-
const STEVE_NEVER_SAVE = NEVER_ADD.filter((na) => !STEVE_ADD.includes(na));
|
|
15
3
|
|
|
16
4
|
export default class SteveModel extends HybridModel {
|
|
17
5
|
get name() {
|
|
@@ -40,14 +28,4 @@ export default class SteveModel extends HybridModel {
|
|
|
40
28
|
|
|
41
29
|
this._description = value;
|
|
42
30
|
}
|
|
43
|
-
|
|
44
|
-
cleanForSave(data, forNew) {
|
|
45
|
-
const val = super.cleanForSave(data);
|
|
46
|
-
|
|
47
|
-
for (const field of STEVE_NEVER_SAVE) {
|
|
48
|
-
deleteProperty(val, field);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return val;
|
|
52
|
-
}
|
|
53
31
|
}
|
|
@@ -22,7 +22,8 @@ import Socket, {
|
|
|
22
22
|
EVENT_DISCONNECT_ERROR,
|
|
23
23
|
NO_WATCH,
|
|
24
24
|
NO_SCHEMA,
|
|
25
|
-
REVISION_TOO_OLD
|
|
25
|
+
REVISION_TOO_OLD,
|
|
26
|
+
NO_PERMS
|
|
26
27
|
} from '@shell/utils/socket';
|
|
27
28
|
import { normalizeType } from '@shell/plugins/dashboard-store/normalize';
|
|
28
29
|
import day from 'dayjs';
|
|
@@ -332,6 +333,10 @@ const sharedActions = {
|
|
|
332
333
|
|
|
333
334
|
commit('setWantSocket', true);
|
|
334
335
|
|
|
336
|
+
if ( process.server ) {
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
|
|
335
340
|
state.debugSocket && console.info(`Subscribe [${ getters.storeName }]`); // eslint-disable-line no-console
|
|
336
341
|
|
|
337
342
|
const url = `${ state.config.baseUrl }/subscribe`;
|
|
@@ -430,6 +435,14 @@ const sharedActions = {
|
|
|
430
435
|
return;
|
|
431
436
|
}
|
|
432
437
|
|
|
438
|
+
const schema = getters.schemaFor(type, false, false);
|
|
439
|
+
|
|
440
|
+
if (!!schema?.attributes?.verbs?.includes && !schema.attributes.verbs.includes('watch')) {
|
|
441
|
+
state.debugSocket && console.info('Will not Watch (type does not have watch verb)', JSON.stringify(params)); // eslint-disable-line no-console
|
|
442
|
+
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
|
|
433
446
|
// If socket is in error don't try to watch.... unless we `force` it
|
|
434
447
|
const inError = getters.inError(params);
|
|
435
448
|
|
|
@@ -597,7 +610,7 @@ const defaultActions = {
|
|
|
597
610
|
},
|
|
598
611
|
|
|
599
612
|
rehydrateSubscribe({ state, dispatch }) {
|
|
600
|
-
if ( state.wantSocket && !state.socket ) {
|
|
613
|
+
if ( process.client && state.wantSocket && !state.socket ) {
|
|
601
614
|
dispatch('subscribe');
|
|
602
615
|
}
|
|
603
616
|
},
|
|
@@ -635,13 +648,17 @@ const defaultActions = {
|
|
|
635
648
|
await dispatch('find', {
|
|
636
649
|
type: resourceType,
|
|
637
650
|
id,
|
|
638
|
-
opt
|
|
651
|
+
opt: {
|
|
652
|
+
...opt,
|
|
653
|
+
// Pass the namespace so `find` can construct the url correctly
|
|
654
|
+
namespaced: namespace,
|
|
655
|
+
// Ensure that find calls watch with no revision (otherwise it'll use the revision from the resource which is probably stale)
|
|
656
|
+
revision: null
|
|
657
|
+
},
|
|
639
658
|
});
|
|
640
|
-
commit('clearInError', params);
|
|
641
659
|
|
|
642
660
|
return;
|
|
643
661
|
}
|
|
644
|
-
|
|
645
662
|
let have, want;
|
|
646
663
|
|
|
647
664
|
if ( selector ) {
|
|
@@ -724,9 +741,11 @@ const defaultActions = {
|
|
|
724
741
|
}
|
|
725
742
|
|
|
726
743
|
// Try resending any frames that were attempted to be sent while the socket was down, once.
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
744
|
+
if ( !process.server ) {
|
|
745
|
+
for ( const obj of state.pendingFrames.slice() ) {
|
|
746
|
+
commit('dequeuePendingFrame', obj);
|
|
747
|
+
dispatch('sendImmediate', obj);
|
|
748
|
+
}
|
|
730
749
|
}
|
|
731
750
|
},
|
|
732
751
|
|
|
@@ -844,15 +863,17 @@ const defaultActions = {
|
|
|
844
863
|
const err = msg.data?.error?.toLowerCase();
|
|
845
864
|
|
|
846
865
|
if ( err.includes('watch not allowed') ) {
|
|
847
|
-
commit('setInError', {
|
|
866
|
+
commit('setInError', { msg, reason: NO_WATCH });
|
|
848
867
|
} else if ( err.includes('failed to find schema') ) {
|
|
849
|
-
commit('setInError', {
|
|
868
|
+
commit('setInError', { msg, reason: NO_SCHEMA });
|
|
850
869
|
} else if ( err.includes('too old') ) {
|
|
851
870
|
// Set an error for (all) subs of this type. This..
|
|
852
871
|
// 1) blocks attempts by resource.stop to resub (as type is in error)
|
|
853
872
|
// 2) will be cleared when resyncWatch --> watch (with force) --> resource.start completes
|
|
854
|
-
commit('setInError', {
|
|
873
|
+
commit('setInError', { msg, reason: REVISION_TOO_OLD });
|
|
855
874
|
dispatch('resyncWatch', msg);
|
|
875
|
+
} else if ( err.includes('the server does not allow this method on the requested resource')) {
|
|
876
|
+
commit('setInError', { msg, reason: NO_PERMS });
|
|
856
877
|
}
|
|
857
878
|
},
|
|
858
879
|
|
|
@@ -1023,10 +1044,10 @@ const defaultMutations = {
|
|
|
1023
1044
|
}
|
|
1024
1045
|
},
|
|
1025
1046
|
|
|
1026
|
-
setInError(state, msg) {
|
|
1047
|
+
setInError(state, { msg, reason }) {
|
|
1027
1048
|
const key = keyForSubscribe(msg);
|
|
1028
1049
|
|
|
1029
|
-
state.inError[key] =
|
|
1050
|
+
state.inError[key] = reason;
|
|
1030
1051
|
},
|
|
1031
1052
|
|
|
1032
1053
|
clearInError(state, msg) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import
|
|
2
|
+
import { PropType, defineComponent } from 'vue';
|
|
3
3
|
|
|
4
4
|
interface Badge {
|
|
5
5
|
stateBackground: string;
|
|
@@ -11,7 +11,7 @@ interface Badge {
|
|
|
11
11
|
* <p>Represents a badge whose label and color is either taken from the value property or
|
|
12
12
|
* from the label and color properties. The state property takes precedence.</p>
|
|
13
13
|
*/
|
|
14
|
-
export default
|
|
14
|
+
export default defineComponent({
|
|
15
15
|
props: {
|
|
16
16
|
/**
|
|
17
17
|
* A value having the properties `stateBackground` and `stateDisplay`
|
|
@@ -59,7 +59,7 @@ export default Vue.extend({
|
|
|
59
59
|
</script>
|
|
60
60
|
|
|
61
61
|
<template>
|
|
62
|
-
<span :class="
|
|
62
|
+
<span :class="['badge-state', bg]">
|
|
63
63
|
<i
|
|
64
64
|
v-if="icon"
|
|
65
65
|
class="icon"
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import { mount } from '@vue/test-utils';
|
|
2
2
|
import { Banner } from './index';
|
|
3
|
-
import { cleanHtmlDirective } from '@shell/plugins/clean-html-directive';
|
|
4
3
|
|
|
5
4
|
describe('component: Banner', () => {
|
|
6
5
|
it('should display text based on label', () => {
|
|
7
6
|
const label = 'test';
|
|
8
7
|
const wrapper = mount(
|
|
9
8
|
Banner,
|
|
10
|
-
{
|
|
11
|
-
directives: { cleanHtmlDirective },
|
|
12
|
-
propsData: { label }
|
|
13
|
-
});
|
|
9
|
+
{ propsData: { label } });
|
|
14
10
|
|
|
15
11
|
const element = wrapper.find('span').element;
|
|
16
12
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import
|
|
2
|
+
import { defineComponent } from 'vue';
|
|
3
3
|
import { nlToBr } from '@shell/utils/string';
|
|
4
4
|
import { stringify } from '@shell/utils/error';
|
|
5
5
|
|
|
6
|
-
export default
|
|
6
|
+
export default defineComponent({
|
|
7
7
|
props: {
|
|
8
8
|
/**
|
|
9
9
|
* A color class that represents the color of the banner.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import
|
|
2
|
+
import { defineComponent, PropType } from 'vue';
|
|
3
3
|
|
|
4
|
-
export default
|
|
4
|
+
export default defineComponent({
|
|
5
5
|
name: 'Card',
|
|
6
6
|
props: {
|
|
7
7
|
/**
|
|
@@ -22,7 +22,7 @@ export default Vue.extend({
|
|
|
22
22
|
* The function to invoke when the default action button is clicked.
|
|
23
23
|
*/
|
|
24
24
|
buttonAction: {
|
|
25
|
-
type: Function
|
|
25
|
+
type: Function as PropType<(event: MouseEvent) => void>,
|
|
26
26
|
default: (): void => { }
|
|
27
27
|
},
|
|
28
28
|
/**
|
|
@@ -151,7 +151,7 @@ export default Vue.extend({
|
|
|
151
151
|
|
|
152
152
|
.card-body {
|
|
153
153
|
justify-content: flex-start;
|
|
154
|
-
overflow:
|
|
154
|
+
overflow: auto;
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
> * {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import
|
|
2
|
+
import { PropType, defineComponent } from 'vue';
|
|
3
3
|
import { _EDIT, _VIEW } from '@shell/config/query-params';
|
|
4
4
|
import { addObject, removeObject } from '@shell/utils/array';
|
|
5
5
|
import cloneDeep from 'lodash/cloneDeep';
|
|
6
6
|
|
|
7
|
-
export default
|
|
7
|
+
export default defineComponent({
|
|
8
8
|
name: 'Checkbox',
|
|
9
9
|
|
|
10
10
|
props: {
|
|
@@ -140,7 +140,7 @@ export default Vue.extend({
|
|
|
140
140
|
/**
|
|
141
141
|
* Toggles the checked state for the checkbox and emits an 'input' event.
|
|
142
142
|
*/
|
|
143
|
-
clicked(event: MouseEvent): boolean | void {
|
|
143
|
+
clicked(event: MouseEvent | KeyboardEvent): boolean | void {
|
|
144
144
|
if ((event.target as HTMLLinkElement).tagName === 'A' && (event.target as HTMLLinkElement).href) {
|
|
145
145
|
// Ignore links inside the checkbox label so you can click them
|
|
146
146
|
return true;
|
|
@@ -325,6 +325,7 @@ $fontColor: var(--input-label);
|
|
|
325
325
|
border-radius: var(--border-radius);
|
|
326
326
|
transition: all 0.3s ease-out;
|
|
327
327
|
border: 1px solid var(--border);
|
|
328
|
+
flex-shrink: 0;
|
|
328
329
|
}
|
|
329
330
|
|
|
330
331
|
input {
|
|
@@ -5,7 +5,7 @@ describe('component: LabeledInput', () => {
|
|
|
5
5
|
it('should emit input only once', () => {
|
|
6
6
|
const value = '2';
|
|
7
7
|
const delay = 1;
|
|
8
|
-
const wrapper = mount(LabeledInput
|
|
8
|
+
const wrapper = mount(LabeledInput, {
|
|
9
9
|
propsData: { delay },
|
|
10
10
|
mocks: { $store: { getters: { 'i18n/t': jest.fn() } } }
|
|
11
11
|
});
|
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import
|
|
3
|
-
import CompactInput from '@shell/mixins/compact-input';
|
|
4
|
-
import LabeledFormElement from '@shell/mixins/labeled-form-element';
|
|
2
|
+
import { defineComponent } from 'vue';
|
|
5
3
|
import TextAreaAutoGrow from '@components/Form/TextArea/TextAreaAutoGrow.vue';
|
|
6
4
|
import LabeledTooltip from '@components/LabeledTooltip/LabeledTooltip.vue';
|
|
7
5
|
import { escapeHtml } from '@shell/utils/string';
|
|
8
6
|
import cronstrue from 'cronstrue';
|
|
9
7
|
import { isValidCron } from 'cron-validator';
|
|
10
8
|
import { debounce } from 'lodash';
|
|
9
|
+
import { useLabeledFormElement, labeledFormElementProps } from '@shell/composables/useLabeledFormElement';
|
|
10
|
+
import { useCompactInput } from '@shell/composables/useCompactInput';
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
)
|
|
12
|
+
declare module 'vue/types/vue' {
|
|
13
|
+
interface Vue {
|
|
14
|
+
onInput: (event: Event) => void | ((event: Event) => void);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default defineComponent({
|
|
15
19
|
components: { LabeledTooltip, TextAreaAutoGrow },
|
|
16
|
-
|
|
20
|
+
|
|
21
|
+
inheritAttrs: false,
|
|
17
22
|
|
|
18
23
|
props: {
|
|
24
|
+
...labeledFormElementProps,
|
|
19
25
|
/**
|
|
20
26
|
* The type of the Labeled Input.
|
|
21
27
|
* @values text, cron, multiline, multiline-password
|
|
@@ -93,21 +99,36 @@ export default (
|
|
|
93
99
|
},
|
|
94
100
|
},
|
|
95
101
|
|
|
102
|
+
setup(props, { emit }) {
|
|
103
|
+
const {
|
|
104
|
+
focused,
|
|
105
|
+
onFocusLabeled,
|
|
106
|
+
onBlurLabeled,
|
|
107
|
+
isDisabled,
|
|
108
|
+
validationMessage,
|
|
109
|
+
requiredField
|
|
110
|
+
} = useLabeledFormElement(props, emit);
|
|
111
|
+
const { isCompact } = useCompactInput(props);
|
|
112
|
+
|
|
113
|
+
return {
|
|
114
|
+
focused,
|
|
115
|
+
onFocusLabeled,
|
|
116
|
+
onBlurLabeled,
|
|
117
|
+
isDisabled,
|
|
118
|
+
validationMessage,
|
|
119
|
+
requiredField,
|
|
120
|
+
isCompact,
|
|
121
|
+
};
|
|
122
|
+
},
|
|
123
|
+
|
|
96
124
|
data() {
|
|
97
125
|
return {
|
|
98
126
|
updated: false,
|
|
99
|
-
validationErrors: ''
|
|
127
|
+
validationErrors: '',
|
|
100
128
|
};
|
|
101
129
|
},
|
|
102
130
|
|
|
103
131
|
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
132
|
/**
|
|
112
133
|
* Determines if the Labeled Input should display a label.
|
|
113
134
|
*/
|
|
@@ -122,7 +143,7 @@ export default (
|
|
|
122
143
|
return !!this.tooltip || !!this.tooltipKey;
|
|
123
144
|
},
|
|
124
145
|
|
|
125
|
-
tooltipValue(): string | undefined {
|
|
146
|
+
tooltipValue(): string | Record<string, unknown> | undefined {
|
|
126
147
|
if (this.hasTooltip) {
|
|
127
148
|
return this.tooltipKey ? this.t(this.tooltipKey) : this.tooltip;
|
|
128
149
|
}
|
|
@@ -144,7 +165,7 @@ export default (
|
|
|
144
165
|
if (this.type !== 'cron' || !this.value) {
|
|
145
166
|
return;
|
|
146
167
|
}
|
|
147
|
-
if (!isValidCron(this.value)) {
|
|
168
|
+
if (typeof this.value === 'string' && !isValidCron(this.value)) {
|
|
148
169
|
return this.t('generic.invalidCron');
|
|
149
170
|
}
|
|
150
171
|
try {
|
|
@@ -173,15 +194,22 @@ export default (
|
|
|
173
194
|
/**
|
|
174
195
|
* The max length for the Labeled Input.
|
|
175
196
|
*/
|
|
176
|
-
_maxlength(): number |
|
|
197
|
+
_maxlength(): number | undefined {
|
|
177
198
|
if (this.type === 'text' && this.maxlength) {
|
|
178
199
|
return this.maxlength;
|
|
179
200
|
}
|
|
180
201
|
|
|
181
|
-
return
|
|
202
|
+
return undefined;
|
|
182
203
|
},
|
|
183
204
|
},
|
|
184
205
|
|
|
206
|
+
created() {
|
|
207
|
+
/**
|
|
208
|
+
* Determines if the Labeled Input @input event should be debounced.
|
|
209
|
+
*/
|
|
210
|
+
this.onInput = this.delay ? debounce(this.delayInput, this.delay) : this.delayInput;
|
|
211
|
+
},
|
|
212
|
+
|
|
185
213
|
methods: {
|
|
186
214
|
/**
|
|
187
215
|
* Attempts to give the Labeled Input focus.
|
|
@@ -220,7 +248,9 @@ export default (
|
|
|
220
248
|
* NOTE: In multiline, TextAreaAutoGrow emits a string with the value
|
|
221
249
|
* https://github.com/rancher/dashboard/issues/10249
|
|
222
250
|
*/
|
|
223
|
-
delayInput(
|
|
251
|
+
delayInput(val: string | Event): void {
|
|
252
|
+
const value = typeof val === 'string' ? val : (val?.target as HTMLInputElement)?.value;
|
|
253
|
+
|
|
224
254
|
this.$emit('input', value);
|
|
225
255
|
},
|
|
226
256
|
|
|
@@ -237,7 +267,7 @@ export default (
|
|
|
237
267
|
* event.
|
|
238
268
|
* @see labeled-form-element.ts mixin for onBlurLabeled()
|
|
239
269
|
*/
|
|
240
|
-
onBlur(event: string): void {
|
|
270
|
+
onBlur(event: string | FocusEvent): void {
|
|
241
271
|
this.$emit('blur', event);
|
|
242
272
|
this.onBlurLabeled();
|
|
243
273
|
},
|
|
@@ -289,7 +319,7 @@ export default (
|
|
|
289
319
|
:placeholder="_placeholder"
|
|
290
320
|
autocapitalize="off"
|
|
291
321
|
:class="{ conceal: type === 'multiline-password' }"
|
|
292
|
-
@input="onInput
|
|
322
|
+
@input="onInput"
|
|
293
323
|
@focus="onFocus"
|
|
294
324
|
@blur="onBlur"
|
|
295
325
|
/>
|
|
@@ -306,7 +336,7 @@ export default (
|
|
|
306
336
|
autocomplete="off"
|
|
307
337
|
autocapitalize="off"
|
|
308
338
|
:data-lpignore="ignorePasswordManagers"
|
|
309
|
-
@input="onInput
|
|
339
|
+
@input="onInput"
|
|
310
340
|
@focus="onFocus"
|
|
311
341
|
@blur="onBlur"
|
|
312
342
|
@change="onChange"
|
|
@@ -331,8 +361,9 @@ export default (
|
|
|
331
361
|
>{{ cronHint }}</label>
|
|
332
362
|
<label
|
|
333
363
|
v-if="subLabel"
|
|
364
|
+
v-clean-html="subLabel"
|
|
334
365
|
class="sub-label"
|
|
335
|
-
|
|
366
|
+
/>
|
|
336
367
|
</div>
|
|
337
368
|
</template>
|
|
338
369
|
<style scoped lang="scss">
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { shallowMount } from '@vue/test-utils';
|
|
2
2
|
import { RadioButton } from './index';
|
|
3
|
-
import { cleanHtmlDirective } from '@shell/plugins/clean-html-directive';
|
|
4
3
|
|
|
5
4
|
describe('radioButton.vue', () => {
|
|
6
5
|
it('renders label slot contents', () => {
|
|
@@ -13,8 +12,7 @@ describe('radioButton.vue', () => {
|
|
|
13
12
|
const wrapper = shallowMount(
|
|
14
13
|
RadioButton,
|
|
15
14
|
{
|
|
16
|
-
|
|
17
|
-
propsData: {
|
|
15
|
+
propsData: {
|
|
18
16
|
label: 'Test Label', val: {}, value: {}
|
|
19
17
|
}
|
|
20
18
|
});
|