Skip to content

Commit 6bc5d72

Browse files
author
Guillaume Chau
committed
feat(ui): search fields
1 parent c167797 commit 6bc5d72

File tree

5 files changed

+66
-13
lines changed

5 files changed

+66
-13
lines changed

packages/@vue/cli-ui/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"@vue/cli-plugin-eslint": "^3.0.0-rc.3",
6262
"@vue/cli-service": "^3.0.0-rc.3",
6363
"@vue/eslint-config-standard": "^3.0.0-rc.3",
64-
"@vue/ui": "^0.4.5",
64+
"@vue/ui": "^0.4.6",
6565
"ansi_up": "^2.0.2",
6666
"cross-env": "^5.1.5",
6767
"eslint": "^4.16.0",

packages/@vue/cli-ui/src/views/ProjectConfigurations.vue

+19-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44
:title="$t('org.vue.views.project-configurations.title')"
55
class="limit-width"
66
>
7+
<template slot="actions">
8+
<VueInput
9+
v-model="search"
10+
icon-left="search"
11+
class="round"
12+
/>
13+
</template>
14+
715
<ApolloQuery
816
:query="require('../graphql/configurations.gql')"
917
class="fill-height"
@@ -49,6 +57,12 @@ export default {
4957
}
5058
},
5159
60+
data () {
61+
return {
62+
search: ''
63+
}
64+
},
65+
5266
bus: {
5367
quickOpenProject (project) {
5468
this.$apollo.getClient().writeQuery({
@@ -63,7 +77,11 @@ export default {
6377
methods: {
6478
generateItems (configurations) {
6579
if (!configurations) return []
66-
return configurations.map(
80+
81+
const reg = this.search && new RegExp(this.search, 'i')
82+
return configurations.filter(
83+
item => !reg || item.name.match(reg) || item.description.match(reg)
84+
).map(
6785
configuration => ({
6886
route: {
6987
name: 'project-configuration-details',

packages/@vue/cli-ui/src/views/ProjectPlugins.vue

+26-7
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
class="limit-width"
66
>
77
<template slot="actions">
8+
<VueInput
9+
v-model="search"
10+
icon-left="search"
11+
class="round"
12+
/>
13+
814
<VueButton
915
icon-left="add"
1016
:label="$t('org.vue.views.project-plugins.button')"
@@ -39,13 +45,20 @@
3945
class="overlay"
4046
/>
4147

42-
<div v-else-if="data" class="plugins">
43-
<ProjectPluginItem
44-
v-for="plugin of data.plugins"
45-
:key="plugin.id"
46-
:plugin="plugin"
47-
/>
48-
</div>
48+
<ListFilter
49+
v-else-if="data"
50+
class="plugins"
51+
:list="data.plugins"
52+
:filter="item => !search || item.id.includes(search)"
53+
>
54+
<template slot-scope="{ list }">
55+
<ProjectPluginItem
56+
v-for="plugin of list"
57+
:key="plugin.id"
58+
:plugin="plugin"
59+
/>
60+
</template>
61+
</ListFilter>
4962
</template>
5063
</ApolloQuery>
5164
</ContentView>
@@ -69,6 +82,12 @@ export default {
6982
}
7083
},
7184
85+
data () {
86+
return {
87+
search: ''
88+
}
89+
},
90+
7291
apollo: {
7392
projectCurrent: PROJECT_CURRENT
7493
},

packages/@vue/cli-ui/src/views/ProjectTasks.vue

+17-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
<ContentView
44
:title="$t('org.vue.views.project-tasks.title')"
55
>
6+
<template slot="actions">
7+
<VueInput
8+
v-model="search"
9+
icon-left="search"
10+
class="round"
11+
/>
12+
</template>
13+
614
<ApolloQuery
715
:query="require('../graphql/tasks.gql')"
816
class="fill-height"
@@ -50,6 +58,12 @@ export default {
5058
}
5159
},
5260
61+
data () {
62+
return {
63+
search: ''
64+
}
65+
},
66+
5367
apollo: {
5468
$subscribe: {
5569
taskChanged: {
@@ -72,7 +86,9 @@ export default {
7286
methods: {
7387
generateItems (tasks) {
7488
if (!tasks) return []
75-
return tasks.map(
89+
return tasks.filter(
90+
item => !this.search || item.name.includes(this.search)
91+
).map(
7692
task => ({
7793
route: {
7894
name: 'project-task-details',

yarn.lock

+3-3
Original file line numberDiff line numberDiff line change
@@ -1048,9 +1048,9 @@
10481048
dependencies:
10491049
lodash "^4.17.4"
10501050

1051-
"@vue/ui@^0.4.5":
1052-
version "0.4.5"
1053-
resolved "https://registry.yarnpkg.com/@vue/ui/-/ui-0.4.5.tgz#003334fd98e42ef600e8f3f3fbd98733e9a9fadd"
1051+
"@vue/ui@^0.4.6":
1052+
version "0.4.6"
1053+
resolved "https://registry.yarnpkg.com/@vue/ui/-/ui-0.4.6.tgz#bba955547435d7471fdb9c5379ac5cc19d45605d"
10541054
dependencies:
10551055
focus-visible "^4.1.4"
10561056
material-design-icons "^3.0.1"

0 commit comments

Comments
 (0)