@eui/tools 6.4.3 → 6.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.version.properties +1 -1
- package/CHANGELOG.md +18 -0
- package/bin/eui-scripts.js +2 -0
- package/bin/scripts/csdr-app.js +12 -0
- package/bin/scripts/csdr-sync.js +1 -1
- package/package.json +6 -2
- package/sandbox.js +24 -8
- package/scripts/app/public/index.html +243 -0
- package/scripts/app/public/stats.html +157 -0
- package/scripts/app/routes/index.js +65 -0
- package/scripts/app/server.js +35 -0
- package/scripts/csdr/cli/skeletons/virtual-remote/15.x/dependencies.json +1 -0
- package/scripts/csdr/config/global.js +5 -55
- package/scripts/csdr/config/packages.js +4 -4
- package/scripts/csdr/config/remotes.js +30 -3
- package/scripts/csdr/init/packages.js +28 -0
- package/scripts/csdr/metadata/stats.js +23 -0
- package/scripts/csdr/sync/sync-utils.js +3 -0
- package/scripts/index.js +0 -1
- package/scripts/utils/notification/config.js +16 -27
- package/scripts/utils/notification/message-stack.js +0 -3
- package/scripts.json +5 -0
- package/scripts/utils/notification/mail-utils.js +0 -59
package/.version.properties
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
6.
|
|
1
|
+
6.5.0
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
## 6.5.0 (2023-02-24)
|
|
2
|
+
|
|
3
|
+
##### New Features
|
|
4
|
+
|
|
5
|
+
* **other:**
|
|
6
|
+
* csdr apps first iteration - MWP-9204 [MWP-9204](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-9204) ([4d9a9fd4](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/4d9a9fd40f135c2a462eb98b32c83aa7972b01da))
|
|
7
|
+
|
|
8
|
+
* * *
|
|
9
|
+
* * *
|
|
10
|
+
## 6.4.4 (2023-02-23)
|
|
11
|
+
|
|
12
|
+
##### Chores
|
|
13
|
+
|
|
14
|
+
* **other:**
|
|
15
|
+
* send msteams channel email to gitlab vars for XLR processing - EUI-7146 [EUI-7146](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-7146) ([665f70bb](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/665f70bb7fea498c15577810deb129bb2ba2a287))
|
|
16
|
+
|
|
17
|
+
* * *
|
|
18
|
+
* * *
|
|
1
19
|
## 6.4.3 (2023-02-23)
|
|
2
20
|
|
|
3
21
|
##### Chores
|
package/bin/eui-scripts.js
CHANGED
|
@@ -29,6 +29,7 @@ const scriptIndex = args.findIndex(
|
|
|
29
29
|
x === 'publish-all' ||
|
|
30
30
|
x === 'generate-translations' ||
|
|
31
31
|
x === 'test-package' ||
|
|
32
|
+
x === 'csdr-app' ||
|
|
32
33
|
x === 'csdr-init' ||
|
|
33
34
|
x === 'csdr-upgrade-deps' ||
|
|
34
35
|
x === 'csdr-serve-app' ||
|
|
@@ -72,6 +73,7 @@ switch (script) {
|
|
|
72
73
|
case 'publish-all':
|
|
73
74
|
case 'test-package':
|
|
74
75
|
case 'generate-translations':
|
|
76
|
+
case 'csdr-app':
|
|
75
77
|
case 'csdr-init':
|
|
76
78
|
case 'csdr-upgrade-deps':
|
|
77
79
|
case 'csdr-serve-app':
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const tools = require('../../scripts/utils/tools');
|
|
4
|
+
|
|
5
|
+
Promise.resolve()
|
|
6
|
+
.then(() => {
|
|
7
|
+
return tools.runScript('node ./packages/eui-tools/scripts/app/server.js --prod');
|
|
8
|
+
})
|
|
9
|
+
.catch((e) => {
|
|
10
|
+
console.log(e);
|
|
11
|
+
process.exit(1);
|
|
12
|
+
})
|
package/bin/scripts/csdr-sync.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eui/tools",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.5.0",
|
|
4
4
|
"tag": "latest",
|
|
5
5
|
"license": "EUPL-1.1",
|
|
6
6
|
"description": "eUI common tools and scripts",
|
|
@@ -46,6 +46,10 @@
|
|
|
46
46
|
"imagemin": "7.0.1",
|
|
47
47
|
"imagemin-svgo": "9.0.0",
|
|
48
48
|
"concat": "1.0.3",
|
|
49
|
-
"file-saver": "2.0.5"
|
|
49
|
+
"file-saver": "^2.0.5",
|
|
50
|
+
"morgan": "^1.10.0",
|
|
51
|
+
"open": "^8.4.0",
|
|
52
|
+
"body-parser": "^1.20.1",
|
|
53
|
+
"express": "^4.18.2"
|
|
50
54
|
}
|
|
51
55
|
}
|
package/sandbox.js
CHANGED
|
@@ -1188,15 +1188,31 @@ const versionUtils = require('./scripts/csdr/version/version-utils');
|
|
|
1188
1188
|
// console.log(teamsUtils.getChannelHook('pipeline-ui-edui'));
|
|
1189
1189
|
// })
|
|
1190
1190
|
|
|
1191
|
-
Promise.resolve()
|
|
1192
|
-
|
|
1191
|
+
// Promise.resolve()
|
|
1192
|
+
// .then(() => {
|
|
1193
1193
|
|
|
1194
|
-
|
|
1195
|
-
|
|
1194
|
+
// var startTime = moment('03-01-2021 01:01:01', 'DD-MM-YYYY hh:mm:ss');
|
|
1195
|
+
// var endTime = moment('03-01-2021 01:04:53', 'DD-MM-YYYY hh:mm:ss');
|
|
1196
1196
|
|
|
1197
|
-
|
|
1197
|
+
// var secondsDiff = endTime.diff(startTime, 's');
|
|
1198
1198
|
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1199
|
+
// const getMinSec = (s) => { return(s-(s%=60))/60+'m'+(9<s?':':':0')+s+'s'; }
|
|
1200
|
+
// const minSec = getMinSec(secondsDiff);
|
|
1201
|
+
// console.log(minSec);
|
|
1202
|
+
// })
|
|
1203
|
+
|
|
1204
|
+
// Promise.resolve()
|
|
1205
|
+
// .then(() => {
|
|
1206
|
+
// const options = configUtils.global.getConfigOptions();
|
|
1207
|
+
// console.log(options);
|
|
1208
|
+
|
|
1209
|
+
// const pkg = configUtils.packages.getPackage('mapar-administration-ui');
|
|
1210
|
+
// const config = notificationUtils.config.getPackageConfig(pkg);
|
|
1211
|
+
|
|
1212
|
+
// console.log(config);
|
|
1213
|
+
// })
|
|
1214
|
+
|
|
1215
|
+
Promise.resolve()
|
|
1216
|
+
.then(() => {
|
|
1217
|
+
return initUtils.packages.importScripts();
|
|
1202
1218
|
})
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<script src="https://unpkg.com/vue@2"></script>
|
|
7
|
+
<link
|
|
8
|
+
rel="stylesheet"
|
|
9
|
+
href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" />
|
|
10
|
+
<style>
|
|
11
|
+
.full-height-flex {
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
height: 100vh;
|
|
15
|
+
}
|
|
16
|
+
.header-flex {
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
}
|
|
20
|
+
.body-flex {
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
overflow-y: auto;
|
|
24
|
+
}
|
|
25
|
+
</style>
|
|
26
|
+
</head>
|
|
27
|
+
|
|
28
|
+
<body>
|
|
29
|
+
<div id="app" class="container-fluid">
|
|
30
|
+
<div class="row">
|
|
31
|
+
<div class="col-4 full-height-flex">
|
|
32
|
+
<h3 class="mt-2 mb-4">
|
|
33
|
+
CSDR custom installation (experimental)
|
|
34
|
+
</h3>
|
|
35
|
+
|
|
36
|
+
<div class="header-flex">
|
|
37
|
+
<h5 class="mb-3">Choose an app / euiVersion</h5>
|
|
38
|
+
<form>
|
|
39
|
+
<div class="row mb-3">
|
|
40
|
+
<label class="col-sm-2 col-form-label"
|
|
41
|
+
>App</label
|
|
42
|
+
>
|
|
43
|
+
<div class="col-sm-10">
|
|
44
|
+
<select disabled class="form-select">
|
|
45
|
+
<option>Open this select menu</option>
|
|
46
|
+
<option selected value="my-workplace">
|
|
47
|
+
MyWorkplace
|
|
48
|
+
</option>
|
|
49
|
+
<!-- <option value="sedia">Sedia</option> -->
|
|
50
|
+
</select>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
<div class="row mb-3">
|
|
54
|
+
<label class="col-sm-2 col-form-label"
|
|
55
|
+
>eUI Version</label
|
|
56
|
+
>
|
|
57
|
+
<div class="col-sm-10">
|
|
58
|
+
<select disabled class="form-select">
|
|
59
|
+
<option>Open this select menu</option>
|
|
60
|
+
<option selected value="15.x">
|
|
61
|
+
eUI 15
|
|
62
|
+
</option>
|
|
63
|
+
<!-- <option value="10.x">eUI 10</option> -->
|
|
64
|
+
</select>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
</form>
|
|
68
|
+
</div>
|
|
69
|
+
<div class="body-flex">
|
|
70
|
+
<h5 class="mt-2 mb-3">
|
|
71
|
+
Select the remote(s) you want to work with:
|
|
72
|
+
</h5>
|
|
73
|
+
<p class="text-warning fw-bold">
|
|
74
|
+
select at least one remote to work on
|
|
75
|
+
</p>
|
|
76
|
+
<table
|
|
77
|
+
class="table table-striped"
|
|
78
|
+
v-show="remotes.length !== 0">
|
|
79
|
+
<thead>
|
|
80
|
+
<tr>
|
|
81
|
+
<th scope="col"> </th>
|
|
82
|
+
<th scope="col">Remote</th>
|
|
83
|
+
<th scope="col">Participant ?</th>
|
|
84
|
+
<th scope="col">Full skel.?</th>
|
|
85
|
+
</tr>
|
|
86
|
+
</thead>
|
|
87
|
+
<tbody>
|
|
88
|
+
<tr v-for="remote in remotes">
|
|
89
|
+
<td>
|
|
90
|
+
<div
|
|
91
|
+
class="form-check"
|
|
92
|
+
:key="remote.name">
|
|
93
|
+
<input
|
|
94
|
+
class="form-check-input"
|
|
95
|
+
type="checkbox"
|
|
96
|
+
:value="remote.name"
|
|
97
|
+
:id="remote.name"
|
|
98
|
+
v-model="selectedRemotes"
|
|
99
|
+
@change="remoteSelected($event)" />
|
|
100
|
+
</div>
|
|
101
|
+
</td>
|
|
102
|
+
<td>{{ remote.name }}</td>
|
|
103
|
+
<td>
|
|
104
|
+
<div
|
|
105
|
+
:class="{ 'text-primary fw-bold': remote.participant }">
|
|
106
|
+
{{ remote.participant }}
|
|
107
|
+
</div>
|
|
108
|
+
</td>
|
|
109
|
+
<td>
|
|
110
|
+
<div
|
|
111
|
+
:class="{ 'text-success fw-bold': remote.fullSkeletonSources }">
|
|
112
|
+
{{ remote.fullSkeletonSources }}
|
|
113
|
+
</div>
|
|
114
|
+
</td>
|
|
115
|
+
</tr>
|
|
116
|
+
</tbody>
|
|
117
|
+
</table>
|
|
118
|
+
</div>
|
|
119
|
+
</div>
|
|
120
|
+
|
|
121
|
+
<div class="col-8">
|
|
122
|
+
<h5 class="mt-5 mb-3">
|
|
123
|
+
Selected remotes :
|
|
124
|
+
<span class="text-primary fw-bold">{{
|
|
125
|
+
selectedRemotes.length
|
|
126
|
+
}}</span>
|
|
127
|
+
</h5>
|
|
128
|
+
{{ selectedRemotes }}
|
|
129
|
+
|
|
130
|
+
<h5 class="mt-5 mb-3">
|
|
131
|
+
Derived dependencies:
|
|
132
|
+
<span class="text-primary fw-bold">{{
|
|
133
|
+
deps.length
|
|
134
|
+
}}</span>
|
|
135
|
+
</h5>
|
|
136
|
+
{{ deps }}
|
|
137
|
+
|
|
138
|
+
<h5 class="mt-5 mb-3">
|
|
139
|
+
Derived UI packages to be locally cloned :
|
|
140
|
+
<span class="text-primary fw-bold">{{
|
|
141
|
+
packages.length
|
|
142
|
+
}}</span>
|
|
143
|
+
</h5>
|
|
144
|
+
{{ packages }}
|
|
145
|
+
|
|
146
|
+
<h5 class="mt-5 mb-3">
|
|
147
|
+
Remotes to install as dependencies :
|
|
148
|
+
<span class="text-primary fw-bold">{{
|
|
149
|
+
remotesToInstall.length
|
|
150
|
+
}}</span>
|
|
151
|
+
</h5>
|
|
152
|
+
{{ remotesToInstall }}
|
|
153
|
+
|
|
154
|
+
<hr />
|
|
155
|
+
|
|
156
|
+
<button
|
|
157
|
+
class="btn btn-primary"
|
|
158
|
+
type="button"
|
|
159
|
+
:disabled="selectedRemotes.length === 0">
|
|
160
|
+
Save configuration
|
|
161
|
+
</button>
|
|
162
|
+
|
|
163
|
+
<div class="alert alert-info mt-2">
|
|
164
|
+
<p>
|
|
165
|
+
Saving the configuration will generate a file called
|
|
166
|
+
<span class="fw-bold"
|
|
167
|
+
>./csdr/.euirc-csdr-custom.json</span
|
|
168
|
+
>
|
|
169
|
+
</p>
|
|
170
|
+
<p>
|
|
171
|
+
Execute after the
|
|
172
|
+
<strong>npm run init -- --custom</strong> from your
|
|
173
|
+
command line to follow progress of installation
|
|
174
|
+
</p>
|
|
175
|
+
</div>
|
|
176
|
+
</div>
|
|
177
|
+
</div>
|
|
178
|
+
</div>
|
|
179
|
+
</body>
|
|
180
|
+
|
|
181
|
+
<script>
|
|
182
|
+
const getRequestBody = (items) => {
|
|
183
|
+
return {
|
|
184
|
+
method: "POST",
|
|
185
|
+
headers: {
|
|
186
|
+
"Content-Type": "application/json",
|
|
187
|
+
},
|
|
188
|
+
body: JSON.stringify(items),
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
new Vue({
|
|
193
|
+
el: "#app",
|
|
194
|
+
data() {
|
|
195
|
+
return {
|
|
196
|
+
remotes: [],
|
|
197
|
+
selectedRemotes: [],
|
|
198
|
+
deps: [],
|
|
199
|
+
packages: [],
|
|
200
|
+
remotesToInstall: [],
|
|
201
|
+
};
|
|
202
|
+
},
|
|
203
|
+
created() {
|
|
204
|
+
this.getRemotes();
|
|
205
|
+
},
|
|
206
|
+
methods: {
|
|
207
|
+
async getRemotes() {
|
|
208
|
+
const res = await fetch(
|
|
209
|
+
"http://localhost:3000/api/remotes"
|
|
210
|
+
);
|
|
211
|
+
const finalRes = await res.json();
|
|
212
|
+
this.remotes = finalRes;
|
|
213
|
+
this.getRemotesToInstall();
|
|
214
|
+
},
|
|
215
|
+
async getPackages() {
|
|
216
|
+
const res = await fetch(
|
|
217
|
+
"http://localhost:3000/api/remotes/packages",
|
|
218
|
+
getRequestBody(this.selectedRemotes)
|
|
219
|
+
);
|
|
220
|
+
const finalRes = await res.json();
|
|
221
|
+
this.packages = finalRes.packages.filter(
|
|
222
|
+
(p) =>
|
|
223
|
+
p.indexOf("csdr-") < 0 &&
|
|
224
|
+
p.indexOf("cc-shared-ui") < 0 &&
|
|
225
|
+
p.indexOf("mywp-shared-ui") < 0
|
|
226
|
+
);
|
|
227
|
+
this.deps = finalRes.deps;
|
|
228
|
+
this.getRemotesToInstall();
|
|
229
|
+
},
|
|
230
|
+
remoteSelected(event) {
|
|
231
|
+
this.getPackages();
|
|
232
|
+
},
|
|
233
|
+
getRemotesToInstall() {
|
|
234
|
+
this.remotesToInstall = this.remotes
|
|
235
|
+
.map((r) => r.name)
|
|
236
|
+
.filter((r) => {
|
|
237
|
+
return !this.selectedRemotes.includes(r);
|
|
238
|
+
});
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
});
|
|
242
|
+
</script>
|
|
243
|
+
</html>
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<script src="https://unpkg.com/vue@2"></script>
|
|
7
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.min.js"></script>
|
|
8
|
+
<link
|
|
9
|
+
rel="stylesheet"
|
|
10
|
+
href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" />
|
|
11
|
+
<style>
|
|
12
|
+
.full-height-flex {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
height: 100vh;
|
|
16
|
+
}
|
|
17
|
+
.body-flex {
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
overflow-y: auto;
|
|
21
|
+
}
|
|
22
|
+
</style>
|
|
23
|
+
</head>
|
|
24
|
+
|
|
25
|
+
<body>
|
|
26
|
+
<div id="app" class="container-fluid">
|
|
27
|
+
<div class="row">
|
|
28
|
+
<div class="col-4 full-height-flex">
|
|
29
|
+
<h3 class="mt-2 mb-4">CSDR remotes stats</h3>
|
|
30
|
+
<div class="body-flex">
|
|
31
|
+
<h5 class="mt-2 mb-3">Select a remote:</h5>
|
|
32
|
+
<table
|
|
33
|
+
class="table table-striped"
|
|
34
|
+
v-show="remotes.length !== 0">
|
|
35
|
+
<thead>
|
|
36
|
+
<tr>
|
|
37
|
+
<th scope="col"> </th>
|
|
38
|
+
<th scope="col">Remote</th>
|
|
39
|
+
<th scope="col">Participant ?</th>
|
|
40
|
+
<th scope="col">Full skel.?</th>
|
|
41
|
+
</tr>
|
|
42
|
+
</thead>
|
|
43
|
+
<tbody>
|
|
44
|
+
<tr v-for="remote in remotes">
|
|
45
|
+
<td>
|
|
46
|
+
<div
|
|
47
|
+
class="form-radio"
|
|
48
|
+
:key="remote.name">
|
|
49
|
+
<input
|
|
50
|
+
class="form-radio-input"
|
|
51
|
+
type="radio"
|
|
52
|
+
:value="remote.name"
|
|
53
|
+
:id="remote.name"
|
|
54
|
+
v-model="selectedRemotes"
|
|
55
|
+
@change="remoteSelected($event)" />
|
|
56
|
+
</div>
|
|
57
|
+
</td>
|
|
58
|
+
<td>{{ remote.name }}</td>
|
|
59
|
+
<td>
|
|
60
|
+
<div
|
|
61
|
+
:class="{ 'text-primary fw-bold': remote.participant }">
|
|
62
|
+
{{ remote.participant }}
|
|
63
|
+
</div>
|
|
64
|
+
</td>
|
|
65
|
+
<td>
|
|
66
|
+
<div
|
|
67
|
+
:class="{ 'text-success fw-bold': remote.fullSkeletonSources }">
|
|
68
|
+
{{ remote.fullSkeletonSources }}
|
|
69
|
+
</div>
|
|
70
|
+
</td>
|
|
71
|
+
</tr>
|
|
72
|
+
</tbody>
|
|
73
|
+
</table>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
<div class="col-8">
|
|
78
|
+
<h5 class="mt-5 mb-3">
|
|
79
|
+
Selected remote : {{ selectedRemotes }}
|
|
80
|
+
</h5>
|
|
81
|
+
<div class="d-none">{{ remoteStats.versions }}</div>
|
|
82
|
+
<div style="height: 250px">
|
|
83
|
+
<canvas id="versions"></canvas>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
</body>
|
|
89
|
+
|
|
90
|
+
<script>
|
|
91
|
+
const getRequestBody = (items) => {
|
|
92
|
+
return {
|
|
93
|
+
method: "POST",
|
|
94
|
+
headers: {
|
|
95
|
+
"Content-Type": "application/json",
|
|
96
|
+
},
|
|
97
|
+
body: JSON.stringify(items),
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
new Vue({
|
|
102
|
+
el: "#app",
|
|
103
|
+
data() {
|
|
104
|
+
return {
|
|
105
|
+
remotes: [],
|
|
106
|
+
selectedRemotes: [],
|
|
107
|
+
remoteStats: {},
|
|
108
|
+
};
|
|
109
|
+
},
|
|
110
|
+
created() {
|
|
111
|
+
this.getRemotes();
|
|
112
|
+
},
|
|
113
|
+
methods: {
|
|
114
|
+
async getRemotes() {
|
|
115
|
+
const res = await fetch(
|
|
116
|
+
"http://localhost:3000/api/remotes"
|
|
117
|
+
);
|
|
118
|
+
const finalRes = await res.json();
|
|
119
|
+
this.remotes = finalRes;
|
|
120
|
+
},
|
|
121
|
+
remoteSelected(event) {
|
|
122
|
+
console.log(this.selectedRemotes);
|
|
123
|
+
this.getRemoteStats();
|
|
124
|
+
},
|
|
125
|
+
async getRemoteStats() {
|
|
126
|
+
const res = await fetch(
|
|
127
|
+
"http://localhost:3000/api/remotes/stats",
|
|
128
|
+
getRequestBody({ remote: this.selectedRemotes })
|
|
129
|
+
);
|
|
130
|
+
const finalRes = await res.json();
|
|
131
|
+
this.remoteStats = finalRes;
|
|
132
|
+
this.genVersionsChart();
|
|
133
|
+
},
|
|
134
|
+
genVersionsChart() {
|
|
135
|
+
const ctx = document
|
|
136
|
+
.getElementById("versions")
|
|
137
|
+
.getContext("2d");
|
|
138
|
+
var myChart = new Chart(ctx, {
|
|
139
|
+
type: "line",
|
|
140
|
+
data: {
|
|
141
|
+
labels: this.remoteStats.versions.map(v => `${v.version} - ${v.date}`),
|
|
142
|
+
datasets: [
|
|
143
|
+
{
|
|
144
|
+
data: this.remoteStats.versions.map(v => v.duration),
|
|
145
|
+
label: "Duration",
|
|
146
|
+
borderColor: "#3e95cd",
|
|
147
|
+
backgroundColor: "#7bb6dd",
|
|
148
|
+
fill: false,
|
|
149
|
+
},
|
|
150
|
+
],
|
|
151
|
+
},
|
|
152
|
+
});
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
});
|
|
156
|
+
</script>
|
|
157
|
+
</html>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const router = require('express').Router();
|
|
4
|
+
|
|
5
|
+
const configUtils = require('../../csdr/config/config-utils');
|
|
6
|
+
const metadataUtils = require('../../csdr/metadata/metadata-utils');
|
|
7
|
+
const tools = require('../../utils/tools');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
router.get('/remotes', function (req, res) {
|
|
11
|
+
return Promise.resolve()
|
|
12
|
+
.then(() => {
|
|
13
|
+
return configUtils.remotes.getCsdrRemotesArray('my-workplace', '15.x');
|
|
14
|
+
})
|
|
15
|
+
.then((fetchedRemotes) => {
|
|
16
|
+
let remotes = tools.sortArray(fetchedRemotes, 'name');
|
|
17
|
+
remotes = remotes.map((r) => {
|
|
18
|
+
let participant = false;
|
|
19
|
+
if (r.fullSkeletonSources) {
|
|
20
|
+
if (r.skeletonConfig.options && r.skeletonConfig.options.participant) {
|
|
21
|
+
participant = true;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
...r,
|
|
26
|
+
participant,
|
|
27
|
+
}
|
|
28
|
+
})
|
|
29
|
+
res.send(remotes);
|
|
30
|
+
})
|
|
31
|
+
.catch((e) => {
|
|
32
|
+
console.log(e);
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
router.post('/remotes/packages', function (req, res) {
|
|
37
|
+
return Promise.resolve()
|
|
38
|
+
.then(() => {
|
|
39
|
+
const remotes = req.body;
|
|
40
|
+
const depsPackages = configUtils.remotes.getRemotesPackages(remotes);
|
|
41
|
+
res.send(depsPackages);
|
|
42
|
+
})
|
|
43
|
+
.catch((e) => {
|
|
44
|
+
console.log(e);
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
router.post('/remotes/stats', function (req, res) {
|
|
50
|
+
return Promise.resolve()
|
|
51
|
+
.then(() => {
|
|
52
|
+
return metadataUtils.stats.getRemoteStats(req.body.remote);
|
|
53
|
+
})
|
|
54
|
+
.then((remoteStats) => {
|
|
55
|
+
res.send(remoteStats);
|
|
56
|
+
})
|
|
57
|
+
.catch((e) => {
|
|
58
|
+
console.log(e);
|
|
59
|
+
})
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
// Export API routes
|
|
65
|
+
module.exports = router;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// GLOBAL
|
|
2
|
+
const express = require('express');
|
|
3
|
+
const bodyParser = require('body-parser');
|
|
4
|
+
const cors = require('cors');
|
|
5
|
+
const logger = require('morgan');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
const open = require('open');
|
|
8
|
+
|
|
9
|
+
// LOCAL
|
|
10
|
+
const tools = require('../utils/tools');
|
|
11
|
+
|
|
12
|
+
// SERVER
|
|
13
|
+
const app = express();
|
|
14
|
+
app.set('port', (process.env.PORT || 3000));
|
|
15
|
+
app.use(cors());
|
|
16
|
+
app.use(bodyParser.urlencoded({ extended: true }));
|
|
17
|
+
app.use(bodyParser.json());
|
|
18
|
+
app.use(logger('dev'));
|
|
19
|
+
app.use(express.static(path.join(__dirname, 'public')));
|
|
20
|
+
|
|
21
|
+
// ROUTES DEFS
|
|
22
|
+
app.use('/api', require('./routes'));
|
|
23
|
+
|
|
24
|
+
// STARTING - opening html page if prod flag is passed
|
|
25
|
+
app.listen(app.get('port'), () => {
|
|
26
|
+
const { prod, stats } = tools.getArgs();
|
|
27
|
+
if (prod) {
|
|
28
|
+
if (stats) {
|
|
29
|
+
open('http://localhost:3000/stats.html');
|
|
30
|
+
} else {
|
|
31
|
+
open('http://localhost:3000');
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
console.log('We are live on ' + app.get('port'));
|
|
35
|
+
});
|
|
@@ -229,13 +229,11 @@ module.exports.getConfigOptions = () => {
|
|
|
229
229
|
SLACK_CHANNEL_FRONTEND: null,
|
|
230
230
|
SLACK_CHANNEL_BACKEND: null,
|
|
231
231
|
SLACK_CHANNEL_PROJECT: null,
|
|
232
|
-
MAIL_ADDRESS_FRONTEND: null,
|
|
233
|
-
MAIL_ADDRESS_BACKEND: null,
|
|
234
|
-
MAIL_ADDRESS_PROJECT: null,
|
|
235
232
|
MSTEAMS_HOST: null,
|
|
236
233
|
MSTEAMS_FRONTEND_CHANNEL: null,
|
|
237
234
|
MSTEAMS_BACKEND_CHANNEL: null,
|
|
238
235
|
MSTEAMS_PROJECT_CHANNEL: null,
|
|
236
|
+
MSTEAMS_CHANNELS_EMAILS: null,
|
|
239
237
|
API_HOST: null,
|
|
240
238
|
AUDIT_DEPENDENCIES_GATES: null,
|
|
241
239
|
}
|
|
@@ -327,22 +325,6 @@ module.exports.getConfigOptions = () => {
|
|
|
327
325
|
}
|
|
328
326
|
}
|
|
329
327
|
|
|
330
|
-
const mail = notification.mail;
|
|
331
|
-
|
|
332
|
-
if (mail) {
|
|
333
|
-
if (mail.channels) {
|
|
334
|
-
if (mail.channels.frontend) {
|
|
335
|
-
configOptions.MAIL_ADDRESS_FRONTEND = this.getNotificationMailAddress(mail.channels.frontend);
|
|
336
|
-
}
|
|
337
|
-
if (mail.channels.backend) {
|
|
338
|
-
configOptions.MAIL_ADDRESS_BACKEND = this.getNotificationMailAddress(mail.channels.backend);
|
|
339
|
-
}
|
|
340
|
-
if (mail.channels.project) {
|
|
341
|
-
configOptions.MAIL_ADDRESS_PROJECT = this.getNotificationMailAddress(mail.channels.project);
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
|
|
346
328
|
const msteams = notification.msteams;
|
|
347
329
|
|
|
348
330
|
if (msteams) {
|
|
@@ -361,6 +343,10 @@ module.exports.getConfigOptions = () => {
|
|
|
361
343
|
configOptions.MSTEAMS_PROJECT_CHANNEL = msteams.channels.project;
|
|
362
344
|
}
|
|
363
345
|
}
|
|
346
|
+
|
|
347
|
+
if (msteams.channelsEmails) {
|
|
348
|
+
configOptions.MSTEAMS_CHANNELS_EMAILS = msteams.channelsEmails;
|
|
349
|
+
}
|
|
364
350
|
}
|
|
365
351
|
}
|
|
366
352
|
|
|
@@ -395,42 +381,6 @@ module.exports.getConfigOptions = () => {
|
|
|
395
381
|
}
|
|
396
382
|
|
|
397
383
|
|
|
398
|
-
module.exports.getNotificationMailChannel = (channelName) => {
|
|
399
|
-
const config = this.getConfig();
|
|
400
|
-
var channelPrefix;
|
|
401
|
-
|
|
402
|
-
if (config && config.notification && config.notification.mail && config.notification.mail.channelsMap) {
|
|
403
|
-
channelPrefix = config.notification.mail.channelsMap[channelName];
|
|
404
|
-
if (!channelPrefix) {
|
|
405
|
-
channelPrefix = config.notification.mail.channelsMap[config.notification.mail.defaultChannel];
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
return channelPrefix;
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
module.exports.getNotificationMailAddress = (channelName) => {
|
|
413
|
-
const config = this.getConfig();
|
|
414
|
-
|
|
415
|
-
const getChannel = (channelName) => {
|
|
416
|
-
let channelPrefix;
|
|
417
|
-
|
|
418
|
-
if (config && config.notification && config.notification.mail && config.notification.mail.channelsMap) {
|
|
419
|
-
channelPrefix = config.notification.mail.channelsMap[channelName];
|
|
420
|
-
if (!channelPrefix) {
|
|
421
|
-
channelPrefix = config.notification.mail.channelsMap[config.notification.mail.defaultChannel];
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
return channelPrefix;
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
const channelPrefix = getChannel(channelName);
|
|
429
|
-
|
|
430
|
-
return channelPrefix + config.notification.mail.addressSuffix;
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
|
|
434
384
|
module.exports.getLocalEuiVersion = () => {
|
|
435
385
|
let euiVersionsLocal = [
|
|
436
386
|
...innerPackages.getLocalPackagesEuiVersion(),
|
|
@@ -23,8 +23,8 @@ module.exports.getCsdrPackagesFull = (flattenChildren = true) => {
|
|
|
23
23
|
try {
|
|
24
24
|
outputPackages.push(this.getPackage(p, true));
|
|
25
25
|
} catch (e) {
|
|
26
|
-
tools.logInfo(`Package: ${p} is in local config but not found in global... should be cleaned up`);
|
|
27
|
-
console.log(e);
|
|
26
|
+
// tools.logInfo(`Package: ${p} is in local config but not found in global... should be cleaned up`);
|
|
27
|
+
// console.log(e);
|
|
28
28
|
}
|
|
29
29
|
})
|
|
30
30
|
return outputPackages;
|
|
@@ -39,8 +39,8 @@ const getPackages = module.exports.getPackages = () => {
|
|
|
39
39
|
try {
|
|
40
40
|
outputPackages.push(this.getPackage(p));
|
|
41
41
|
} catch (e) {
|
|
42
|
-
tools.logInfo(`Package: ${p} is in local config but not found in global... should be cleaned up`);
|
|
43
|
-
console.log(e);
|
|
42
|
+
// tools.logInfo(`Package: ${p} is in local config but not found in global... should be cleaned up`);
|
|
43
|
+
// console.log(e);
|
|
44
44
|
}
|
|
45
45
|
})
|
|
46
46
|
return outputPackages;
|
|
@@ -8,12 +8,11 @@ const tools = require('../../utils/tools');
|
|
|
8
8
|
|
|
9
9
|
// INNER
|
|
10
10
|
const innerGlobal = require('./global');
|
|
11
|
-
|
|
11
|
+
const innerPackages = require('./packages');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
module.exports.getRemote = (remoteName) => {
|
|
16
|
-
|
|
17
16
|
// if not provided as param, we fetch them from the command line (local operations)
|
|
18
17
|
if (!remoteName) {
|
|
19
18
|
remoteName = tools.getArgs().root;
|
|
@@ -64,7 +63,7 @@ module.exports.getCsdrRemotes = (hostName, euiVersion) => {
|
|
|
64
63
|
const hostNameFilterFn = (r) => {
|
|
65
64
|
if (r.build) {
|
|
66
65
|
if (!r.build.appTarget || r.build.appTarget === 'MWP_ONLY') {
|
|
67
|
-
if (hostName === 'my-workplace') {
|
|
66
|
+
if (hostName === 'my-workplace' || hostName) {
|
|
68
67
|
return true;
|
|
69
68
|
}
|
|
70
69
|
} else if (r.build.appTarget === 'SEDIA_ONLY') {
|
|
@@ -150,3 +149,31 @@ module.exports.getRemoteByNpmPkg = (npmPkg, fromCsdrConfig) => {
|
|
|
150
149
|
module.exports.isLocalRemote = (npmPkg) => {
|
|
151
150
|
return this.getRemoteByNpmPkg(npmPkg) !== undefined;
|
|
152
151
|
}
|
|
152
|
+
|
|
153
|
+
module.exports.getRemotesPackages = (remotes) => {
|
|
154
|
+
let packages = [], deps = [];
|
|
155
|
+
|
|
156
|
+
remotes.forEach((r) => {
|
|
157
|
+
const remote = this.getRemote(r);
|
|
158
|
+
const npmPkgs = Object.keys(remote.dependencies.composite);
|
|
159
|
+
|
|
160
|
+
deps = [...deps, ...npmPkgs];
|
|
161
|
+
|
|
162
|
+
npmPkgs.forEach((npmPkg) => {
|
|
163
|
+
const pkg = innerPackages.getPackageByNpmPkg(npmPkg, true);
|
|
164
|
+
if (pkg) {
|
|
165
|
+
packages.push(pkg.name);
|
|
166
|
+
}
|
|
167
|
+
})
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
packages = packages.filter((pkg) => {
|
|
171
|
+
return pkg.indexOf('eui') < 0;
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
return {
|
|
175
|
+
deps: tools.removeArrayDuplicates(deps),
|
|
176
|
+
packages: tools.removeArrayDuplicates(packages)
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
@@ -125,3 +125,31 @@ module.exports.installHostPackage = (projectName) => {
|
|
|
125
125
|
throw e;
|
|
126
126
|
})
|
|
127
127
|
}
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
module.exports.importScripts = () => {
|
|
131
|
+
return Promise.resolve()
|
|
132
|
+
.then(() => {
|
|
133
|
+
tools.logTitle("Init scripts for local packages");
|
|
134
|
+
const packages = configUtils.packages.getPackages();
|
|
135
|
+
|
|
136
|
+
const rootPackageJsonFile = path.join(process.cwd(), 'package.json')
|
|
137
|
+
const rootPackageJson = require(rootPackageJsonFile);
|
|
138
|
+
|
|
139
|
+
packages.forEach((p) => {
|
|
140
|
+
const scriptsFile = path.join(p.paths.root, 'scripts.json');
|
|
141
|
+
if (tools.isFileExists(scriptsFile)) {
|
|
142
|
+
tools.logInfo(`Processing scripts.json file for package: ${p.name}`);
|
|
143
|
+
|
|
144
|
+
const scriptsJson = require(scriptsFile);
|
|
145
|
+
rootPackageJson.scripts = { ...rootPackageJson.scripts, ...scriptsJson };
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
tools.logInfo('Updating root package.json');
|
|
150
|
+
tools.writeJsonFileSync(rootPackageJsonFile, rootPackageJson);
|
|
151
|
+
})
|
|
152
|
+
.catch((e) => {
|
|
153
|
+
throw e;
|
|
154
|
+
})
|
|
155
|
+
}
|
|
@@ -453,3 +453,26 @@ module.exports.getCommitsByUsers = (packages, range = 'ALL') => {
|
|
|
453
453
|
return tools.sortArray(usersArray, 'commits', 'desc');
|
|
454
454
|
})
|
|
455
455
|
}
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
module.exports.getRemoteStats = (remoteName) => {
|
|
459
|
+
const remote = configUtils.remotes.getRemote(remoteName);
|
|
460
|
+
|
|
461
|
+
let versions;
|
|
462
|
+
|
|
463
|
+
return Promise.resolve()
|
|
464
|
+
.then(() => {
|
|
465
|
+
return metadataUtils.packageVersions.getMetadata(remote);
|
|
466
|
+
})
|
|
467
|
+
.then((metadata) => {
|
|
468
|
+
versions = metadata.versions;
|
|
469
|
+
})
|
|
470
|
+
.then(() => {
|
|
471
|
+
return {
|
|
472
|
+
versions
|
|
473
|
+
}
|
|
474
|
+
})
|
|
475
|
+
.catch((e) => {
|
|
476
|
+
throw e;
|
|
477
|
+
})
|
|
478
|
+
}
|
package/scripts/index.js
CHANGED
|
@@ -31,7 +31,6 @@ module.exports.cleanUtils = require('./utils/clean/clean-utils');
|
|
|
31
31
|
// utils - notification
|
|
32
32
|
module.exports.notificationCommon = require('./utils/notification/common');
|
|
33
33
|
module.exports.notificationConfig = require('./utils/notification/config');
|
|
34
|
-
module.exports.notificationMailUtils = require('./utils/notification/mail-utils');
|
|
35
34
|
module.exports.notificationMessageStack = require('./utils/notification/message-stack');
|
|
36
35
|
module.exports.notificationUtils = require('./utils/notification/notification-utils');
|
|
37
36
|
module.exports.notificationPackage = require('./utils/notification/package');
|
|
@@ -12,15 +12,14 @@ module.exports.getPackageConfig = (pkg) => {
|
|
|
12
12
|
// Fetching global config - default if not overriden in package own config
|
|
13
13
|
const globalConfig = configUtils.global.getConfigOptions();
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
let slackChannel, msTeamsChannel;
|
|
16
|
+
|
|
16
17
|
|
|
17
18
|
if (pkg.backend) {
|
|
18
19
|
slackChannel = globalConfig.SLACK_CHANNEL_BACKEND;
|
|
19
|
-
mailAdress = globalConfig.MAIL_ADDRESS_BACKEND;
|
|
20
20
|
msTeamsChannel = globalConfig.MSTEAMS_BACKEND_CHANNEL;
|
|
21
21
|
} else {
|
|
22
22
|
slackChannel = globalConfig.SLACK_CHANNEL_FRONTEND;
|
|
23
|
-
mailAdress = globalConfig.MAIL_ADDRESS_FRONTEND;
|
|
24
23
|
msTeamsChannel = globalConfig.MSTEAMS_FRONTEND_CHANNEL;
|
|
25
24
|
}
|
|
26
25
|
|
|
@@ -32,15 +31,11 @@ module.exports.getPackageConfig = (pkg) => {
|
|
|
32
31
|
SLACK_HOOK: globalConfig.SLACK_HOOK,
|
|
33
32
|
SLACK_CHANNEL: slackChannel
|
|
34
33
|
}
|
|
35
|
-
} else if (globalConfig.NOTIFICATION_CLIENT === 'MAIL') {
|
|
36
|
-
return {
|
|
37
|
-
CLIENT: globalConfig.NOTIFICATION_CLIENT,
|
|
38
|
-
MAIL_ADDRESS: mailAdress
|
|
39
|
-
}
|
|
40
34
|
} else if (globalConfig.NOTIFICATION_CLIENT === 'SLACK') {
|
|
41
35
|
return {
|
|
42
36
|
CLIENT: globalConfig.NOTIFICATION_CLIENT,
|
|
43
37
|
MSTEAMS_CHANNEL: msTeamsChannel,
|
|
38
|
+
MSTEAMS_CHANNEL_EMAIL: globalConfig.MSTEAMS_CHANNELS_EMAILS[msTeamsChannel]
|
|
44
39
|
}
|
|
45
40
|
}
|
|
46
41
|
|
|
@@ -61,15 +56,11 @@ module.exports.getPackageConfig = (pkg) => {
|
|
|
61
56
|
SLACK_HOOK: globalConfig.SLACK_HOOK,
|
|
62
57
|
SLACK_CHANNEL: pkg.notification.channel
|
|
63
58
|
}
|
|
64
|
-
} else if (pkg.notification.client === 'MAIL') {
|
|
65
|
-
return {
|
|
66
|
-
CLIENT: pkg.notification.client,
|
|
67
|
-
MAIL_ADDRESS: configUtils.global.getNotificationMailAddress(pkg.notification.channel)
|
|
68
|
-
}
|
|
69
59
|
} else if (pkg.notification.client === 'MSTEAMS') {
|
|
70
60
|
return {
|
|
71
61
|
CLIENT: pkg.notification.client,
|
|
72
62
|
MSTEAMS_CHANNEL: pkg.notification.channel,
|
|
63
|
+
MSTEAMS_CHANNEL_EMAIL: globalConfig.MSTEAMS_CHANNELS_EMAILS[pkg.notification.channel]
|
|
73
64
|
}
|
|
74
65
|
}
|
|
75
66
|
}
|
|
@@ -88,15 +79,11 @@ module.exports.getProjectConfig = (project) => {
|
|
|
88
79
|
SLACK_HOOK: globalConfig.SLACK_HOOK,
|
|
89
80
|
SLACK_CHANNEL: globalConfig.SLACK_CHANNEL_PROJECT
|
|
90
81
|
}
|
|
91
|
-
} else if (globalConfig.NOTIFICATION_CLIENT === 'MAIL') {
|
|
92
|
-
return {
|
|
93
|
-
CLIENT: globalConfig.NOTIFICATION_CLIENT,
|
|
94
|
-
MAIL_ADDRESS: globalConfig.MAIL_ADDRESS_PROJECT
|
|
95
|
-
}
|
|
96
82
|
} else if (globalConfig.NOTIFICATION_CLIENT === 'MSTEAMS') {
|
|
97
83
|
return {
|
|
98
84
|
CLIENT: globalConfig.NOTIFICATION_CLIENT,
|
|
99
85
|
MSTEAMS_CHANNEL: globalConfig.MSTEAMS_PROJECT_CHANNEL,
|
|
86
|
+
MSTEAMS_CHANNEL_EMAIL: globalConfig.MSTEAMS_CHANNELS_EMAILS[globalConfig.MSTEAMS_PROJECT_CHANNEL]
|
|
100
87
|
}
|
|
101
88
|
}
|
|
102
89
|
|
|
@@ -117,15 +104,11 @@ module.exports.getProjectConfig = (project) => {
|
|
|
117
104
|
SLACK_HOOK: globalConfig.SLACK_HOOK,
|
|
118
105
|
SLACK_CHANNEL: project.notification.channel
|
|
119
106
|
}
|
|
120
|
-
} else if (project.notification.client === 'MAIL') {
|
|
121
|
-
return {
|
|
122
|
-
CLIENT: project.notification.client,
|
|
123
|
-
MAIL_ADDRESS: configUtils.global.getNotificationMailAddress(project.notification.channel)
|
|
124
|
-
}
|
|
125
107
|
} else if (project.notification.client === 'MSTEAMS') {
|
|
126
108
|
return {
|
|
127
109
|
CLIENT: globalConfig.NOTIFICATION_CLIENT,
|
|
128
110
|
MSTEAMS_CHANNEL: project.notification.channel,
|
|
111
|
+
MSTEAMS_CHANNEL_EMAIL: globalConfig.MSTEAMS_CHANNELS_EMAILS[project.notification.channel]
|
|
129
112
|
}
|
|
130
113
|
}
|
|
131
114
|
}
|
|
@@ -133,14 +116,14 @@ module.exports.getProjectConfig = (project) => {
|
|
|
133
116
|
}
|
|
134
117
|
|
|
135
118
|
|
|
136
|
-
module.exports.storeConfig = (rootPath, slackHook, slackChannel,
|
|
119
|
+
module.exports.storeConfig = (rootPath, slackHook, slackChannel, msTeamsChannel, msTeamsChannelEmail) => {
|
|
137
120
|
return Promise.resolve()
|
|
138
121
|
.then(() => {
|
|
139
122
|
var content = '';
|
|
140
123
|
content += `export SLACK_HOOK=${slackHook}\n`;
|
|
141
124
|
content += `export SLACK_CHANNEL=${slackChannel}\n`;
|
|
142
|
-
content += `export MAIL_ADDRESS=${mailAddress}\n`;
|
|
143
125
|
content += `export MSTEAMS_CHANNEL=${msTeamsChannel}\n`;
|
|
126
|
+
content += `export MSTEAMS_CHANNEL_EMAIL=${msTeamsChannelEmail}\n`;
|
|
144
127
|
return pipelineUtils.setVariables(rootPath, content);
|
|
145
128
|
})
|
|
146
129
|
|
|
@@ -153,8 +136,11 @@ module.exports.storePackageConfig = (pkg) => {
|
|
|
153
136
|
return Promise.resolve()
|
|
154
137
|
.then(() => {
|
|
155
138
|
const config = this.getPackageConfig(pkg);
|
|
139
|
+
|
|
156
140
|
return this.storeConfig(
|
|
157
|
-
process.cwd(),
|
|
141
|
+
process.cwd(),
|
|
142
|
+
config.SLACK_HOOK, config.SLACK_CHANNEL,
|
|
143
|
+
config.MSTEAMS_CHANNEL, config.MSTEAMS_CHANNEL_EMAIL
|
|
158
144
|
);
|
|
159
145
|
})
|
|
160
146
|
|
|
@@ -167,8 +153,11 @@ module.exports.storeProjectConfig = (project) => {
|
|
|
167
153
|
return Promise.resolve()
|
|
168
154
|
.then(() => {
|
|
169
155
|
const config = this.getProjectConfig(project);
|
|
156
|
+
|
|
170
157
|
return this.storeConfig(
|
|
171
|
-
project.paths.rootPath,
|
|
158
|
+
project.paths.rootPath,
|
|
159
|
+
config.SLACK_HOOK, config.SLACK_CHANNEL,
|
|
160
|
+
config.MSTEAMS_CHANNEL, config.MSTEAMS_CHANNEL_EMAIL
|
|
172
161
|
);
|
|
173
162
|
})
|
|
174
163
|
|
|
@@ -53,9 +53,6 @@ const sendMessage = (config) => {
|
|
|
53
53
|
.then(() => {
|
|
54
54
|
if (config.CLIENT === 'MSTEAMS') {
|
|
55
55
|
return innerTeamsUtils.sendMessage(config, messageContent);
|
|
56
|
-
|
|
57
|
-
} else if (config.CLIENT === 'MAIL') {
|
|
58
|
-
// TODO IF MAIL NOTIF IS NEEDED...
|
|
59
56
|
}
|
|
60
57
|
})
|
|
61
58
|
.catch((e) => {
|
package/scripts.json
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{
|
|
2
|
+
"csdr:app-dev": "nodemon --ext js --watch ./packages/eui-tools/scripts ./packages/eui-tools/scripts/app/server.js",
|
|
3
|
+
"csdr:app": "node ./packages/eui-tools/scripts/app/server.js --prod",
|
|
4
|
+
"csdr:app-stats": "node ./packages/eui-tools/scripts/app/server.js --prod --stats"
|
|
5
|
+
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
// LOCALS
|
|
5
|
-
const tools = require('../tools');
|
|
6
|
-
|
|
7
|
-
let { dryRun, debug} = tools.getArgs();
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const sendCore = (subject, body, recipient) => {
|
|
11
|
-
const sendmail = require('sendmail')(); // if used in the future and needed this deps is required : "sendmail": "1.6.1"
|
|
12
|
-
|
|
13
|
-
tools.logInfo(`Sending mail to : ${recipient}`);
|
|
14
|
-
tools.logInfo('Message subject / body :');
|
|
15
|
-
console.log(subject);
|
|
16
|
-
console.log(body);
|
|
17
|
-
|
|
18
|
-
if (dryRun) {
|
|
19
|
-
console.log('----------------------------------------------');
|
|
20
|
-
console.log('----------------------------------------------');
|
|
21
|
-
console.log(subject);
|
|
22
|
-
console.log('----------------------------------------------');
|
|
23
|
-
console.log(body);
|
|
24
|
-
console.log('----------------------------------------------');
|
|
25
|
-
console.log(recipient);
|
|
26
|
-
console.log('----------------------------------------------');
|
|
27
|
-
console.log('----------------------------------------------');
|
|
28
|
-
|
|
29
|
-
} else {
|
|
30
|
-
|
|
31
|
-
return new Promise((resolve, reject) => {
|
|
32
|
-
sendmail({
|
|
33
|
-
from: 'automated-notifications@nomail.ec.europa.eu',
|
|
34
|
-
to: recipient,
|
|
35
|
-
subject: subject,
|
|
36
|
-
html: body
|
|
37
|
-
}, function (err, reply) {
|
|
38
|
-
if (err) {
|
|
39
|
-
console.log(err && err.stack);
|
|
40
|
-
reject(err);
|
|
41
|
-
} else {
|
|
42
|
-
console.dir(reply);
|
|
43
|
-
resolve();
|
|
44
|
-
}
|
|
45
|
-
})
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
module.exports.sendMessage = (subject, message, recipient) => {
|
|
52
|
-
return Promise.resolve()
|
|
53
|
-
.then(() => {
|
|
54
|
-
return sendCore(subject, message, recipient);
|
|
55
|
-
})
|
|
56
|
-
.catch(e => {
|
|
57
|
-
throw e;
|
|
58
|
-
})
|
|
59
|
-
}
|