@rancher/shell 0.1.3 → 0.1.4

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 (131) hide show
  1. package/assets/brand/suse/dark/rancher-logo.svg +1 -148
  2. package/assets/brand/suse/rancher-logo.svg +1 -130
  3. package/assets/images/featured/img1.jpg +0 -0
  4. package/assets/images/featured.jpg +0 -0
  5. package/assets/images/generic-plugin.svg +7 -0
  6. package/assets/styles/themes/_dark.scss +3 -0
  7. package/assets/styles/themes/_light.scss +3 -0
  8. package/assets/styles/themes/_suse.scss +1 -1
  9. package/assets/translations/en-us.yaml +183 -45
  10. package/assets/translations/zh-hans.yaml +21 -24
  11. package/components/AsyncButton.vue +17 -2
  12. package/components/ButtonDropdown.vue +4 -0
  13. package/components/Carousel.vue +291 -0
  14. package/components/CommunityLinks.vue +69 -18
  15. package/components/CruResource.vue +11 -3
  16. package/components/Dialog.vue +102 -0
  17. package/components/ExplorerMembers.vue +2 -4
  18. package/components/ExplorerProjectsNamespaces.vue +6 -7
  19. package/components/IconMessage.vue +9 -1
  20. package/components/LocaleSelector.vue +62 -29
  21. package/components/ResourceTable.vue +7 -2
  22. package/components/SimpleBox.vue +6 -4
  23. package/components/SortableTable/index.vue +11 -21
  24. package/components/Tabbed/Tab.vue +5 -0
  25. package/components/Tabbed/index.vue +29 -2
  26. package/components/auth/Principal.vue +1 -0
  27. package/components/fleet/FleetBundles.vue +8 -3
  28. package/components/fleet/FleetSummary.vue +6 -0
  29. package/components/form/KeyValue.vue +80 -58
  30. package/components/form/NameNsDescription.vue +10 -4
  31. package/components/form/ResourceTabs/index.vue +5 -1
  32. package/components/formatter/ClusterLink.vue +3 -7
  33. package/components/nav/NamespaceFilter.vue +3 -3
  34. package/components/nav/TopLevelMenu.vue +10 -28
  35. package/config/footer.js +13 -14
  36. package/config/labels-annotations.js +2 -1
  37. package/config/product/explorer.js +5 -4
  38. package/config/product/legacy.js +0 -47
  39. package/config/product/multi-cluster-apps.js +0 -12
  40. package/config/product/settings.js +12 -1
  41. package/config/product/uiplugins.js +17 -0
  42. package/config/settings.js +21 -2
  43. package/config/types.js +5 -1
  44. package/config/uiplugins.js +60 -0
  45. package/content/docs/en-us/getting-started.md +1 -26
  46. package/core/plugins.js +12 -0
  47. package/detail/provisioning.cattle.io.cluster.vue +3 -3
  48. package/detail/workload/index.vue +2 -2
  49. package/dialog/DiagnosticTimingsDialog.vue +116 -0
  50. package/dialog/RotateCertificatesDialog.vue +9 -3
  51. package/edit/auth/azuread.vue +28 -9
  52. package/edit/networking.k8s.io.ingress/index.vue +2 -2
  53. package/edit/persistentvolume/index.vue +3 -0
  54. package/edit/pod.vue +27 -0
  55. package/edit/provisioning.cattle.io.cluster/rke2.vue +76 -5
  56. package/edit/service.vue +7 -5
  57. package/edit/workload/__tests__/Upgrading.test.ts +1 -0
  58. package/edit/workload/index.vue +13 -1
  59. package/edit/workload/mixins/workload.js +13 -13
  60. package/edit/workload/storage/ContainerMountPaths.vue +240 -0
  61. package/edit/workload/storage/Mount.vue +1 -0
  62. package/edit/workload/storage/awsElasticBlockStore.vue +20 -1
  63. package/edit/workload/storage/azureDisk.vue +22 -2
  64. package/edit/workload/storage/azureFile.vue +20 -2
  65. package/edit/workload/storage/csi/index.vue +23 -1
  66. package/edit/workload/storage/gcePersistentDisk.vue +20 -2
  67. package/edit/workload/storage/index.vue +23 -49
  68. package/edit/workload/storage/vsphereVolume.vue +11 -1
  69. package/layouts/default.vue +14 -8
  70. package/layouts/home.vue +9 -4
  71. package/layouts/plain.vue +10 -5
  72. package/list/management.cattle.io.setting.vue +3 -3
  73. package/list/provisioning.cattle.io.cluster.vue +1 -1
  74. package/machine-config/harvester.vue +5 -3
  75. package/models/catalog.cattle.io.uiplugin.js +34 -0
  76. package/models/cluster/node.js +25 -2
  77. package/models/fleet.cattle.io.bundle.js +1 -1
  78. package/models/harvesterhci.io.management.cluster.js +11 -5
  79. package/models/provisioning.cattle.io.cluster.js +12 -6
  80. package/models/workload.js +5 -3
  81. package/nuxt.config.js +69 -25
  82. package/package.json +108 -109
  83. package/pages/auth/login.vue +1 -1
  84. package/pages/c/_cluster/apps/charts/index.vue +46 -1
  85. package/pages/c/_cluster/apps/charts/install.vue +10 -9
  86. package/pages/c/_cluster/explorer/index.vue +72 -9
  87. package/pages/c/_cluster/explorer/tools/index.vue +12 -5
  88. package/pages/c/_cluster/mcapps/index.vue +1 -1
  89. package/pages/c/_cluster/settings/brand.vue +0 -40
  90. package/pages/c/_cluster/settings/links.vue +200 -0
  91. package/pages/c/_cluster/uiplugins/DeveloperInstallDialog.vue +232 -0
  92. package/pages/c/_cluster/uiplugins/InstallDialog.vue +242 -0
  93. package/pages/c/_cluster/uiplugins/PluginInfoPanel.vue +284 -0
  94. package/pages/c/_cluster/uiplugins/RemoveUIPlugins.vue +130 -0
  95. package/pages/c/_cluster/uiplugins/SetupUIPlugins.vue +253 -0
  96. package/pages/c/_cluster/uiplugins/UninstallDialog.vue +115 -0
  97. package/pages/c/_cluster/uiplugins/index.vue +694 -0
  98. package/pages/diagnostic.vue +185 -101
  99. package/pages/docs/_doc.vue +3 -1
  100. package/pages/home.vue +21 -56
  101. package/pages/prefs.vue +108 -88
  102. package/pages/safeMode.vue +17 -0
  103. package/pages/support/index.vue +23 -15
  104. package/pkg/dynamic-importer.lib.js +4 -0
  105. package/plugins/dashboard-store/resource-class.js +2 -2
  106. package/plugins/formatters.js +15 -0
  107. package/plugins/plugin.js +56 -4
  108. package/plugins/steve/mutations.js +1 -1
  109. package/plugins/steve/subscribe.js +94 -72
  110. package/plugins/steve/web-worker.steve-sub-worker.js +24 -15
  111. package/promptRemove/management.cattle.io.globalrole.vue +47 -0
  112. package/promptRemove/management.cattle.io.roletemplate.vue +47 -0
  113. package/promptRemove/mixin/roleDeletionCheck.js +97 -0
  114. package/scripts/publish-shell.sh +1 -1
  115. package/scripts/sync-shell-deps +37 -0
  116. package/store/catalog.js +9 -8
  117. package/store/i18n.js +10 -1
  118. package/store/prefs.js +16 -0
  119. package/store/type-map.js +32 -5
  120. package/store/uiplugins.ts +15 -61
  121. package/utils/__tests__/object.test.ts +0 -24
  122. package/utils/__tests__/selector.test.ts +1 -1
  123. package/utils/dynamic-importer.js +4 -0
  124. package/utils/grafana.js +2 -6
  125. package/utils/socket.js +41 -20
  126. package/utils/string.js +1 -7
  127. package/utils/validators/formRules/__tests__/index.test.ts +108 -0
  128. package/utils/validators/formRules/index.ts +9 -1
  129. package/yarn-error.log +195 -0
  130. package/pages/plugins.vue +0 -387
  131. package/server/verdaccio-middleware.js +0 -56
package/yarn-error.log ADDED
@@ -0,0 +1,195 @@
1
+ Arguments:
2
+ /usr/local/bin/node /usr/local/Cellar/yarn/1.22.11/libexec/bin/yarn.js publish . --new-version 0.1.4 --no-git-tag-version --access public
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:/Users/nwm/google-cloud-sdk/bin:/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:/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: canceled
18
+ at Interface.<anonymous> (/usr/local/Cellar/yarn/1.22.11/libexec/lib/cli.js:137023:13)
19
+ at Interface.emit (node:events:527:28)
20
+ at Interface._ttyWrite (node:readline:1081:16)
21
+ at ReadStream.onkeypress (node:readline:288:10)
22
+ at ReadStream.emit (node:events:527:28)
23
+ at emitKeys (node:internal/readline/utils:358:14)
24
+ at emitKeys.next (<anonymous>)
25
+ at ReadStream.onData (node:internal/readline/emitKeypressEvents:61:36)
26
+ at ReadStream.emit (node:events:527:28)
27
+ at addChunk (node:internal/streams/readable:315:12)
28
+
29
+ npm manifest:
30
+ {
31
+ "name": "@rancher/shell",
32
+ "version": "0.1.4",
33
+ "description": "Rancher Dashboard Shell",
34
+ "repository": "https://github.com/rancherlabs/dashboard",
35
+ "license": "Apache-2.0",
36
+ "author": "SUSE",
37
+ "private": false,
38
+ "engines": {
39
+ "node": ">=12"
40
+ },
41
+ "files": [
42
+ "**/*"
43
+ ],
44
+ "scripts": {
45
+ "clean": "./scripts/clean",
46
+ "lint": "./node_modules/.bin/eslint --max-warnings 0 --ext .ts,.js,.vue .",
47
+ "test": "./node_modules/.bin/nyc ava --serial --verbose",
48
+ "nuxt": "./node_modules/.bin/nuxt",
49
+ "dev": "./node_modules/.bin/nuxt dev",
50
+ "mem-dev": "node --max-old-space-size=8192 ./node_modules/.bin/nuxt dev",
51
+ "docker-dev": "docker run --rm --name dashboard-dev -p 8005:8005 -e API=$API -v $(pwd):/src -v dashboard_node:/src/node_modules rancher/dashboard:dev",
52
+ "build": "./node_modules/.bin/nuxt build --devtools",
53
+ "analyze": "./node_modules/.bin/nuxt build --analyze",
54
+ "start": "./node_modules/.bin/nuxt start",
55
+ "generate": "./node_modules/.bin/nuxt generate",
56
+ "dev-debug": "node --inspect ./node_modules/.bin/nuxt",
57
+ "cy:run": "cypress run",
58
+ "cy:open": "cypress open",
59
+ "e2e:pre": "NODE_ENV=dev yarn build",
60
+ "e2e:run": "NODE_ENV=dev START_SERVER_AND_TEST_INSECURE=1 start-server-and-test start https://localhost:8005/ cy:run",
61
+ "e2e:dev": "start-server-and-test dev https://localhost:8005 cy:open"
62
+ },
63
+ "dependencies": {
64
+ "@aws-sdk/client-ec2": "3.1.0",
65
+ "@aws-sdk/client-eks": "3.1.0",
66
+ "@aws-sdk/client-kms": "3.8.1",
67
+ "@babel/plugin-proposal-optional-chaining": "7.14.5",
68
+ "@babel/plugin-proposal-private-property-in-object": "7.14.5",
69
+ "@babel/preset-typescript": "7.16.7",
70
+ "@innologica/vue-dropdown-menu": "0.1.3",
71
+ "@novnc/novnc": "1.2.0",
72
+ "@nuxt/types": "2.14.6",
73
+ "@nuxt/typescript-build": "2.1.0",
74
+ "@nuxtjs/axios": "5.12.0",
75
+ "@nuxtjs/eslint-config-typescript": "6.0.1",
76
+ "@nuxtjs/eslint-module": "1.2.0",
77
+ "@nuxtjs/proxy": "1.3.3",
78
+ "@nuxtjs/style-resources": "1.2.1",
79
+ "@nuxtjs/webpack-profile": "0.1.0",
80
+ "@popperjs/core": "2.4.4",
81
+ "@types/node": "16.4.3",
82
+ "@typescript-eslint/eslint-plugin": "4.33.0",
83
+ "@typescript-eslint/parser": "4.33.0",
84
+ "@vue/cli-plugin-babel": "4.5.15",
85
+ "@vue/cli-plugin-typescript": "4.5.15",
86
+ "@vue/cli-service": "4.5.15",
87
+ "@vue/test-utils": "1.2.1",
88
+ "@vue/vue2-jest": "27.0.0",
89
+ "add": "2.0.6",
90
+ "ansi_up": "5.0.0",
91
+ "babel-eslint": "10.1.0",
92
+ "babel-plugin-module-resolver": "4.0.0",
93
+ "babel-preset-vue": "2.0.2",
94
+ "browser-env": "3.3.0",
95
+ "cookie": "0.5.0",
96
+ "cookie-universal-nuxt": "2.1.4",
97
+ "core-js": "3.21.1",
98
+ "cron-validator": "1.2.0",
99
+ "cronstrue": "1.95.0",
100
+ "cross-env": "6.0.3",
101
+ "css-loader": "4.3.0",
102
+ "csv-loader": "3.0.3",
103
+ "cypress": "10.3.1",
104
+ "d3": "7.3.0",
105
+ "d3-selection": "1.4.1",
106
+ "dagre-d3": "0.6.4",
107
+ "dayjs": "1.8.29",
108
+ "diff2html": "2.11.2",
109
+ "dompurify": "2.0.12",
110
+ "eslint": "7.32.0",
111
+ "eslint-config-standard": "16.0.3",
112
+ "eslint-import-resolver-node": "0.3.4",
113
+ "eslint-module-utils": "2.6.1",
114
+ "eslint-plugin-cypress": "2.12.1",
115
+ "eslint-plugin-import": "2.23.4",
116
+ "eslint-plugin-jest": "24.4.0",
117
+ "eslint-plugin-n": "15.2.0",
118
+ "eslint-plugin-vue": "7.14.0",
119
+ "event-target-shim": "5.0.1",
120
+ "express": "4.17.1",
121
+ "file-saver": "2.0.2",
122
+ "frontmatter-markdown-loader": "3.7.0",
123
+ "identicon.js": "2.3.3",
124
+ "intl-messageformat": "7.8.4",
125
+ "is-url": "1.2.4",
126
+ "jest": "27.5.1",
127
+ "jest-serializer-vue": "2.0.2",
128
+ "jexl": "2.2.2",
129
+ "jquery": "3.5.1",
130
+ "js-cookie": "2.2.1",
131
+ "js-yaml": "4.1.0",
132
+ "js-yaml-loader": "1.2.2",
133
+ "jsdiff": "1.1.1",
134
+ "jsdom-global": "3.0.2",
135
+ "jsonpath-plus": "6.0.1",
136
+ "jsrsasign": "10.2.0",
137
+ "jszip": "3.7.0",
138
+ "lodash": "4.17.21",
139
+ "marked": "4.0.17",
140
+ "nodemon": "2.0.4",
141
+ "nuxt": "2.15.8",
142
+ "nyc": "15.1.0",
143
+ "papaparse": "5.3.0",
144
+ "portal-vue": "2.1.7",
145
+ "rancher-icons": "rancher/icons#v2.0.3",
146
+ "require-extension-hooks": "0.3.3",
147
+ "require-extension-hooks-babel": "1.0.0",
148
+ "require-extension-hooks-vue": "3.0.0",
149
+ "sass": "1.51.0",
150
+ "sass-loader": "10.2.1",
151
+ "serve-static": "1.14.1",
152
+ "set-cookie-parser": "2.4.6",
153
+ "shell-quote": "1.7.3",
154
+ "sinon": "8.1.1",
155
+ "start-server-and-test": "1.13.1",
156
+ "style-loader": "1.2.1",
157
+ "ts-node": "8.10.2",
158
+ "typescript": "4.1.6",
159
+ "url-parse": "1.5.10",
160
+ "v-tooltip": "2.0.3",
161
+ "vue": "2.6.14",
162
+ "vue-clipboard2": "0.3.1",
163
+ "vue-codemirror": "4.0.6",
164
+ "vue-js-modal": "1.3.35",
165
+ "vue-resize": "0.4.5",
166
+ "vue-select": "3.18.3",
167
+ "vue-server-renderer": "2.6.14",
168
+ "vue-shortkey": "3.1.7",
169
+ "vue-template-compiler": "2.6.14",
170
+ "vue2-transitions": "0.3.0",
171
+ "vuedraggable": "2.24.3",
172
+ "vuex": "3.6.2",
173
+ "webpack-bundle-analyzer": "4.5.0",
174
+ "webpack-virtual-modules": "0.4.3",
175
+ "xterm": "4.9.0",
176
+ "xterm-addon-fit": "0.4.0",
177
+ "xterm-addon-search": "0.7.0",
178
+ "xterm-addon-web-links": "0.4.0",
179
+ "xterm-addon-webgl": "0.9.0",
180
+ "worker-loader": "3.0.8",
181
+ "yarn": "1.22.18"
182
+ },
183
+ "nyc": {
184
+ "extension": [
185
+ ".js",
186
+ ".vue"
187
+ ]
188
+ }
189
+ }
190
+
191
+ yarn manifest:
192
+ No manifest
193
+
194
+ Lockfile:
195
+ No lockfile
package/pages/plugins.vue DELETED
@@ -1,387 +0,0 @@
1
- <script>
2
- import { mapGetters } from 'vuex';
3
- import { LabeledInput } from '@components/Form/LabeledInput';
4
-
5
- export default {
6
- components: { LabeledInput },
7
- data() {
8
- return {
9
- name: '',
10
- location: '',
11
- catalogUrl: '',
12
- view: 'installed',
13
- dialogOpen: false,
14
- catalogDialogOpen: false,
15
- canModifyName: true,
16
- canModifyLocation: true,
17
- };
18
- },
19
- layout: 'plain',
20
- async fetch() {
21
- await this.$store.dispatch('uiplugins/loadCatalogs');
22
- },
23
- computed: {
24
- ...mapGetters({ plugins: 'uiplugins/plugins' }),
25
- ...mapGetters({ catalog: 'uiplugins/catalog' }),
26
- list() {
27
- // Get installed plugins and mark up the list
28
- const pMap = {};
29
- const list = [];
30
- // Map of plugins in the catalog
31
- const cMap = {};
32
-
33
- this.plugins.forEach((p) => {
34
- pMap[p.name] = p;
35
- });
36
-
37
- this.catalog.forEach((catalogItem) => {
38
- const item = { ...catalogItem };
39
-
40
- list.push(item);
41
- cMap[item.name] = true;
42
-
43
- item.installed = pMap[item.name]?.metadata;
44
- item.builtin = !!pMap[item.name]?.builtin;
45
- item.displayVersion = item.installed ? item.installed.version : item.version;
46
- item.icon = item.installed?.icon;
47
- item.download = `/download-pkg/${ item.name }-${ item.version }`;
48
-
49
- if (item.installed) {
50
- if (item.installed.version !== item.version) {
51
- // TODO: Only if newer
52
- item.upgrade = item.version;
53
- }
54
- }
55
- });
56
-
57
- this.plugins.forEach((p) => {
58
- if (!cMap[p.name]) {
59
- // Plugin is installed but not in the catalog, so add item for it
60
- list.push({
61
- ...p.metadata,
62
- installed: true,
63
- builtin: p.builtin,
64
- displayVersion: p.metadata?.version,
65
- icon: p.metadata?.icon
66
- });
67
- }
68
- });
69
-
70
- return list;
71
- }
72
- },
73
- watch: {
74
- name(neu, old) {
75
- if (this.canModifyLocation) {
76
- this.location = `/pkg/${ neu }/${ neu }.umd.min.js`;
77
- }
78
- },
79
- location(neu, old) {
80
- if (this.canModifyName) {
81
- const names = neu.split('/');
82
- let last = names[names.length - 1];
83
- const index = last.indexOf('.umd.min.js');
84
-
85
- if (index !== -1) {
86
- last = last.substr(0, index);
87
- }
88
-
89
- this.name = last;
90
- }
91
- }
92
- },
93
- methods: {
94
- updateName(v) {
95
- this.canModifyName = v.length === 0;
96
- },
97
- updateLocation(v) {
98
- this.canModifyLocation = v.length === 0;
99
- },
100
- showAddDialog() {
101
- this.dialogOpen = true;
102
- this.$modal.show('addPluginDialog');
103
- },
104
-
105
- closeAddDialog() {
106
- this.dialogOpen = false;
107
- this.$modal.hide('addPluginDialog');
108
- },
109
-
110
- showAddCatalogDialog() {
111
- this.catalogDialogOpen = true;
112
- this.$modal.show('addCatlogDialog');
113
- },
114
- closeAddCatalogDialog() {
115
- this.catalogDialogOpen = false;
116
- this.$modal.hide('addCatlogDialog');
117
- },
118
-
119
- addCatalog() {
120
- this.$store.dispatch('uiplugins/addCatalog', this.catalogUrl);
121
- this.$store.dispatch('uiplugins/loadCatalogs');
122
- this.closeAddCatalogDialog();
123
- },
124
-
125
- loadPlugin() {
126
- this.load(this.name, this.location);
127
- },
128
-
129
- load(name, url) {
130
- if (!name) {
131
- const parts = url.split('/');
132
- const n = parts[parts.length - 1];
133
-
134
- name = n.split('.')[0];
135
- }
136
-
137
- this.$plugin.loadAsync(name, url).then(() => {
138
- this.closeAddDialog();
139
- this.$store.dispatch('growl/success', {
140
- title: `Loaded plugin ${ name }`,
141
- message: `Plugin was loaded successfully`,
142
- timeout: 3000,
143
- }, { root: true });
144
- }).catch((error) => {
145
- this.closeAddDialog();
146
- const message = typeof error === 'object' ? 'Could not load code' : error;
147
-
148
- this.$store.dispatch('growl/error', {
149
- title: 'Error loading plugin',
150
- message,
151
- timeout: 5000
152
- }, { root: true });
153
- });
154
- },
155
-
156
- async install(plugin) {
157
- // Might need to download the package first
158
- if (plugin.download) {
159
- await this.$store.dispatch('rancher/request', { url: plugin.download }, { root: true });
160
- }
161
-
162
- const name = `${ plugin.name }-${ plugin.version }`;
163
- let moduleUrl = `/pkg/${ name }/${ name }.umd.min.js`;
164
-
165
- if (plugin.location) {
166
- moduleUrl = `${ plugin.location }/${ name }/${ name }.umd.min.js`;
167
- }
168
-
169
- this.load(name, moduleUrl);
170
- },
171
-
172
- uninstall(plugin) {
173
- this.$plugin.removePlugin(plugin.name);
174
- }
175
- }
176
- };
177
- </script>
178
-
179
- <template>
180
- <div class="plugins">
181
- <div class="plugin-header">
182
- <h2>Plugins</h2>
183
- <button class="btn role-primary mr-10" @click="showAddCatalogDialog()">
184
- Add Catalog
185
- </button>
186
- <button class="btn role-primary" @click="showAddDialog()">
187
- Load
188
- </button>
189
- </div>
190
- <br />
191
- <div class="plugin-list">
192
- <div v-for="plugin in list" :key="plugin.name" class="plugin">
193
- <div class="plugin-icon">
194
- <img v-if="plugin.icon" :src="plugin.icon" class="icon plugin-icon-img" />
195
- <i v-else class="icon icon-apps"></i>
196
- </div>
197
- <div class="plugin-metadata">
198
- <div class="plugin-name">
199
- {{ plugin.name }}
200
- </div>
201
- <div>{{ plugin.description }}</div>
202
- <div v-if="plugin.builtin" class="plugin-builtin">
203
- Built-in plugin
204
- </div>
205
- <div class="plugin-version">
206
- {{ plugin.displayVersion }}
207
- </div>
208
- <div v-if="plugin.installed">
209
- <!-- <div>{{ plugin.installed.version }}</div> -->
210
- <div class="plugin-actions">
211
- <button class="btn role-secondary" @click="uninstall(plugin)">
212
- Uninstall
213
- </button>
214
- </div>
215
- </div>
216
- <div v-else class="plugin-actions">
217
- <button class="btn role-secondary" @click="install(plugin)">
218
- Install
219
- </button>
220
- </div>
221
- </div>
222
- </div>
223
- </div>
224
-
225
- <modal
226
- name="addPluginDialog"
227
- height="auto"
228
- :scrollable="true"
229
- @closed="closeAddDialog()"
230
- >
231
- <div class="plugin-add-dialog">
232
- <h4 class="mt-20">
233
- Load Plugin
234
- </h4>
235
- <div class="custom">
236
- <div class="fields">
237
- <LabeledInput v-model="name" v-focus label="Plugin module name" @input="updateName" />
238
- </div>
239
- </div>
240
- <div class="custom mt-10">
241
- <div class="fields">
242
- <LabeledInput v-model="location" label="Plugin URL" @input="updateLocation" />
243
- </div>
244
- <div class="dialog-buttons">
245
- <button class="btn role-secondary" @click="closeAddDialog()">
246
- Cancel
247
- </button>
248
- <button class="btn role-primary" @click="loadPlugin()">
249
- Load Plugin
250
- </button>
251
- </div>
252
- </div>
253
- </div>
254
- </modal>
255
-
256
- <modal
257
- name="addCatlogDialog"
258
- height="auto"
259
- :scrollable="true"
260
- @closed="closeAddCatalogDialog()"
261
- >
262
- <div class="plugin-add-dialog">
263
- <h4 class="mt-20">
264
- Add Plugin Catalog
265
- </h4>
266
- <div class="custom mt-10">
267
- <div class="fields">
268
- <LabeledInput v-model="catalogUrl" label="Catalog URL" />
269
- </div>
270
- <div class="dialog-buttons">
271
- <button class="btn role-secondary" @click="closeAddCatalogDialog()">
272
- Cancel
273
- </button>
274
- <button class="btn role-primary" @click="addCatalog()">
275
- Add
276
- </button>
277
- </div>
278
- </div>
279
- </div>
280
- </modal>
281
- </div>
282
- </template>
283
-
284
- <style lang="scss" scoped>
285
- .plugin-list {
286
- display: flex;
287
- > .plugin:not(:last-child) {
288
- margin-right: 20px;
289
- }
290
- }
291
- .plugins {
292
- display: inherit;
293
- }
294
-
295
- .plugin-add-dialog {
296
- padding: 10px;
297
-
298
- .dialog-buttons {
299
- display: flex;
300
- justify-content: flex-end;
301
-
302
- > *:not(:last-child) {
303
- margin-right: 10px;
304
- }
305
- }
306
- }
307
-
308
- .plugin-header {
309
- display: flex;
310
- align-items: center;
311
- margin-bottom: 10px;
312
-
313
- > h2 {
314
- flex: 1;
315
- margin-bottom: 0;
316
- }
317
- }
318
-
319
- .plugin {
320
- display: flex;
321
- border: 1px solid var(--border);
322
- padding: 10px;
323
- width: 320px;
324
-
325
- .plugin-icon {
326
- font-size: 40px;
327
- margin-right:10px;
328
- color: #888;
329
-
330
- .plugin-icon-img {
331
- height: 40px;
332
- width: 40px;
333
- }
334
- }
335
-
336
- .plugin-metadata {
337
- flex: 1;
338
- }
339
-
340
- .plugin-builtin {
341
- color: var(--primary);
342
- display: block;
343
- padding: 2px 0;
344
- text-transform: uppercase;
345
- }
346
-
347
- .plugin-name {
348
- font-size: 16px;
349
- font-weight: bold;
350
- }
351
-
352
- .plugin-version {
353
- border: 1px solid var(--primary);
354
- display: inline-block;
355
- font-size: 12px;
356
- padding: 2px 5px;
357
- border-radius: 4px;
358
- margin: 5px 0;
359
- }
360
-
361
- .plugin-actions {
362
- display: flex;
363
- justify-content: flex-end;
364
-
365
- .btn {
366
- line-height: 20px;
367
- min-height: 20px;
368
- padding: 0 5px;
369
- }
370
- }
371
- }
372
-
373
- .fields {
374
- display: flex;
375
- // > div:first-child {
376
- // width: 260px;
377
- // margin-right: 20px;
378
- // }
379
- }
380
-
381
- .custom {
382
- button {
383
- margin-top: 10px;
384
- }
385
- }
386
-
387
- </style>
@@ -1,56 +0,0 @@
1
- import http from 'http';
2
- import path from 'path';
3
- import fs from 'fs-extra';
4
- import tar from 'tar';
5
-
6
- export default function(req, res, next) {
7
- if (req.url.startsWith('/download-pkg')) {
8
- const urlp = req.url.split('/');
9
- const pkg = urlp[urlp.length - 1];
10
- const name = pkg.split('-')[0];
11
-
12
- const downloadFolder = path.resolve(__dirname, '..', '..', 'dist-pkg');
13
- const pkgFolder = path.resolve(downloadFolder, pkg);
14
-
15
- // If the package is already there, use that
16
- if (fs.existsSync(pkgFolder)) {
17
- res.statusCode = 200;
18
- res.write('OK');
19
-
20
- return res.end();
21
- }
22
-
23
- // Need to download
24
- const url = `http://127.0.0.1:4873/${ name }/-/${ pkg }.tgz`;
25
- const destPath = path.join(downloadFolder, `${ pkg }.tgz`);
26
- const dest = fs.createWriteStream(destPath);
27
-
28
- dest.on('open', () => {
29
- http.get(url, (response) => {
30
- response.pipe(dest);
31
- }).on('error', () => {
32
- fs.unlink(dest);
33
- res.status = 500;
34
- res.write('ERROR');
35
- res.end();
36
- });
37
- });
38
-
39
- dest.on('finish', () => {
40
- dest.close(() => {
41
- fs.ensureDirSync(pkgFolder);
42
- tar.x({
43
- file: destPath,
44
- strip: 1,
45
- C: pkgFolder
46
- }).then(() => {
47
- res.statusCode = 200;
48
- res.write('OK');
49
- res.end();
50
- });
51
- });
52
- });
53
- } else {
54
- next();
55
- }
56
- }