@rancher/shell 0.5.3 → 1.2.1
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 +407 -468
- 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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { saveAs } from 'file-saver';
|
|
3
3
|
import AnsiUp from 'ansi_up';
|
|
4
4
|
import { addParams } from '@shell/utils/url';
|
|
5
|
-
import {
|
|
5
|
+
import { base64Decode } from '@shell/utils/crypto';
|
|
6
6
|
import { LOGS_RANGE, LOGS_TIME, LOGS_WRAP } from '@shell/store/prefs';
|
|
7
7
|
import LabeledSelect from '@shell/components/form/LabeledSelect';
|
|
8
8
|
import { Checkbox } from '@components/Form/Checkbox';
|
|
@@ -25,61 +25,6 @@ import Window from './Window';
|
|
|
25
25
|
|
|
26
26
|
let lastId = 1;
|
|
27
27
|
const ansiup = new AnsiUp();
|
|
28
|
-
// Convert arrayBuffer(Uint8Array) to string
|
|
29
|
-
// ref: https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder
|
|
30
|
-
// ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/of
|
|
31
|
-
const ab2str = (input, outputEncoding = 'utf8') => {
|
|
32
|
-
const decoder = new TextDecoder(outputEncoding);
|
|
33
|
-
|
|
34
|
-
return decoder.decode(input);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
// The utf-8 encoded messages pushed by websocket may truncate multi-byte utf-8 characters,
|
|
38
|
-
// which causes the front-end to be unable to parse the truncated multi-byte utf-8 characters in the previous and next messages when decoding.
|
|
39
|
-
// Therefore, we need to determine whether the last 4 bytes of the current pushed message contain incomplete utf-8 encoded characters.
|
|
40
|
-
// ref: https://en.wikipedia.org/wiki/UTF-8#Encoding
|
|
41
|
-
const isLogTruncated = (uint8ArrayBuffer) => {
|
|
42
|
-
const len = uint8ArrayBuffer.length;
|
|
43
|
-
const count = Math.min(4, len);
|
|
44
|
-
let isTruncated = false;
|
|
45
|
-
|
|
46
|
-
// Parses the last ${count} bytes of the array to determine if there are any truncated utf-8 characters.
|
|
47
|
-
for ( let i = 0; i < count; i++ ) {
|
|
48
|
-
const a = uint8ArrayBuffer[len - (1 + i)];
|
|
49
|
-
|
|
50
|
-
// 1 byte utf-8 character in binary form: 0xxxxxxxxx
|
|
51
|
-
if ((a & 0b10000000) === 0b00000000) {
|
|
52
|
-
break;
|
|
53
|
-
}
|
|
54
|
-
// Multi-byte utf-8 character, intermediate binary form: 10xxxxxx
|
|
55
|
-
if ((a & 0b11000000) === 0b10000000) {
|
|
56
|
-
continue;
|
|
57
|
-
}
|
|
58
|
-
// 2 byte utf-8 character in binary form: 110xxxxx 10xxxxxx
|
|
59
|
-
if ((a & 0b11100000) === 0b11000000) {
|
|
60
|
-
if ( i !== 1) {
|
|
61
|
-
isTruncated = true;
|
|
62
|
-
}
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
// 3 byte utf-8 character in binary form: 1110xxxx 10xxxxxx 10xxxxxx
|
|
66
|
-
if ((a & 0b11110000) === 0b11100000) {
|
|
67
|
-
if (i !== 2) {
|
|
68
|
-
isTruncated = true;
|
|
69
|
-
}
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
// 4 byte utf-8 character in binary form: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
|
|
73
|
-
if ((a & 0b11111000) === 0b11110000) {
|
|
74
|
-
if (i !== 3) {
|
|
75
|
-
isTruncated = true;
|
|
76
|
-
}
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return isTruncated;
|
|
82
|
-
};
|
|
83
28
|
|
|
84
29
|
export default {
|
|
85
30
|
components: {
|
|
@@ -328,80 +273,34 @@ export default {
|
|
|
328
273
|
console.error('Connect Error', e); // eslint-disable-line no-console
|
|
329
274
|
});
|
|
330
275
|
|
|
331
|
-
let logBuffer = [];
|
|
332
|
-
let truncatedLog = '';
|
|
333
|
-
|
|
334
276
|
this.socket.addEventListener(EVENT_MESSAGE, (e) => {
|
|
335
|
-
const
|
|
336
|
-
const replacedData = decodedData.replace(/[-_]/g, (char) => char === '-' ? '+' : '/');
|
|
337
|
-
const b = base64DecodeToBuffer(replacedData);
|
|
338
|
-
const isTruncated = isLogTruncated(b);
|
|
277
|
+
const line = base64Decode(e.detail.data);
|
|
339
278
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
return;
|
|
344
|
-
}
|
|
279
|
+
let msg = line;
|
|
280
|
+
let time = null;
|
|
345
281
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
// If the logBuffer is not empty,
|
|
349
|
-
// there are truncated utf-8 characters in the previous message
|
|
350
|
-
// that need to be merged with the current message before decoding.
|
|
351
|
-
if (logBuffer.length > 0) {
|
|
352
|
-
// Convert arrayBuffer(Uint8Array) to string
|
|
353
|
-
// ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/of
|
|
354
|
-
d = ab2str(Uint8Array.of(...logBuffer, ...b));
|
|
355
|
-
logBuffer = [];
|
|
356
|
-
} else {
|
|
357
|
-
d = b.toString();
|
|
358
|
-
}
|
|
359
|
-
let data = d;
|
|
360
|
-
|
|
361
|
-
if (truncatedLog) {
|
|
362
|
-
data = `${ truncatedLog }${ d }`;
|
|
363
|
-
truncatedLog = '';
|
|
364
|
-
}
|
|
282
|
+
const idx = line.indexOf(' ');
|
|
365
283
|
|
|
366
|
-
if (
|
|
367
|
-
const
|
|
284
|
+
if ( idx > 0 ) {
|
|
285
|
+
const timeStr = line.substr(0, idx);
|
|
286
|
+
const date = new Date(timeStr);
|
|
368
287
|
|
|
369
|
-
if (
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
return;
|
|
288
|
+
if ( !isNaN(date.getSeconds()) ) {
|
|
289
|
+
time = date.toISOString();
|
|
290
|
+
msg = line.substr(idx + 1);
|
|
373
291
|
}
|
|
374
|
-
data = lines.slice(0, -1).join('\n');
|
|
375
|
-
truncatedLog = lines.slice(-1);
|
|
376
292
|
}
|
|
377
|
-
// Websocket message may contain multiple lines - loop through each line, one by one
|
|
378
|
-
data.split('\n').filter((line) => line).forEach((line) => {
|
|
379
|
-
let msg = line;
|
|
380
|
-
let time = null;
|
|
381
|
-
|
|
382
|
-
const idx = line.indexOf(' ');
|
|
383
|
-
|
|
384
|
-
if ( idx > 0 ) {
|
|
385
|
-
const timeStr = line.substr(0, idx);
|
|
386
|
-
const date = new Date(timeStr);
|
|
387
293
|
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
const parsedLine = {
|
|
395
|
-
id: lastId++,
|
|
396
|
-
msg: ansiup.ansi_to_html(msg),
|
|
397
|
-
rawMsg: msg,
|
|
398
|
-
time,
|
|
399
|
-
};
|
|
294
|
+
const parsedLine = {
|
|
295
|
+
id: lastId++,
|
|
296
|
+
msg: ansiup.ansi_to_html(msg),
|
|
297
|
+
rawMsg: msg,
|
|
298
|
+
time,
|
|
299
|
+
};
|
|
400
300
|
|
|
401
|
-
|
|
301
|
+
Object.freeze(parsedLine);
|
|
402
302
|
|
|
403
|
-
|
|
404
|
-
});
|
|
303
|
+
this.backlog.push(parsedLine);
|
|
405
304
|
});
|
|
406
305
|
|
|
407
306
|
this.socket.connect();
|
|
@@ -79,7 +79,6 @@ export default {
|
|
|
79
79
|
fitAddon: null,
|
|
80
80
|
searchAddon: null,
|
|
81
81
|
webglAddon: null,
|
|
82
|
-
canvasAddon: null,
|
|
83
82
|
isOpen: false,
|
|
84
83
|
isOpening: false,
|
|
85
84
|
backlog: [],
|
|
@@ -156,7 +155,6 @@ export default {
|
|
|
156
155
|
webgl: import(/* webpackChunkName: "xterm" */ 'xterm-addon-webgl'),
|
|
157
156
|
weblinks: import(/* webpackChunkName: "xterm" */ 'xterm-addon-web-links'),
|
|
158
157
|
search: import(/* webpackChunkName: "xterm" */ 'xterm-addon-search'),
|
|
159
|
-
canvas: import(/* webpackChunkName: "xterm" */ 'xterm-addon-canvas')
|
|
160
158
|
});
|
|
161
159
|
|
|
162
160
|
const terminal = new xterm.Terminal({
|
|
@@ -173,11 +171,10 @@ export default {
|
|
|
173
171
|
this.searchAddon = new addons.search.SearchAddon();
|
|
174
172
|
|
|
175
173
|
try {
|
|
176
|
-
this.webglAddon = new addons.webgl.
|
|
174
|
+
this.webglAddon = new addons.webgl.WebGlAddon();
|
|
177
175
|
} catch (e) {
|
|
178
176
|
// Some browsers (Safari) don't support the webgl renderer, so don't use it.
|
|
179
177
|
this.webglAddon = null;
|
|
180
|
-
this.canvasAddon = new addons.canvas.CanvasAddon();
|
|
181
178
|
}
|
|
182
179
|
|
|
183
180
|
terminal.loadAddon(this.fitAddon);
|
|
@@ -187,8 +184,6 @@ export default {
|
|
|
187
184
|
|
|
188
185
|
if (this.webglAddon) {
|
|
189
186
|
terminal.loadAddon(this.webglAddon);
|
|
190
|
-
} else {
|
|
191
|
-
terminal.loadAddon(this.canvasAddon);
|
|
192
187
|
}
|
|
193
188
|
|
|
194
189
|
this.fit();
|
|
@@ -20,6 +20,10 @@ export default {
|
|
|
20
20
|
|
|
21
21
|
height: {
|
|
22
22
|
get() {
|
|
23
|
+
if ( process.server ) {
|
|
24
|
+
return 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
23
27
|
if ( this.userHeight ) {
|
|
24
28
|
return this.userHeight;
|
|
25
29
|
}
|
|
@@ -48,6 +52,10 @@ export default {
|
|
|
48
52
|
|
|
49
53
|
width: {
|
|
50
54
|
get() {
|
|
55
|
+
if ( process.server ) {
|
|
56
|
+
return 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
51
59
|
if (this.userWidth) {
|
|
52
60
|
return this.userWidth;
|
|
53
61
|
}
|
|
@@ -334,8 +342,7 @@ export default {
|
|
|
334
342
|
/>
|
|
335
343
|
<span class="tab-label"> {{ tab.label }}</span>
|
|
336
344
|
<i
|
|
337
|
-
|
|
338
|
-
class="closer icon icon-fw icon-x wm-closer-button"
|
|
345
|
+
class="closer icon icon-fw icon-x"
|
|
339
346
|
@click.stop="close(tab.id)"
|
|
340
347
|
/>
|
|
341
348
|
</div>
|
|
@@ -433,16 +440,9 @@ export default {
|
|
|
433
440
|
margin-left: 5px;
|
|
434
441
|
border: 1px solid var(--body-text);
|
|
435
442
|
border-radius: var(--border-radius);
|
|
436
|
-
line-height: 12px;
|
|
437
|
-
font-size: 10px;
|
|
438
|
-
width: 14px;
|
|
439
|
-
align-self: center;
|
|
440
|
-
display: flex;
|
|
441
|
-
justify-content: center;
|
|
442
443
|
|
|
443
444
|
&:hover {
|
|
444
|
-
|
|
445
|
-
color: var(--link-border);
|
|
445
|
+
background-color: var(--wm-closer-hover-bg);
|
|
446
446
|
}
|
|
447
447
|
}
|
|
448
448
|
}
|
|
@@ -502,5 +502,4 @@ export default {
|
|
|
502
502
|
border-right: var(--nav-border-size) solid var(--nav-border);
|
|
503
503
|
}
|
|
504
504
|
}
|
|
505
|
-
|
|
506
505
|
</style>
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import TopLevelMenu from '@shell/components/nav/TopLevelMenu';
|
|
2
|
-
import { SETTING } from '@shell/config/settings';
|
|
3
1
|
import { mount, Wrapper } from '@vue/test-utils';
|
|
2
|
+
import TopLevelMenu from '@shell/components/nav/TopLevelMenu';
|
|
4
3
|
|
|
5
4
|
// DISCLAIMER: This should not be added here, although we have several store requests which are irrelevant
|
|
6
5
|
const defaultStore = {
|
|
@@ -33,38 +32,6 @@ describe('topLevelMenu', () => {
|
|
|
33
32
|
expect(cluster.exists()).toBe(true);
|
|
34
33
|
});
|
|
35
34
|
|
|
36
|
-
it('should not "crash" the component if the structure of banner settings is in an old format', () => {
|
|
37
|
-
const wrapper: Wrapper<InstanceType<typeof TopLevelMenu>> = mount(TopLevelMenu, {
|
|
38
|
-
mocks: {
|
|
39
|
-
$store: {
|
|
40
|
-
getters: {
|
|
41
|
-
'management/all': () => [{ name: 'whatever' },
|
|
42
|
-
// object based on https://github.com/rancher/dashboard/issues/10140#issuecomment-1883252402
|
|
43
|
-
{
|
|
44
|
-
id: SETTING.BANNERS,
|
|
45
|
-
value: JSON.stringify({
|
|
46
|
-
banner: {
|
|
47
|
-
color: '#78c9cf',
|
|
48
|
-
background: '#27292e',
|
|
49
|
-
text: 'Hello World!'
|
|
50
|
-
},
|
|
51
|
-
showHeader: 'true',
|
|
52
|
-
showFooter: 'true'
|
|
53
|
-
})
|
|
54
|
-
}],
|
|
55
|
-
...defaultStore
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
stubs: ['BrandImage', 'nuxt-link']
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
expect(wrapper.vm.globalBannerSettings).toStrictEqual({
|
|
63
|
-
headerFont: '2em',
|
|
64
|
-
footerFont: '2em'
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
|
|
68
35
|
describe('searching a term', () => {
|
|
69
36
|
describe('should displays a no results message if have clusters but', () => {
|
|
70
37
|
it('given no matching clusters', () => {
|
|
@@ -5,7 +5,7 @@ import Type from '@shell/components/nav/Type.vue';
|
|
|
5
5
|
jest.mock('vue-router');
|
|
6
6
|
|
|
7
7
|
// Configuration text
|
|
8
|
-
const className = '
|
|
8
|
+
const className = 'nuxt-link-active';
|
|
9
9
|
|
|
10
10
|
describe('component: Type', () => {
|
|
11
11
|
describe('should not use highlight class', () => {
|
|
@@ -16,12 +16,6 @@ describe('component: Type', () => {
|
|
|
16
16
|
mocks: {
|
|
17
17
|
$route: { path: 'whatever' },
|
|
18
18
|
$router: { resolve: () => ({ route: { path: 'whatever' } }) },
|
|
19
|
-
$store: {
|
|
20
|
-
getters: {
|
|
21
|
-
currentStore: () => 'cluster',
|
|
22
|
-
'cluster/count': () => 1,
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
19
|
},
|
|
26
20
|
});
|
|
27
21
|
|
|
@@ -37,12 +31,6 @@ describe('component: Type', () => {
|
|
|
37
31
|
mocks: {
|
|
38
32
|
$route: { hash: 'whatever' },
|
|
39
33
|
$router: { resolve: () => ({ route: { path: 'whatever' } }) },
|
|
40
|
-
$store: {
|
|
41
|
-
getters: {
|
|
42
|
-
currentStore: () => 'cluster',
|
|
43
|
-
'cluster/count': () => 1,
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
34
|
},
|
|
47
35
|
});
|
|
48
36
|
|
|
@@ -79,12 +67,6 @@ describe('component: Type', () => {
|
|
|
79
67
|
path: 'whatever',
|
|
80
68
|
},
|
|
81
69
|
$router: { resolve: () => ({ route: { path: 'many/parts' } }) },
|
|
82
|
-
$store: {
|
|
83
|
-
getters: {
|
|
84
|
-
currentStore: () => 'cluster',
|
|
85
|
-
'cluster/count': () => 1,
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
70
|
},
|
|
89
71
|
});
|
|
90
72
|
|
|
@@ -119,12 +101,6 @@ describe('component: Type', () => {
|
|
|
119
101
|
path: currentPath,
|
|
120
102
|
},
|
|
121
103
|
$router: { resolve: () => ({ route: { path: menuPath } }) },
|
|
122
|
-
$store: {
|
|
123
|
-
getters: {
|
|
124
|
-
currentStore: () => 'cluster',
|
|
125
|
-
'cluster/count': () => 1,
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
104
|
},
|
|
129
105
|
});
|
|
130
106
|
|
|
@@ -150,12 +126,6 @@ describe('component: Type', () => {
|
|
|
150
126
|
path: currentPath,
|
|
151
127
|
},
|
|
152
128
|
$router: { resolve: () => ({ route: { path: menuPath } }) },
|
|
153
|
-
$store: {
|
|
154
|
-
getters: {
|
|
155
|
-
currentStore: () => 'cluster',
|
|
156
|
-
'cluster/count': () => 1,
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
129
|
},
|
|
160
130
|
});
|
|
161
131
|
|
|
@@ -18,8 +18,10 @@ export default {
|
|
|
18
18
|
|
|
19
19
|
data.nuxtChild = true
|
|
20
20
|
const _parent = parent
|
|
21
|
-
|
|
21
|
+
const transitions = parent.$nuxt.nuxt.transitions
|
|
22
|
+
const defaultTransition = parent.$nuxt.nuxt.defaultTransition
|
|
22
23
|
|
|
24
|
+
let depth = 0
|
|
23
25
|
while (parent) {
|
|
24
26
|
if (parent.$vnode && parent.$vnode.data.nuxtChild) {
|
|
25
27
|
depth++
|
|
@@ -27,18 +29,48 @@ export default {
|
|
|
27
29
|
parent = parent.$parent
|
|
28
30
|
}
|
|
29
31
|
data.nuxtChildDepth = depth
|
|
32
|
+
const transition = transitions[depth] || defaultTransition
|
|
33
|
+
const transitionProps = {}
|
|
34
|
+
transitionsKeys.forEach((key) => {
|
|
35
|
+
if (typeof transition[key] !== 'undefined') {
|
|
36
|
+
transitionProps[key] = transition[key]
|
|
37
|
+
}
|
|
38
|
+
})
|
|
30
39
|
|
|
31
40
|
const listeners = {}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
listenersKeys.forEach((key) => {
|
|
42
|
+
if (typeof transition[key] === 'function') {
|
|
43
|
+
listeners[key] = transition[key].bind(_parent)
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
if (process.client) {
|
|
47
|
+
// Add triggerScroll event on beforeEnter (fix #1376)
|
|
48
|
+
const beforeEnter = listeners.beforeEnter
|
|
49
|
+
listeners.beforeEnter = (el) => {
|
|
50
|
+
// Ensure to trigger scroll event after calling scrollBehavior
|
|
51
|
+
window.$nuxt.$nextTick(() => {
|
|
52
|
+
window.$nuxt.$emit('triggerScroll')
|
|
53
|
+
})
|
|
54
|
+
if (beforeEnter) {
|
|
55
|
+
return beforeEnter.call(_parent, el)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// make sure that leave is called asynchronous (fix #5703)
|
|
61
|
+
if (transition.css === false) {
|
|
62
|
+
const leave = listeners.leave
|
|
63
|
+
|
|
64
|
+
// only add leave listener when user didnt provide one
|
|
65
|
+
// or when it misses the done argument
|
|
66
|
+
if (!leave || leave.length < 2) {
|
|
67
|
+
listeners.leave = (el, done) => {
|
|
68
|
+
if (leave) {
|
|
69
|
+
leave.call(_parent, el)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
_parent.$nextTick(done)
|
|
73
|
+
}
|
|
42
74
|
}
|
|
43
75
|
}
|
|
44
76
|
|
|
@@ -48,11 +80,43 @@ export default {
|
|
|
48
80
|
routerView = h('keep-alive', { props: props.keepAliveProps }, [routerView])
|
|
49
81
|
}
|
|
50
82
|
|
|
51
|
-
// this needs to be a "transition" or another non-rendering component,
|
|
52
|
-
// otherwise we will break pages like the charts wizard or the extensions main screen (DOM would render an additional element and break CSS)
|
|
53
|
-
// we can deal with this later once we remove this component and <nuxt /> component
|
|
54
83
|
return h('transition', {
|
|
84
|
+
props: transitionProps,
|
|
55
85
|
on: listeners
|
|
56
86
|
}, [routerView])
|
|
57
87
|
}
|
|
58
88
|
}
|
|
89
|
+
|
|
90
|
+
const transitionsKeys = [
|
|
91
|
+
'name',
|
|
92
|
+
'mode',
|
|
93
|
+
'appear',
|
|
94
|
+
'css',
|
|
95
|
+
'type',
|
|
96
|
+
'duration',
|
|
97
|
+
'enterClass',
|
|
98
|
+
'leaveClass',
|
|
99
|
+
'appearClass',
|
|
100
|
+
'enterActiveClass',
|
|
101
|
+
'enterActiveClass',
|
|
102
|
+
'leaveActiveClass',
|
|
103
|
+
'appearActiveClass',
|
|
104
|
+
'enterToClass',
|
|
105
|
+
'leaveToClass',
|
|
106
|
+
'appearToClass'
|
|
107
|
+
]
|
|
108
|
+
|
|
109
|
+
const listenersKeys = [
|
|
110
|
+
'beforeEnter',
|
|
111
|
+
'enter',
|
|
112
|
+
'afterEnter',
|
|
113
|
+
'enterCancelled',
|
|
114
|
+
'beforeLeave',
|
|
115
|
+
'leave',
|
|
116
|
+
'afterLeave',
|
|
117
|
+
'leaveCancelled',
|
|
118
|
+
'beforeAppear',
|
|
119
|
+
'appear',
|
|
120
|
+
'afterAppear',
|
|
121
|
+
'appearCancelled'
|
|
122
|
+
]
|
package/components/nuxt/nuxt.js
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import TabTitle from '@shell/components/TabTitle';
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<template>
|
|
6
|
+
<div>
|
|
7
|
+
<header>
|
|
8
|
+
<div class="title">
|
|
9
|
+
<h1
|
|
10
|
+
data-testid="charts-header-title"
|
|
11
|
+
class="m-0"
|
|
12
|
+
>
|
|
13
|
+
<TabTitle :show-child="false">
|
|
14
|
+
{{ t('user.retention.edit.title.header') }}
|
|
15
|
+
</TabTitle>
|
|
16
|
+
<router-link
|
|
17
|
+
:to="{
|
|
18
|
+
name: 'c-cluster-product-resource',
|
|
19
|
+
params: {
|
|
20
|
+
cluster: '_',
|
|
21
|
+
product: 'auth',
|
|
22
|
+
resource: 'management.cattle.io.user',
|
|
23
|
+
}
|
|
24
|
+
}"
|
|
25
|
+
>
|
|
26
|
+
{{ t('user.retention.edit.title.pre') }}
|
|
27
|
+
</router-link>
|
|
28
|
+
{{ t('user.retention.edit.title.post') }}
|
|
29
|
+
</h1>
|
|
30
|
+
</div>
|
|
31
|
+
</header>
|
|
32
|
+
<h2>{{ t('user.retention.edit.title.subTitle') }}</h2>
|
|
33
|
+
</div>
|
|
34
|
+
</template>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Store } from 'vuex';
|
|
2
|
+
|
|
3
|
+
import { stringFor } from '@shell/plugins/i18n';
|
|
4
|
+
|
|
5
|
+
let store: Store<any> | null = null;
|
|
6
|
+
|
|
7
|
+
export const useI18n = (vuexStore: Store<any>): { t: typeof t } => {
|
|
8
|
+
store = vuexStore;
|
|
9
|
+
|
|
10
|
+
if (!store) {
|
|
11
|
+
throw new Error('usI18n() must be called from setup()');
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return { t };
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Allows for consuming i18n strings with the Vue composition API.
|
|
19
|
+
* @param key - The key for the i18n string to translate.
|
|
20
|
+
* @param args - An object or array containing arguments for the translation function.
|
|
21
|
+
* @param raw - A boolean determining if the string returned is a raw representation.
|
|
22
|
+
* @returns A translated string or the raw value if the raw parameter is set to true.
|
|
23
|
+
*/
|
|
24
|
+
const t = (key: string, args?: unknown, raw?: boolean): unknown => {
|
|
25
|
+
return stringFor(store, key, args, raw);
|
|
26
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { getCurrentInstance } from 'vue';
|
|
2
|
+
import { Store } from 'vuex';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* useStore allows for accessing Vuex stores from within a setup function. This is a temporary measure for working with
|
|
6
|
+
* Vuex in Vue2.
|
|
7
|
+
*
|
|
8
|
+
* TODO: #9541 Remove for Vue 3 migration
|
|
9
|
+
*/
|
|
10
|
+
export const useStore = ():Store<any> => {
|
|
11
|
+
const vm = getCurrentInstance();
|
|
12
|
+
|
|
13
|
+
if (!vm) throw new Error('useStore() must be called from setup()');
|
|
14
|
+
|
|
15
|
+
return vm.proxy.$store;
|
|
16
|
+
};
|
package/config/home-links.js
CHANGED
|
@@ -2,6 +2,7 @@ import { DOCS_BASE } from '@shell/config/private-label';
|
|
|
2
2
|
import { MANAGEMENT } from '@shell/config/types';
|
|
3
3
|
import { SETTING } from '@shell/config/settings';
|
|
4
4
|
import { allHash } from '@shell/utils/promise';
|
|
5
|
+
import { isRancherPrime } from '@shell/config/version';
|
|
5
6
|
|
|
6
7
|
const DEFAULT_LINKS = [
|
|
7
8
|
{
|
|
@@ -26,11 +27,17 @@ const DEFAULT_LINKS = [
|
|
|
26
27
|
},
|
|
27
28
|
{
|
|
28
29
|
key: 'getStarted',
|
|
29
|
-
value:
|
|
30
|
+
value: 'https://ranchermanager.docs.rancher.com/getting-started/overview',
|
|
30
31
|
enabled: true,
|
|
31
32
|
},
|
|
32
33
|
];
|
|
33
34
|
|
|
35
|
+
const COLLECTIVE_LINK = {
|
|
36
|
+
key: 'suseCollective',
|
|
37
|
+
value: 'https://susecollective.suse.com/join/prime',
|
|
38
|
+
enabled: true,
|
|
39
|
+
};
|
|
40
|
+
|
|
34
41
|
const SUPPORT_LINK = {
|
|
35
42
|
key: 'commercialSupport',
|
|
36
43
|
value: '/support',
|
|
@@ -47,6 +54,9 @@ const CN_FORUMS_LINK = {
|
|
|
47
54
|
// We add a version attribute to the setting so we know what has been migrated and which version of the setting we have
|
|
48
55
|
export const CUSTOM_LINKS_VERSION = 'v1';
|
|
49
56
|
|
|
57
|
+
// Version with collective added (Prime)
|
|
58
|
+
export const CUSTOM_LINKS_COLLECTIVE_VERSION = 'v1.1';
|
|
59
|
+
|
|
50
60
|
// Fetch the settings required for the links, taking into account legacy settings if we have not migrated
|
|
51
61
|
export async function fetchLinks(store, hasSupport, isSupportPage, t) {
|
|
52
62
|
let uiLinks = {};
|
|
@@ -63,11 +73,26 @@ export async function fetchLinks(store, hasSupport, isSupportPage, t) {
|
|
|
63
73
|
}
|
|
64
74
|
|
|
65
75
|
// If uiLinks is set and has the correct version, then we are okay, otherwise we need to migrate from the old settings
|
|
66
|
-
if (uiLinks?.version
|
|
76
|
+
if (uiLinks?.version?.startsWith(CUSTOM_LINKS_VERSION)) {
|
|
77
|
+
// v1 > v1.1 migration
|
|
78
|
+
if (uiLinks?.version === CUSTOM_LINKS_VERSION) {
|
|
79
|
+
uiLinks.version = CUSTOM_LINKS_COLLECTIVE_VERSION;
|
|
80
|
+
|
|
81
|
+
// Add collective link so that it is enabled by default
|
|
82
|
+
if (!uiLinks.defaults.includes(COLLECTIVE_LINK.key)) {
|
|
83
|
+
uiLinks.defaults.push(COLLECTIVE_LINK.key);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
67
87
|
// Map out the default settings, as we only store keys of the ones to show
|
|
68
88
|
if (uiLinks.defaults) {
|
|
69
89
|
const defaults = [...DEFAULT_LINKS];
|
|
70
90
|
|
|
91
|
+
// Add prime link if necessary
|
|
92
|
+
if (isRancherPrime()) {
|
|
93
|
+
defaults.push(COLLECTIVE_LINK);
|
|
94
|
+
}
|
|
95
|
+
|
|
71
96
|
// Map the link name stored to the default link, if it exists
|
|
72
97
|
defaults.forEach((link) => {
|
|
73
98
|
const enabled = uiLinks.defaults.find((linkName) => linkName === link.key);
|
|
@@ -89,6 +114,11 @@ export async function fetchLinks(store, hasSupport, isSupportPage, t) {
|
|
|
89
114
|
custom: []
|
|
90
115
|
};
|
|
91
116
|
|
|
117
|
+
// Add prime link if necessary
|
|
118
|
+
if (isRancherPrime()) {
|
|
119
|
+
links.defaults.push(COLLECTIVE_LINK);
|
|
120
|
+
}
|
|
121
|
+
|
|
92
122
|
// There are two legacy settings:
|
|
93
123
|
// SETTING.ISSUES - can specify a custom link to use for 'File an issue'
|
|
94
124
|
// SETTING.COMMUNITY_LINKS - can specify whether to hide all of the default links (other than 'File an issue')
|