Skip to content

Commit c02cba5

Browse files
committed
Changed sidebar, removed second level. Improved previous runs from pipelines view
1 parent d5c2e23 commit c02cba5

File tree

9 files changed

+60
-170
lines changed

9 files changed

+60
-170
lines changed

frontend/build/webpack.dev.conf.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ module.exports = merge(baseWebpackConfig, {
3232
}),
3333
// https://github.com/ampedandwired/html-webpack-plugin
3434
new HtmlWebpackPlugin({
35-
title: 'Gaia - Build powerful automation pipelines in any programming language.',
35+
title: 'Gaia - Build powerful pipelines in any programming language.',
3636
filename: 'index.html',
3737
template: 'index.html',
3838
inject: true,

frontend/build/webpack.prod.conf.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const webpackConfig = merge(baseWebpackConfig, {
5151
// you can customize output by editing /index.html
5252
// see https://github.com/ampedandwired/html-webpack-plugin
5353
new HtmlWebpackPlugin({
54-
title: 'Gaia - Build powerful automation pipelines in any programming language.',
54+
title: 'Gaia - Build powerful pipelines in any programming language.',
5555
filename: process.env.NODE_ENV === 'testing'
5656
? 'index.html'
5757
: config.build.index,

frontend/client/components/layout/Sidebar.vue

+5-113
Original file line numberDiff line numberDiff line change
@@ -8,121 +8,26 @@
88
</div>
99
<ul class="menu-list">
1010
<li v-for="(item, index) in menu" :key="index">
11-
<router-link :to="item.path" :exact="true" :aria-expanded="isExpanded(item) ? 'true' : 'false'" v-if="item.path" @click.native="toggle(index, item)">
11+
<router-link :to="item.path" :exact="true" v-if="item.path">
1212
<span class="icon icon-left is-small"><i :class="['fa', item.meta.icon]"></i></span>
1313
{{ item.meta.label || item.name }}
14-
<span class="icon is-small is-angle" v-if="item.subroute && item.subroute.length">
15-
<i class="fa fa-angle-down"></i>
16-
</span>
1714
</router-link>
18-
<a :aria-expanded="isExpanded(item)" v-else @click.native="toggle(index, item)">
19-
<span class="icon icon-left is-small"><i :class="['fa', item.meta.icon]"></i></span>
20-
{{ item.meta.label || item.name }}
21-
<span class="icon is-small is-angle" v-if="item.subroute && item.subroute.length">
22-
<i class="fa fa-angle-down"></i>
23-
</span>
24-
</a>
25-
26-
<expanding v-if="item.subroute && item.subroute.length">
27-
<ul v-show="isExpanded(item)" class="menu-list-expanded">
28-
<li v-for="(subItem, index) in item.subroute" v-if="subItem.path" :key="index">
29-
<router-link :to="subItem.path">
30-
{{ subItem.meta && subItem.meta.label || subItem.name }}
31-
</router-link>
32-
</li>
33-
</ul>
34-
</expanding>
3515
</li>
3616
</ul>
3717
</aside>
3818
</template>
3919

4020
<script>
41-
import Expanding from 'vue-bulma-expanding'
42-
import { mapGetters, mapActions } from 'vuex'
21+
import { mapGetters } from 'vuex'
4322
4423
export default {
45-
components: {
46-
Expanding
47-
},
48-
4924
props: {
5025
show: Boolean
5126
},
5227
53-
data () {
54-
return {
55-
isReady: false
56-
}
57-
},
58-
59-
mounted () {
60-
let route = this.$route
61-
if (route.name) {
62-
this.isReady = true
63-
this.shouldExpandMatchItem(route)
64-
}
65-
},
66-
6728
computed: mapGetters({
6829
menu: 'menuitems'
69-
}),
70-
71-
methods: {
72-
...mapActions([
73-
'expandMenu'
74-
]),
75-
76-
isExpanded (item) {
77-
return item.meta.expanded
78-
},
79-
80-
toggle (index, item) {
81-
this.expandMenu({
82-
index: index,
83-
expanded: !item.meta.expanded
84-
})
85-
},
86-
87-
shouldExpandMatchItem (route) {
88-
var parent
89-
90-
const p = this.findParentFromMenu(route)
91-
if (p) {
92-
parent = p
93-
}
94-
95-
if (parent && 'expanded' in parent.meta) {
96-
this.expandMenu({
97-
item: parent,
98-
expanded: true
99-
})
100-
}
101-
},
102-
103-
findParentFromMenu (route) {
104-
const menu = this.menu
105-
for (let i = 0, l = menu.length; i < l; i++) {
106-
const item = menu[i]
107-
const k = item.subroute && item.subroute.length
108-
if (k) {
109-
for (let j = 0; j < k; j++) {
110-
if (item.subroute[j].path === route.path) {
111-
return item
112-
}
113-
}
114-
}
115-
}
116-
}
117-
},
118-
119-
watch: {
120-
$route (route) {
121-
this.isReady = true
122-
this.shouldExpandMatchItem(route)
123-
}
124-
}
125-
30+
})
12631
}
12732
</script>
12833

@@ -160,12 +65,6 @@ a.navbar-item:hover {
16065
16166
.icon {
16267
vertical-align: baseline;
163-
&.is-angle {
164-
position: absolute;
165-
right: 10px;
166-
margin-top: 13px;
167-
transition: transform .377s ease;
168-
}
16968
}
17069
17170
.brand-top {
@@ -198,7 +97,6 @@ a.navbar-item:hover {
19897
li a.is-active {
19998
background-color: rgb(60, 57, 74);
20099
color: #51a0f6;
201-
font-weight: bold;
202100
border-right: 3px solid #51a0f6;
203101
}
204102
@@ -214,15 +112,9 @@ a.navbar-item:hover {
214112
215113
li a {
216114
color: #8c91a0;
217-
width: 140px;
218-
margin-left: 60px;
115+
width: 150px;
116+
margin-left: 50px;
219117
line-height: 40px;
220-
221-
&[aria-expanded="true"] {
222-
.is-angle {
223-
transform: rotate(180deg);
224-
}
225-
}
226118
}
227119
228120
li a + ul {

frontend/client/store/actions.js

-7
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,6 @@ export const toggleSidebar = ({ commit }, config) => {
88

99
export const toggleDevice = ({ commit }, device) => commit(types.TOGGLE_DEVICE, device)
1010

11-
export const expandMenu = ({ commit }, menuItem) => {
12-
if (menuItem) {
13-
menuItem.expanded = menuItem.expanded || false
14-
commit(types.EXPAND_MENU, menuItem)
15-
}
16-
}
17-
1811
export const switchEffect = ({ commit }, effectItem) => {
1912
if (effectItem) {
2013
commit(types.SWITCH_EFFECT, effectItem)
+9-17
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import * as types from '../../mutation-types'
21
import lazyLoading from './lazyLoading'
3-
import pipelines from './pipelines'
42

53
// show: meta.label -> name
64
// name: component name
@@ -17,23 +15,17 @@ const state = {
1715
},
1816
component: lazyLoading('overview', true)
1917
},
20-
pipelines
21-
]
22-
}
23-
24-
const mutations = {
25-
[types.EXPAND_MENU] (state, menuItem) {
26-
if (menuItem.index > -1) {
27-
if (state.items[menuItem.index] && state.items[menuItem.index].meta) {
28-
state.items[menuItem.index].meta.expanded = menuItem.expanded
29-
}
30-
} else if (menuItem.item && 'expanded' in menuItem.item.meta) {
31-
menuItem.item.meta.expanded = menuItem.expanded
18+
{
19+
name: 'Create Pipeline',
20+
path: '/pipelines/create',
21+
meta: {
22+
icon: 'fa-plus'
23+
},
24+
component: lazyLoading('pipelines/create')
3225
}
33-
}
26+
]
3427
}
3528

3629
export default {
37-
state,
38-
mutations
30+
state
3931
}

frontend/client/store/modules/menu/pipelines.js

-22
This file was deleted.

frontend/client/store/mutation-types.js

-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,4 @@ export const TOGGLE_DEVICE = 'TOGGLE_DEVICE'
22

33
export const TOGGLE_SIDEBAR = 'TOGGLE_SIDEBAR'
44

5-
export const EXPAND_MENU = 'EXPAND_MENU'
6-
75
export const SWITCH_EFFECT = 'SWITCH_EFFECT'

frontend/client/views/pipelines/detail.vue

+44-6
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,21 @@
1717
:rows="runsRows"
1818
:paginate="true"
1919
:global-search="true"
20-
:defaultSortBy="{field: 'id', type: 'asc'}"
20+
:defaultSortBy="{field: 'id', type: 'desc'}"
2121
globalSearchPlaceholder="Search ..."
2222
styleClass="table table-own-bordered">
2323
<template slot="table-row" slot-scope="props">
24-
<td>{{ props.row.id }}</td>
25-
<td>{{ props.row.status }}</td>
26-
<td>{{ props.row.startdate }}</td>
24+
<td>
25+
<router-link :to="{ path: '/pipelines/detail', query: { pipelineid: pipelineID, runid: props.row.id }}" class="is-blue">
26+
{{ props.row.id }}
27+
</router-link>
28+
</td>
29+
<td>
30+
<span v-if="props.row.status === 'success'" style="color: green;">{{ props.row.status }}</span>
31+
<span v-else-if="props.row.status === 'failed'" style="color: red;">{{ props.row.status }}</span>
32+
<span v-else>{{ props.row.status }}</span>
33+
</td>
34+
<td>{{ calculateDuration(props.row.startdate, props.row.finishdate) }}</td>
2735
</template>
2836
<div slot="emptystate" class="empty-table-text">
2937
No pipeline runs found in database.
@@ -40,6 +48,7 @@ import Vue from 'vue'
4048
import Vis from 'vis'
4149
import VueTippy from 'vue-tippy'
4250
import VueGoodTable from 'vue-good-table'
51+
import moment from 'moment'
4352
4453
Vue.use(VueGoodTable)
4554
Vue.use(VueTippy)
@@ -48,6 +57,7 @@ export default {
4857
4958
data () {
5059
return {
60+
pipelineID: null,
5161
nodes: null,
5262
edges: null,
5363
lastRedraw: false,
@@ -62,8 +72,7 @@ export default {
6272
field: 'status'
6373
},
6474
{
65-
label: 'Duration',
66-
field: 'startdate'
75+
label: 'Duration'
6776
}
6877
],
6978
runsRows: [],
@@ -110,13 +119,26 @@ export default {
110119
}.bind(this), 3000)
111120
},
112121
122+
watch: {
123+
'$route': 'locationReload'
124+
},
125+
113126
methods: {
127+
locationReload () {
128+
// View should be re-rendered
129+
this.lastRedraw = false
130+
131+
// Fetch data
132+
this.fetchData()
133+
},
134+
114135
fetchData () {
115136
// look up url parameters
116137
var pipelineID = this.$route.query.pipelineid
117138
if (!pipelineID) {
118139
return
119140
}
141+
this.pipelineID = pipelineID
120142
121143
// runID is optional
122144
var runID = this.$route.query.runid
@@ -273,6 +295,22 @@ export default {
273295
// We have to move out the instance out of vue because of https://github.com/almende/vis/issues/2567
274296
window.pipelineView = new Vis.Network(container, data, this.pipelineViewOptions)
275297
}
298+
},
299+
300+
calculateDuration (startdate, finishdate) {
301+
if (!moment(startdate).millisecond()) {
302+
startdate = moment()
303+
}
304+
if (!moment(finishdate).millisecond()) {
305+
finishdate = moment()
306+
}
307+
308+
// Calculate difference
309+
var diff = moment(finishdate).diff(moment(startdate), 'seconds')
310+
if (diff < 60) {
311+
return diff + ' seconds'
312+
}
313+
return moment.duration(diff, 'seconds').humanize()
276314
}
277315
}
278316

frontend/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
"plotly.js": "^1.33.1",
4646
"vis": "^4.21.0",
4747
"vue": "^2.5.13",
48-
"vue-bulma-breadcrumb": "^1.0.1",
4948
"vue-bulma-collapse": "1.0.3",
5049
"vue-bulma-datepicker": "^1.3.0",
5150
"vue-bulma-expanding": "^0.0.1",

0 commit comments

Comments
 (0)