From 83939c9214609fe2db4d24a7f1f4b90f369355d2 Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Mon, 12 Mar 2018 02:41:30 +0100 Subject: [PATCH] feat(ui): Plugin add search (wip) --- packages/@vue/cli-ui/package.json | 1 + .../cli-ui/src/assets/search-by-algolia.svg | 1 + .../src/components/InstantSearchInput.vue | 67 ++++++ .../components/InstantSearchPagination.vue | 67 ++++++ .../@vue/cli-ui/src/components/ItemLogo.vue | 103 +++++++++ .../cli-ui/src/components/ListItemInfo.vue | 26 ++- .../@vue/cli-ui/src/components/LoggerView.vue | 2 +- .../src/components/PackageSearchItem.vue | 94 ++++++++ .../@vue/cli-ui/src/components/ProjectNav.vue | 29 ++- .../src/components/ProjectPluginItem.vue | 33 +-- .../@vue/cli-ui/src/graphql-api/type-defs.js | 2 +- packages/@vue/cli-ui/src/main.js | 2 + packages/@vue/cli-ui/src/router.js | 6 + packages/@vue/cli-ui/src/style/main.styl | 37 +++ .../@vue/cli-ui/src/views/ProjectPlugins.vue | 1 + .../cli-ui/src/views/ProjectPluginsAdd.vue | 215 ++++++++++++++++++ yarn.lock | 97 +++++++- 17 files changed, 725 insertions(+), 58 deletions(-) create mode 100644 packages/@vue/cli-ui/src/assets/search-by-algolia.svg create mode 100644 packages/@vue/cli-ui/src/components/InstantSearchInput.vue create mode 100644 packages/@vue/cli-ui/src/components/InstantSearchPagination.vue create mode 100644 packages/@vue/cli-ui/src/components/ItemLogo.vue create mode 100644 packages/@vue/cli-ui/src/components/PackageSearchItem.vue create mode 100644 packages/@vue/cli-ui/src/views/ProjectPluginsAdd.vue diff --git a/packages/@vue/cli-ui/package.json b/packages/@vue/cli-ui/package.json index 40f864168e..8fa1cb618d 100644 --- a/packages/@vue/cli-ui/package.json +++ b/packages/@vue/cli-ui/package.json @@ -39,6 +39,7 @@ "vue": "^2.5.13", "vue-apollo": "^3.0.0-beta.5", "vue-cli-plugin-apollo": "^0.4.1", + "vue-instantsearch": "^1.5.1", "vue-router": "^3.0.1", "vue-template-compiler": "^2.5.13", "xterm": "^3.2.0" diff --git a/packages/@vue/cli-ui/src/assets/search-by-algolia.svg b/packages/@vue/cli-ui/src/assets/search-by-algolia.svg new file mode 100644 index 0000000000..989ed6ab8f --- /dev/null +++ b/packages/@vue/cli-ui/src/assets/search-by-algolia.svg @@ -0,0 +1 @@ +search-by-algolia \ No newline at end of file diff --git a/packages/@vue/cli-ui/src/components/InstantSearchInput.vue b/packages/@vue/cli-ui/src/components/InstantSearchInput.vue new file mode 100644 index 0000000000..f0a774c5d8 --- /dev/null +++ b/packages/@vue/cli-ui/src/components/InstantSearchInput.vue @@ -0,0 +1,67 @@ + + + + + diff --git a/packages/@vue/cli-ui/src/components/InstantSearchPagination.vue b/packages/@vue/cli-ui/src/components/InstantSearchPagination.vue new file mode 100644 index 0000000000..9a3f19597d --- /dev/null +++ b/packages/@vue/cli-ui/src/components/InstantSearchPagination.vue @@ -0,0 +1,67 @@ + + + + + diff --git a/packages/@vue/cli-ui/src/components/ItemLogo.vue b/packages/@vue/cli-ui/src/components/ItemLogo.vue new file mode 100644 index 0000000000..8b2387822a --- /dev/null +++ b/packages/@vue/cli-ui/src/components/ItemLogo.vue @@ -0,0 +1,103 @@ + + + + + diff --git a/packages/@vue/cli-ui/src/components/ListItemInfo.vue b/packages/@vue/cli-ui/src/components/ListItemInfo.vue index 87a5598fc6..c920646835 100644 --- a/packages/@vue/cli-ui/src/components/ListItemInfo.vue +++ b/packages/@vue/cli-ui/src/components/ListItemInfo.vue @@ -5,7 +5,11 @@ selected }" > -
{{ name }}
+
+ + {{ name }} + +
{{ description }} @@ -14,8 +18,10 @@ v-if="link" :href="link" target="_blank" + class="more-info" @click.stop="() => {}" > + More info
@@ -37,7 +43,7 @@ export default { name: { type: String, - required: true + default: null }, selected: { @@ -68,6 +74,22 @@ export default { svg fill @color + .more-info + color $vue-color-primary + padding 0 4px 0 2px + border-radius $br + .vue-icon + >>> svg + fill @color + &:hover + color $vue-color-light + background $vue-color-primary + .vue-icon + >>> svg + fill @color + &:active + background darken($vue-color-primary, 10%) + &.selected .name color $vue-color-primary diff --git a/packages/@vue/cli-ui/src/components/LoggerView.vue b/packages/@vue/cli-ui/src/components/LoggerView.vue index be4c58b0f4..de77ccb9d0 100644 --- a/packages/@vue/cli-ui/src/components/LoggerView.vue +++ b/packages/@vue/cli-ui/src/components/LoggerView.vue @@ -19,7 +19,7 @@ /> diff --git a/packages/@vue/cli-ui/src/components/PackageSearchItem.vue b/packages/@vue/cli-ui/src/components/PackageSearchItem.vue new file mode 100644 index 0000000000..55d2cfd9ff --- /dev/null +++ b/packages/@vue/cli-ui/src/components/PackageSearchItem.vue @@ -0,0 +1,94 @@ + + + + + diff --git a/packages/@vue/cli-ui/src/components/ProjectNav.vue b/packages/@vue/cli-ui/src/components/ProjectNav.vue index b936a9530f..42b2643de4 100644 --- a/packages/@vue/cli-ui/src/components/ProjectNav.vue +++ b/packages/@vue/cli-ui/src/components/ProjectNav.vue @@ -41,7 +41,6 @@ const BUILTIN_ROUTES = [ export default { data () { return { - currentRoute: null, routes: [ ...BUILTIN_ROUTES // Plugins routes here @@ -50,22 +49,22 @@ export default { } }, - watch: { - currentRoute (name) { - if (this.$route.name !== name) { - this.$router.push({ name }) - } - }, - - '$route.name': { - handler (value) { - if (value !== this.currentRoute) { - this.currentRoute = value - } + computed: { + currentRoute: { + get () { + const currentRoute = this.$route.name + const route = this.routes.find( + r => currentRoute.indexOf(r.name) === 0 + ) + return route ? route.name : null }, - immediate: true + set (name) { + if (this.$route.name !== name) { + this.$router.push({ name }) + } + } } - } + }, } diff --git a/packages/@vue/cli-ui/src/components/ProjectPluginItem.vue b/packages/@vue/cli-ui/src/components/ProjectPluginItem.vue index 1d7b4087bd..48ae8aef60 100644 --- a/packages/@vue/cli-ui/src/components/ProjectPluginItem.vue +++ b/packages/@vue/cli-ui/src/components/ProjectPluginItem.vue @@ -1,18 +1,6 @@ diff --git a/packages/@vue/cli-ui/src/views/ProjectPluginsAdd.vue b/packages/@vue/cli-ui/src/views/ProjectPluginsAdd.vue new file mode 100644 index 0000000000..73c37cad54 --- /dev/null +++ b/packages/@vue/cli-ui/src/views/ProjectPluginsAdd.vue @@ -0,0 +1,215 @@ + + + + + diff --git a/yarn.lock b/yarn.lock index 1c86395f7b..ac18195954 100644 --- a/yarn.lock +++ b/yarn.lock @@ -811,6 +811,10 @@ agent-base@^4.1.0: dependencies: es6-promisify "^5.0.0" +agentkeepalive@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/agentkeepalive/-/agentkeepalive-2.2.0.tgz#c5d1bd4b129008f1163f236f86e5faea2026e2ef" + ajv-keywords@^2.1.0: version "2.1.1" resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-2.1.1.tgz#617997fc5f60576894c435f940d819e135b80762" @@ -843,6 +847,35 @@ ajv@^6.1.0: fast-json-stable-stringify "^2.0.0" json-schema-traverse "^0.3.0" +algoliasearch-helper@^2.21.1: + version "2.24.0" + resolved "https://registry.yarnpkg.com/algoliasearch-helper/-/algoliasearch-helper-2.24.0.tgz#6ebf91683a82799bc4019ee1ad92d0ad0f41167b" + dependencies: + events "^1.1.0" + lodash "^4.13.1" + qs "^6.2.1" + util "^0.10.3" + +algoliasearch@^3.18.1: + version "3.25.1" + resolved "https://registry.yarnpkg.com/algoliasearch/-/algoliasearch-3.25.1.tgz#e543108b528e5c89338834473cb8fb082d13d11f" + dependencies: + agentkeepalive "^2.2.0" + debug "^2.6.8" + envify "^4.0.0" + es6-promise "^4.1.0" + events "^1.1.0" + foreach "^2.0.5" + global "^4.3.2" + inherits "^2.0.1" + isarray "^2.0.1" + load-script "^1.0.0" + object-keys "^1.0.11" + querystring-es3 "^0.2.1" + reduce "^1.0.1" + semver "^5.1.0" + tunnel-agent "^0.6.0" + align-text@^0.1.1, align-text@^0.1.3: version "0.1.4" resolved "https://registry.yarnpkg.com/align-text/-/align-text-0.1.4.tgz#0cd90a561093f35d0a99256c22b7069433fad117" @@ -3338,6 +3371,10 @@ dom-serializer@0: domelementtype "~1.1.1" entities "~1.1.1" +dom-walk@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/dom-walk/-/dom-walk-0.1.1.tgz#672226dc74c8f799ad35307df936aba11acd6018" + domain-browser@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.2.0.tgz#3d31f50191a6749dd1375a7f522e823d42e54eda" @@ -3533,6 +3570,13 @@ entities@^1.1.1, entities@~1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/entities/-/entities-1.1.1.tgz#6e5c2d0a5621b5dadaecef80b90edfb5cd7772f0" +envify@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/envify/-/envify-4.1.0.tgz#f39ad3db9d6801b4e6b478b61028d3f0b6819f7e" + dependencies: + esprima "^4.0.0" + through "~2.3.4" + errno@^0.1.3, errno@~0.1.7: version "0.1.7" resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.7.tgz#4684d71779ad39af177e3f007996f7c67c852618" @@ -3595,7 +3639,7 @@ es6-map@^0.1.3: es6-symbol "~3.1.1" event-emitter "~0.3.5" -es6-promise@^4.0.3: +es6-promise@^4.0.3, es6-promise@^4.1.0: version "4.2.4" resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.4.tgz#dc4221c2b16518760bd8c39a52d8f356fc00ed29" @@ -3631,7 +3675,7 @@ es6-weak-map@^2.0.1: es6-iterator "^2.0.1" es6-symbol "^3.1.1" -escape-html@~1.0.3: +escape-html@^1.0.3, escape-html@~1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" @@ -3911,7 +3955,7 @@ eventemitter3@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-2.0.3.tgz#b5e1079b59fb5e1ba2771c0a993be060a58c99ba" -events@^1.0.0, events@^1.1.1: +events@^1.0.0, events@^1.1.0, events@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/events/-/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924" @@ -4716,6 +4760,13 @@ global-dirs@^0.1.0: dependencies: ini "^1.3.4" +global@^4.3.2: + version "4.3.2" + resolved "https://registry.yarnpkg.com/global/-/global-4.3.2.tgz#e76989268a6c74c38908b1305b10fc0e394e9d0f" + dependencies: + min-document "^2.19.0" + process "~0.5.1" + globals@^11.0.1, globals@^11.1.0: version "11.3.0" resolved "https://registry.yarnpkg.com/globals/-/globals-11.3.0.tgz#e04fdb7b9796d8adac9c8f64c14837b2313378b0" @@ -5759,6 +5810,10 @@ isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" +isarray@^2.0.1: + version "2.0.4" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-2.0.4.tgz#38e7bcbb0f3ba1b7933c86ba1894ddfc3781bbb7" + isbinaryfile@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/isbinaryfile/-/isbinaryfile-3.0.2.tgz#4a3e974ec0cba9004d3fc6cde7209ea69368a621" @@ -6602,6 +6657,10 @@ load-json-file@^4.0.0: pify "^3.0.0" strip-bom "^3.0.0" +load-script@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/load-script/-/load-script-1.0.0.tgz#0491939e0bee5643ee494a7e3da3d2bac70c6ca4" + loader-fs-cache@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/loader-fs-cache/-/loader-fs-cache-1.0.1.tgz#56e0bf08bd9708b26a765b68509840c8dec9fdbc" @@ -7172,6 +7231,12 @@ mimic-fn@^1.0.0: version "1.2.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" +min-document@^2.19.0: + version "2.19.0" + resolved "https://registry.yarnpkg.com/min-document/-/min-document-2.19.0.tgz#7bd282e3f5842ed295bb748cdd9f1ffa2c824685" + dependencies: + dom-walk "^0.1.0" + minimalistic-assert@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.0.tgz#702be2dda6b37f4836bcb3f5db56641b64a1d3d3" @@ -7636,7 +7701,7 @@ object-hash@^1.1.4: version "1.2.0" resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-1.2.0.tgz#e96af0e96981996a1d47f88ead8f74f1ebc4422b" -object-keys@^1.0.8: +object-keys@^1.0.11, object-keys@^1.0.8, object-keys@~1.0.0: version "1.0.11" resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.11.tgz#c54601778ad560f1142ce0e01bcca8b56d13426d" @@ -8419,6 +8484,10 @@ process@^0.11.10: version "0.11.10" resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" +process@~0.5.1: + version "0.5.2" + resolved "https://registry.yarnpkg.com/process/-/process-0.5.2.tgz#1638d8a8e34c2f440a91db95ab9aeb677fc185cf" + progress@1.1.8, progress@^1.1.8: version "1.1.8" resolved "https://registry.yarnpkg.com/progress/-/progress-1.1.8.tgz#e260c78f6161cdd9b0e56cc3e0a85de17c7a57be" @@ -8537,7 +8606,7 @@ q@^1.1.2, q@^1.4.1, q@^1.5.1: version "1.5.1" resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7" -qs@6.5.1, qs@~6.5.1: +qs@6.5.1, qs@^6.2.1, qs@~6.5.1: version "6.5.1" resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.1.tgz#349cdf6eef89ec45c12d7d5eb3fc0c870343a6d8" @@ -8556,7 +8625,7 @@ query-string@^4.1.0: object-assign "^4.1.0" strict-uri-encode "^1.0.0" -querystring-es3@^0.2.0: +querystring-es3@^0.2.0, querystring-es3@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/querystring-es3/-/querystring-es3-0.2.1.tgz#9ec61f79049875707d69414596fd907a4d711e73" @@ -8767,6 +8836,12 @@ reduce-function-call@^1.0.1: dependencies: balanced-match "^0.4.2" +reduce@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/reduce/-/reduce-1.0.1.tgz#14fa2e5ff1fc560703a020cbb5fbaab691565804" + dependencies: + object-keys "~1.0.0" + reflect-metadata@^0.1.10: version "0.1.12" resolved "https://registry.yarnpkg.com/reflect-metadata/-/reflect-metadata-0.1.12.tgz#311bf0c6b63cd782f228a81abe146a2bfa9c56f2" @@ -10021,7 +10096,7 @@ through2@^2.0.0, through2@^2.0.2: readable-stream "^2.1.5" xtend "~4.0.1" -through@2, "through@>=2.2.7 <3", through@^2.3.4, through@^2.3.6, through@~2.3, through@~2.3.1: +through@2, "through@>=2.2.7 <3", through@^2.3.4, through@^2.3.6, through@~2.3, through@~2.3.1, through@~2.3.4: version "2.3.8" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" @@ -10678,6 +10753,14 @@ vue-hot-reload-api@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/vue-hot-reload-api/-/vue-hot-reload-api-2.3.0.tgz#97976142405d13d8efae154749e88c4e358cf926" +vue-instantsearch@^1.5.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/vue-instantsearch/-/vue-instantsearch-1.5.1.tgz#6a16b4e2de746a555bc096082cb43eb423355f8e" + dependencies: + algoliasearch "^3.18.1" + algoliasearch-helper "^2.21.1" + escape-html "^1.0.3" + vue-jest@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/vue-jest/-/vue-jest-2.1.1.tgz#7e78c7731cd581e88f275ae9b7faf8098e53dda0"