@rancher/shell 0.3.10 → 0.3.12

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.
Files changed (96) hide show
  1. package/assets/translations/en-us.yaml +51 -5
  2. package/chart/monitoring/StorageClassSelector.vue +1 -0
  3. package/chart/monitoring/index.vue +4 -0
  4. package/chart/monitoring/prometheus/index.vue +6 -3
  5. package/components/ActionMenu.vue +1 -1
  6. package/components/DetailText.vue +1 -0
  7. package/components/DetailTop.vue +0 -2
  8. package/components/ExplorerMembers.vue +22 -10
  9. package/components/ExplorerProjectsNamespaces.vue +1 -0
  10. package/components/GrafanaDashboard.vue +2 -2
  11. package/components/Inactivity.vue +1 -0
  12. package/components/ModalWithCard.vue +1 -0
  13. package/components/ResourceList/index.vue +1 -1
  14. package/components/SortableTable/THead.vue +1 -0
  15. package/components/Tabbed/index.vue +2 -0
  16. package/components/Wizard.vue +4 -3
  17. package/components/form/ChangePassword.vue +3 -0
  18. package/components/form/KeyValue.vue +12 -7
  19. package/components/form/NodeAffinity.vue +29 -7
  20. package/components/form/PodAffinity.vue +27 -7
  21. package/components/form/Taints.vue +6 -0
  22. package/components/formatter/ExtensionCache.vue +74 -0
  23. package/components/nav/Header.vue +1 -0
  24. package/components/nav/WindowManager/ContainerShell.vue +10 -0
  25. package/components/nav/WindowManager/index.vue +1 -0
  26. package/config/product/explorer.js +1 -10
  27. package/config/product/monitoring.js +2 -1
  28. package/config/router.js +3 -3
  29. package/config/table-headers.js +32 -24
  30. package/config/uiplugins.js +11 -0
  31. package/config/workload.ts +1 -0
  32. package/core/types.ts +25 -7
  33. package/creators/pkg/files/.github/workflows/build-container.yml +64 -0
  34. package/creators/pkg/init +13 -6
  35. package/detail/helm.cattle.io.projecthelmchart.vue +2 -2
  36. package/detail/node.vue +2 -2
  37. package/detail/workload/index.vue +1 -1
  38. package/edit/__tests__/management.cattle.io.setting.test.ts +1 -1
  39. package/edit/autoscaling.horizontalpodautoscaler/metric-target.vue +0 -2
  40. package/edit/logging.banzaicloud.io.output/__tests__/logging.banzaicloud.io.output.test.ts +43 -0
  41. package/edit/logging.banzaicloud.io.output/index.vue +8 -5
  42. package/edit/logging.banzaicloud.io.output/providers/__tests__/loki.test.ts +13 -0
  43. package/edit/logging.banzaicloud.io.output/providers/loki.vue +1 -0
  44. package/edit/monitoring.coreos.com.alertmanagerconfig/receiverConfig.vue +0 -2
  45. package/edit/monitoring.coreos.com.receiver/index.vue +32 -1
  46. package/edit/monitoring.coreos.com.receiver/types/email.vue +12 -4
  47. package/edit/namespace.vue +1 -0
  48. package/edit/provisioning.cattle.io.cluster/MachinePool.vue +36 -6
  49. package/edit/provisioning.cattle.io.cluster/__tests__/rke2.test.ts +2 -2
  50. package/edit/provisioning.cattle.io.cluster/rke2.vue +58 -13
  51. package/edit/token.vue +1 -0
  52. package/middleware/authenticated.js +1 -0
  53. package/models/__tests__/batch.cronjob.test.ts +88 -0
  54. package/models/cluster/node.js +8 -0
  55. package/models/management.cattle.io.clusterroletemplatebinding.js +5 -1
  56. package/models/projectroletemplatebinding.js +9 -1
  57. package/models/workload.js +1 -1
  58. package/package.json +1 -1
  59. package/pages/__tests__/prefs.test.ts +96 -0
  60. package/pages/account/index.vue +3 -0
  61. package/pages/auth/setup.vue +13 -13
  62. package/pages/c/_cluster/apps/charts/chart.vue +1 -1
  63. package/pages/c/_cluster/apps/charts/install.vue +5 -2
  64. package/pages/c/_cluster/monitoring/index.vue +10 -5
  65. package/pages/c/_cluster/settings/performance.vue +2 -0
  66. package/pages/c/_cluster/uiplugins/CatalogList/CatalogLoadDialog.vue +601 -0
  67. package/pages/c/_cluster/uiplugins/CatalogList/index.vue +183 -0
  68. package/pages/c/_cluster/uiplugins/UninstallDialog.vue +50 -9
  69. package/pages/c/_cluster/uiplugins/index.vue +329 -224
  70. package/pages/fail-whale.vue +1 -1
  71. package/pages/home.vue +11 -0
  72. package/pages/prefs.vue +20 -1
  73. package/plugins/plugin.js +1 -1
  74. package/plugins/steve/subscribe.js +34 -7
  75. package/plugins/steve/worker/index.js +4 -3
  76. package/public/index.html +6 -1
  77. package/rancher-components/components/Card/Card.vue +1 -0
  78. package/rancher-components/components/Form/Radio/RadioGroup.vue +1 -0
  79. package/scripts/extension/bundle +20 -4
  80. package/scripts/extension/helm/charts/ui-plugin-server/.helmignore +23 -0
  81. package/scripts/extension/helm/charts/ui-plugin-server/Chart.yaml +20 -0
  82. package/scripts/extension/helm/charts/ui-plugin-server/templates/_helpers.tpl +52 -0
  83. package/scripts/extension/helm/charts/ui-plugin-server/templates/cr.yaml +12 -0
  84. package/scripts/extension/helm/charts/ui-plugin-server/values.yaml +6 -0
  85. package/scripts/extension/helm/package/Dockerfile +27 -0
  86. package/scripts/extension/helm/package/nginx.conf +17 -0
  87. package/scripts/extension/helm/scripts/package +23 -0
  88. package/scripts/extension/helm/scripts/patch +101 -0
  89. package/scripts/extension/helm/scripts/version +31 -0
  90. package/scripts/extension/helmpatch +3 -25
  91. package/scripts/extension/publish +47 -32
  92. package/types/shell/index.d.ts +30 -24
  93. package/utils/__tests__/grafana.test.ts +2 -2
  94. package/utils/error.js +11 -0
  95. package/utils/grafana.js +5 -4
  96. package/vue.config.js +3 -17
@@ -2,6 +2,7 @@
2
2
 
3
3
  SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
4
4
  BASE_DIR="$(pwd)"
5
+ BASE_EXT=$(basename ${BASE_DIR})
5
6
 
6
7
  CYAN="\033[96m"
7
8
  YELLOW="\033[93m"
@@ -162,15 +163,16 @@ CHART_TMP=${BASE_DIR}/tmp/_charts
162
163
  rm -rf ${TMP}
163
164
  mkdir -p ${TMP}
164
165
 
165
- CHART_TEMPLATE=${BASE_DIR}/tmp/ui-plugin-server
166
-
167
166
  # --------------------------------------------------------------------------------
168
- # Clone the plugin server template into the temporary folder
167
+ # Copy the plugin server template into the temporary folder
169
168
  # --------------------------------------------------------------------------------
170
169
  pushd ${TMP} > /dev/null
171
- git clone -q https://github.com/nwmac/ui-plugin-server.git
170
+ cp -r ${SCRIPT_DIR}/helm .
172
171
  popd > /dev/null
173
172
 
173
+ CHART_TEMPLATE=${BASE_DIR}/tmp/helm
174
+ ROOT_INDEX=${BASE_DIR}/index.yaml
175
+
174
176
  # --------------------------------------------------------------------------------
175
177
  # Iterate through all packages - built them all or build only those specified on the command line
176
178
  # --------------------------------------------------------------------------------
@@ -211,8 +213,6 @@ for d in pkg/*/ ; do
211
213
  find plugin -type f | sort > files.txt
212
214
  popd > /dev/null
213
215
 
214
- rm -rf ${TMP}/container
215
-
216
216
  # --------------------------------------------------------------------------------
217
217
  # Create the Helm chart
218
218
  # --------------------------------------------------------------------------------
@@ -241,21 +241,21 @@ for d in pkg/*/ ; do
241
241
  cp ./pkg/${pkg}/README.md ${CHART_FOLDER}/README.md
242
242
  fi
243
243
 
244
+ pushd ${CHART_FOLDER}/templates > /dev/null
245
+
244
246
  if [ "${GITHUB_BUILD}" == "true" ]; then
245
247
  echo "Patching for GitHub build"
246
- pushd ${CHART_FOLDER} > /dev/null
247
- cd templates
248
- mv cr.yaml temp.cr
249
- rm *.yaml
250
- mv temp.cr cr.yaml
251
248
  ENDPOINT=https://raw.githubusercontent.com/${GITHUB_SOURCE}/${GITHUB_BRANCH}/extensions/${pkg}/${PKG_VERSION}
252
- sed -i.bak -e 's@endpoint: .*@endpoint: '"${ENDPOINT}"'@g' cr.yaml
253
- rm *.bak
254
- popd > /dev/null
249
+ else
250
+ echo "Patching for container build"
251
+ ENDPOINT=http://${IMAGE_PREFIX}${BASE_EXT}-svc.cattle-ui-plugin-system:8080/plugin/${PKG_NAME}
255
252
  fi
253
+ sed -i.bak -e 's@endpoint: .*@endpoint: '"${ENDPOINT}"'@g' cr.yaml
254
+ rm *.bak
255
+ popd > /dev/null
256
256
 
257
257
  # Additional patches
258
- ${SCRIPT_DIR}/helmpatch ${CHART_FOLDER} "${BASE_DIR}/pkg/${pkg}/package.json" "${REGISTRY}${REGISTRY_ORG}/${IMAGE_PREFIX}${pkg}"
258
+ ${SCRIPT_DIR}/helmpatch ${CHART_FOLDER} "${BASE_DIR}/pkg/${pkg}/package.json"
259
259
 
260
260
  # Package into a .tgz helm chart
261
261
  helm package ${CHART_FOLDER} -d ${ASSETS}/${pkg}
@@ -268,10 +268,11 @@ for d in pkg/*/ ; do
268
268
  if [ -f "${HELM_INDEX}" ]; then
269
269
  UPDATE="--merge ${HELM_INDEX}"
270
270
  elif [ "${GITHUB_BUILD}" == "true" ] && [[ -n ${GITHUB_SOURCE} ]]; then
271
+ # Check if git branch contains index.yaml
271
272
  GITHUB_SOURCE=$(echo -e "${GITHUB_SOURCE}" | sed 's/https:\/\///g')
272
273
 
273
- # Check if git branch contains index.yaml
274
- wget -P ${BASE_DIR} https://raw.githubusercontent.com/${GITHUB_SOURCE}/${GITHUB_BRANCH}/index.yaml
274
+ wget -P ${BASE_DIR} https://raw.githubusercontent.com/${GITHUB_SOURCE}/${GITHUB_BRANCH}/index.yaml 2>/dev/null
275
+ HELM_INDEX="${BASE_DIR}/index.yaml"
275
276
 
276
277
  if [ -f "${HELM_INDEX}" ]; then
277
278
  UPDATE="--merge ${HELM_INDEX}"
@@ -281,44 +282,58 @@ for d in pkg/*/ ; do
281
282
  # Base URL referencing assets directly from GitHub
282
283
  BASE_URL="assets/${pkg}"
283
284
 
285
+ # Relative URL references assets within the container deployment
286
+ RELATIVE_URL="plugin/"
287
+
284
288
  rm -rf ${CHART_TMP}
285
289
  mkdir -p ${CHART_TMP}
286
290
  cp ${ASSETS}/${pkg}/*.tgz ${CHART_TMP}
287
291
 
288
- helm repo index ${CHART_TMP} --url ${BASE_URL} ${UPDATE}
289
-
290
- cp ${CHART_TMP}/index.yaml ${HELM_INDEX}
291
-
292
292
  if [ "${GITHUB_BUILD}" == "true" ]; then
293
- # Make temp directory for workflow build artifact
294
- mkdir -p tmp/{assets,charts,extensions}/$pkg
295
-
296
- cp -r ${PKG_ASSET} tmp/assets/$pkg
297
- cp -r ${CHARTS}/${pkg}/${PKG_VERSION} tmp/charts/$pkg
298
- cp -r ${EXT_FOLDER} tmp/extensions/$pkg
293
+ helm repo index ${ASSETS} --url ${BASE_URL} ${UPDATE}
294
+ elif ! [ -e "${HELM_INDEX}" ]; then
295
+ helm repo index ${ASSETS} --url ${RELATIVE_URL}
299
296
  fi
300
297
 
301
298
  BUILT="true"
302
299
  fi
303
300
  done
304
301
 
302
+ if [ -f ${ROOT_INDEX} ]; then
303
+ UPDATE="--merge ${ROOT_INDEX}"
304
+ helm repo index ${ASSETS} ${UPDATE}
305
+ fi
306
+
307
+ if [ -f ${ASSETS}/index.yaml ]; then
308
+ cp ${ASSETS}/index.yaml ${BASE_DIR}
309
+ fi
310
+
305
311
  if [ "${GITHUB_BUILD}" == "false" ]; then
306
- BASE=$(basename ${BASE_DIR})
307
312
  EXT_VERSION=$(jq -r .version ${BASE_DIR}/package.json)
308
313
 
309
314
  if [ -z ${EXT_VERSION} ]; then
310
315
  EXT_VERSION="0.0.0"
311
316
  fi
312
317
 
313
- echo -e "${CYAN}Base extension: ${BASE}${RESET}"
318
+ echo -e "${CYAN}Base extension: ${BASE_EXT}${RESET}"
314
319
  echo -e "${CYAN}Extension version: ${EXT_VERSION}${RESET}"
315
320
 
316
321
  # Build the docker image
317
- ${SCRIPT_DIR}/bundle ${BASE} ${EXT_VERSION} ${REGISTRY} ${REGISTRY_ORG} ${IMAGE_PREFIX} ${PUSH}
322
+ ${SCRIPT_DIR}/bundle ${BASE_EXT} ${EXT_VERSION} ${REGISTRY} ${REGISTRY_ORG} ${IMAGE_PREFIX} ${PUSH}
318
323
  fi
319
324
 
320
- if [ "${GITHUB_BUILD}" == "true" ]; then
321
- cp index.yaml tmp
325
+ if [ "${GITHUB_BUILD}" == "true" ] && [ -f ${ROOT_INDEX} ]; then
326
+ cp ${ROOT_INDEX} tmp
327
+ fi
328
+
329
+ if [ "${GITHUB_BUILD}" == "true" ] && [ "${BUILT}" == "true" ]; then
330
+ echo -e "${BOLD}${CYAN}Packaging for Github Build${RESET}"
331
+ # Make temp directory for workflow build artifact
332
+ mkdir -p tmp/{assets,charts,extensions}
333
+
334
+ cp -r ${ASSETS}/* tmp/assets
335
+ cp -r ${CHARTS}/* tmp/charts
336
+ cp -r ${BASE_DIR}/extensions/* tmp/extensions
322
337
  fi
323
338
 
324
339
  if [ "${BUILT}" == "true" ]; then
@@ -1546,30 +1546,36 @@ export namespace FLEET_BUNDLE_TYPE {
1546
1546
  const width_30: number;
1547
1547
  export { width_30 as width };
1548
1548
  }
1549
- export namespace RBAC_USERS {
1550
- const name_111: string;
1551
- export { name_111 as name };
1552
- const sort_101: string[];
1553
- export { sort_101 as sort };
1554
- export function getValue_13(row: any): any;
1555
- export { getValue_13 as getValue };
1556
- }
1557
- export namespace RBAC_GROUPS {
1558
- const name_112: string;
1559
- export { name_112 as name };
1560
- const sort_102: string[];
1561
- export { sort_102 as sort };
1562
- export function getValue_14(row: any): any;
1563
- export { getValue_14 as getValue };
1564
- }
1565
- export namespace RBAC_SERVICE_ACCOUNTS {
1566
- const name_113: string;
1567
- export { name_113 as name };
1568
- const sort_103: string[];
1569
- export { sort_103 as sort };
1570
- export function getValue_15(row: any): any;
1571
- export { getValue_15 as getValue };
1572
- }
1549
+ export const UI_PLUGIN_CATALOG: ({
1550
+ name: string;
1551
+ labelKey: string;
1552
+ sort: string[];
1553
+ value: string;
1554
+ width: number;
1555
+ default: string;
1556
+ formatter: string;
1557
+ formatterOpts: {
1558
+ arbitrary: boolean;
1559
+ };
1560
+ } | {
1561
+ name: string;
1562
+ labelKey: string;
1563
+ value: string;
1564
+ sort: string[];
1565
+ formatter: string;
1566
+ width?: undefined;
1567
+ default?: undefined;
1568
+ formatterOpts?: undefined;
1569
+ } | {
1570
+ name: string;
1571
+ sort: string[];
1572
+ labelKey: string;
1573
+ value: string;
1574
+ width?: undefined;
1575
+ default?: undefined;
1576
+ formatter?: undefined;
1577
+ formatterOpts?: undefined;
1578
+ })[];
1573
1579
  }
1574
1580
 
1575
1581
  // @shell/config/types
@@ -29,7 +29,7 @@ describe('fx: getClusterPrefix', () => {
29
29
  it('future monitoring version, local cluster', () => {
30
30
  const prefix = getClusterPrefix('103.0.0+up41.0.0', 'local');
31
31
 
32
- expect(prefix).toStrictEqual('/k8s/clusters/local');
32
+ expect(prefix).toStrictEqual('');
33
33
  });
34
34
  it('empty monitoring version, downstream cluster', () => {
35
35
  const prefix = getClusterPrefix('', 'c-abcd');
@@ -39,6 +39,6 @@ describe('fx: getClusterPrefix', () => {
39
39
  it('empty monitoring version, local cluster', () => {
40
40
  const prefix = getClusterPrefix('', 'local');
41
41
 
42
- expect(prefix).toStrictEqual('/k8s/clusters/local');
42
+ expect(prefix).toStrictEqual('');
43
43
  });
44
44
  });
package/utils/error.js CHANGED
@@ -39,6 +39,17 @@ export function stringify(err) {
39
39
  } else if ( err && typeof err === 'object' ) {
40
40
  if ( err.message ) {
41
41
  str = err.message;
42
+
43
+ if (typeof str === 'string') {
44
+ try {
45
+ const data = JSON.parse(str).data;
46
+
47
+ if (data) {
48
+ return data;
49
+ }
50
+ } catch {}
51
+ }
52
+
42
53
  if ( err.detail ) {
43
54
  if ( str ) {
44
55
  str += ` (${ err.detail })`;
package/utils/grafana.js CHANGED
@@ -1,12 +1,13 @@
1
1
  import { haveV2Monitoring } from '@shell/utils/monitoring';
2
2
  import { parse as parseUrl, addParam } from '@shell/utils/url';
3
- import { compare } from '@shell/utils/version';
4
3
  import { CATALOG } from '@shell/config/types';
5
4
 
6
- const MONITORING_VERSION_NEW_URL_PATTERN = '102.0.0+up40.1.2';
5
+ // these two versions of monitoring included a bug fix attempt that required the local cluster to use a different url
6
+ // the solution going forward doesn't require this, see https://github.com/rancher/dashboard/issues/8885
7
+ const MONITORING_VERSION_ALT_URL = ['100.2.0+up40.1.2', '102.0.0+up40.1.2'];
7
8
 
8
9
  export function getClusterPrefix(monitoringVersion, clusterId) {
9
- if (compare(monitoringVersion, MONITORING_VERSION_NEW_URL_PATTERN) >= 0) {
10
+ if (MONITORING_VERSION_ALT_URL.includes(monitoringVersion)) {
10
11
  return `/k8s/clusters/${ clusterId }`;
11
12
  }
12
13
 
@@ -53,7 +54,7 @@ export async function dashboardExists(monitoringVersion, store, clusterId, embed
53
54
  }
54
55
 
55
56
  export async function allDashboardsExist(store, clusterId, embeddedUrls, storeName = 'cluster') {
56
- let res;
57
+ let res;
57
58
 
58
59
  try {
59
60
  res = await store.dispatch(`${ storeName }/find`, { type: CATALOG.APP, id: 'cattle-monitoring-system/rancher-monitoring' });
package/vue.config.js CHANGED
@@ -248,9 +248,6 @@ module.exports = function(dir, _appConfig) {
248
248
  resourceBase += '/';
249
249
  }
250
250
 
251
- // Store the Router Base as env variable that we can use in `nuxt/router.js`
252
- process.env.VUE_APP_ROUTER_BASE = routerBasePath;
253
-
254
251
  console.log(`Build: ${ dev ? 'Development' : 'Production' }`); // eslint-disable-line no-console
255
252
 
256
253
  if ( !dev ) {
@@ -352,6 +349,7 @@ module.exports = function(dir, _appConfig) {
352
349
  },
353
350
  publicPath: resourceBase || undefined,
354
351
  css: {
352
+ extract: false, // inline css styles instead of including with `<links`
355
353
  loaderOptions: {
356
354
  sass: {
357
355
  // This is effectively added to the beginning of each style that's imported or included in a vue file. We may want to look into including these in app.scss
@@ -400,6 +398,8 @@ module.exports = function(dir, _appConfig) {
400
398
  'process.env.rancherEnv': JSON.stringify(rancherEnv),
401
399
  'process.env.harvesterPkgUrl': JSON.stringify(process.env.HARVESTER_PKG_URL),
402
400
  'process.env.api': JSON.stringify(api),
401
+ // Store the Router Base as env variable that we can use in `shell/config/router.js`
402
+ 'process.env.routerBase': JSON.stringify(routerBasePath),
403
403
 
404
404
  // This is a replacement of the nuxt publicRuntimeConfig
405
405
  'nuxt.publicRuntimeConfig': JSON.stringify({
@@ -533,20 +533,6 @@ module.exports = function(dir, _appConfig) {
533
533
  ]
534
534
  },
535
535
  // Prevent warning in log with the md files in the content folder
536
- {
537
- test: /\.md$/,
538
- use: [
539
- {
540
- loader: 'url-loader',
541
- options: {
542
- name: '[path][name].[ext]',
543
- limit: 1,
544
- esModule: false
545
- },
546
- }
547
- ]
548
- },
549
- // Prevent warning in log with the md files in the content folder
550
536
  {
551
537
  test: /\.md$/,
552
538
  use: [