Skip to content

Commit b6fc325

Browse files
committed
Implemented UI for pipeline search. TODO implement backend
1 parent 50ff077 commit b6fc325

File tree

5 files changed

+108
-22
lines changed

5 files changed

+108
-22
lines changed

frontend/client/components/layout/AppMain.vue

+2
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,7 @@ export default {
4848
4949
.app-content {
5050
padding: 20px;
51+
z-index: 0;
52+
padding-top: 90px;
5153
}
5254
</style>

frontend/client/components/layout/Navbar.vue

+85-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,25 @@
77
<i class="fa fa-search fa-lg" aria-hidden="true"/>
88
</div>
99
<div>
10-
<input class="borderless-search" type="text" placeholder="Find pipeline ..." v-model="search">
10+
<input class="borderless-search" type="text" placeholder="Find pipeline ..." v-model="search" @input="onChange">
11+
<ul id="autocomplete-results" v-show="resultsOpen" class="autocomplete-results">
12+
<li class="autocomplete-result" v-for="(result, i) in results" :key="i">
13+
<div class="results-bg">
14+
<div class="box box-bg">
15+
<article class="media">
16+
<div class="media-left">
17+
<div class="avatar">
18+
<img src="~assets/golang.png">
19+
</div>
20+
</div>
21+
<div class="media-content" style="margin-top: 7px;">
22+
{{ result.name }}
23+
</div>
24+
</article>
25+
</div>
26+
</div>
27+
</li>
28+
</ul>
1129
</div>
1230
<div class="navbar-button">
1331
<a class="button is-primary" @click="createPipeline">
@@ -46,7 +64,9 @@ export default {
4664
4765
data () {
4866
return {
49-
search: ''
67+
search: '',
68+
resultsOpen: false,
69+
results: {}
5070
}
5171
},
5272
@@ -66,6 +86,11 @@ export default {
6686
6787
mounted () {
6888
this.reload()
89+
document.addEventListener('click', this.handleClickOutside)
90+
},
91+
92+
destroyed () {
93+
document.removeEventListener('click', this.handleClickOutside)
6994
},
7095
7196
watch: {
@@ -82,6 +107,29 @@ export default {
82107
window.location.reload()
83108
},
84109
110+
onChange () {
111+
this.$emit('input', this.search)
112+
113+
// Fake search
114+
this.results = [
115+
{
116+
name: 'Test 1',
117+
id: 1
118+
},
119+
{
120+
name: 'Test 2',
121+
id: 2
122+
}
123+
]
124+
this.resultsOpen = true
125+
},
126+
127+
handleClickOutside (evt) {
128+
if (!this.$el.contains(evt.target)) {
129+
this.resultsOpen = false
130+
}
131+
},
132+
85133
logout () {
86134
this.$router.push('/')
87135
this.$store.commit('clearIntervals')
@@ -181,7 +229,7 @@ export default {
181229
}
182230
183231
.app-navbar {
184-
position: static;
232+
position: fixed;
185233
min-width: 100%;
186234
height: 70px;
187235
z-index: 1024 - 1;
@@ -206,4 +254,38 @@ export default {
206254
padding-right: 15px;
207255
padding-top: 7px;
208256
}
257+
258+
.autocomplete-results {
259+
position: absolute;
260+
z-index: 2500;
261+
padding: 0;
262+
margin: 0;
263+
left: 210px;
264+
max-width: 350px;
265+
box-shadow: 20px 0 30px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(255, 255, 255, 0.19);
266+
height: 177px;
267+
overflow: auto;
268+
width: 350px;
269+
background-color: #2a2735 !important;
270+
271+
}
272+
273+
.autocomplete-result {
274+
list-style: none;
275+
text-align: left;
276+
padding: 4px 6px;
277+
cursor: pointer;
278+
}
279+
280+
.autocomplete-result.is-active,
281+
.autocomplete-result:hover {
282+
background-color: #51a0f6;
283+
color: black;
284+
}
285+
286+
.box-bg {
287+
background-color: #3f3d49;
288+
color: whitesmoke;
289+
text-align: center;
290+
}
209291
</style>

frontend/client/views/overview/index.vue

+11-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div class="columns is-multiline">
33
<template v-for="(pipeline, index) in pipelines">
44
<div class="column is-one-third" :key="index">
5-
<div class="notification content-article">
5+
<div class="pipeline-box notification content-article">
66
<div class="status-display-success" v-if="pipeline.r.status === 'success'"></div>
77
<div class="status-display-fail" v-else-if="pipeline.r.status === 'failed'"></div>
88
<div class="status-display-unknown" v-else></div>
@@ -53,8 +53,7 @@ import moment from 'moment'
5353
export default {
5454
data () {
5555
return {
56-
pipelines: [],
57-
currentPath: ''
56+
pipelines: []
5857
}
5958
},
6059
@@ -66,20 +65,23 @@ export default {
6665
var intervalID = setInterval(function () {
6766
this.fetchData()
6867
}.bind(this), 3000)
69-
this.currentPath = this.$route.path
7068
7169
// Append interval id to store
7270
this.$store.commit('appendInterval', intervalID)
7371
},
7472
73+
destroyed () {
74+
this.$store.commit('clearIntervals')
75+
},
76+
7577
watch: {
7678
'$route': 'fetchData'
7779
},
7880
7981
methods: {
8082
fetchData () {
8183
if (this.$route.path !== this.currentPath) {
82-
this.$store.commit('clearIntervals')
84+
// this.$store.commit('clearIntervals')
8385
}
8486
8587
this.$http
@@ -171,6 +173,10 @@ export default {
171173
background-color: grey;
172174
}
173175
176+
.pipeline-box {
177+
width: 377px;
178+
}
179+
174180
.outer-box {
175181
padding-left: 40px;
176182
min-height: 170px;

frontend/client/views/pipeline/create.vue

+5-7
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,7 @@ export default {
244244
field: 'errmsg'
245245
}
246246
],
247-
historyRows: [],
248-
currentPath: ''
247+
historyRows: []
249248
}
250249
},
251250
@@ -264,22 +263,21 @@ export default {
264263
var intervalID = setInterval(function () {
265264
this.fetchData()
266265
}.bind(this), 3000)
267-
this.currentPath = this.$route.path
268266
269267
// Append interval id to store
270268
this.$store.commit('appendInterval', intervalID)
271269
},
272270
271+
destroyed () {
272+
this.$store.commit('clearIntervals')
273+
},
274+
273275
watch: {
274276
'$route': 'fetchData'
275277
},
276278
277279
methods: {
278280
fetchData () {
279-
if (this.$route.path !== this.currentPath) {
280-
this.$store.commit('clearIntervals')
281-
}
282-
283281
this.$http
284282
.get('/api/v1/pipeline/created', { showProgressBar: false })
285283
.then(response => {

frontend/client/views/pipeline/detail.vue

+5-7
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,7 @@ export default {
121121
},
122122
arrows: {to: true}
123123
}
124-
},
125-
currentPath: ''
124+
}
126125
}
127126
},
128127
@@ -135,12 +134,15 @@ export default {
135134
var intervalID = setInterval(function () {
136135
this.fetchData()
137136
}.bind(this), 3000)
138-
this.currentPath = this.$route.path
139137
140138
// Append interval id to store
141139
this.$store.commit('appendInterval', intervalID)
142140
},
143141
142+
destroyed () {
143+
this.$store.commit('clearIntervals')
144+
},
145+
144146
watch: {
145147
'$route': 'locationReload'
146148
},
@@ -150,10 +152,6 @@ export default {
150152
// View should be re-rendered
151153
this.lastRedraw = false
152154
153-
if (this.$route.path !== this.currentPath) {
154-
this.$store.commit('clearIntervals')
155-
}
156-
157155
// Fetch data
158156
this.fetchData()
159157
},

0 commit comments

Comments
 (0)