-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
276 lines (228 loc) · 8.11 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
<!DOCTYPE html>
<html>
<head>
<title>Product manager dashboard</title>
<link rel="stylesheet" href="/style/style.css">
<script src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
<script src="https://api.trello.com/1/client.js?key=5971ce0cdd8bc45946980a62ed81ae8c"></script>
<!-- iaroslavfleancu key: 94afea1ea20379967621024a84542978 -->
<!-- production key: 5971ce0cdd8bc45946980a62ed81ae8c -->
</head>
<body>
<script type="text/javascript">
$(document).ready(function () {
// authentication in Trello
window.Trello.authorize({
type: 'popup',
name: 'Getting Started Application',
scope: {
read: 'true',
write: 'true' },
expiration: 'never',
success: authenticationSuccess,
error: authenticationFailure
});
let windowLocation = window.location;
let getUrlParams = new URLSearchParams(window.location.search);
// var stakeHolderBoardId = "gKxlWcuZ"; // production`
let stakeHolderBoardId = getUrlParams.get("boardId") ? getUrlParams.get("boardId") : "0jbJrgQT"; // stage
// let inProcessListId = "5cc038eb82b24e47dfebb29a"; // production
let inProcessListId = getUrlParams.get("inProcessListId") ? getUrlParams.get("inProcessListId") : "5cdd02c1a2d65314809ed345"; // stage
var APIurl = {
lablesOnStakeHolderBoard: "/boards/" + stakeHolderBoardId + "/labels",
cardsOnStakeHolderBoard: "/boards/" + stakeHolderBoardId + "/cards/?customFieldItems=true",
listOnStakeHolderBoard: '/boards/' + stakeHolderBoardId + '/?lists=all&list_fields=all'
}
if (windowLocation.hash){
if (windowLocation.hash === "#production"){
$("a.production").addClass('active');
}else{
$("a.stage").addClass('active');
}
}
Trello.get(APIurl.cardsOnStakeHolderBoard, cardsRequestSuccess, error);
Trello.get(APIurl.listOnStakeHolderBoard, getAllListsInBoard, error);
function getAllListsInBoard(data) {
console.log("board lists", data)
}
var cardsObjects;
function cardsRequestSuccess(data){
cardsObjects = data;
Trello.get(APIurl.lablesOnStakeHolderBoard, labelsRequestSuccess, error)
console.log('cardsRequestSuccess', data);
showBugsNotInProcess(data);
showNoLabelCards(data);
showNoPersonaCards(data);
showCardsWithoutEpic(data);
z = selectBugCards(data);
console.log('selectBugCards',z);
}
function error(data) {
console.log(data);
}
function selectBugCards(array){
var bugsIDs = [];
$(array).each(function (i,v) {
// check if relevant label is assigned
var isBug = false;
$(v.labels).each(function(i,v){
if (v.name === "bug") {
isBug = true;
}
});
isBug ? bugsIDs.push(v.id) : false;
});
return bugsIDs;
}
function showBugsNotInProcess(array) {
console.log('showBugsNotInProcess', array);
var bugCardsIds = selectBugCards(array);
var container = $("#bugsNotInProcess");
$(array).each(function (i,v) {
var name = v.name;
var url = v.url;
var id = v.id;
var idList = v.idList;
$(bugCardsIds).each(function(i,v){
if (idList !== inProcessListId && v === id) {
container.append('<li class="list-card-details"><a target="_blank" href="' + url + '">' + name + '</a></li>' + "<br>");
}
});
})
}
function showAllCards(array) {
allCardsContainer = $("#allCards");
$(array).each(function (i,v) {
allCardsContainer.append(v.id + "<br>");
console.log(v);
})
}
function showNoLabelCards(array) {
var counter = 0;
noLabelContainer = $("#noLabel");
$(array).each(function (i,v) {
if (v.labels.length === 0) {
if (counter === 0){
noLabelContainer.append("<span style=\"background: red\">No labels here :( </span><br><br>");
counter++;
}
noLabelContainer.append('<a target="_blank" href="https://trello.com/c/' + v.id + '">' + v.name + '</a>' + "<br>");
}
})
}
function showNoPersonaCards(array) {
var counter = 0;
noLabelContainer = $("#noPersona");
$(array).each(function (i,v) {
var name = v.name;
var id = v.id;
var hasPersona = false;
// check if relevant label is assigned
$(v.labels).each(function(i,v){
if (v.name === "Customer" || v.name === "End-user" || v.name === "Developer" || v.name === "Business") {
hasPersona = true;
}
});
if (counter === 0){
noLabelContainer.append("<br><br><span style=\"background: red\">No Persona here :( </span><br><br>");
counter++;
}
if (hasPersona === false){
noLabelContainer.append('<a target="_blank" href="https://trello.com/c/' + id + '">' + name + '</a>' + "<br>");
// isNoPersona = false;
}
})
}
function showCardsWithoutEpic(array) {
var counter = 0;
noLabelContainer = $("#noEpic");
$(array).each(function (i,v) {
var name = v.name;
var id = v.id;
var hasEpic = false;
// check if relevant label is assigned
$(v.labels).each(function(i,v){
if (v.name === "HAS EPIC" || v.name === "bug") {
hasEpic = true;
}
});
if (counter === 0){
noLabelContainer.append("<br><br><span style=\"background: red\">No no Epic :( </span><br><br>");
counter++;
}
if (hasEpic === false){
noLabelContainer.append('<a target="_blank" href="https://trello.com/c/' + id + '">' + name + '</a>' + "<br>");
// isNoPersona = false;
}
})
}
function authenticationSuccess() {
console.log("Auth Success")
}
function authenticationFailure() {
console.log("Auth failed")
}
function log(v){
console.log(v);
}
var labelsRequestSuccess = function(data){
showLabelsWhioutCards(data);
}
var showLabelsWhioutCards = function(labesObjests) {
var labelsOnTheCards = [];
$(cardsObjects).each(function(i,v){
$(v.labels).each(function(i,v){
labelsOnTheCards.push(v);
});
});
var labelsOnTheCardsIds = []
$(labelsOnTheCards).each(function(i,v){
labelsOnTheCardsIds.push(v.id)
});
var lonelyLabels = []
$(labesObjests).each(function(i,v){
if (labelsOnTheCardsIds.includes(v.id) === false && v.id !== "5cd916492684a3894419f34f") {
lonelyLabels.push(v);
var color = v.color;
if (color === "black") {
color = "lightgrey";
}
$("#labelsWithoutCards").append("<span onclick=deleteLabel('" +v.id+ "') style='background:"+ color +"'>" + v.name + "<span style='border: 1px red solid; padding: 3px; border-radius: 2px; background:pink'> click to delete </span></span> " + "</br>");
}
})
log(lonelyLabels)
}
function deleteLabel(id) {
Trello.delete("/labels/" + id, log(123));
}
$.get('/example.json', function(data, status){
log(data.super );
});
})
</script>
<ul id="bugsNotInProcess" class="bugsNotInProcess">
<!-- <h1>Fix it ASAP!</h1>-->
<!-- <p>If you know there is a bug, you must fix it ASAP. Now, someone can not use our product and going away from us. Most likely this person will be NEVER BACK! <a href="https://www.ministryoftesting.com/dojo/lessons/ten-reasons-why-you-fix-bugs-as-soon-as-you-find-them">(Why?)</a></p>-->
<!-- <h2>These bugs are not in process of being fixed, but they must be:</h2>-->
<h2>bugs not in process</h2>
</ul>
<div id="allCards"></div>
<div id="noLabel"></div>
<div id="noPersona"></div>
<div id="noEpic"></div>
<div id="labelsWithoutCards">
<h1>Keep it clean</h1>
<p>These labels are not used on the board:</p>
</div>
<div>
<h2>Utility info</h2>
<p>https://developers.trello.com/docs/getting-started-custom-fields#section-get-all-custom-field-definitions-on-a-board</p>
<pre></pre>
</div>
<iframe class="document" src="https://docs.google.com/a/holdex.io/document/d/e/2PACX-1vTpzQ43KEee2ctGPvrVXdyK1igc6OSlqyS2vS9gumatJhqOsvU0GAtacSdT-u_eId33byQCzyPUNXh1/pub?embedded=true"></iframe>
<a class="switch-board-btn production" href="/?boardId=gKxlWcuZ&inProcessListId=5cc038eb82b24e47dfebb29a#production">Stakeholder Interview board</a>
<a class="switch-board-btn stage" href="/?boardId=0jbJrgQT&inProcessListId=5cdd02c1a2d65314809ed345#stage">Sandbox board</a>
</body>
</html>