@rancher/shell 0.1.3 → 0.1.21

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 (245) hide show
  1. package/assets/brand/suse/dark/rancher-logo.svg +1 -148
  2. package/assets/brand/suse/favicon.png +0 -0
  3. package/assets/brand/suse/rancher-logo.svg +1 -130
  4. package/assets/images/featured/img1.jpg +0 -0
  5. package/assets/images/featured.jpg +0 -0
  6. package/assets/images/generic-plugin.svg +1 -0
  7. package/assets/styles/themes/_dark.scss +3 -0
  8. package/assets/styles/themes/_light.scss +3 -0
  9. package/assets/styles/themes/_suse.scss +1 -1
  10. package/assets/translations/en-us.yaml +219 -47
  11. package/assets/translations/zh-hans.yaml +21 -24
  12. package/components/AsyncButton.vue +17 -2
  13. package/components/ButtonDropdown.vue +4 -0
  14. package/components/Carousel.vue +291 -0
  15. package/components/CommunityLinks.vue +64 -22
  16. package/components/CruResource.vue +11 -3
  17. package/components/Dialog.vue +102 -0
  18. package/components/ExplorerMembers.vue +2 -4
  19. package/components/ExplorerProjectsNamespaces.vue +25 -9
  20. package/components/IconMessage.vue +9 -1
  21. package/components/LazyImage.vue +21 -8
  22. package/components/LocaleSelector.vue +62 -29
  23. package/components/PromptRemove.vue +2 -2
  24. package/components/ResourceList/Masthead.vue +21 -1
  25. package/components/ResourceList/ResourceLoadingIndicator.vue +0 -8
  26. package/components/ResourceList/index.vue +9 -23
  27. package/components/ResourceTable.vue +7 -2
  28. package/components/SimpleBox.vue +6 -4
  29. package/components/SortableTable/index.vue +18 -25
  30. package/components/Tabbed/Tab.vue +5 -0
  31. package/components/Tabbed/index.vue +54 -9
  32. package/components/TypeDescription.vue +10 -1
  33. package/components/auth/Principal.vue +1 -0
  34. package/components/fleet/FleetBundles.vue +8 -3
  35. package/components/fleet/FleetClusters.vue +6 -0
  36. package/components/fleet/FleetRepos.vue +7 -1
  37. package/components/fleet/FleetSummary.vue +6 -0
  38. package/components/form/Command.vue +5 -0
  39. package/components/form/EnvVars.vue +5 -0
  40. package/components/form/KeyValue.vue +80 -58
  41. package/components/form/NameNsDescription.vue +13 -5
  42. package/components/form/NodeScheduling.vue +6 -1
  43. package/components/form/PodAffinity.vue +5 -0
  44. package/components/form/ResourceTabs/index.vue +5 -1
  45. package/components/form/ServiceNameSelect.vue +5 -0
  46. package/components/form/ValueFromResource.vue +7 -1
  47. package/components/formatter/ClusterLink.vue +3 -7
  48. package/components/nav/NamespaceFilter.vue +3 -3
  49. package/components/nav/TopLevelMenu.vue +12 -29
  50. package/config/home-links.js +155 -0
  51. package/config/labels-annotations.js +2 -1
  52. package/config/private-label.js +1 -1
  53. package/config/product/explorer.js +5 -4
  54. package/config/product/legacy.js +0 -47
  55. package/config/product/manager.js +0 -2
  56. package/config/product/multi-cluster-apps.js +0 -12
  57. package/config/product/settings.js +12 -1
  58. package/config/product/uiplugins.js +17 -0
  59. package/config/settings.js +23 -2
  60. package/config/types.js +5 -1
  61. package/config/uiplugins.js +117 -0
  62. package/config/version.js +17 -0
  63. package/content/docs/en-us/getting-started.md +1 -26
  64. package/core/plugin.ts +12 -0
  65. package/core/plugins.js +38 -2
  66. package/core/types.ts +6 -0
  67. package/creators/app/{.eslintignore → files/.eslintignore} +0 -0
  68. package/creators/app/{.eslintrc.js → files/.eslintrc.js} +0 -0
  69. package/creators/app/{.vscode → files/.vscode}/settings.json +0 -0
  70. package/creators/app/{babel.config.js → files/babel.config.js} +0 -0
  71. package/creators/app/{nuxt.config.js → files/nuxt.config.js} +0 -0
  72. package/creators/app/{tsconfig.json → files/tsconfig.json} +2 -1
  73. package/creators/app/init +16 -17
  74. package/creators/app/package.json +6 -0
  75. package/creators/pkg/{babel.config.js → files/babel.config.js} +0 -0
  76. package/creators/pkg/{index.ts → files/index.ts} +0 -0
  77. package/creators/pkg/{tsconfig.json → files/tsconfig.json} +13 -12
  78. package/creators/pkg/{vue.config.js → files/vue.config.js} +0 -0
  79. package/creators/pkg/init +1 -1
  80. package/creators/update/init +54 -0
  81. package/creators/update/package.json +20 -0
  82. package/creators/update/upgrade +56 -0
  83. package/creators/update/yarn-error.log +54 -0
  84. package/detail/provisioning.cattle.io.cluster.vue +3 -3
  85. package/detail/workload/index.vue +3 -2
  86. package/dialog/DiagnosticTimingsDialog.vue +116 -0
  87. package/dialog/RotateCertificatesDialog.vue +9 -3
  88. package/edit/auth/azuread.vue +28 -9
  89. package/edit/networking.k8s.io.ingress/index.vue +2 -2
  90. package/edit/persistentvolume/index.vue +51 -13
  91. package/edit/persistentvolumeclaim.vue +31 -13
  92. package/edit/pod.vue +27 -0
  93. package/edit/provisioning.cattle.io.cluster/rke2.vue +103 -24
  94. package/edit/service.vue +7 -5
  95. package/edit/workload/__tests__/Upgrading.test.ts +1 -0
  96. package/edit/workload/index.vue +32 -10
  97. package/edit/workload/mixins/workload.js +121 -126
  98. package/edit/workload/storage/ContainerMountPaths.vue +240 -0
  99. package/edit/workload/storage/Mount.vue +1 -0
  100. package/edit/workload/storage/awsElasticBlockStore.vue +20 -1
  101. package/edit/workload/storage/azureDisk.vue +22 -2
  102. package/edit/workload/storage/azureFile.vue +20 -2
  103. package/edit/workload/storage/csi/index.vue +23 -1
  104. package/edit/workload/storage/gcePersistentDisk.vue +20 -2
  105. package/edit/workload/storage/index.vue +33 -65
  106. package/edit/workload/storage/persistentVolumeClaim/index.vue +5 -0
  107. package/edit/workload/storage/secret.vue +6 -1
  108. package/edit/workload/storage/vsphereVolume.vue +11 -1
  109. package/layouts/default.vue +14 -8
  110. package/layouts/home.vue +9 -4
  111. package/layouts/plain.vue +10 -5
  112. package/list/catalog.cattle.io.app.vue +10 -9
  113. package/list/catalog.cattle.io.clusterrepo.vue +6 -61
  114. package/list/cis.cattle.io.clusterscan.vue +12 -12
  115. package/list/fleet.cattle.io.bundle.vue +33 -28
  116. package/list/fleet.cattle.io.cluster.vue +26 -22
  117. package/list/fleet.cattle.io.clustergroup.vue +6 -0
  118. package/list/fleet.cattle.io.clusterregistrationtoken.vue +28 -24
  119. package/list/fleet.cattle.io.gitrepo.vue +25 -14
  120. package/list/helm.cattle.io.projecthelmchart.vue +52 -33
  121. package/list/logging.banzaicloud.io.clusterflow.vue +7 -12
  122. package/list/logging.banzaicloud.io.flow.vue +7 -14
  123. package/list/management.cattle.io.cluster.vue +26 -15
  124. package/list/management.cattle.io.feature.vue +13 -8
  125. package/list/management.cattle.io.setting.vue +3 -3
  126. package/list/management.cattle.io.user.vue +38 -19
  127. package/list/monitoring.coreos.com.alertmanagerconfig.vue +8 -15
  128. package/list/namespace.vue +14 -1
  129. package/list/node.vue +13 -16
  130. package/list/persistentvolume.vue +16 -9
  131. package/list/persistentvolumeclaim.vue +5 -8
  132. package/list/provisioning.cattle.io.cluster.vue +35 -9
  133. package/list/service.vue +24 -12
  134. package/list/ui.cattle.io.navlink.vue +6 -0
  135. package/list/workload.vue +2 -2
  136. package/machine-config/harvester.vue +5 -3
  137. package/middleware/authenticated.js +6 -0
  138. package/mixins/resource-fetch.js +12 -18
  139. package/mixins/resource-manager.js +126 -0
  140. package/models/catalog.cattle.io.uiplugin.js +38 -0
  141. package/models/cluster/node.js +25 -2
  142. package/models/fleet.cattle.io.bundle.js +1 -1
  143. package/models/harvesterhci.io.management.cluster.js +11 -5
  144. package/models/pod.js +15 -5
  145. package/models/provisioning.cattle.io.cluster.js +16 -6
  146. package/models/workload.js +5 -3
  147. package/models/workload.service.js +10 -0
  148. package/nuxt.config.js +70 -25
  149. package/package.json +108 -109
  150. package/pages/auth/login.vue +11 -1
  151. package/pages/auth/verify.vue +9 -0
  152. package/pages/c/_cluster/apps/charts/index.vue +46 -1
  153. package/pages/c/_cluster/apps/charts/install.vue +10 -9
  154. package/pages/c/_cluster/explorer/index.vue +72 -9
  155. package/pages/c/_cluster/explorer/tools/index.vue +12 -5
  156. package/pages/c/_cluster/mcapps/index.vue +1 -1
  157. package/pages/c/_cluster/settings/DefaultLinksEditor.vue +108 -0
  158. package/pages/c/_cluster/settings/brand.vue +0 -40
  159. package/pages/c/_cluster/settings/links.vue +152 -0
  160. package/pages/c/_cluster/settings/performance.vue +90 -7
  161. package/pages/c/_cluster/uiplugins/DeveloperInstallDialog.vue +232 -0
  162. package/pages/c/_cluster/uiplugins/InstallDialog.vue +293 -0
  163. package/pages/c/_cluster/uiplugins/PluginInfoPanel.vue +300 -0
  164. package/pages/c/_cluster/uiplugins/RemoveUIPlugins.vue +125 -0
  165. package/pages/c/_cluster/uiplugins/SetupUIPlugins.vue +261 -0
  166. package/pages/c/_cluster/uiplugins/UninstallDialog.vue +122 -0
  167. package/pages/c/_cluster/uiplugins/index.vue +808 -0
  168. package/pages/diagnostic.vue +185 -101
  169. package/pages/docs/_doc.vue +3 -1
  170. package/pages/home.vue +21 -56
  171. package/pages/prefs.vue +108 -88
  172. package/pages/safeMode.vue +17 -0
  173. package/pages/support/index.vue +34 -137
  174. package/pkg/dynamic-importer.lib.js +4 -0
  175. package/plugins/dashboard-store/actions.js +19 -0
  176. package/plugins/dashboard-store/getters.js +20 -3
  177. package/plugins/dashboard-store/mutations.js +13 -7
  178. package/plugins/dashboard-store/resource-class.js +2 -2
  179. package/plugins/formatters.js +15 -0
  180. package/plugins/plugin.js +61 -6
  181. package/plugins/steve/getters.js +12 -0
  182. package/plugins/steve/mutations.js +1 -1
  183. package/plugins/steve/subscribe.js +94 -72
  184. package/plugins/steve/web-worker.steve-sub-worker.js +24 -15
  185. package/plugins/version.js +21 -0
  186. package/promptRemove/management.cattle.io.globalrole.vue +47 -0
  187. package/promptRemove/management.cattle.io.roletemplate.vue +47 -0
  188. package/promptRemove/mixin/roleDeletionCheck.js +97 -0
  189. package/rancher-components/Form/TextArea/TextAreaAutoGrow.vue +6 -7
  190. package/rancher-components/components/BadgeState/BadgeState.spec.ts +12 -0
  191. package/rancher-components/components/BadgeState/BadgeState.vue +107 -0
  192. package/rancher-components/components/BadgeState/index.ts +1 -0
  193. package/rancher-components/components/Banner/Banner.test.ts +13 -0
  194. package/rancher-components/components/Banner/Banner.vue +163 -0
  195. package/rancher-components/components/Banner/index.ts +1 -0
  196. package/rancher-components/components/Card/Card.vue +150 -0
  197. package/rancher-components/components/Card/index.ts +1 -0
  198. package/rancher-components/components/Form/Checkbox/Checkbox.test.ts +77 -0
  199. package/rancher-components/components/Form/Checkbox/Checkbox.vue +395 -0
  200. package/rancher-components/components/Form/Checkbox/index.ts +1 -0
  201. package/rancher-components/components/Form/LabeledInput/LabeledInput.test.ts +29 -0
  202. package/rancher-components/components/Form/LabeledInput/LabeledInput.vue +343 -0
  203. package/rancher-components/components/Form/LabeledInput/index.ts +1 -0
  204. package/rancher-components/components/Form/Radio/RadioButton.vue +270 -0
  205. package/rancher-components/components/Form/Radio/RadioGroup.vue +235 -0
  206. package/rancher-components/components/Form/Radio/index.ts +2 -0
  207. package/rancher-components/components/Form/TextArea/TextAreaAutoGrow.vue +168 -0
  208. package/rancher-components/components/Form/TextArea/index.ts +1 -0
  209. package/rancher-components/components/Form/ToggleSwitch/ToggleSwitch.test.ts +107 -0
  210. package/rancher-components/components/Form/ToggleSwitch/ToggleSwitch.vue +137 -0
  211. package/rancher-components/components/Form/ToggleSwitch/index.ts +1 -0
  212. package/rancher-components/components/Form/index.ts +5 -0
  213. package/rancher-components/components/LabeledTooltip/LabeledTooltip.vue +137 -0
  214. package/rancher-components/components/LabeledTooltip/index.ts +1 -0
  215. package/scripts/publish-shell.sh +40 -7
  216. package/scripts/record-deps.js +37 -0
  217. package/scripts/sync-shell-deps +37 -0
  218. package/scripts/test-plugins-build.sh +8 -5
  219. package/scripts/typegen.sh +84 -0
  220. package/store/auth.js +3 -0
  221. package/store/catalog.js +9 -8
  222. package/store/i18n.js +10 -1
  223. package/store/index.js +12 -3
  224. package/store/prefs.js +16 -0
  225. package/store/type-map.js +32 -5
  226. package/store/uiplugins.ts +15 -61
  227. package/types/shell/index.d.ts +3046 -0
  228. package/utils/__tests__/object.test.ts +0 -24
  229. package/utils/__tests__/selector.test.ts +1 -1
  230. package/utils/dynamic-importer.js +4 -0
  231. package/utils/favicon.js +8 -2
  232. package/utils/gc/gc-interval.ts +40 -0
  233. package/utils/gc/gc-root-store.js +76 -0
  234. package/utils/gc/gc-route-changed.ts +44 -0
  235. package/utils/gc/gc-types.ts +21 -0
  236. package/utils/gc/gc.ts +282 -0
  237. package/utils/grafana.js +2 -6
  238. package/utils/socket.js +41 -20
  239. package/utils/string.js +1 -7
  240. package/utils/validators/formRules/__tests__/index.test.ts +108 -0
  241. package/utils/validators/formRules/index.ts +9 -1
  242. package/config/footer.js +0 -19
  243. package/creators/pkg/nuxt.config.js +0 -6
  244. package/pages/plugins.vue +0 -387
  245. package/server/verdaccio-middleware.js +0 -56
@@ -0,0 +1,117 @@
1
+ import semver from 'semver';
2
+
3
+ // Version of the plugin API supported
4
+ export const UI_PLUGIN_API_VERSION = '1.0.0';
5
+ export const UI_PLUGIN_HOST_APP = 'rancher-manager';
6
+
7
+ export const UI_PLUGIN_BASE_URL = '/api/v1/namespaces/cattle-ui-plugin-system/services/http:ui-plugin-operator:80/proxy';
8
+
9
+ export const UI_PLUGIN_NAMESPACE = 'cattle-ui-plugin-system';
10
+
11
+ // Annotation name and value that indicate a chart is a UI plugin
12
+ export const UI_PLUGIN_ANNOTATION_NAME = 'catalog.cattle.io/ui-component';
13
+ export const UI_PLUGIN_ANNOTATION_VALUE = 'plugins';
14
+
15
+ export const UI_PLUGIN_OPERATOR_CRD_CHART_NAME = 'ui-plugin-operator-crd';
16
+ export const UI_PLUGIN_OPERATOR_CHART_NAME = 'ui-plugin-operator';
17
+
18
+ export const UI_PLUGIN_CHARTS = [
19
+ UI_PLUGIN_OPERATOR_CHART_NAME,
20
+ UI_PLUGIN_OPERATOR_CRD_CHART_NAME,
21
+ ];
22
+
23
+ // Expected chart repo name for the UI Plugins operator
24
+ export const UI_PLUGIN_OPERATOR_REPO_NAME = 'rancher-charts';
25
+
26
+ // Info for the Helm Chart Repository that we will add
27
+ export const UI_PLUGINS_REPO_NAME = 'rancher-ui-plugins';
28
+
29
+ export const UI_PLUGINS_REPO_URL = 'https://github.com/rancher/ui-plugin-charts';
30
+ export const UI_PLUGINS_REPO_BRANCH = 'main';
31
+
32
+ // Chart annotations
33
+ export const UI_PLUGIN_CHART_ANNOTATIONS = {
34
+ RANCHER_VERSION: 'catalog.cattle.io/rancher-version',
35
+ EXTENSIONS_VERSION: 'catalog.cattle.io/ui-extenstions-version',
36
+ EXTENSIONS_HOST: 'catalog.cattle.io/ui-extenstions-host',
37
+ };
38
+
39
+ // Plugin Metadata properties
40
+ export const UI_PLUGIN_METADATA = {
41
+ RANCHER_VERSION: 'rancherVersion',
42
+ EXTENSION_VERSION: 'extVersion',
43
+ EXTENSIONS_HOST: 'host',
44
+ };
45
+
46
+ export function isUIPlugin(chart) {
47
+ return !!chart?.versions.find((v) => {
48
+ return v.annotations && v.annotations[UI_PLUGIN_ANNOTATION_NAME] === UI_PLUGIN_ANNOTATION_VALUE;
49
+ });
50
+ }
51
+
52
+ export function uiPluginHasAnnotation(chart, name, value) {
53
+ return !!chart?.versions.find((v) => {
54
+ return v.annotations && v.annotations[name] === value;
55
+ });
56
+ }
57
+
58
+ // Should we load a plugin, based on the metadata returned by the backend?
59
+ // Returns error key string or false
60
+ export function shouldNotLoadPlugin(plugin, rancherVersion) {
61
+ if (!plugin.name || !plugin.version || !plugin.endpoint) {
62
+ return 'plugins.error.generic';
63
+ }
64
+
65
+ // Plugin specified a required extension API version
66
+ const requiredAPI = plugin.metadata?.[UI_PLUGIN_METADATA.EXTENSION_VERSION];
67
+
68
+ if (requiredAPI && !semver.satisfies(UI_PLUGIN_API_VERSION, requiredAPI)) {
69
+ return 'plugins.error.api';
70
+ }
71
+
72
+ // Host application
73
+ const requiredHost = plugin.metadata?.[UI_PLUGIN_METADATA.EXTENSIONS_HOST];
74
+
75
+ if (requiredHost && requiredHost !== UI_PLUGIN_HOST_APP) {
76
+ return 'plugins.error.host';
77
+ }
78
+
79
+ // Rancher version
80
+ if (rancherVersion) {
81
+ const requiredRancherVersion = plugin.metadata?.[UI_PLUGIN_METADATA.RANCHER_VERSION];
82
+
83
+ if (requiredRancherVersion && !semver.satisfies(rancherVersion, requiredRancherVersion)) {
84
+ return 'plugins.error.version';
85
+ }
86
+ }
87
+
88
+ return false;
89
+ }
90
+
91
+ // Can a chart version be used for this Rancher (based on the annotations on the chart)?
92
+ export function isSupportedChartVersion(chartVersion, rancherVersion) {
93
+ // Plugin specified a required extension API version
94
+ const requiredAPI = chartVersion.annotations?.[UI_PLUGIN_CHART_ANNOTATIONS.EXTENSIONS_VERSION];
95
+
96
+ if (requiredAPI && !semver.satisfies(UI_PLUGIN_API_VERSION, requiredAPI)) {
97
+ return false;
98
+ }
99
+
100
+ // Host application
101
+ const requiredHost = chartVersion.annotations?.[UI_PLUGIN_CHART_ANNOTATIONS.EXTENSIONS_HOST];
102
+
103
+ if (requiredHost && requiredHost !== UI_PLUGIN_HOST_APP) {
104
+ return false;
105
+ }
106
+
107
+ // Rancher version
108
+ if (rancherVersion) {
109
+ const requiredRancherVersion = chartVersion.annotations?.[UI_PLUGIN_CHART_ANNOTATIONS.RANCHER_VERSION];
110
+
111
+ if (requiredRancherVersion && !semver.satisfies(rancherVersion, requiredRancherVersion)) {
112
+ return false;
113
+ }
114
+ }
115
+
116
+ return true;
117
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Store version data retrieved from the backend /rancherversion API
3
+ */
4
+ let _versionData = { RancherPrime: 'false' };
5
+
6
+ export function isRancherPrime() {
7
+ return _versionData.RancherPrime?.toLowerCase() === 'true';
8
+ }
9
+
10
+ export function getVersionData() {
11
+ return _versionData;
12
+ }
13
+
14
+ export function setVersionData(v) {
15
+ // Remove any properties on 'v' we don't want
16
+ _versionData = JSON.parse(JSON.stringify(v));
17
+ }
@@ -72,11 +72,6 @@ As of version 2.6, Cluster Manager is no longer provided as a separate UI. The d
72
72
  <tr class="table-group">
73
73
  <td colspan="3">Global</td>
74
74
  </tr>
75
- <tr>
76
- <td>Apps</td>
77
- <td>Global → Apps</td>
78
- <td>Menu → Multi-cluster Apps → Apps</td>
79
- </tr>
80
75
  <tr>
81
76
  <td>Settings</td>
82
77
  <td>Global → Settings</td>
@@ -100,7 +95,7 @@ As of version 2.6, Cluster Manager is no longer provided as a separate UI. The d
100
95
  <tr>
101
96
  <td>Pod Security Policies</td>
102
97
  <td>Global → Security → Pod Security Policies</td>
103
- <td>Menu → Cluster Management → Advanced → Pod Security Policies</td>
98
+ <td>Menu → Cluster Management → Pod Security Policies</td>
104
99
  </tr>
105
100
  <!-- -->
106
101
  <tr class="table-group">
@@ -136,26 +131,11 @@ As of version 2.6, Cluster Manager is no longer provided as a separate UI. The d
136
131
  <td>(Cluster) → Tools → Notifiers</td>
137
132
  <td>Menu → (Cluster) → Legacy -> Notifiers</td>
138
133
  </tr>
139
- <tr>
140
- <td>Logging (V1)</td>
141
- <td>(Cluster) → Tools → Logging</td>
142
- <td>Menu → (Cluster) → Cluster Tools -> Logging (Legacy)</td>
143
- </tr>
144
134
  <tr>
145
135
  <td>Monitoring (V1)</td>
146
136
  <td>(Cluster) → Tools → Monitoring</td>
147
137
  <td>Menu → (Cluster) → Cluster Tools -> Monitoring (Legacy)</td>
148
138
  </tr>
149
- <tr>
150
- <td>Istio (V1)</td>
151
- <td>(Cluster) → Tools → Istio</td>
152
- <td>Menu → (Cluster) → Cluster Tools -> Istio (Legacy)</td>
153
- </tr>
154
- <tr>
155
- <td>CIS Scans (V1)</td>
156
- <td>(Cluster) → Tools → CIS Scans</td>
157
- <td>Menu → (Cluster) → Legacy -> CIS Scans</td>
158
- </tr>
159
139
  <tr class="table-group">
160
140
  <td colspan="3">V1 Monitoring</td>
161
141
  <tr>
@@ -212,11 +192,6 @@ As of version 2.6, Cluster Manager is no longer provided as a separate UI. The d
212
192
  <td>(Cluster) → (Project) → Tools → Monitoring</td>
213
193
  <td>Menu → (Cluster) → Legacy → Project → (Project) → Monitoring</td>
214
194
  </tr>
215
- <tr>
216
- <td>Pipeline</td>
217
- <td>(Cluster) → (Project) → Tools → Pipeline</td>
218
- <td>Menu → (Cluster) → Legacy → Project → (Project) → Pipelines → Configuration</td>
219
- </tr>
220
195
  <tr class="table-group">
221
196
  <td colspan="3">Other</td>
222
197
  </tr>
package/core/plugin.ts CHANGED
@@ -45,6 +45,10 @@ export class Plugin implements IPlugin {
45
45
  this.name = this._metadata.name || this.id;
46
46
  }
47
47
 
48
+ get version() {
49
+ return this._metadata.version;
50
+ }
51
+
48
52
  get validators() {
49
53
  return this._validators;
50
54
  }
@@ -104,6 +108,14 @@ export class Plugin implements IPlugin {
104
108
  this.routes.push({ parent, route });
105
109
  }
106
110
 
111
+ setHomePage(component: any) {
112
+ this.addRoute({
113
+ name: 'home',
114
+ path: '/home',
115
+ component
116
+ });
117
+ }
118
+
107
119
  addUninstallHook(hook: Function) {
108
120
  this.uninstallHooks.push(hook);
109
121
  }
package/core/plugins.js CHANGED
@@ -2,6 +2,7 @@ import { productsLoaded } from '@shell/store/type-map';
2
2
  import { clearModelCache } from '@shell/plugins/dashboard-store/model-loader';
3
3
  import { Plugin } from './plugin';
4
4
  import { PluginRoutes } from './plugin-routes';
5
+ import { UI_PLUGIN_BASE_URL } from '@shell/config/uiplugins';
5
6
 
6
7
  const MODEL_TYPE = 'models';
7
8
 
@@ -16,9 +17,9 @@ export default function({
16
17
  let _lastLoaded = 0;
17
18
 
18
19
  // Track which plugin loaded what, so we can unload stuff
19
- const plugins = {};
20
+ let plugins = {};
20
21
 
21
- const pluginRoutes = new PluginRoutes(app.router);
22
+ let pluginRoutes = new PluginRoutes(app.router);
22
23
 
23
24
  inject('plugin', {
24
25
  // Plugins should not use these - but we will pass them in for now as a 2nd argument
@@ -35,6 +36,24 @@ export default function({
35
36
  return internal;
36
37
  },
37
38
 
39
+ // Load a plugin from a UI package
40
+ loadPluginAsync(plugin) {
41
+ const { name, version } = plugin;
42
+ const id = `${ name }-${ version }`;
43
+ let url;
44
+
45
+ if (plugin?.metadata?.direct === 'true') {
46
+ url = plugin.endpoint;
47
+ } else {
48
+ // See if the plugin has a main metadata property set
49
+ const main = plugin?.metadata?.main || `${ id }.umd.min.js`;
50
+
51
+ url = `${ UI_PLUGIN_BASE_URL }/${ name }/${ version }/plugin/${ main }`;
52
+ }
53
+
54
+ return this.loadAsync(id, url);
55
+ },
56
+
38
57
  // Load a plugin from a UI package
39
58
  loadAsync(id, mainFile) {
40
59
  return new Promise((resolve, reject) => {
@@ -140,6 +159,23 @@ export default function({
140
159
  }
141
160
  },
142
161
 
162
+ async logout() {
163
+ const all = Object.keys(plugins);
164
+
165
+ for (let i = 0; i < all.length; i++) {
166
+ const name = all[i];
167
+
168
+ try {
169
+ await this.removePlugin(name);
170
+ } catch (e) {
171
+ console.error('Error removing plugin', e); // eslint-disable-line no-console
172
+ }
173
+ }
174
+
175
+ plugins = {};
176
+ pluginRoutes = new PluginRoutes(app.router);
177
+ },
178
+
143
179
  // Remove the plugin
144
180
  async removePlugin(name) {
145
181
  const plugin = Object.values(plugins).find(p => p.name === name);
package/core/types.ts CHANGED
@@ -73,6 +73,12 @@ export interface IPlugin {
73
73
  addRoute(route: RouteConfig): void;
74
74
  addRoute(parent: string, route: RouteConfig): void;
75
75
 
76
+ /**
77
+ * Set the component to use for the landing home page
78
+ * @param component Home page component
79
+ */
80
+ setHomePage(component: any): void;
81
+
76
82
  /**
77
83
  * Add routes to the Vue Router
78
84
  */
@@ -33,7 +33,8 @@
33
33
  "@types/node",
34
34
  "@nuxt/types",
35
35
  "cypress",
36
- "rancher"
36
+ "rancher",
37
+ "shell"
37
38
  ]
38
39
  },
39
40
  "exclude": [
package/creators/app/init CHANGED
@@ -1,13 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const fs = require('fs-extra');
4
3
  const path = require('path');
5
- const exec = require('child_process').exec;
4
+ const fs = require('fs-extra');
6
5
 
7
6
  const targets = {
8
- 'dev': './node_modules/.bin/nuxt dev',
9
- 'nuxt': './node_modules/.bin/nuxt',
10
- 'build': './node_modules/.bin/nuxt build'
7
+ dev: './node_modules/.bin/nuxt dev',
8
+ nuxt: './node_modules/.bin/nuxt',
9
+ build: './node_modules/.bin/nuxt build'
11
10
  };
12
11
 
13
12
  const files = [
@@ -30,8 +29,8 @@ if (args.length == 3) {
30
29
  const folder = path.resolve('.');
31
30
 
32
31
  appFolder = path.join(folder, name);
33
- console.log(` Creating application folder: ${ appFolder}`);
34
- fs.ensureDirSync(appFolder);
32
+ console.log(` Creating application folder: ${ appFolder }`);
33
+ fs.ensureDirSync(appFolder);
35
34
  }
36
35
 
37
36
  // Check that there is a package file
@@ -71,18 +70,23 @@ const creatorPkgData = fs.readFileSync(path.join(__dirname, 'package.json'));
71
70
  const creatorPkg = JSON.parse(creatorPkgData);
72
71
 
73
72
  pkg.dependencies['@rancher/shell'] = `^${ creatorPkg.version }`;
74
- pkg.dependencies['core-js'] = '^3.20.3';
75
- pkg.dependencies['css-loader'] = '4.3.0';
73
+
74
+ // Rest of dependencies are in the _pkgs property of package.json - copy then across
75
+ if (creatorPkg._pkgs) {
76
+ Object.keys(creatorPkg._pkgs).forEach((pkg) => {
77
+ pkg.dependencies[pkg] = creatorPkg._pkgs[pkg];
78
+ });
79
+ }
76
80
 
77
81
  fs.writeFileSync(path.join(appFolder, 'package.json'), JSON.stringify(pkg, null, 2));
78
82
 
79
83
  // Copy base files
80
84
  files.forEach((file) => {
81
- const src = path.join(__dirname, file);
85
+ const src = path.join(__dirname, 'files', file);
82
86
  const dest = path.join(appFolder, file);
83
87
 
84
88
  if (!fs.existsSync(dest)) {
85
- console.log(' Adding file: ' + file);
89
+ console.log(` Adding file: ${ file }`);
86
90
 
87
91
  const folder = path.dirname(file);
88
92
 
@@ -93,9 +97,4 @@ files.forEach((file) => {
93
97
  }
94
98
  });
95
99
 
96
- // require("child_process").spawn('yarn', ['install'], {
97
- // cwd: process.cwd(),
98
- // stdio: "inherit"
99
- // });
100
-
101
- console.log('');
100
+ console.log('');
@@ -13,6 +13,12 @@
13
13
  "engines": {
14
14
  "node": ">=12"
15
15
  },
16
+ "_requires": [
17
+ "core-js",
18
+ "css-loader",
19
+ "@types/lodash",
20
+ "@rancher/components"
21
+ ],
16
22
  "dependencies": {
17
23
  "fs-extra": "^10.0.0"
18
24
  }
File without changes
@@ -16,12 +16,16 @@
16
16
  "typeRoots": [
17
17
  "../../node_modules",
18
18
  "../../node_modules/@rancher/shell/types"
19
- ],
19
+ ],
20
20
  "types": [
21
21
  "node",
22
22
  "webpack-env",
23
+ "@types/node",
24
+ "@types/jest",
25
+ "@types/lodash",
23
26
  "@nuxt/types",
24
- "rancher"
27
+ "rancher",
28
+ "shell"
25
29
  ],
26
30
  "lib": [
27
31
  "esnext",
@@ -30,24 +34,21 @@
30
34
  "scripthost"
31
35
  ],
32
36
  "paths": {
33
- "@shell/core/*": [
34
- "../../node_modules/@rancher/shell/core/*"
35
- ],
36
- "@shell/config/*": [
37
- "../../node_modules/@rancher/shell/config/*"
37
+ "@shell/*": [
38
+ "../../node_modules/@rancher/shell/*"
38
39
  ],
39
- "@shell/store/*": [
40
- "../../node_modules/@rancher/shell/store/*"
40
+ "@components/*": [
41
+ "@rancher/components/*"
41
42
  ]
42
43
  }
43
44
  },
44
45
  "include": [
45
46
  "**/*.ts",
47
+ "**/*.d.ts",
46
48
  "**/*.tsx",
47
- "**/*.vue",
48
- "../../node_modules/@rancher/shell/core/types.ts"
49
+ "**/*.vue"
49
50
  ],
50
51
  "exclude": [
51
- "node_modules"
52
+ "../../node_modules"
52
53
  ]
53
54
  }
package/creators/pkg/init CHANGED
@@ -95,7 +95,7 @@ if (addTypeFolders) {
95
95
 
96
96
  // Copy base files
97
97
  files.forEach((file) => {
98
- const src = path.join(__dirname, file);
98
+ const src = path.join(__dirname, 'files', file);
99
99
  const dest = path.join(path.join(pkgFolder, file));
100
100
 
101
101
  if (!fs.existsSync(dest)) {
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env node
2
+
3
+ const path = require('path');
4
+ const fs = require('fs-extra');
5
+ const { spawnSync } = require('child_process');
6
+
7
+ const scriptFolder = __dirname;
8
+ const dest = path.resolve('.');
9
+
10
+ // Remove first two args
11
+ let args = process.argv;
12
+ args.splice(0, 2);
13
+
14
+ const res = spawnSync(`${__dirname}/upgrade`, args, {
15
+ cwd: dest,
16
+ shell: false,
17
+ stdio: [ 'ignore', process.stdout, process.stderr ],
18
+ });
19
+
20
+ if (res.status !== 0) {
21
+ process.exit(res.status);
22
+ }
23
+
24
+ // Read the existing package.json
25
+ let rawdata = fs.readFileSync(path.join(dest, 'package.json'));
26
+ const appPackage = JSON.parse(rawdata);
27
+
28
+ // Read the package.json from the app creator
29
+ rawdata = fs.readFileSync(path.join(scriptFolder, 'app', 'package.json'));
30
+ const latestPackage = JSON.parse(rawdata);
31
+
32
+ // Read the package.json from the upgrade creator
33
+ rawdata = fs.readFileSync(path.join(scriptFolder, 'package.json'));
34
+ const upgradePackage = JSON.parse(rawdata);
35
+
36
+ // Update dependency versions to match the latest from the creator
37
+ Object.keys(latestPackage.dependencies).forEach((key) => {
38
+ const version = latestPackage.dependencies[key];
39
+
40
+ appPackage.dependencies[key] = version;
41
+ });
42
+
43
+ // Update the version of @rancher/shell
44
+ const shellVersion = upgradePackage.version;
45
+
46
+ appPackage.dependencies['@rancher/shell'] = shellVersion;
47
+
48
+ fs.writeFileSync(path.join(dest, 'package.json'), JSON.stringify(appPackage, null, 2));
49
+
50
+ spawnSync(`yarn`, ['install'], {
51
+ cwd: dest,
52
+ shell: false,
53
+ stdio: [ 'ignore', process.stdout, process.stderr ],
54
+ });
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@rancher/create-update",
3
+ "description": "Rancher UI Update helper",
4
+ "version": "0.0.0",
5
+ "license": "Apache-2.0",
6
+ "author": "SUSE",
7
+ "private": false,
8
+ "bin": "./init",
9
+ "files": [
10
+ "**/*.*",
11
+ "init",
12
+ "upgrade"
13
+ ],
14
+ "engines": {
15
+ "node": ">=12"
16
+ },
17
+ "dependencies": {
18
+ "fs-extra": "^10.0.0"
19
+ }
20
+ }
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env sh
2
+
3
+ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
4
+
5
+ echo "Upgrading Rancher Shell"
6
+
7
+ # Get the version number from the package.json file
8
+ VERSION=$(node -p -e "require('${SCRIPT_DIR}/package.json').version")
9
+
10
+ echo "Updating to version: ${VERSION}"
11
+ echo ""
12
+
13
+ FORCE="false"
14
+
15
+ if [ "$1" == "-f" ]; then
16
+ FORCE="true"
17
+ fi
18
+
19
+ # Check for a clean git repository
20
+ if [ ! -d ".git" ] && [ "${FORCE}" == "false" ]; then
21
+ echo "Not runnning in a git repository. Re-run with -f to ignore this check"
22
+ echo "Note: This action will update yuor files - running in a git repsository will ensure you have visibility over changes made"
23
+ exit 1
24
+ fi
25
+
26
+ if [[ $(git diff --stat) != '' ]] && [ "${FORCE}" == "false" ]; then
27
+ echo "Git repository is not clean. Re-run with -f to ignore this check"
28
+ echo "Note: This action will update yuor files - running in a clean git repsository will ensure you have visibility over changes made"
29
+ exit 1
30
+ fi
31
+
32
+ # Check this is a Rancher Extension
33
+ if [ ! -f "./package.json" ]; then
34
+ echo "Can't find package.json - check you're running from the correct folder"
35
+ exit 1
36
+ fi
37
+
38
+ HAS_SHELL=$(grep "\"@rancher/shell\"" package.json -c )
39
+ if [ "${HAS_SHELL}" != "1" ]; then
40
+ echo "package.json does not reference @rancher/shell - check you're running from the correct folder"
41
+ exit 1
42
+ fi
43
+
44
+ # Copy files for the top-level folder (from the app creator)
45
+ cp ${SCRIPT_DIR}/app/files/* .
46
+
47
+ # Go through each folder in the pkg folder and update their files
48
+ for pkg in ./pkg/*
49
+ do
50
+ if [ -d "${pkg}" ]; then
51
+ pkgName=$(basename $pkg)
52
+ echo "Updating package ${pkgName}"
53
+
54
+ cp ${SCRIPT_DIR}/pkg/files/* ${pkg}
55
+ fi
56
+ done
@@ -0,0 +1,54 @@
1
+ Arguments:
2
+ /usr/local/bin/node /usr/local/Cellar/yarn/1.22.11/libexec/bin/yarn.js add @rancher/pkg@0.0.0
3
+
4
+ PATH:
5
+ /Users/nwm/.gem/ruby/3.1.2/bin:/Users/nwm/.rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/bin:/Users/nwm/.rubies/ruby-3.1.2/bin:/Users/nwm/.deno/bin:/usr/local/sbin:/opt/local/bin:/opt/local/sbin:/Users/nwm/.rd/bin:/Users/nwm/go/bin:/usr/local/bin:/Users/nwm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/usr/local/MacGPG2/bin:/Library/Apple/usr/bin:/Users/nwm/.deno/bin:/usr/local/sbin:/Users/nwm/google-cloud-sdk/bin:/opt/local/bin:/opt/local/sbin:/Users/nwm/.rd/bin:/Users/nwm/go/bin:/Users/nwm/bin:/Applications/Utilities/kdiff3.app/Contents/MacOS/:/Applications/Visual Studio Code.app/Contents/Resources/app/bin:/Applications/Utilities/kdiff3.app/Contents/MacOS/:/Applications/Visual Studio Code.app/Contents/Resources/app/bin
6
+
7
+ Yarn version:
8
+ 1.22.11
9
+
10
+ Node version:
11
+ 16.16.0
12
+
13
+ Platform:
14
+ darwin x64
15
+
16
+ Trace:
17
+ Error: https://registry.yarnpkg.com/@rancher%2fpkg: Not found
18
+ at Request.params.callback [as _callback] (/usr/local/Cellar/yarn/1.22.11/libexec/lib/cli.js:66992:18)
19
+ at Request.self.callback (/usr/local/Cellar/yarn/1.22.11/libexec/lib/cli.js:140763:22)
20
+ at Request.emit (node:events:527:28)
21
+ at Request.<anonymous> (/usr/local/Cellar/yarn/1.22.11/libexec/lib/cli.js:141735:10)
22
+ at Request.emit (node:events:527:28)
23
+ at IncomingMessage.<anonymous> (/usr/local/Cellar/yarn/1.22.11/libexec/lib/cli.js:141657:12)
24
+ at Object.onceWrapper (node:events:641:28)
25
+ at IncomingMessage.emit (node:events:539:35)
26
+ at endReadableNT (node:internal/streams/readable:1345:12)
27
+ at processTicksAndRejections (node:internal/process/task_queues:83:21)
28
+
29
+ npm manifest:
30
+ {
31
+ "name": "@rancher/create-app",
32
+ "description": "Rancher UI Upgrade helper",
33
+ "version": "0.0.0",
34
+ "license": "Apache-2.0",
35
+ "author": "SUSE",
36
+ "private": false,
37
+ "bin": "./init",
38
+ "files": [
39
+ "*.*",
40
+ "init"
41
+ ],
42
+ "engines": {
43
+ "node": ">=12"
44
+ },
45
+ "dependencies": {
46
+ "fs-extra": "^10.0.0"
47
+ }
48
+ }
49
+
50
+ yarn manifest:
51
+ No manifest
52
+
53
+ Lockfile:
54
+ No lockfile