@rancher/shell 0.5.2 → 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 +77 -71
- 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/CodeMirror.vue +21 -19
- 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/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/ResourceList/Masthead.vue +18 -1
- package/components/ResourceTable.vue +2 -14
- package/components/ResourceYaml.vue +0 -5
- package/components/SideNav.vue +1 -1
- package/components/SortableTable/THead.vue +9 -7
- package/components/SortableTable/index.vue +3 -2
- package/components/StatusTable.vue +1 -5
- package/components/TabTitle.vue +84 -0
- package/components/Tabbed/index.vue +0 -12
- 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/KeyValue.vue +0 -1
- 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/__tests__/ClusterProvider.test.ts +28 -0
- package/components/nav/Group.vue +2 -2
- package/components/nav/Header.vue +2 -1
- package/components/nav/TopLevelMenu.vue +3 -29
- package/components/nav/Type.vue +3 -1
- 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 +0 -33
- package/components/nav/__tests__/Type.test.ts +1 -1
- 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.cluster.vue +1 -11
- package/detail/node.vue +0 -42
- package/detail/pod.vue +1 -68
- package/detail/provisioning.cattle.io.cluster.vue +4 -6
- 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 -31
- 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} +126 -109
- package/edit/provisioning.cattle.io.cluster/{tabs/MachinePool.vue → MachinePool.vue} +7 -1
- package/edit/provisioning.cattle.io.cluster/{tabs/registries/RegistryConfigs.vue → RegistryConfigs.vue} +3 -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 +37 -99
- package/edit/provisioning.cattle.io.cluster/rke2.vue +690 -181
- package/edit/service.vue +0 -12
- 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/management.cattle.io.feature.vue +7 -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/amazonec2.vue +1 -0
- 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 +8 -55
- package/models/secret.js +18 -117
- 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 -0
- package/pages/c/_cluster/settings/banners.vue +2 -0
- package/pages/c/_cluster/settings/brand.vue +2 -0
- 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/AddExtensionRepos.vue +4 -4
- 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/SetupUIPlugins.vue +5 -2
- package/pages/c/_cluster/uiplugins/__tests__/AddExtensionRepos.test.ts +96 -0
- package/pages/c/_cluster/uiplugins/__tests__/SetupUIPlugins.test.ts +128 -0
- 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__/actions.spec.ts +250 -0
- package/plugins/dashboard-store/__tests__/{mutations.test.ts → mutations.spec.ts} +1 -1
- package/plugins/dashboard-store/actions.js +21 -22
- package/plugins/dashboard-store/classify.js +18 -1
- package/plugins/dashboard-store/getters.js +5 -10
- package/plugins/dashboard-store/index.js +12 -0
- package/plugins/dashboard-store/mutations.js +4 -0
- package/plugins/dashboard-store/resource-class.js +18 -59
- package/plugins/i18n.js +1 -1
- package/plugins/steve/__tests__/getters.spec.ts +56 -24
- package/plugins/steve/__tests__/subscribe.spec.ts +106 -0
- package/plugins/steve/getters.js +30 -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 +11 -8
- package/store/prefs.js +38 -33
- package/store/type-map.js +8 -13
- package/tsconfig.default.json +46 -0
- package/tsconfig.json +9 -35
- package/types/shell/index.d.ts +404 -463
- package/utils/__tests__/create-yaml.test.ts +10 -0
- package/utils/axios.js +19 -0
- package/utils/create-yaml.js +6 -6
- 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 -14
- 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/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/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/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 -144
- 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 -90
- package/models/__tests__/workload.test.ts +0 -91
- package/plugins/clean-html.js +0 -53
- package/plugins/dashboard-store/__tests__/actions.test.ts +0 -165
- 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__/steve-class.spec.ts +0 -59
- package/plugins/steve/__tests__/utils/steve-mocks.ts +0 -31
- package/scripts/.gitlab/workflows/build-extension-catalog.gitlab-ci.yml +0 -50
- package/server/har-file.js +0 -183
- 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/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__/{getters.test.ts → getters.spec.ts} +0 -0
- /package/rancher-components/BadgeState/{BadgeState.spec.ts → BadgeState.test.ts} +0 -0
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
getBlockDescriptor,
|
|
3
3
|
dumpBlock,
|
|
4
4
|
} from '@shell/utils/create-yaml';
|
|
5
|
+
import jsyaml from 'js-yaml';
|
|
5
6
|
|
|
6
7
|
const key = 'example';
|
|
7
8
|
const randomData = '\n foo\n bar\n';
|
|
@@ -61,6 +62,15 @@ describe('fx: dumpBlock', () => {
|
|
|
61
62
|
});
|
|
62
63
|
});
|
|
63
64
|
|
|
65
|
+
it('should not create a data block when the value of a key is not a string', () => {
|
|
66
|
+
const data = { key: { test: 'test' } };
|
|
67
|
+
|
|
68
|
+
const expectedResult = jsyaml.dump(data);
|
|
69
|
+
const result = dumpBlock(data);
|
|
70
|
+
|
|
71
|
+
expect(result).toStrictEqual(expectedResult);
|
|
72
|
+
});
|
|
73
|
+
|
|
64
74
|
it('should retain line breaks when a line longer than 80 characters exists', () => {
|
|
65
75
|
const data = {
|
|
66
76
|
'managerApiConfiguration.properties': `# Sample XPlanManagerAPI Configuration (if this comment is longer than 80 characters, the output should remain the same)
|
package/utils/axios.js
CHANGED
|
@@ -75,6 +75,10 @@ const createAxiosInstance = (axiosOptions) => {
|
|
|
75
75
|
};
|
|
76
76
|
|
|
77
77
|
const setupProgress = (axios) => {
|
|
78
|
+
if (process.server) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
78
82
|
// A noop loading inteterface for when $nuxt is not yet ready
|
|
79
83
|
const noopLoading = {
|
|
80
84
|
finish: () => { },
|
|
@@ -163,6 +167,21 @@ export default (ctx, inject) => {
|
|
|
163
167
|
headers
|
|
164
168
|
};
|
|
165
169
|
|
|
170
|
+
// Proxy SSR request headers headers
|
|
171
|
+
if (process.server && ctx.req && ctx.req.headers) {
|
|
172
|
+
const reqHeaders = { ...ctx.req.headers };
|
|
173
|
+
|
|
174
|
+
for (const h of ['accept', 'host', 'cf-ray', 'cf-connecting-ip', 'content-length', 'content-md5', 'content-type']) {
|
|
175
|
+
delete reqHeaders[h];
|
|
176
|
+
}
|
|
177
|
+
axiosOptions.headers.common = { ...reqHeaders, ...axiosOptions.headers.common };
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (process.server) {
|
|
181
|
+
// Don't accept brotli encoding because Node can't parse it
|
|
182
|
+
axiosOptions.headers.common['accept-encoding'] = 'gzip, deflate';
|
|
183
|
+
}
|
|
184
|
+
|
|
166
185
|
const axios = createAxiosInstance(axiosOptions);
|
|
167
186
|
|
|
168
187
|
// Inject axios to the context as $axios
|
package/utils/create-yaml.js
CHANGED
|
@@ -32,6 +32,7 @@ const ALWAYS_ADD = [
|
|
|
32
32
|
];
|
|
33
33
|
|
|
34
34
|
export const NEVER_ADD = [
|
|
35
|
+
'metadata.clusterName',
|
|
35
36
|
'metadata.clusterName',
|
|
36
37
|
'metadata.creationTimestamp',
|
|
37
38
|
'metadata.deletionGracePeriodSeconds',
|
|
@@ -45,16 +46,11 @@ export const NEVER_ADD = [
|
|
|
45
46
|
'metadata.resourceVersion',
|
|
46
47
|
'metadata.relationships',
|
|
47
48
|
'metadata.selfLink',
|
|
48
|
-
'metadata.state',
|
|
49
49
|
'metadata.uid',
|
|
50
50
|
// CRD -> Schema describes the schema used for validation, pruning, and defaulting of this version of the custom resource. If we allow processing we fall into inf loop on openAPIV3Schema.allOf which contains a cyclical ref of allOf props.
|
|
51
51
|
'spec.versions.schema',
|
|
52
52
|
'status',
|
|
53
53
|
'stringData',
|
|
54
|
-
'links',
|
|
55
|
-
'_name',
|
|
56
|
-
'_labels',
|
|
57
|
-
'_annotations',
|
|
58
54
|
];
|
|
59
55
|
|
|
60
56
|
export const ACTIVELY_REMOVE = [
|
|
@@ -465,7 +461,11 @@ export function dumpBlock(data, options = {}) {
|
|
|
465
461
|
|
|
466
462
|
let out = parsed;
|
|
467
463
|
|
|
468
|
-
const blockFields = Object.keys(data).filter((k) =>
|
|
464
|
+
const blockFields = Object.keys(data).filter((k) => {
|
|
465
|
+
if (typeof data[k] === 'string') {
|
|
466
|
+
return data[k].includes('\n');
|
|
467
|
+
}
|
|
468
|
+
});
|
|
469
469
|
|
|
470
470
|
if (blockFields.length) {
|
|
471
471
|
for (const key of blockFields) {
|
|
@@ -8,6 +8,7 @@ import { cronSchedule } from '@shell/utils/validators/cron-schedule';
|
|
|
8
8
|
import { podAffinity } from '@shell/utils/validators/pod-affinity';
|
|
9
9
|
import { roleTemplateRules } from '@shell/utils/validators/role-template';
|
|
10
10
|
import { clusterName } from '@shell/utils/validators/cluster-name';
|
|
11
|
+
import { isHttps } from '@shell/utils/validators/setting';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Custom validation functions beyond normal scalr types
|
|
@@ -29,4 +30,5 @@ export default {
|
|
|
29
30
|
cronSchedule,
|
|
30
31
|
podAffinity,
|
|
31
32
|
roleTemplateRules,
|
|
33
|
+
isHttps,
|
|
32
34
|
};
|
package/utils/error.js
CHANGED
|
@@ -1,24 +1,9 @@
|
|
|
1
1
|
import { isArray } from '@shell/utils/array';
|
|
2
2
|
|
|
3
3
|
export class ClusterNotFoundError extends Error {
|
|
4
|
-
static name = 'ClusterNotFoundError'
|
|
5
|
-
|
|
6
4
|
constructor(message) {
|
|
7
5
|
super(message);
|
|
8
|
-
this.name = ClusterNotFoundError
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* An error occurred and the user should be redirected to a certain location (where this is handled)
|
|
14
|
-
*/
|
|
15
|
-
export class RedirectToError extends Error {
|
|
16
|
-
static name = 'RedirectToError'
|
|
17
|
-
|
|
18
|
-
constructor(message, url) {
|
|
19
|
-
super(message);
|
|
20
|
-
this.url = url;
|
|
21
|
-
this.name = RedirectToError.name;
|
|
6
|
+
this.name = 'ClusterNotFoundError';
|
|
22
7
|
}
|
|
23
8
|
}
|
|
24
9
|
|
package/utils/monitoring.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Helpers for determining if V2 or v1 Monitoring are installed
|
|
2
2
|
|
|
3
|
-
import { SCHEMA, MONITORING,
|
|
3
|
+
import { SCHEMA, MONITORING, ENDPOINTS } from '@shell/config/types';
|
|
4
4
|
import { normalizeType } from '@shell/plugins/dashboard-store/normalize';
|
|
5
5
|
import { findBy } from '@shell/utils/array';
|
|
6
6
|
import { isEmpty } from '@shell/utils/object';
|
|
@@ -9,10 +9,7 @@ import { isEmpty } from '@shell/utils/object';
|
|
|
9
9
|
export function monitoringStatus() {
|
|
10
10
|
return {
|
|
11
11
|
monitoringStatus() {
|
|
12
|
-
const status = {
|
|
13
|
-
v1: haveV1Monitoring(this.$store.getters),
|
|
14
|
-
v2: haveV2Monitoring(this.$store.getters),
|
|
15
|
-
};
|
|
12
|
+
const status = { v2: haveV2Monitoring(this.$store.getters) };
|
|
16
13
|
|
|
17
14
|
status.installed = status.v1 || status.v2;
|
|
18
15
|
|
|
@@ -22,10 +19,6 @@ export function monitoringStatus() {
|
|
|
22
19
|
}
|
|
23
20
|
|
|
24
21
|
export function haveV2Monitoring(getters) {
|
|
25
|
-
// Can't have V2 and V1 monitoring installed, so if V1 is installed we know v2 is not
|
|
26
|
-
if (haveV1Monitoring(getters)) {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
22
|
const inStore = getters['getStoreNameByProductId'];
|
|
30
23
|
|
|
31
24
|
// Just check for the pod monitors CRD
|
|
@@ -35,36 +28,8 @@ export function haveV2Monitoring(getters) {
|
|
|
35
28
|
return !!exists;
|
|
36
29
|
}
|
|
37
30
|
|
|
38
|
-
// For v1 Monitoring, the cluster object indicates presence via status.monitoringStatus
|
|
39
|
-
export function haveV1Monitoring(getters) {
|
|
40
|
-
const cluster = getters['currentCluster'];
|
|
41
|
-
|
|
42
|
-
return !!cluster?.status?.monitoringStatus;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
31
|
export const CATTLE_MONITORING_NAMESPACE = 'cattle-monitoring-system';
|
|
46
32
|
|
|
47
|
-
export async function haveV1MonitoringWorkloads(store) {
|
|
48
|
-
const workloadsByType = await Promise.all(
|
|
49
|
-
Object.values(WORKLOAD_TYPES).map((type) => store.dispatch('cluster/findAll', { type })
|
|
50
|
-
)
|
|
51
|
-
);
|
|
52
|
-
const workloads = workloadsByType.flat();
|
|
53
|
-
|
|
54
|
-
for (let i = 0; i < workloads.length; i++) {
|
|
55
|
-
const workload = workloads[i];
|
|
56
|
-
|
|
57
|
-
if (!isEmpty(workload?.spec?.template?.spec?.containers) &&
|
|
58
|
-
workload.spec.template.spec.containers.find((c) => c.image?.includes('quay.io/coreos/prometheus-operator') ||
|
|
59
|
-
c.image?.includes('rancher/coreos-prometheus-operator')) &&
|
|
60
|
-
workload?.metadata?.namespace !== CATTLE_MONITORING_NAMESPACE) {
|
|
61
|
-
return Promise.resolve(true);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return Promise.resolve(false);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
33
|
async function hasEndpointSubsets(store, id) {
|
|
69
34
|
if (store.getters['cluster/schemaFor'](ENDPOINTS)) {
|
|
70
35
|
const endpoints = await store.dispatch('cluster/findAll', { type: ENDPOINTS }) || [];
|
package/utils/nuxt.js
CHANGED
|
@@ -5,10 +5,12 @@ import {
|
|
|
5
5
|
|
|
6
6
|
// window.{{globals.loadedCallback}} hook
|
|
7
7
|
// Useful for jsdom testing or plugins (https://github.com/tmpvar/jsdom#dealing-with-asynchronous-script-loading)
|
|
8
|
-
|
|
9
|
-
window.
|
|
10
|
-
window.
|
|
11
|
-
|
|
8
|
+
if (process.client) {
|
|
9
|
+
window.onNuxtReadyCbs = [];
|
|
10
|
+
window.onNuxtReady = (cb) => {
|
|
11
|
+
window.onNuxtReadyCbs.push(cb);
|
|
12
|
+
};
|
|
13
|
+
}
|
|
12
14
|
|
|
13
15
|
export function createGetCounter(counterObject, defaultKey = '') {
|
|
14
16
|
return function getCounter(id = defaultKey) {
|
|
@@ -90,6 +92,10 @@ export function applyAsyncData(Component, asyncData) {
|
|
|
90
92
|
Component.options.data = function() {
|
|
91
93
|
const data = ComponentData.call(this, this);
|
|
92
94
|
|
|
95
|
+
if (this.$ssrContext) {
|
|
96
|
+
asyncData = this.$ssrContext.asyncData[Component.cid];
|
|
97
|
+
}
|
|
98
|
+
|
|
93
99
|
return { ...data, ...asyncData };
|
|
94
100
|
};
|
|
95
101
|
|
|
@@ -204,14 +210,15 @@ export async function setContext(app, context) {
|
|
|
204
210
|
// If context not defined, create it
|
|
205
211
|
if (!app.context) {
|
|
206
212
|
app.context = {
|
|
207
|
-
|
|
208
|
-
|
|
213
|
+
isStatic: process.static,
|
|
214
|
+
isDev: true,
|
|
215
|
+
isHMR: false,
|
|
209
216
|
app,
|
|
210
|
-
store:
|
|
211
|
-
payload:
|
|
212
|
-
error:
|
|
213
|
-
base:
|
|
214
|
-
env:
|
|
217
|
+
store: app.store,
|
|
218
|
+
payload: context.payload,
|
|
219
|
+
error: context.error,
|
|
220
|
+
base: app.router.options.base,
|
|
221
|
+
env: {
|
|
215
222
|
commit: 'head', version: '0.1.2', dev: true, pl: 1, perfTest: false, rancherEnv: 'web', api: 'http://localhost:8989'
|
|
216
223
|
}
|
|
217
224
|
};
|
|
@@ -224,6 +231,9 @@ export async function setContext(app, context) {
|
|
|
224
231
|
app.context.res = context.res;
|
|
225
232
|
}
|
|
226
233
|
|
|
234
|
+
if (context.ssrContext) {
|
|
235
|
+
app.context.ssrContext = context.ssrContext;
|
|
236
|
+
}
|
|
227
237
|
app.context.redirect = (status, path, query) => {
|
|
228
238
|
if (!status) {
|
|
229
239
|
return;
|
|
@@ -250,16 +260,27 @@ export async function setContext(app, context) {
|
|
|
250
260
|
});
|
|
251
261
|
} else {
|
|
252
262
|
path = withQuery(path, query);
|
|
263
|
+
if (process.server) {
|
|
264
|
+
app.context.next({
|
|
265
|
+
path,
|
|
266
|
+
status
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
if (process.client) {
|
|
270
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Location/replace
|
|
271
|
+
window.location.replace(path);
|
|
253
272
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
// Throw a redirect error
|
|
258
|
-
throw new Error('ERR_REDIRECT');
|
|
273
|
+
// Throw a redirect error
|
|
274
|
+
throw new Error('ERR_REDIRECT');
|
|
275
|
+
}
|
|
259
276
|
}
|
|
260
277
|
};
|
|
261
|
-
|
|
262
|
-
|
|
278
|
+
if (process.server) {
|
|
279
|
+
app.context.beforeNuxtRender = (fn) => context.beforeRenderFns.push(fn);
|
|
280
|
+
}
|
|
281
|
+
if (process.client) {
|
|
282
|
+
app.context.nuxtState = window.__NUXT__;
|
|
283
|
+
}
|
|
263
284
|
}
|
|
264
285
|
|
|
265
286
|
// Dynamic keys
|
package/utils/object.js
CHANGED
|
@@ -110,20 +110,6 @@ export function remove(obj, path) {
|
|
|
110
110
|
return obj;
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
/**
|
|
114
|
-
* `delete` a property at the given path.
|
|
115
|
-
*
|
|
116
|
-
* This is similar to `remove` but doesn't need any fancy kube obj path splitting
|
|
117
|
-
* and doesn't use `Vue.set` (avoids reactivity)
|
|
118
|
-
*/
|
|
119
|
-
export function deleteProperty(obj, path) {
|
|
120
|
-
const pathAr = path.split('.');
|
|
121
|
-
const propToDelete = pathAr.pop();
|
|
122
|
-
|
|
123
|
-
// Walk down path until final prop, then delete final prop
|
|
124
|
-
delete pathAr.reduce((o, k) => o[k] || {}, obj)[propToDelete];
|
|
125
|
-
}
|
|
126
|
-
|
|
127
113
|
export function getter(path) {
|
|
128
114
|
return function(obj) {
|
|
129
115
|
return get(obj, path);
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import { getMatchedComponents, setScrollRestoration } from './nuxt';
|
|
2
2
|
|
|
3
|
-
if (
|
|
4
|
-
|
|
3
|
+
if (process.client) {
|
|
4
|
+
if ('scrollRestoration' in window.history) {
|
|
5
|
+
setScrollRestoration('manual');
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
// reset scrollRestoration to auto when leaving page, allowing page reload
|
|
8
|
+
// and back-navigation from other pages to use the browser to restore the
|
|
9
|
+
// scrolling position.
|
|
10
|
+
window.addEventListener('beforeunload', () => {
|
|
11
|
+
setScrollRestoration('auto');
|
|
12
|
+
});
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
// Setting scrollRestoration to manual again when returning to this page.
|
|
15
|
+
window.addEventListener('load', () => {
|
|
16
|
+
setScrollRestoration('manual');
|
|
17
|
+
});
|
|
18
|
+
}
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
function shouldScrollToTop(route) {
|
package/utils/socket.js
CHANGED
|
@@ -27,6 +27,7 @@ export const EVENT_DISCONNECT_ERROR = 'disconnect_error';
|
|
|
27
27
|
|
|
28
28
|
export const NO_WATCH = 'NO_WATCH';
|
|
29
29
|
export const NO_SCHEMA = 'NO_SCHEMA';
|
|
30
|
+
export const NO_PERMS = 'NO_PERMS';
|
|
30
31
|
export const REVISION_TOO_OLD = 'TOO_OLD';
|
|
31
32
|
|
|
32
33
|
export default class Socket extends EventTarget {
|
package/utils/time.js
CHANGED
package/utils/title.ts
ADDED
package/utils/url.ts
CHANGED
|
@@ -43,66 +43,21 @@ describe('formRules', () => {
|
|
|
43
43
|
expect(formRuleResult).toStrictEqual(expectedResult);
|
|
44
44
|
});
|
|
45
45
|
|
|
46
|
-
it('"
|
|
46
|
+
it('"isHttps" : returns undefined when valid https url value is supplied', () => {
|
|
47
47
|
const testValue = 'https://url.com';
|
|
48
|
-
const formRuleResult = formRules.
|
|
48
|
+
const formRuleResult = formRules.isHttps('server-url')(testValue);
|
|
49
49
|
|
|
50
50
|
expect(formRuleResult).toBeUndefined();
|
|
51
51
|
});
|
|
52
52
|
|
|
53
|
-
it('"
|
|
53
|
+
it('"isHttps" : returns correct message when http url value is supplied', () => {
|
|
54
54
|
const testValue = 'http://url.com';
|
|
55
|
-
const formRuleResult = formRules.
|
|
55
|
+
const formRuleResult = formRules.isHttps('server-url')(testValue);
|
|
56
56
|
const expectedResult = JSON.stringify({ message: 'validation.setting.serverUrl.https' });
|
|
57
57
|
|
|
58
58
|
expect(formRuleResult).toStrictEqual(expectedResult);
|
|
59
59
|
});
|
|
60
60
|
|
|
61
|
-
describe('localhost', () => {
|
|
62
|
-
const message = JSON.stringify({ message: 'validation.setting.serverUrl.localhost' });
|
|
63
|
-
const testCases = [
|
|
64
|
-
['http://LOCALhosT:8005', message],
|
|
65
|
-
['http://localhost:8005', message],
|
|
66
|
-
['https://localhost:8005', message],
|
|
67
|
-
['localhost', message],
|
|
68
|
-
['http://127.0.0.1', message],
|
|
69
|
-
['https://127.0.0.1', message],
|
|
70
|
-
['127.0.0.1', message],
|
|
71
|
-
['https://test.com', undefined],
|
|
72
|
-
['https://test.com/localhost', undefined],
|
|
73
|
-
[undefined, undefined]
|
|
74
|
-
];
|
|
75
|
-
|
|
76
|
-
it.each(testCases)(
|
|
77
|
-
'should return undefined or correct message based on the provided url',
|
|
78
|
-
(url, expected) => {
|
|
79
|
-
const formRuleResult = formRules.localhost(url);
|
|
80
|
-
|
|
81
|
-
expect(formRuleResult).toStrictEqual(expected);
|
|
82
|
-
}
|
|
83
|
-
);
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
describe('trailingForwardSlash', () => {
|
|
87
|
-
const message = JSON.stringify({ message: 'validation.setting.serverUrl.trailingForwardSlash' });
|
|
88
|
-
const testCases = [
|
|
89
|
-
['https://test.com', undefined],
|
|
90
|
-
['https://test.com/', message],
|
|
91
|
-
['https://', undefined],
|
|
92
|
-
['/', undefined],
|
|
93
|
-
[undefined, undefined]
|
|
94
|
-
];
|
|
95
|
-
|
|
96
|
-
it.each(testCases)(
|
|
97
|
-
'should return undefined or correct message based on the provided url',
|
|
98
|
-
(url, expected) => {
|
|
99
|
-
const formRuleResult = formRules.trailingForwardSlash(url);
|
|
100
|
-
|
|
101
|
-
expect(formRuleResult).toStrictEqual(expected);
|
|
102
|
-
}
|
|
103
|
-
);
|
|
104
|
-
});
|
|
105
|
-
|
|
106
61
|
it('"interval" : returns undefined when valid hour interval value is supplied', () => {
|
|
107
62
|
const testValue = '5h';
|
|
108
63
|
const formRuleResult = formRules.interval(testValue);
|
|
@@ -2,11 +2,9 @@ import { RBAC } from '@shell/config/types';
|
|
|
2
2
|
import { HCI } from '@shell/config/labels-annotations';
|
|
3
3
|
import isEmpty from 'lodash/isEmpty';
|
|
4
4
|
import has from 'lodash/has';
|
|
5
|
-
import isUrl from 'is-url';
|
|
6
5
|
// import uniq from 'lodash/uniq';
|
|
7
6
|
import cronstrue from 'cronstrue';
|
|
8
7
|
import { Translation } from '@shell/types/t';
|
|
9
|
-
import { isHttps, isLocalhost, hasTrailingForwardSlash } from '@shell/utils/validators/setting';
|
|
10
8
|
|
|
11
9
|
// import uniq from 'lodash/uniq';
|
|
12
10
|
export type Validator<T = undefined | string> = (val: any, arg?: any) => T;
|
|
@@ -36,6 +34,10 @@ export class Port {
|
|
|
36
34
|
}
|
|
37
35
|
}
|
|
38
36
|
|
|
37
|
+
const httpsKeys = [
|
|
38
|
+
'server-url'
|
|
39
|
+
];
|
|
40
|
+
|
|
39
41
|
const runValidators = (val: any, validators: Validator[]) => {
|
|
40
42
|
for (const validator of validators) {
|
|
41
43
|
const message = validator(val);
|
|
@@ -137,13 +139,11 @@ export default function(t: Translation, { key = 'Value' }: ValidationOptions): {
|
|
|
137
139
|
}
|
|
138
140
|
};
|
|
139
141
|
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
const localhost: Validator = (val: string) => isLocalhost(val) ? t('validation.setting.serverUrl.localhost') : undefined;
|
|
142
|
+
const isHttps: ValidatorFactory = (key: string) => {
|
|
143
|
+
const isHttps: Validator = (val: string) => httpsKeys.includes(key) && !val.toLowerCase().startsWith('https://') ? t('validation.setting.serverUrl.https') : undefined;
|
|
143
144
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
const url: Validator = (val: string) => val && !isUrl(val) ? t('validation.setting.serverUrl.url') : undefined;
|
|
145
|
+
return isHttps;
|
|
146
|
+
};
|
|
147
147
|
|
|
148
148
|
const interval: Validator = (val: string) => !/^\d+[hms]$/.test(val) ? t('validation.monitoring.route.interval', { key }) : undefined;
|
|
149
149
|
|
|
@@ -475,10 +475,7 @@ export default function(t: Translation, { key = 'Value' }: ValidationOptions): {
|
|
|
475
475
|
hostname,
|
|
476
476
|
imageUrl,
|
|
477
477
|
interval,
|
|
478
|
-
|
|
479
|
-
localhost,
|
|
480
|
-
trailingForwardSlash,
|
|
481
|
-
url,
|
|
478
|
+
isHttps,
|
|
482
479
|
matching,
|
|
483
480
|
maxLength,
|
|
484
481
|
maxValue,
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
const httpsKeys = [
|
|
2
|
+
'server-url'
|
|
3
|
+
];
|
|
2
4
|
|
|
3
|
-
export
|
|
5
|
+
export function isHttps(value, getters, errors, validatorArgs, displayKey) {
|
|
6
|
+
const key = validatorArgs[0];
|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
if (httpsKeys.includes(key) && !value.toLowerCase().startsWith('https://')) {
|
|
9
|
+
errors.push(getters['i18n/t']('validation.setting.serverUrl.https'));
|
|
10
|
+
}
|
|
6
11
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export const hasTrailingForwardSlash = (value) => isUrl(value) && value?.toLowerCase().endsWith('/');
|
|
12
|
+
return errors;
|
|
13
|
+
}
|
package/vue.config.js
CHANGED
|
@@ -6,7 +6,6 @@ const { generateDynamicTypeImport } = require('./pkg/auto-import');
|
|
|
6
6
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
7
7
|
const serverMiddlewares = require('./server/server-middleware.js');
|
|
8
8
|
const configHelper = require('./vue-config-helper.js');
|
|
9
|
-
const har = require('./server/har-file');
|
|
10
9
|
|
|
11
10
|
// Suppress info level logging messages from http-proxy-middleware
|
|
12
11
|
// This hides all of the "[HPM Proxy created] ..." messages
|
|
@@ -292,14 +291,6 @@ module.exports = function(dir, _appConfig) {
|
|
|
292
291
|
'/engines-dist': configHelper.proxyOpts('https://127.0.0.1:8000'),
|
|
293
292
|
};
|
|
294
293
|
|
|
295
|
-
// HAR File support - load network responses from the specified .har file and use those rather than communicating to the Rancher server
|
|
296
|
-
const harFile = process.env.HAR_FILE;
|
|
297
|
-
let harData;
|
|
298
|
-
|
|
299
|
-
if (harFile) {
|
|
300
|
-
harData = har.loadFile(harFile, devPorts ? 8005 : 80, ''); // eslint-disable-line no-console
|
|
301
|
-
}
|
|
302
|
-
|
|
303
294
|
const config = {
|
|
304
295
|
// Vue server
|
|
305
296
|
devServer: {
|
|
@@ -322,19 +313,6 @@ module.exports = function(dir, _appConfig) {
|
|
|
322
313
|
|
|
323
314
|
app.use(serverMiddlewares);
|
|
324
315
|
|
|
325
|
-
if (harData) {
|
|
326
|
-
console.log('Installing HAR file middleware'); // eslint-disable-line no-console
|
|
327
|
-
app.use(har.harProxy(harData, process.env.HAR_DIR));
|
|
328
|
-
|
|
329
|
-
server.websocketProxies.push({
|
|
330
|
-
upgrade(req, socket, head) {
|
|
331
|
-
const responseHeaders = ['HTTP/1.1 101 Web Socket Protocol Handshake', 'Upgrade: WebSocket', 'Connection: Upgrade'];
|
|
332
|
-
|
|
333
|
-
socket.write(`${ responseHeaders.join('\r\n') }\r\n\r\n`);
|
|
334
|
-
}
|
|
335
|
-
});
|
|
336
|
-
}
|
|
337
|
-
|
|
338
316
|
Object.keys(proxy).forEach((p) => {
|
|
339
317
|
const px = createProxyMiddleware({
|
|
340
318
|
...proxy[p],
|
|
@@ -400,7 +378,7 @@ module.exports = function(dir, _appConfig) {
|
|
|
400
378
|
config.resolve.alias['@pkg'] = path.join(dir, 'pkg');
|
|
401
379
|
config.resolve.alias['./node_modules'] = path.join(dir, 'node_modules');
|
|
402
380
|
config.resolve.alias['@components'] = COMPONENTS_DIR;
|
|
403
|
-
config.resolve.alias['vue$'] =
|
|
381
|
+
config.resolve.alias['vue$'] = path.resolve(process.cwd(), 'node_modules', 'vue', 'dist', dev ? 'vue.js' : 'vue.min.js');
|
|
404
382
|
config.resolve.modules.push(__dirname);
|
|
405
383
|
config.plugins.push(virtualModules);
|
|
406
384
|
config.plugins.push(autoImport);
|
|
@@ -409,6 +387,7 @@ module.exports = function(dir, _appConfig) {
|
|
|
409
387
|
// DefinePlugin does string replacement within our code. We may want to consider replacing it with something else. In code we'll see something like
|
|
410
388
|
// process.env.commit even though process and env aren't even defined objects. This could cause people to be mislead.
|
|
411
389
|
config.plugins.push(new webpack.DefinePlugin({
|
|
390
|
+
'process.client': JSON.stringify(true),
|
|
412
391
|
'process.env.commit': JSON.stringify(commit),
|
|
413
392
|
'process.env.version': JSON.stringify(dashboardVersion),
|
|
414
393
|
'process.env.dev': JSON.stringify(dev),
|
|
@@ -565,7 +544,7 @@ module.exports = function(dir, _appConfig) {
|
|
|
565
544
|
options: { mode: ['body'] }
|
|
566
545
|
}
|
|
567
546
|
]
|
|
568
|
-
}
|
|
547
|
+
}
|
|
569
548
|
];
|
|
570
549
|
|
|
571
550
|
config.module.rules.push(...loaders);
|