@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
|
@@ -10,6 +10,7 @@ import { allHash } from '@shell/utils/promise';
|
|
|
10
10
|
import { STORAGE_CLASS, SECRET, PV } from '@shell/config/types';
|
|
11
11
|
import { mapGetters } from 'vuex';
|
|
12
12
|
import { STORAGE } from '@shell/config/labels-annotations';
|
|
13
|
+
import ChartPsp from '@shell/components/ChartPsp';
|
|
13
14
|
|
|
14
15
|
export default {
|
|
15
16
|
components: {
|
|
@@ -18,7 +19,8 @@ export default {
|
|
|
18
19
|
S3,
|
|
19
20
|
LabeledInput,
|
|
20
21
|
LabeledSelect,
|
|
21
|
-
Banner
|
|
22
|
+
Banner,
|
|
23
|
+
ChartPsp
|
|
22
24
|
},
|
|
23
25
|
|
|
24
26
|
hasTabs: true,
|
|
@@ -65,7 +67,7 @@ export default {
|
|
|
65
67
|
|
|
66
68
|
computed: {
|
|
67
69
|
defaultStorageClass() {
|
|
68
|
-
return this.storageClasses.filter((sc) => sc.metadata.annotations
|
|
70
|
+
return this.storageClasses.filter((sc) => sc.metadata.annotations[STORAGE.DEFAULT_STORAGE_CLASS] && sc.metadata.annotations[STORAGE.DEFAULT_STORAGE_CLASS] !== 'false' )[0] || '';
|
|
69
71
|
},
|
|
70
72
|
|
|
71
73
|
availablePVs() {
|
|
@@ -167,6 +169,12 @@ export default {
|
|
|
167
169
|
label="Chart Options"
|
|
168
170
|
name="chartOptions"
|
|
169
171
|
>
|
|
172
|
+
<!-- Conditionally display PSP checkbox -->
|
|
173
|
+
<ChartPsp
|
|
174
|
+
:value="value"
|
|
175
|
+
:cluster="currentCluster"
|
|
176
|
+
/>
|
|
177
|
+
|
|
170
178
|
<Banner
|
|
171
179
|
color="info"
|
|
172
180
|
:label="t('backupRestoreOperator.deployment.storage.tip')"
|
|
@@ -200,7 +208,6 @@ export default {
|
|
|
200
208
|
:status="reclaimWarning ? 'warning' : null"
|
|
201
209
|
:options="storageClasses"
|
|
202
210
|
:hover-tooltip="true"
|
|
203
|
-
data-testid="backup-chart-select-existing-storage-class"
|
|
204
211
|
/>
|
|
205
212
|
</div>
|
|
206
213
|
<div class="col span-6">
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
import CreateEditView from '@shell/mixins/create-edit-view';
|
|
3
3
|
import { LabeledInput } from '@components/Form/LabeledInput';
|
|
4
4
|
import { azureEnvironments } from '@shell/machine-config/azure';
|
|
5
|
-
import { parseAzureError } from '@shell/utils/azure';
|
|
6
5
|
import LabeledSelect from '@shell/components/form/LabeledSelect';
|
|
7
6
|
|
|
7
|
+
const AZURE_ERROR_MSG_REGEX = /^.*Message=\"(.*)\"$/;
|
|
8
|
+
const AZURE_ERROR_JSON_REGEX = /^.*Response body: ({.*})/;
|
|
9
|
+
|
|
8
10
|
export default {
|
|
9
11
|
components: { LabeledInput, LabeledSelect },
|
|
10
12
|
mixins: [CreateEditView],
|
|
@@ -57,10 +59,21 @@ export default {
|
|
|
57
59
|
return true;
|
|
58
60
|
} catch (e) {
|
|
59
61
|
if (e.error) {
|
|
60
|
-
|
|
62
|
+
// Try and parse the response from Azure a couple of ways
|
|
63
|
+
const msgMatch = e.error.match(AZURE_ERROR_MSG_REGEX);
|
|
64
|
+
|
|
65
|
+
if (msgMatch?.length === 2) {
|
|
66
|
+
return { errors: [msgMatch[1]] };
|
|
67
|
+
} else {
|
|
68
|
+
const jsonMatch = e.error.match(AZURE_ERROR_JSON_REGEX);
|
|
69
|
+
|
|
70
|
+
if (jsonMatch?.length === 2) {
|
|
71
|
+
try {
|
|
72
|
+
const errorObj = JSON.parse(jsonMatch[1]);
|
|
61
73
|
|
|
62
|
-
|
|
63
|
-
|
|
74
|
+
return { errors: [errorObj.error_description] };
|
|
75
|
+
} catch (e) {}
|
|
76
|
+
}
|
|
64
77
|
}
|
|
65
78
|
}
|
|
66
79
|
|
|
@@ -273,7 +273,6 @@ export default Vue.extend<{ phase: string}, any, any, any>({
|
|
|
273
273
|
:data-testid="componentTestid + '-async-button'"
|
|
274
274
|
@click="clicked"
|
|
275
275
|
>
|
|
276
|
-
<span v-if="mode === 'manual-refresh'">{{ t('action.refresh') }}</span>
|
|
277
276
|
<i
|
|
278
277
|
v-if="displayIcon"
|
|
279
278
|
v-clean-tooltip="tooltip"
|
|
@@ -286,11 +285,3 @@ export default Vue.extend<{ phase: string}, any, any, any>({
|
|
|
286
285
|
/>
|
|
287
286
|
</button>
|
|
288
287
|
</template>
|
|
289
|
-
|
|
290
|
-
<style lang="scss" scoped>
|
|
291
|
-
// refresh mode has icon + text. We need to fix the positioning of the icon and sizing
|
|
292
|
-
.manual-refresh i {
|
|
293
|
-
margin: 0 0 0 8px !important;
|
|
294
|
-
font-size: 1rem !important;
|
|
295
|
-
}
|
|
296
|
-
</style>
|
package/components/Carousel.vue
CHANGED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { Checkbox } from '@components/Form/Checkbox';
|
|
3
|
+
import { mapGetters } from 'vuex';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
components: { Checkbox },
|
|
7
|
+
props: {
|
|
8
|
+
value: {
|
|
9
|
+
type: Object,
|
|
10
|
+
default: () => {
|
|
11
|
+
return {};
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
mode: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: 'edit'
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Optional title section prior checkbox
|
|
21
|
+
*/
|
|
22
|
+
title: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: null
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Cluster information
|
|
29
|
+
*/
|
|
30
|
+
cluster: {
|
|
31
|
+
type: Object,
|
|
32
|
+
default: null
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
created() {
|
|
36
|
+
if (!this.value.global.cattle) {
|
|
37
|
+
this.$set(this.value.global, 'cattle', { psp: { enabled: false } });
|
|
38
|
+
}
|
|
39
|
+
if (!this.value.global.cattle.psp) {
|
|
40
|
+
this.$set(this.value.global.cattle, 'psp', { enabled: false });
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
computed: {
|
|
44
|
+
...mapGetters({ t: 'i18n/t' }),
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Display checkbox only if contains PSP or K8S version is less than 1.25
|
|
48
|
+
*/
|
|
49
|
+
hasCheckbox() {
|
|
50
|
+
const clusterVersion = this.cluster?.kubernetesVersion || '';
|
|
51
|
+
const version = clusterVersion.match(/\d+/g);
|
|
52
|
+
const isRequiredVersion = version?.length ? +version[0] === 1 && +version[1] < 25 : false;
|
|
53
|
+
|
|
54
|
+
return isRequiredVersion;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
</script>
|
|
59
|
+
|
|
60
|
+
<template>
|
|
61
|
+
<div
|
|
62
|
+
v-if="hasCheckbox"
|
|
63
|
+
class="mt-10 mb-10"
|
|
64
|
+
>
|
|
65
|
+
<h3 v-if="title">
|
|
66
|
+
{{ title }}
|
|
67
|
+
</h3>
|
|
68
|
+
|
|
69
|
+
<Checkbox
|
|
70
|
+
v-model="value.global.cattle.psp.enabled"
|
|
71
|
+
data-testid="psp-checkbox"
|
|
72
|
+
:mode="mode"
|
|
73
|
+
:label="t('catalog.chart.enablePSP')"
|
|
74
|
+
/>
|
|
75
|
+
</div>
|
|
76
|
+
</template>
|
|
@@ -15,11 +15,10 @@ export default {
|
|
|
15
15
|
showLocalIcon() {
|
|
16
16
|
return this.cluster.isLocal && !this.cluster.isHarvester && !this.cluster.badge?.iconText;
|
|
17
17
|
},
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return this.cluster.badge?.color || '';
|
|
18
|
+
badgeLogoBorderBottom() {
|
|
19
|
+
const color = this.cluster.badge?.color;
|
|
20
|
+
|
|
21
|
+
return color ? `4px solid ${ color }` : '';
|
|
23
22
|
}
|
|
24
23
|
},
|
|
25
24
|
methods: {
|
|
@@ -45,17 +44,14 @@ export default {
|
|
|
45
44
|
>
|
|
46
45
|
<div
|
|
47
46
|
class="cluster-badge-logo"
|
|
48
|
-
:class="{ 'disabled': !isEnabled
|
|
47
|
+
:class="{ 'disabled': !isEnabled }"
|
|
48
|
+
:style="{ borderBottom: badgeLogoBorderBottom }"
|
|
49
49
|
>
|
|
50
50
|
<span
|
|
51
51
|
class="cluster-badge-logo-text"
|
|
52
52
|
>
|
|
53
53
|
{{ smallIdentifier(cluster.label) }}
|
|
54
54
|
</span>
|
|
55
|
-
<span
|
|
56
|
-
class="custom-color-decoration"
|
|
57
|
-
:style="{'background': customColor}"
|
|
58
|
-
/>
|
|
59
55
|
<svg
|
|
60
56
|
v-if="showLocalIcon"
|
|
61
57
|
class="cluster-local-logo"
|
|
@@ -103,6 +99,7 @@ export default {
|
|
|
103
99
|
</template>
|
|
104
100
|
|
|
105
101
|
<style lang="scss" scoped>
|
|
102
|
+
|
|
106
103
|
.cluster-icon-menu {
|
|
107
104
|
position: relative;
|
|
108
105
|
align-items: center;
|
|
@@ -114,8 +111,8 @@ export default {
|
|
|
114
111
|
.cluster-pin-icon {
|
|
115
112
|
position: absolute;
|
|
116
113
|
top: -6px;
|
|
117
|
-
right: -
|
|
118
|
-
font-size:
|
|
114
|
+
right: -4px;
|
|
115
|
+
font-size: 12px;
|
|
119
116
|
transform: scaleX(-1);
|
|
120
117
|
color: var(--body-text);
|
|
121
118
|
}
|
|
@@ -138,18 +135,6 @@ export default {
|
|
|
138
135
|
font-size: 12px;
|
|
139
136
|
text-transform: uppercase;
|
|
140
137
|
|
|
141
|
-
&.custom-color {
|
|
142
|
-
border-bottom: 4px solid transparent;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
.custom-color-decoration {
|
|
146
|
-
height: 4px;
|
|
147
|
-
width: 100%;
|
|
148
|
-
position: absolute;
|
|
149
|
-
bottom: 0;
|
|
150
|
-
border-radius: 0px 0px 5px 5px;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
138
|
&.disabled {
|
|
154
139
|
filter: grayscale(1);
|
|
155
140
|
color: var(--muted);
|
|
@@ -24,23 +24,18 @@ export default {
|
|
|
24
24
|
asTextArea: {
|
|
25
25
|
type: Boolean,
|
|
26
26
|
default: false
|
|
27
|
-
}
|
|
28
|
-
showKeyMapBox: {
|
|
29
|
-
type: Boolean,
|
|
30
|
-
default: false
|
|
31
|
-
},
|
|
27
|
+
}
|
|
32
28
|
},
|
|
33
29
|
|
|
34
30
|
data() {
|
|
35
31
|
return {
|
|
36
|
-
codeMirrorRef:
|
|
37
|
-
loaded:
|
|
38
|
-
showKeyMapCloseIcon: false,
|
|
39
|
-
removeKeyMapBox: false,
|
|
32
|
+
codeMirrorRef: null,
|
|
33
|
+
loaded: false
|
|
40
34
|
};
|
|
41
35
|
},
|
|
42
36
|
|
|
43
37
|
computed: {
|
|
38
|
+
|
|
44
39
|
isDisabled() {
|
|
45
40
|
return this.mode === _VIEW;
|
|
46
41
|
},
|
|
@@ -75,10 +70,6 @@ export default {
|
|
|
75
70
|
|
|
76
71
|
return out;
|
|
77
72
|
},
|
|
78
|
-
|
|
79
|
-
keyMapText() {
|
|
80
|
-
return this.combinedOptions?.keyMap ? this.t(`prefs.keymap.${ this.combinedOptions.keyMap }`) : null;
|
|
81
|
-
},
|
|
82
73
|
},
|
|
83
74
|
|
|
84
75
|
created() {
|
|
@@ -133,47 +124,19 @@ export default {
|
|
|
133
124
|
if ( this.$refs.codeMirrorRef ) {
|
|
134
125
|
this.$refs.codeMirrorRef.codemirror.doc.setValue(value);
|
|
135
126
|
}
|
|
136
|
-
},
|
|
137
|
-
|
|
138
|
-
closeKeyMapInfo() {
|
|
139
|
-
this.removeKeyMapBox = true;
|
|
140
|
-
},
|
|
141
|
-
|
|
142
|
-
onKeyMapMouseOver(v) {
|
|
143
|
-
this.showKeyMapCloseIcon = v;
|
|
144
127
|
}
|
|
145
128
|
}
|
|
146
129
|
};
|
|
147
130
|
</script>
|
|
148
131
|
|
|
149
132
|
<template>
|
|
150
|
-
<
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
<div
|
|
156
|
-
v-if="showKeyMapBox && !removeKeyMapBox && keyMapText"
|
|
157
|
-
class="keymap overlay"
|
|
158
|
-
>
|
|
159
|
-
<div
|
|
160
|
-
v-clean-tooltip="t('codeMirror.keymap.tooltip')"
|
|
161
|
-
class="label"
|
|
162
|
-
data-testid="code-mirror-keymap"
|
|
163
|
-
@mouseover="onKeyMapMouseOver(true)"
|
|
164
|
-
@mouseleave="onKeyMapMouseOver(false)"
|
|
165
|
-
>
|
|
166
|
-
<span>
|
|
167
|
-
{{ keyMapText }}
|
|
168
|
-
</span>
|
|
169
|
-
<i
|
|
170
|
-
v-if="showKeyMapCloseIcon"
|
|
171
|
-
class="icon icon-close icon-sm"
|
|
172
|
-
@click="closeKeyMapInfo"
|
|
173
|
-
/>
|
|
174
|
-
</div>
|
|
175
|
-
</div>
|
|
133
|
+
<client-only placeholder=" Loading...">
|
|
134
|
+
<div
|
|
135
|
+
class="code-mirror"
|
|
136
|
+
:class="{['as-text-area']: asTextArea}"
|
|
137
|
+
>
|
|
176
138
|
<codemirror
|
|
139
|
+
v-if="loaded"
|
|
177
140
|
ref="codeMirrorRef"
|
|
178
141
|
:value="value"
|
|
179
142
|
:options="combinedOptions"
|
|
@@ -184,41 +147,17 @@ export default {
|
|
|
184
147
|
@focus="onFocus"
|
|
185
148
|
@blur="onBlur"
|
|
186
149
|
/>
|
|
150
|
+
<div v-else>
|
|
151
|
+
Loading...
|
|
152
|
+
</div>
|
|
187
153
|
</div>
|
|
188
|
-
|
|
189
|
-
Loading...
|
|
190
|
-
</div>
|
|
191
|
-
</div>
|
|
154
|
+
</client-only>
|
|
192
155
|
</template>
|
|
193
156
|
|
|
194
157
|
<style lang="scss">
|
|
195
158
|
.code-mirror {
|
|
196
159
|
z-index: 0;
|
|
197
160
|
|
|
198
|
-
.overlay {
|
|
199
|
-
position: sticky;
|
|
200
|
-
display: grid;
|
|
201
|
-
top: 0;
|
|
202
|
-
float: right;
|
|
203
|
-
height: 0;
|
|
204
|
-
z-index: 1;
|
|
205
|
-
|
|
206
|
-
.label {
|
|
207
|
-
border-radius: 2px;
|
|
208
|
-
border-style: dashed;
|
|
209
|
-
border-width: 0.1px;
|
|
210
|
-
margin: 7px 7px 0 0;
|
|
211
|
-
padding: 7px;
|
|
212
|
-
color: var(--darker);
|
|
213
|
-
background-color: var(--overlay-bg);
|
|
214
|
-
font-size: 12px;
|
|
215
|
-
|
|
216
|
-
.icon {
|
|
217
|
-
cursor: pointer;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
161
|
.vue-codemirror .CodeMirror {
|
|
223
162
|
height: initial;
|
|
224
163
|
background: none
|
|
@@ -311,5 +250,7 @@ export default {
|
|
|
311
250
|
background-color: var(--primary);
|
|
312
251
|
}
|
|
313
252
|
}
|
|
253
|
+
|
|
314
254
|
}
|
|
255
|
+
|
|
315
256
|
</style>
|
package/components/CopyCode.vue
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { isArray } from '@shell/utils/array';
|
|
3
|
-
import { copyTextToClipboard } from '@shell/utils/clipboard';
|
|
4
|
-
import { exceptionToErrorsArray } from '@shell/utils/error';
|
|
5
3
|
|
|
6
4
|
function flatten(node) {
|
|
7
5
|
if ( node.text ) {
|
|
@@ -29,16 +27,14 @@ export default {
|
|
|
29
27
|
|
|
30
28
|
const content = flatten(this.$slots.default).trim();
|
|
31
29
|
|
|
32
|
-
|
|
30
|
+
this.$copyText(content).then(() => {
|
|
33
31
|
this.copied = true;
|
|
34
32
|
|
|
35
33
|
setTimeout(() => {
|
|
36
34
|
this.copied = false;
|
|
37
35
|
}, 2000);
|
|
38
|
-
this.$emit('copied');
|
|
39
|
-
}).catch((e) => {
|
|
40
|
-
this.$emit('error', exceptionToErrorsArray(e));
|
|
41
36
|
});
|
|
37
|
+
this.$emit('copied');
|
|
42
38
|
},
|
|
43
39
|
},
|
|
44
40
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import AsyncButton from '@shell/components/AsyncButton';
|
|
3
|
-
import { copyTextToClipboard } from '@shell/utils/clipboard';
|
|
4
3
|
|
|
5
4
|
export default {
|
|
6
5
|
components: { AsyncButton },
|
|
@@ -19,7 +18,7 @@ export default {
|
|
|
19
18
|
|
|
20
19
|
methods: {
|
|
21
20
|
clicked(buttonCb) {
|
|
22
|
-
|
|
21
|
+
this.$copyText(this.text).then(() => {
|
|
23
22
|
buttonCb(true);
|
|
24
23
|
}).catch(() => {
|
|
25
24
|
buttonCb(false);
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import { copyTextToClipboard } from '@shell/utils/clipboard';
|
|
3
|
-
import { exceptionToErrorsArray } from '@shell/utils/error';
|
|
4
2
|
export default {
|
|
5
3
|
props: {
|
|
6
4
|
text: {
|
|
@@ -22,20 +20,17 @@ export default {
|
|
|
22
20
|
clicked(event) {
|
|
23
21
|
if (!this.copied) {
|
|
24
22
|
event.preventDefault();
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
this.$copyText(this.text);
|
|
24
|
+
this.copied = true;
|
|
27
25
|
|
|
28
|
-
|
|
26
|
+
let t = event.target;
|
|
29
27
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}).catch((e) => {
|
|
37
|
-
this.$emit('error', exceptionToErrorsArray(e));
|
|
38
|
-
});
|
|
28
|
+
if (t.tagName === 'I') {
|
|
29
|
+
t = t.parentElement || t;
|
|
30
|
+
}
|
|
31
|
+
setTimeout(() => {
|
|
32
|
+
this.copied = false;
|
|
33
|
+
}, 500);
|
|
39
34
|
}
|
|
40
35
|
},
|
|
41
36
|
}
|
|
@@ -11,7 +11,7 @@ export default {
|
|
|
11
11
|
const inStore = this.$store.getters['currentProduct'].inStore;
|
|
12
12
|
let monitoringVersion = '';
|
|
13
13
|
|
|
14
|
-
if (this.$store.getters[`${ inStore }/canList`](CATALOG.APP)) {
|
|
14
|
+
if (this.$store.getters[`${ inStore }/canList}`](CATALOG.APP)) {
|
|
15
15
|
try {
|
|
16
16
|
const res = await this.$store.dispatch(`${ inStore }/find`, { type: CATALOG.APP, id: 'cattle-monitoring-system/rancher-monitoring' });
|
|
17
17
|
|
|
@@ -23,13 +23,13 @@ export default {
|
|
|
23
23
|
|
|
24
24
|
const leader = await hasLeader(monitoringVersion, this.$store.dispatch, this.currentCluster.id);
|
|
25
25
|
|
|
26
|
-
this.hasLeader = leader ? '
|
|
26
|
+
this.hasLeader = leader ? this.t('generic.yes') : this.t('generic.no');
|
|
27
27
|
this.leaderChanges = await leaderChanges(monitoringVersion, this.$store.dispatch, this.currentCluster.id);
|
|
28
28
|
this.failedProposals = await failedProposals(monitoringVersion, this.$store.dispatch, this.currentCluster.id);
|
|
29
29
|
},
|
|
30
30
|
data() {
|
|
31
31
|
return {
|
|
32
|
-
hasLeader: '
|
|
32
|
+
hasLeader: this.t('generic.no'),
|
|
33
33
|
leaderChanges: 0,
|
|
34
34
|
failedProposals: 0
|
|
35
35
|
};
|
|
@@ -46,10 +46,10 @@ export default {
|
|
|
46
46
|
color="info"
|
|
47
47
|
>
|
|
48
48
|
<div class="datum">
|
|
49
|
-
<label>{{ t('etcdInfoBanner.hasLeader') }}</label> {{ hasLeader }}
|
|
49
|
+
<label>{{ t('etcdInfoBanner.hasLeader') }}</label> {{ hasLeader }}
|
|
50
50
|
</div>
|
|
51
51
|
<div class="datum">
|
|
52
|
-
<label>{{ t('etcdInfoBanner.leaderChanges') }}</label> {{ leaderChanges }}
|
|
52
|
+
<label>{{ t('etcdInfoBanner.leaderChanges') }}</label> {{ leaderChanges }}
|
|
53
53
|
</div>
|
|
54
54
|
<div class="datum">
|
|
55
55
|
<label>{{ t('etcdInfoBanner.failedProposals') }}</label> {{ failedProposals }}
|
|
@@ -391,7 +391,7 @@ export default {
|
|
|
391
391
|
/>
|
|
392
392
|
<ResourceTable
|
|
393
393
|
ref="table"
|
|
394
|
-
class="table
|
|
394
|
+
class="table"
|
|
395
395
|
v-bind="$attrs"
|
|
396
396
|
:schema="schema"
|
|
397
397
|
:headers="headers"
|
|
@@ -505,10 +505,6 @@ export default {
|
|
|
505
505
|
<style lang="scss" scoped>
|
|
506
506
|
.project-namespaces {
|
|
507
507
|
& ::v-deep {
|
|
508
|
-
.project-namespaces-table table {
|
|
509
|
-
table-layout: fixed;
|
|
510
|
-
}
|
|
511
|
-
|
|
512
508
|
.project-name {
|
|
513
509
|
line-height: 30px;
|
|
514
510
|
}
|
|
@@ -518,26 +514,6 @@ export default {
|
|
|
518
514
|
flex-direction: row;
|
|
519
515
|
justify-content: space-between;
|
|
520
516
|
|
|
521
|
-
.group-tab {
|
|
522
|
-
max-width: calc(100% - 230px);
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
.project-name {
|
|
526
|
-
display: flex;
|
|
527
|
-
flex-direction: row;
|
|
528
|
-
align-items: center;
|
|
529
|
-
|
|
530
|
-
span:first-child {
|
|
531
|
-
padding-right: 8px;
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
span:last-child {
|
|
535
|
-
text-overflow: ellipsis;
|
|
536
|
-
overflow: hidden;
|
|
537
|
-
white-space: nowrap;
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
|
|
541
517
|
&.has-description {
|
|
542
518
|
.right {
|
|
543
519
|
margin-top: 5px;
|
package/components/IconOrSvg.vue
CHANGED
|
@@ -76,7 +76,7 @@ export default {
|
|
|
76
76
|
for (let x = 0; x < Object.keys(stylesheet.cssRules).length; x++) {
|
|
77
77
|
const cssRules = stylesheet.cssRules[x];
|
|
78
78
|
|
|
79
|
-
if (cssRules.selectorText && ((currTheme === 'light' &&
|
|
79
|
+
if (cssRules.selectorText && ((currTheme === 'light' && cssRules.selectorText.includes('body') &&
|
|
80
80
|
cssRules.selectorText.includes('.theme-light') && cssRules.style.cssText.includes('--link:')) ||
|
|
81
81
|
(currTheme === 'dark' && cssRules.selectorText.includes('.theme-dark')))) {
|
|
82
82
|
// grab the colors to be used on the icon from the css rules
|
package/components/Markdown.vue
CHANGED
|
@@ -13,8 +13,9 @@ export default {
|
|
|
13
13
|
|
|
14
14
|
data() {
|
|
15
15
|
return {
|
|
16
|
-
loaded:
|
|
17
|
-
marked:
|
|
16
|
+
loaded: false,
|
|
17
|
+
marked: null,
|
|
18
|
+
dompurify: null,
|
|
18
19
|
};
|
|
19
20
|
},
|
|
20
21
|
|
|
@@ -25,10 +26,15 @@ export default {
|
|
|
25
26
|
breaks: true
|
|
26
27
|
});
|
|
27
28
|
},
|
|
29
|
+
|
|
30
|
+
sanitized() {
|
|
31
|
+
return this.dompurify.sanitize(this.html);
|
|
32
|
+
},
|
|
28
33
|
},
|
|
29
34
|
|
|
30
35
|
async mounted() {
|
|
31
36
|
const marked = (await import(/* webpackChunkName: "markdown" */ 'marked'));
|
|
37
|
+
const dompurify = (await import(/* webpackChunkName: "markdown" */ 'dompurify')).default;
|
|
32
38
|
|
|
33
39
|
const renderer = new marked.Renderer();
|
|
34
40
|
const linkRenderer = renderer.link;
|
|
@@ -57,8 +63,11 @@ export default {
|
|
|
57
63
|
return rendered;
|
|
58
64
|
};
|
|
59
65
|
|
|
66
|
+
dompurify.setConfig({ ADD_ATTR: ['target'] });
|
|
67
|
+
|
|
60
68
|
this.marked = marked;
|
|
61
69
|
this.markedRenderer = renderer;
|
|
70
|
+
this.dompurify = dompurify;
|
|
62
71
|
this.loaded = true;
|
|
63
72
|
this.$emit('loaded', true);
|
|
64
73
|
}
|
|
@@ -68,7 +77,7 @@ export default {
|
|
|
68
77
|
<template>
|
|
69
78
|
<div
|
|
70
79
|
v-if="loaded"
|
|
71
|
-
v-clean-html="
|
|
80
|
+
v-clean-html="sanitized"
|
|
72
81
|
class="markdown"
|
|
73
82
|
/>
|
|
74
83
|
<Loading v-else />
|
|
@@ -87,20 +96,8 @@ export default {
|
|
|
87
96
|
}
|
|
88
97
|
|
|
89
98
|
.markdown {
|
|
90
|
-
blockquote {
|
|
91
|
-
color: rgb(101, 109, 118);
|
|
92
|
-
border-left: 0.25em solid rgb(208, 215, 222);
|
|
93
|
-
padding: 0 1em;
|
|
94
|
-
margin-bottom: 16px;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
table {
|
|
98
|
-
border-collapse: collapse;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
99
|
TH {
|
|
102
100
|
text-align: left;
|
|
103
|
-
border: 1px solid #e3e7eb;
|
|
104
101
|
}
|
|
105
102
|
|
|
106
103
|
table tr th {
|
|
@@ -121,7 +118,6 @@ export default {
|
|
|
121
118
|
text-align: left;
|
|
122
119
|
margin: 0;
|
|
123
120
|
padding: 6px 13px;
|
|
124
|
-
border: 1px solid #e3e7eb;
|
|
125
121
|
}
|
|
126
122
|
|
|
127
123
|
table tr th :first-child, table tr td :first-child {
|