Skip to content
This repository was archived by the owner on Jan 13, 2021. It is now read-only.

Commit f5a8a8b

Browse files
committed
github didnt merge the filters into master
1 parent 85e4630 commit f5a8a8b

File tree

2 files changed

+86
-10
lines changed

2 files changed

+86
-10
lines changed

frontsherlock/src/components/Dashboard.vue

Lines changed: 85 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,40 @@
44
<center><div uk-spinner></div>
55
Loading...</center>
66
</div>
7-
<h2 v-if="showTitle"> Current Projects </h2>
7+
<div class="uk-grid" v-if="showTitle">
8+
<div class="uk-width-4-5" style="width:65% !important">
9+
<h2 style="margin-left: 18px;"> Current Projects </h2>
10+
</div>
11+
<div class="uk-width-1-5" style="width:35% !important; text-align: right; padding-right: 14px;">
12+
<div class="uk-grid">
13+
<div class="uk-width-1-5">
14+
<i class="material-icons" style="padding-top: 3px;">filter_list</i>
15+
</div>
16+
<div class="uk-width-4-5" style="width: 68% !important; text-align: left; padding-left: 15px; margin-left: 0px;">
17+
<span>
18+
<a class="uk-button uk-button-default filter_state"
19+
v-bind:class="{ filter_state_active: filterActive }"
20+
@click="filterActive = !filterActive, filterClick('active')"> active </a>
21+
<a class="uk-button uk-button-default filter_state"
22+
v-bind:class="{ filter_state_active: filterClose }"
23+
@click="filterClose = !filterClose, filterClick('closed')""> closed </a>
24+
<a class="uk-button uk-button-default filter_state"
25+
v-bind:class="{ filter_state_active: filterNoCycle }"
26+
@click="filterNoCycle = !filterNoCycle, filterClick('nocycle')""> no cycle </a>
27+
</span>
28+
</div>
29+
</div>
30+
</div>
31+
</div>
832

9-
<div v-for="project in projects.projects" class="project_box">
33+
<div>
34+
</div>
35+
<transition-group>
36+
<div v-for="project in projects.projects" :key="project.id" class="project_box" v-if="filter.length === 0 || filter.indexOf(project.cycle_state) > -1">
1037
<router-link :to="{ path: 'project/view/'+project.id }" class="box-link">
1138
<h4 class="hide_overflow">{{project.name}}</h4>
1239
<hr>
40+
1341
<span v-if="project.have_cycle === true">
1442
<span> Current Cycle: {{project.current_cycle}} </span> <br>
1543
<span> Cycle State: {{project.cycle_state}} </span> <br>
@@ -24,7 +52,12 @@
2452
</span>
2553
</router-link>
2654
</div>
27-
55+
</transition-group>
56+
<div v-if="showNoProject">
57+
<center>
58+
<h3 style="padding-top: 100px; padding-bottom:100px;"> No Projects matching yor filters. </h3>
59+
</center>
60+
</div>
2861
<div v-if="showGreetings">
2962
<hr>
3063
<center><h2 style="margin-left:20px"><span class="uk-margin-small-right" uk-icon="icon: heart"></span> Hey, this seems like a brand new installation! Thanks for giving sherlock a try! <span class="uk-margin-small-right" uk-icon="icon: heart"></span></h2>
@@ -54,7 +87,12 @@ export default {
5487
projects: [],
5588
loading: false,
5689
showTitle: false,
57-
showGreetings: false
90+
showGreetings: false,
91+
filterActive: false,
92+
filterClose: false,
93+
filterNoCycle: false,
94+
filter: [],
95+
showNoProject: false
5896
}
5997
},
6098
methods: {
@@ -70,6 +108,21 @@ export default {
70108
this.showTitle = false
71109
}
72110
})
111+
},
112+
filterClick: function (item) {
113+
if (this.filter.indexOf(item) > -1) {
114+
var index = this.filter.indexOf(item)
115+
this.filter.splice(index, 1)
116+
} else {
117+
this.filter.push(item)
118+
}
119+
for (var i = 0; i < this.projects.projects.length > 0; i++) {
120+
if (this.filter.length === 0 || this.filter.indexOf(this.projects.projects[i].cycle_state) > -1) {
121+
this.showNoProject = false
122+
return
123+
}
124+
}
125+
this.showNoProject = true
73126
}
74127
},
75128
created: function () {
@@ -90,12 +143,36 @@ export default {
90143

91144
<style scoped>
92145
93-
.dashboard div{
94-
padding: 10px;
95-
}
96-
97146
.project_box{
98147
min-height: 210px;
99148
}
100149
150+
.filter_state {
151+
border: solid 1px #333;
152+
border-radius: 7px;
153+
padding: 0px 20px;
154+
line-height: 28px;
155+
text-transform: none;
156+
}
157+
.filter_state:hover{
158+
font-weight: 500;
159+
z-index: -1;
160+
transform: scale(1);
161+
box-shadow: 3px 4px 7px -4px #000000;
162+
-webkit-box-shadow: 3px 4px 7px -4px #000000;
163+
-moz-box-shadow: 3px 4px 7px -4px #000000;
164+
box-shadow: 3px 4px 7px -4px #444444;
165+
}
166+
.filter_state_active{
167+
color: #fff !important;
168+
background-color: #2f5c86;
169+
font-weight: 500;
170+
z-index: -1;
171+
transform: scale(.9);
172+
box-shadow: 3px 4px 7px -4px #000000;
173+
-webkit-box-shadow: 3px 4px 7px -4px #000000;
174+
-moz-box-shadow: 3px 4px 7px -4px #000000;
175+
box-shadow: 3px 4px 7px -4px #444444;
176+
}
177+
101178
</style>

sherlockapi/views/dashboard.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ def home():
3030
item['stats'] = count_cycle_stats(cycle_cases_h)
3131
else:
3232
item['cycle_state'] = "nocycle"
33-
34-
return make_response(jsonify(projects=projects))
33+
return make_response(jsonify(projects_qtd=len(projects),projects=projects))
3534

3635
@dashboard.route('/check_global_register_permission', methods=['GET'])
3736
def check_global_register_permission():

0 commit comments

Comments
 (0)