\n\n\n\n","import mod from \"-!../../../../../../cache-loader/dist/cjs.js??ref--16-0!../../../../../../babel-loader/lib/index.js??ref--16-1!../../../../../../cache-loader/dist/cjs.js??ref--1-0!../../../../../../@vue/cli-service/node_modules/vue-loader/lib/index.js??vue-loader-options!./DefaultLinksEditor.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../../../../cache-loader/dist/cjs.js??ref--16-0!../../../../../../babel-loader/lib/index.js??ref--16-1!../../../../../../cache-loader/dist/cjs.js??ref--1-0!../../../../../../@vue/cli-service/node_modules/vue-loader/lib/index.js??vue-loader-options!./DefaultLinksEditor.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./DefaultLinksEditor.vue?vue&type=template&id=7daac88d&scoped=true&\"\nimport script from \"./DefaultLinksEditor.vue?vue&type=script&lang=js&\"\nexport * from \"./DefaultLinksEditor.vue?vue&type=script&lang=js&\"\nimport style0 from \"./DefaultLinksEditor.vue?vue&type=style&index=0&id=7daac88d&prod&lang=scss&scoped=true&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../../../@vue/cli-service/node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"7daac88d\",\n null\n \n)\n\nexport default component.exports","import { DOCS_BASE } from '@shell/config/private-label';\nimport { MANAGEMENT } from '@shell/config/types';\nimport { SETTING } from '@shell/config/settings';\nimport { allHash } from '@shell/utils/promise';\n\nconst DEFAULT_LINKS = [\n {\n key: 'docs',\n value: DOCS_BASE,\n enabled: true,\n },\n {\n key: 'forums',\n value: 'https://forums.rancher.com/',\n enabled: true,\n },\n {\n key: 'slack',\n value: 'https://slack.rancher.io/',\n enabled: true,\n },\n {\n key: 'issues',\n value: 'https://github.com/rancher/dashboard/issues/new/choose',\n enabled: true,\n },\n {\n key: 'getStarted',\n value: 'https://ranchermanager.docs.rancher.com/getting-started/overview',\n enabled: true,\n },\n];\n\nconst SUPPORT_LINK = {\n key: 'commercialSupport',\n value: '/support',\n enabled: true,\n readonly: true\n};\n\nconst CN_FORUMS_LINK = {\n key: 'cnforums',\n value: 'https://forums.rancher.cn/',\n enabled: true,\n};\n\n// We add a version attribute to the setting so we know what has been migrated and which version of the setting we have\nexport const CUSTOM_LINKS_VERSION = 'v1';\n\n// Fetch the settings required for the links, taking into account legacy settings if we have not migrated\nexport async function fetchLinks(store, hasSupport, isSupportPage, t) {\n let uiLinks = {};\n\n try {\n const uiLinksSetting = await store.dispatch('management/find', { type: MANAGEMENT.SETTING, id: SETTING.UI_CUSTOM_LINKS });\n\n // Don't try and parse empty string\n if (uiLinksSetting.value) {\n uiLinks = JSON.parse(uiLinksSetting.value);\n }\n } catch (e) {\n console.warn('Could not parse custom link settings', e); // eslint-disable-line no-console\n }\n\n // If uiLinks is set and has the correct version, then we are okay, otherwise we need to migrate from the old settings\n if (uiLinks?.version === CUSTOM_LINKS_VERSION) {\n // Map out the default settings, as we only store keys of the ones to show\n if (uiLinks.defaults) {\n const defaults = [...DEFAULT_LINKS];\n\n // Map the link name stored to the default link, if it exists\n defaults.forEach((link) => {\n const enabled = uiLinks.defaults.find((linkName) => linkName === link.key);\n\n link.enabled = !!enabled;\n });\n\n uiLinks.defaults = defaults;\n }\n\n return ensureSupportLink(uiLinks, hasSupport, isSupportPage, t, store);\n }\n\n // No new setting, so return the required structure\n // We don't migrate here, as we may not have permissions to create the setting\n const links = {\n version: CUSTOM_LINKS_VERSION,\n defaults: [...DEFAULT_LINKS],\n custom: []\n };\n\n // There are two legacy settings:\n // SETTING.ISSUES - can specify a custom link to use for 'File an issue'\n // SETTING.COMMUNITY_LINKS - can specify whether to hide all of the default links (other than 'File an issue')\n try {\n const { uiIssuesSetting, uiCommunitySetting } = await allHash({\n uiIssuesSetting: store.dispatch('management/find', { type: MANAGEMENT.SETTING, id: SETTING.ISSUES }),\n uiCommunitySetting: store.dispatch('management/find', { type: MANAGEMENT.SETTING, id: SETTING.COMMUNITY_LINKS })\n });\n\n // Should we show the default set of links?\n if (uiCommunitySetting?.value === 'false') {\n // Hide all of the default links\n links.defaults.forEach((link) => (link.enabled = false));\n }\n\n // Do we have a custom 'File an issue' link ?\n if (uiIssuesSetting?.value) {\n links.custom.push({\n label: t ? t('customLinks.defaults.issues') : 'Issues',\n value: uiIssuesSetting.value\n });\n\n // Hide the default 'File an issue' link\n const issueLink = links.defaults?.find((link) => link.key === 'issues');\n\n if (issueLink) {\n issueLink.enabled = false;\n issueLink.readOnly = true;\n }\n }\n } catch (e) {\n console.warn('Could not parse legacy link settings', e); // eslint-disable-line no-console\n }\n\n return ensureSupportLink(links, hasSupport, isSupportPage, t, store);\n}\n\n// Ensure the support link is added if needed\nexport function ensureSupportLink(links, hasSupport, isSupportPage, t, store) {\n if (!hasSupport && !isSupportPage) {\n const supportLink = links.defaults?.find((link) => link.key === 'commercialSupport');\n\n if (!supportLink) {\n links.defaults.push(SUPPORT_LINK);\n }\n }\n\n const selectedLocaleLabel = store.getters['i18n/selectedLocaleLabel'];\n\n if (selectedLocaleLabel === t('locale.zh-hans')) {\n links.defaults.push(CN_FORUMS_LINK);\n }\n\n // Localise the default links\n links.defaults = links.defaults.map((link) => {\n return {\n ...link,\n label: t(`'customLinks.defaults.${ link.key }`)\n };\n });\n\n // Ensure that if any custom links have the same name as a default link, we use the custom link\n const customNamesMap = links.custom.reduce((linkMap, link) => {\n linkMap[link.label] = link;\n\n return linkMap;\n }, {});\n\n // If any custom links have the same name as a default link, then hide and mark readonly the default link\n // Main use case if the 'File an Issue' link when migrating the old settings\n links.defaults.forEach((link) => {\n if (customNamesMap[link.label]) {\n link.enabled = false;\n link.readonly = true;\n }\n });\n\n return links;\n}\n","// style-loader: Adds some css to the DOM by adding a \n","import mod from \"-!../../../../../../cache-loader/dist/cjs.js??ref--16-0!../../../../../../babel-loader/lib/index.js??ref--16-1!../../../../../../cache-loader/dist/cjs.js??ref--1-0!../../../../../../@vue/cli-service/node_modules/vue-loader/lib/index.js??vue-loader-options!./links.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../../../../cache-loader/dist/cjs.js??ref--16-0!../../../../../../babel-loader/lib/index.js??ref--16-1!../../../../../../cache-loader/dist/cjs.js??ref--1-0!../../../../../../@vue/cli-service/node_modules/vue-loader/lib/index.js??vue-loader-options!./links.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./links.vue?vue&type=template&id=123ad2f4&scoped=true&\"\nimport script from \"./links.vue?vue&type=script&lang=js&\"\nexport * from \"./links.vue?vue&type=script&lang=js&\"\nimport style0 from \"./links.vue?vue&type=style&index=0&id=123ad2f4&prod&scoped=true&lang=scss&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../../../@vue/cli-service/node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"123ad2f4\",\n null\n \n)\n\nexport default component.exports","// style-loader: Adds some css to the DOM by adding a