@rancher/shell 0.3.3 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/styles/app.scss +1 -1
- package/assets/styles/fonts/_fontstack.scss +11 -11
- package/assets/styles/vendor/vue-js-modal.scss +3 -3
- package/assets/translations/en-us.yaml +92 -22
- package/assets/translations/zh-hans.yaml +84 -15
- package/babel.config.js +13 -0
- package/chart/gatekeeper.vue +77 -0
- package/chart/istio.vue +108 -111
- package/chart/logging/index.vue +13 -4
- package/chart/monitoring/index.vue +15 -5
- package/chart/monitoring/steps/uninstall-v1.vue +2 -2
- package/chart/rancher-backup/index.vue +10 -3
- package/cloud-credential/aws.vue +1 -1
- package/cloud-credential/digitalocean.vue +1 -1
- package/cloud-credential/gcp.vue +1 -1
- package/cloud-credential/generic.vue +2 -2
- package/cloud-credential/linode.vue +1 -1
- package/cloud-credential/pnap.vue +1 -1
- package/components/ActionMenu.vue +3 -4
- package/components/AssignTo.vue +1 -1
- package/components/AsyncButton.vue +1 -1
- package/components/BannerGraphic.vue +1 -1
- package/components/ButtonDropdown.vue +2 -3
- package/components/ChartPsp.vue +76 -0
- package/components/CruResource.vue +6 -2
- package/components/DashboardMetrics.vue +12 -10
- package/components/DetailText.vue +1 -1
- package/components/DisableAuthProviderModal.vue +1 -1
- package/components/EmberPage.vue +1 -1
- package/components/EtcdInfoBanner.vue +5 -4
- package/components/ExplorerMembers.vue +1 -1
- package/components/ExplorerProjectsNamespaces.vue +15 -2
- package/components/FileDiff.vue +6 -7
- package/components/GrafanaDashboard.vue +18 -21
- package/components/LazyImage.vue +10 -12
- package/components/LogItem.vue +1 -1
- package/components/Markdown.vue +1 -1
- package/components/PromptRemove.vue +2 -2
- package/components/PromptRestore.vue +1 -1
- package/components/ResourceDetail/Masthead.vue +16 -0
- package/components/ResourceDetail/index.vue +21 -4
- package/components/ResourceList/index.vue +1 -1
- package/components/ResourceTable.vue +4 -1
- package/components/SingleClusterInfo.vue +2 -2
- package/components/SortableTable/THead.vue +1 -1
- package/components/SortableTable/index.vue +5 -2
- package/components/__tests__/AsyncButton.test.ts +3 -1
- package/components/__tests__/ChartPsp.test.ts +75 -0
- package/components/__tests__/CruResource.test.ts +3 -1
- package/components/auth/Principal.vue +1 -1
- package/components/fleet/FleetBundles.vue +3 -1
- package/components/fleet/FleetClusters.vue +1 -2
- package/components/fleet/FleetIntro.vue +9 -1
- package/components/fleet/FleetNoWorkspaces.vue +62 -0
- package/components/fleet/FleetSummary.vue +7 -1
- package/components/form/LabeledSelect.vue +14 -11
- package/components/form/MatchExpressions.vue +17 -2
- package/components/form/NameNsDescription.vue +31 -45
- package/components/form/ResourceSelector.vue +1 -1
- package/components/form/SecretSelector.vue +5 -1
- package/components/form/ServiceNameSelect.vue +1 -1
- package/components/form/SimpleSecretSelector.vue +9 -9
- package/components/form/__tests__/LabeledSelect.test.ts +138 -0
- package/components/form/__tests__/NameNsDescription.ts +32 -0
- package/components/formatter/InternalExternalIP.vue +6 -0
- package/components/formatter/InvolvedObjectLink.vue +54 -0
- package/components/formatter/Link.vue +20 -4
- package/components/formatter/LinkName.vue +6 -1
- package/components/formatter/ServiceTargets.vue +1 -1
- package/components/nav/Group.vue +2 -2
- package/components/nav/NamespaceFilter.vue +15 -11
- package/components/nav/TopLevelMenu.vue +2 -4
- package/components/nav/Type.vue +1 -1
- package/components/nav/WorkspaceSwitcher.vue +46 -5
- package/config/labels-annotations.js +17 -0
- package/config/product/auth.js +3 -2
- package/config/product/explorer.js +11 -4
- package/config/product/fleet.js +2 -0
- package/config/router.js +414 -0
- package/config/table-headers.js +10 -2
- package/config/types.js +11 -8
- package/config/uiplugins.js +30 -0
- package/content/docs/en-us/whats-new.md +10 -0
- package/content/docs/zh-hans/whats-new.md +11 -1
- package/core/plugin-helpers.js +64 -61
- package/core/plugin-routes.ts +23 -0
- package/creators/app/app.package.json +2 -1
- package/creators/app/files/.eslintrc.js +1 -1
- package/creators/app/files/babel.config.js +1 -18
- package/creators/app/files/vue.config.js +7 -0
- package/creators/app/init +5 -5
- package/creators/pkg/files/.github/workflows/build-extension.yml +111 -0
- package/creators/pkg/init +35 -4
- package/creators/update/init +1 -1
- package/detail/constraints.gatekeeper.sh.constraint.vue +20 -10
- package/detail/fleet.cattle.io.gitrepo.vue +19 -11
- package/detail/harvesterhci.io.management.cluster.vue +3 -3
- package/detail/provisioning.cattle.io.cluster.vue +54 -12
- package/detail/workload/index.vue +3 -3
- package/dialog/AddClusterMemberDialog.vue +1 -1
- package/dialog/AddProjectMemberDialog.vue +2 -2
- package/dialog/AddonConfigConfirmationDialog.vue +27 -15
- package/dialog/DiagnosticTimingsDialog.vue +1 -1
- package/dialog/ForceMachineRemoveDialog.vue +1 -1
- package/dialog/GenericPrompt.vue +18 -6
- package/dialog/RotateEncryptionKeyDialog.vue +1 -1
- package/dialog/SaveAsRKETemplateDialog.vue +1 -1
- package/dialog/ScaleMachineDownDialog.vue +1 -1
- package/edit/auth/github.vue +8 -8
- package/edit/auth/googleoauth.vue +5 -5
- package/edit/auth/ldap/index.vue +1 -1
- package/edit/auth/oidc.vue +1 -1
- package/edit/auth/saml.vue +1 -1
- package/edit/cis.cattle.io.clusterscan.vue +1 -1
- package/edit/fleet.cattle.io.clustergroup.vue +6 -4
- package/edit/fleet.cattle.io.gitrepo.vue +16 -3
- package/edit/helm.cattle.io.projecthelmchart.vue +5 -1
- package/edit/management.cattle.io.fleetworkspace.vue +141 -6
- package/edit/management.cattle.io.podsecurityadmissionconfigurationtemplate.vue +4 -1
- package/edit/management.cattle.io.setting.vue +1 -1
- package/edit/monitoring.coreos.com.alertmanagerconfig/types/webhook.vue +2 -2
- package/edit/monitoring.coreos.com.receiver/tls.vue +18 -18
- package/edit/monitoring.coreos.com.receiver/types/webhook.banner.vue +4 -4
- package/edit/monitoring.coreos.com.receiver/types/webhook.vue +1 -1
- package/edit/namespace.vue +2 -2
- package/edit/networking.k8s.io.networkpolicy/PolicyRuleTarget.vue +126 -45
- package/edit/networking.k8s.io.networkpolicy/index.vue +1 -1
- package/edit/provisioning.cattle.io.cluster/MachinePool.vue +10 -0
- package/edit/provisioning.cattle.io.cluster/RegistryConfigs.vue +1 -0
- package/edit/provisioning.cattle.io.cluster/__tests__/rke2.test.ts +202 -2
- package/edit/provisioning.cattle.io.cluster/rke2.vue +248 -84
- package/edit/resources.cattle.io.backup.vue +1 -1
- package/edit/service.vue +1 -1
- package/edit/storage.k8s.io.storageclass/provisioners/driver.harvesterhci.io.vue +2 -2
- package/edit/workload/__tests__/Job.test.ts +3 -1
- package/edit/workload/index.vue +8 -3
- package/edit/workload/mixins/workload.js +16 -0
- package/layouts/default.vue +7 -3
- package/list/fleet.cattle.io.bundle.vue +6 -3
- package/list/fleet.cattle.io.clusterregistrationtoken.vue +3 -1
- package/list/fleet.cattle.io.gitrepo.vue +44 -5
- package/list/management.cattle.io.fleetworkspace.vue +45 -0
- package/list/node.vue +69 -16
- package/list/provisioning.cattle.io.cluster.vue +30 -1
- package/machine-config/azure.vue +97 -38
- package/middleware/authenticated.js +34 -0
- package/mixins/chart.js +73 -2
- package/mixins/resource-fetch.js +2 -2
- package/models/apps.statefulset.js +28 -0
- package/models/cluster/node.js +23 -2
- package/models/cluster.x-k8s.io.machine.js +4 -2
- package/models/clusterroletemplatebinding.js +7 -0
- package/models/constraints.gatekeeper.sh.constraint.js +9 -0
- package/models/fleet.cattle.io.cluster.js +19 -10
- package/models/fleet.cattle.io.gitrepo.js +7 -2
- package/models/management.cattle.io.cluster.js +1 -1
- package/models/management.cattle.io.fleetworkspace.js +12 -0
- package/models/management.cattle.io.gitreporestriction.js +5 -0
- package/models/management.cattle.io.podsecurityadmissionconfigurationtemplate.js +3 -0
- package/models/namespace.js +5 -5
- package/models/provisioning.cattle.io.cluster.js +7 -5
- package/nuxt/App.js +210 -0
- package/nuxt/axios.js +186 -0
- package/nuxt/client.js +817 -0
- package/nuxt/components/nuxt-build-indicator.vue +143 -0
- package/nuxt/components/nuxt-child.js +122 -0
- package/nuxt/components/nuxt-error.vue +98 -0
- package/nuxt/components/nuxt-link.client.js +98 -0
- package/nuxt/components/nuxt-link.server.js +16 -0
- package/nuxt/components/nuxt-loading.vue +154 -0
- package/nuxt/components/nuxt.js +101 -0
- package/nuxt/cookie-universal-nuxt.js +9 -0
- package/nuxt/empty.js +1 -0
- package/nuxt/index.js +365 -0
- package/nuxt/jsonp.js +82 -0
- package/nuxt/loading.html +39 -0
- package/nuxt/middleware.js +12 -0
- package/nuxt/mixins/fetch.client.js +90 -0
- package/nuxt/mixins/fetch.server.js +69 -0
- package/nuxt/portal-vue.js +4 -0
- package/nuxt/server.js +312 -0
- package/nuxt/store.js +178 -0
- package/nuxt/utils.js +630 -0
- package/nuxt/views/app.template.html +9 -0
- package/nuxt/views/error.html +23 -0
- package/package.json +5 -9
- package/pages/auth/setup.vue +2 -2
- package/pages/c/_cluster/apps/charts/__tests__/install.helper.test.ts +33 -0
- package/pages/c/_cluster/apps/charts/chart.vue +4 -4
- package/pages/c/_cluster/apps/charts/install.helpers.js +26 -0
- package/pages/c/_cluster/apps/charts/install.vue +40 -66
- package/pages/c/_cluster/explorer/EventsTable.vue +5 -19
- package/pages/c/_cluster/explorer/index.vue +29 -25
- package/pages/c/_cluster/explorer/tools/index.vue +8 -8
- package/pages/c/_cluster/fleet/index.vue +95 -34
- package/pages/c/_cluster/gatekeeper/index.vue +1 -1
- package/pages/c/_cluster/istio/index.vue +5 -5
- package/pages/c/_cluster/manager/cloudCredential/index.vue +1 -1
- package/pages/c/_cluster/monitoring/index.vue +7 -0
- package/pages/c/_cluster/uiplugins/InstallDialog.vue +8 -8
- package/pages/c/_cluster/uiplugins/PluginInfoPanel.vue +20 -7
- package/pages/c/_cluster/uiplugins/index.vue +49 -17
- package/pages/home.vue +9 -4
- package/pages/index.vue +10 -1
- package/plugins/clean-html-directive.js +31 -0
- package/plugins/dashboard-store/actions.js +32 -9
- package/plugins/dashboard-store/mutations.js +5 -2
- package/plugins/dashboard-store/resource-class.js +8 -1
- package/plugins/steve/mutations.js +3 -2
- package/plugins/steve/steve-description-class.js +5 -1
- package/plugins/steve/subscribe.js +63 -54
- package/plugins/steve-create-worker.js +14 -0
- package/promptRemove/management.cattle.io.globalrole.vue +2 -2
- package/promptRemove/management.cattle.io.project.vue +2 -2
- package/promptRemove/management.cattle.io.roletemplate.vue +2 -2
- package/promptRemove/pod.vue +1 -1
- package/public/index.html +65 -0
- package/rancher-components/components/Banner/Banner.test.ts +9 -1
- package/rancher-components/components/Banner/Banner.vue +1 -1
- package/rancher-components/components/Form/Checkbox/Checkbox.vue +2 -0
- package/rancher-components/components/Form/Radio/RadioButton.vue +1 -1
- package/scripts/build-pkg.sh +1 -0
- package/scripts/clean +6 -0
- package/scripts/extension/bundle +58 -0
- package/scripts/extension/helmpatch +89 -0
- package/scripts/extension/publish +314 -0
- package/scripts/test-plugins-build.sh +4 -0
- package/store/__tests__/index.test.ts +110 -0
- package/store/index.js +145 -58
- package/store/type-map.js +26 -19
- package/tsconfig.default.json +36 -0
- package/tsconfig.json +24 -0
- package/types/shell/index.d.ts +420 -343
- package/utils/__tests__/string.test.ts +12 -0
- package/utils/auth.js +65 -0
- package/utils/monitoring.js +2 -1
- package/utils/position.js +5 -8
- package/utils/router.scrollBehavior.js +80 -0
- package/utils/select.js +1 -3
- package/utils/socket.js +1 -0
- package/utils/string.js +13 -0
- package/utils/time.js +9 -0
- package/vue.config.js +679 -0
- package/yarn-error.log +196 -0
- package/chart/rancher-alerting-drivers.vue +0 -53
- package/chart/rancher-gatekeeper.vue +0 -37
- package/creators/app/files/nuxt.config.js +0 -6
- package/models/management.cattle.io.podsecurityadmissionconfigurationtemplate.ts +0 -4
- package/nuxt.config.js +0 -798
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { decodeHtml } from '@shell/utils/string';
|
|
2
|
+
|
|
3
|
+
describe('fx: decodeHtml', () => {
|
|
4
|
+
it('should decode HTML values from escaped string into valid markup', () => {
|
|
5
|
+
const text = '<i>whatever</i>';
|
|
6
|
+
const expectation = `<i>whatever</i>`;
|
|
7
|
+
|
|
8
|
+
const result = decodeHtml(text);
|
|
9
|
+
|
|
10
|
+
expect(result).toStrictEqual(expectation);
|
|
11
|
+
});
|
|
12
|
+
});
|
package/utils/auth.js
CHANGED
|
@@ -2,6 +2,7 @@ import { Popup, popupWindowOptions } from '@shell/utils/window';
|
|
|
2
2
|
import { parse as parseUrl, addParam } from '@shell/utils/url';
|
|
3
3
|
import { BACK_TO, SPA, _EDIT, _FLAGGED } from '@shell/config/query-params';
|
|
4
4
|
import { MANAGEMENT } from '@shell/config/types';
|
|
5
|
+
import { allHash } from '@shell/utils/promise';
|
|
5
6
|
|
|
6
7
|
export function openAuthPopup(url, provider) {
|
|
7
8
|
const popup = new Popup(() => {
|
|
@@ -79,3 +80,67 @@ export const authProvidersInfo = async(store) => {
|
|
|
79
80
|
enabled
|
|
80
81
|
};
|
|
81
82
|
};
|
|
83
|
+
|
|
84
|
+
export const checkSchemasForFindAllHash = (types, store) => {
|
|
85
|
+
const hash = {};
|
|
86
|
+
|
|
87
|
+
for (const [key, value] of Object.entries(types)) {
|
|
88
|
+
const schema = store.getters[`${ value.inStoreType }/schemaFor`](value.type);
|
|
89
|
+
|
|
90
|
+
// It could be that user has permissions for GET but not list
|
|
91
|
+
// e.g. Standard user with GitRepo permissions try to fetch list of fleetworkspaces
|
|
92
|
+
// user has ability to GET but not fleet workspaces
|
|
93
|
+
// so optionally define a function that require it to pass before /findAll
|
|
94
|
+
const validSchema = value.schemaValidator ? value.schemaValidator(schema) : !!schema;
|
|
95
|
+
|
|
96
|
+
if (validSchema) {
|
|
97
|
+
hash[key] = store.dispatch(`${ value.inStoreType }/findAll`, { type: value.type } );
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return allHash(hash);
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export const checkPermissions = (types, getters) => {
|
|
105
|
+
const hash = {};
|
|
106
|
+
|
|
107
|
+
for (const [key, value] of Object.entries(types)) {
|
|
108
|
+
const schema = getters['management/schemaFor'](value.type);
|
|
109
|
+
|
|
110
|
+
if (!schema) {
|
|
111
|
+
hash[key] = false;
|
|
112
|
+
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// It could be that user has permissions for GET but not list
|
|
117
|
+
// e.g. Standard user with GitRepo permissions try to fetch list of fleetworkspaces
|
|
118
|
+
// user has ability to GET but not fleet workspaces
|
|
119
|
+
// so optionally define a function that require it to pass before /findAll
|
|
120
|
+
if (value.schemaValidator) {
|
|
121
|
+
hash[key] = value.schemaValidator(schema);
|
|
122
|
+
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (value.resourceMethods && schema) {
|
|
127
|
+
hash[key] = value.resourceMethods.every((method) => {
|
|
128
|
+
return (schema.resourceMethods || []).includes(method);
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (value.collectionMethods && schema) {
|
|
135
|
+
hash[key] = value.collectionMethods.every((method) => {
|
|
136
|
+
return (schema.collectionMethods || []).includes(method);
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
hash[key] = !!schema;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return allHash(hash);
|
|
146
|
+
};
|
package/utils/monitoring.js
CHANGED
|
@@ -26,9 +26,10 @@ export function haveV2Monitoring(getters) {
|
|
|
26
26
|
if (haveV1Monitoring(getters)) {
|
|
27
27
|
return false;
|
|
28
28
|
}
|
|
29
|
+
const inStore = getters['getStoreNameByProductId'];
|
|
29
30
|
|
|
30
31
|
// Just check for the pod monitors CRD
|
|
31
|
-
const schemas = getters[
|
|
32
|
+
const schemas = getters[`${ inStore }/all`](SCHEMA);
|
|
32
33
|
const exists = findBy(schemas, 'id', normalizeType(MONITORING.PODMONITOR));
|
|
33
34
|
|
|
34
35
|
return !!exists;
|
package/utils/position.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// @TODO replace this with popper.js...
|
|
2
|
-
import $ from 'jquery';
|
|
3
2
|
|
|
4
3
|
export const LEFT = 'left';
|
|
5
4
|
export const RIGHT = 'right';
|
|
@@ -10,10 +9,9 @@ export const BOTTOM = 'bottom';
|
|
|
10
9
|
export const AUTO = 'auto';
|
|
11
10
|
|
|
12
11
|
export function boundingRect(elem) {
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const height = $elem.outerHeight(false);
|
|
12
|
+
const pos = elem.getBoundingClientRect();
|
|
13
|
+
const width = elem.offsetWidth;
|
|
14
|
+
const height = elem.offsetHeight;
|
|
17
15
|
|
|
18
16
|
return {
|
|
19
17
|
top: pos.top,
|
|
@@ -37,9 +35,8 @@ export function fakeRectFor(event) {
|
|
|
37
35
|
}
|
|
38
36
|
|
|
39
37
|
export function screenRect() {
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
const height = $window.height();
|
|
38
|
+
const width = window.innerWidth;
|
|
39
|
+
const height = window.innerHeight;
|
|
43
40
|
const top = window.pageYOffset;
|
|
44
41
|
const left = window.pageXOffset;
|
|
45
42
|
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { getMatchedComponents, setScrollRestoration } from '../nuxt/utils';
|
|
2
|
+
|
|
3
|
+
if (process.client) {
|
|
4
|
+
if ('scrollRestoration' in window.history) {
|
|
5
|
+
setScrollRestoration('manual');
|
|
6
|
+
|
|
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
|
+
});
|
|
13
|
+
|
|
14
|
+
// Setting scrollRestoration to manual again when returning to this page.
|
|
15
|
+
window.addEventListener('load', () => {
|
|
16
|
+
setScrollRestoration('manual');
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function shouldScrollToTop(route) {
|
|
22
|
+
const Pages = getMatchedComponents(route);
|
|
23
|
+
|
|
24
|
+
if (Pages.length === 1) {
|
|
25
|
+
const { options = {} } = Pages[0];
|
|
26
|
+
|
|
27
|
+
return options.scrollToTop !== false;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return Pages.some(({ options }) => options && options.scrollToTop);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export default function(to, from, savedPosition) {
|
|
34
|
+
// If the returned position is falsy or an empty object, will retain current scroll position
|
|
35
|
+
let position = false;
|
|
36
|
+
const isRouteChanged = to !== from;
|
|
37
|
+
|
|
38
|
+
// savedPosition is only available for popstate navigations (back button)
|
|
39
|
+
if (savedPosition) {
|
|
40
|
+
position = savedPosition;
|
|
41
|
+
} else if (isRouteChanged && shouldScrollToTop(to)) {
|
|
42
|
+
position = { x: 0, y: 0 };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const nuxt = window.$nuxt;
|
|
46
|
+
|
|
47
|
+
if (
|
|
48
|
+
// Initial load (vuejs/vue-router#3199)
|
|
49
|
+
!isRouteChanged ||
|
|
50
|
+
// Route hash changes
|
|
51
|
+
(to.path === from.path && to.hash !== from.hash)
|
|
52
|
+
) {
|
|
53
|
+
nuxt.$nextTick(() => nuxt.$emit('triggerScroll'));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return new Promise((resolve) => {
|
|
57
|
+
// wait for the out transition to complete (if necessary)
|
|
58
|
+
nuxt.$once('triggerScroll', () => {
|
|
59
|
+
// coords will be used if no selector is provided,
|
|
60
|
+
// or if the selector didn't match any element.
|
|
61
|
+
if (to.hash) {
|
|
62
|
+
let hash = to.hash;
|
|
63
|
+
|
|
64
|
+
// CSS.escape() is not supported with IE and Edge.
|
|
65
|
+
if (typeof window.CSS !== 'undefined' && typeof window.CSS.escape !== 'undefined') {
|
|
66
|
+
hash = `#${ window.CSS.escape(hash.substr(1)) }`;
|
|
67
|
+
}
|
|
68
|
+
try {
|
|
69
|
+
if (document.querySelector(hash)) {
|
|
70
|
+
// scroll to anchor by returning the selector
|
|
71
|
+
position = { selector: hash };
|
|
72
|
+
}
|
|
73
|
+
} catch (e) {
|
|
74
|
+
console.warn('Failed to save scroll position. Please add CSS.escape() polyfill (https://github.com/mathiasbynens/CSS.escape).'); // eslint-disable-line no-console
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
resolve(position);
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
}
|
package/utils/select.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import $ from 'jquery';
|
|
2
|
-
|
|
3
1
|
export function onClickOption(option, e) {
|
|
4
2
|
if (!this.$attrs.multiple) {
|
|
5
3
|
return;
|
|
@@ -29,7 +27,7 @@ export function onClickOption(option, e) {
|
|
|
29
27
|
// We used to use popper for these, but it does not suppotr fractional pixel placements which
|
|
30
28
|
// means the dropdown does not appear aligned to the control when placed in a column-based layout
|
|
31
29
|
export function calculatePosition(dropdownList, component, width, placement) {
|
|
32
|
-
const selectEl =
|
|
30
|
+
const selectEl = component.$parent.$el;
|
|
33
31
|
const r = selectEl.getBoundingClientRect();
|
|
34
32
|
const p = placement || 'bottom-start';
|
|
35
33
|
const docHeight = document.body.offsetHeight;
|
package/utils/socket.js
CHANGED
package/utils/string.js
CHANGED
|
@@ -60,6 +60,19 @@ export function escapeHtml(html) {
|
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Return HTML markup from escaped HTML string, allowing specific tags
|
|
65
|
+
* @param text string
|
|
66
|
+
* @returns string
|
|
67
|
+
*/
|
|
68
|
+
export function decodeHtml(text) {
|
|
69
|
+
const div = document.createElement('div');
|
|
70
|
+
|
|
71
|
+
div.innerHTML = text;
|
|
72
|
+
|
|
73
|
+
return div.textContent || div.innerText || '';
|
|
74
|
+
}
|
|
75
|
+
|
|
63
76
|
export function escapeRegex(string) {
|
|
64
77
|
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
|
|
65
78
|
}
|
package/utils/time.js
CHANGED
|
@@ -97,6 +97,15 @@ export function elapsedTime(seconds) {
|
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
const days = Math.floor(seconds / (3600 * 24));
|
|
101
|
+
|
|
102
|
+
if (days > 1) {
|
|
103
|
+
return {
|
|
104
|
+
diff: 60,
|
|
105
|
+
label: `${ days }d${ hours - (days * 24) }h`,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
100
109
|
if (hours > 7) {
|
|
101
110
|
return {
|
|
102
111
|
diff: 60,
|