dts-backoffice-util 20.0.0 → 20.2.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/README.md +2 -2
- package/fesm2022/dts-backoffice-util.mjs +76 -30
- package/fesm2022/dts-backoffice-util.mjs.map +1 -1
- package/index.d.ts +5 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,8 +12,8 @@ Segue abaixo as últimas versões da Biblioteca, conforme a versão do PO-UI e A
|
|
|
12
12
|
|
|
13
13
|
| PO-UI | Angular | Versão dtsBackofficeUtil |
|
|
14
14
|
|-|-|-|
|
|
15
|
-
| v20 | v20 | 20.
|
|
16
|
-
| v19 | v19 | 19.
|
|
15
|
+
| v20 | v20 | 20.2.0 |
|
|
16
|
+
| v19 | v19 | 19.6.0 |
|
|
17
17
|
| v18 | v18 | 18.3.0 |
|
|
18
18
|
| v17 | v17 | 17.1.0 |
|
|
19
19
|
| v16 | v16 | 16.1.0 |
|
|
@@ -272,6 +272,15 @@ class MenuDatasulService {
|
|
|
272
272
|
this.openHTMLProgram('THF1', externalName, params, parent);
|
|
273
273
|
}
|
|
274
274
|
openHTMLProgram(type, HTMLProgram, params, parent) {
|
|
275
|
+
const backendType = sessionStorage.getItem('totvs.product.backend.type');
|
|
276
|
+
if (backendType === 'DSS') {
|
|
277
|
+
this.openOnDSS(type, HTMLProgram, params, parent);
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
this.openOnDTS4THF(type, HTMLProgram, params, parent);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
openOnDTS4THF(type, HTMLProgram, params, parent) {
|
|
275
284
|
const datasulPath = document.referrer.indexOf('totvs-menu') > 0 ? 'totvs-menu' : 'menu-html';
|
|
276
285
|
HTMLProgram = HTMLProgram.replace(/\\/g, '/');
|
|
277
286
|
if (HTMLProgram.charAt(0) === '/') {
|
|
@@ -291,8 +300,33 @@ class MenuDatasulService {
|
|
|
291
300
|
if (baseUrl.charAt(baseUrl.length - 1) === '/') {
|
|
292
301
|
baseUrl = baseUrl.slice(0, -1);
|
|
293
302
|
}
|
|
294
|
-
|
|
303
|
+
if (type === 'THF2') {
|
|
304
|
+
baseUrl = `${baseUrl}/#`;
|
|
305
|
+
}
|
|
306
|
+
baseUrl = `${baseUrl}/${params}`;
|
|
307
|
+
}
|
|
308
|
+
this.openWindow(baseUrl, parent);
|
|
309
|
+
}
|
|
310
|
+
openOnDSS(type, HTMLProgram, params, parent) {
|
|
311
|
+
let baseUrl = `${HTMLProgram}`;
|
|
312
|
+
if (params) {
|
|
313
|
+
baseUrl = `${baseUrl}/${params}`;
|
|
314
|
+
}
|
|
315
|
+
try {
|
|
316
|
+
if (window.top && typeof window.top.navigateSmartX === 'function') {
|
|
317
|
+
window.top.navigateSmartX(baseUrl);
|
|
318
|
+
}
|
|
319
|
+
else {
|
|
320
|
+
// Se falhar e precisar do window.open, a barra na frente e o smart-x
|
|
321
|
+
// são necessários para o navegador não emendar na URL atual do iframe
|
|
322
|
+
this.openWindow(`/smart-x/${baseUrl}`, parent);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
catch (e) {
|
|
326
|
+
this.openWindow(`/smart-x/${baseUrl}`, parent);
|
|
295
327
|
}
|
|
328
|
+
}
|
|
329
|
+
openWindow(baseUrl, parent) {
|
|
296
330
|
if (parent) {
|
|
297
331
|
window.open(baseUrl, '_parent');
|
|
298
332
|
}
|
|
@@ -319,7 +353,7 @@ class MenuDatasulService {
|
|
|
319
353
|
}
|
|
320
354
|
const aRequest = [];
|
|
321
355
|
programList.forEach(programSearch => {
|
|
322
|
-
aRequest.push(this.http.post(this.urlMenuPrograms,
|
|
356
|
+
aRequest.push(this.http.post(this.urlMenuPrograms, this.getPayloadSearchProg(programSearch)));
|
|
323
357
|
});
|
|
324
358
|
return forkJoin(aRequest).pipe(map$1((response) => {
|
|
325
359
|
if (!response) {
|
|
@@ -349,6 +383,9 @@ class MenuDatasulService {
|
|
|
349
383
|
return responseReturn;
|
|
350
384
|
}));
|
|
351
385
|
}
|
|
386
|
+
getPayloadSearchProg(programSearch) {
|
|
387
|
+
return { 'codModul': null, 'search': programSearch, 'typeProg': '4,3,1,2', 'groupAplicat': [] };
|
|
388
|
+
}
|
|
352
389
|
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: MenuDatasulService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
353
390
|
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: MenuDatasulService }); }
|
|
354
391
|
}
|
|
@@ -1555,6 +1592,9 @@ class TotvsScheduleExecutionService {
|
|
|
1555
1592
|
}
|
|
1556
1593
|
createExecution(parameters, loading) {
|
|
1557
1594
|
const params = JSON.parse(JSON.stringify(parameters).replace(/\\\\/g, '*|'));
|
|
1595
|
+
if (params) {
|
|
1596
|
+
params.svUuidToken = this.getUuidAccessToken();
|
|
1597
|
+
}
|
|
1558
1598
|
if (loading) {
|
|
1559
1599
|
return this.http.post(`${this.urlJobScheduler}`, params, this.headers);
|
|
1560
1600
|
}
|
|
@@ -1565,55 +1605,49 @@ class TotvsScheduleExecutionService {
|
|
|
1565
1605
|
createExecutionForNow(executionParams, loading) {
|
|
1566
1606
|
let jobScheduleParams;
|
|
1567
1607
|
const date = new Date();
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
params.programEMS5 = false;
|
|
1608
|
+
if (!executionParams.programEMS5) {
|
|
1609
|
+
executionParams.programEMS5 = false;
|
|
1571
1610
|
}
|
|
1572
|
-
if (!
|
|
1573
|
-
|
|
1611
|
+
if (!executionParams.programStyle) {
|
|
1612
|
+
executionParams.programStyle = 0;
|
|
1574
1613
|
}
|
|
1575
|
-
if (!
|
|
1576
|
-
|
|
1614
|
+
if (!executionParams.programVersion) {
|
|
1615
|
+
executionParams.programVersion = '';
|
|
1577
1616
|
}
|
|
1578
|
-
if (!
|
|
1579
|
-
|
|
1617
|
+
if (!executionParams.businessParams || executionParams.businessParams.length === 0) {
|
|
1618
|
+
executionParams.businessParams = [{ chave: '', valor: '' }];
|
|
1580
1619
|
}
|
|
1581
1620
|
jobScheduleParams = {};
|
|
1582
1621
|
jobScheduleParams.status = 'active';
|
|
1583
|
-
jobScheduleParams.processID =
|
|
1622
|
+
jobScheduleParams.processID = executionParams.programName;
|
|
1584
1623
|
jobScheduleParams.firstExecution = `${date.getFullYear()}-${(date.getMonth() + 1)}-${date.getDate()}T${this.addZero(date.getHours())}:${this.addZero(date.getMinutes())}:00.000Z`;
|
|
1585
1624
|
jobScheduleParams.recurrent = false;
|
|
1586
1625
|
jobScheduleParams.executionParameter = {
|
|
1587
1626
|
parametros: [
|
|
1588
|
-
{ chave: 'rpwServer', valor:
|
|
1589
|
-
{ chave: 'RPW_PROGRAM', valor:
|
|
1590
|
-
{ chave: 'RPW_PRG_EMS5', valor:
|
|
1591
|
-
{ chave: 'RPW_PRG_ESTILO', valor:
|
|
1592
|
-
{ chave: 'RPW_PRG_VERS', valor:
|
|
1593
|
-
{ parametros_negocio:
|
|
1627
|
+
{ chave: 'rpwServer', valor: executionParams.executionServer },
|
|
1628
|
+
{ chave: 'RPW_PROGRAM', valor: executionParams.externalName },
|
|
1629
|
+
{ chave: 'RPW_PRG_EMS5', valor: executionParams.programEMS5 ? 'yes' : 'no' },
|
|
1630
|
+
{ chave: 'RPW_PRG_ESTILO', valor: executionParams.programStyle },
|
|
1631
|
+
{ chave: 'RPW_PRG_VERS', valor: executionParams.programVersion },
|
|
1632
|
+
{ parametros_negocio: executionParams.businessParams }
|
|
1594
1633
|
]
|
|
1595
1634
|
};
|
|
1596
|
-
if (
|
|
1635
|
+
if (executionParams.paramDigitDef && executionParams.paramDigitDef.length > 0) {
|
|
1597
1636
|
jobScheduleParams.executionParameter.parametros.push({
|
|
1598
|
-
param_digita_def:
|
|
1637
|
+
param_digita_def: executionParams.paramDigitDef
|
|
1599
1638
|
});
|
|
1600
1639
|
}
|
|
1601
|
-
if (
|
|
1640
|
+
if (executionParams.paramDigitData && executionParams.paramDigitData.length > 0) {
|
|
1602
1641
|
jobScheduleParams.executionParameter.parametros.push({
|
|
1603
|
-
param_digita_dados:
|
|
1642
|
+
param_digita_dados: executionParams.paramDigitData
|
|
1604
1643
|
});
|
|
1605
1644
|
}
|
|
1606
|
-
if (
|
|
1645
|
+
if (executionParams.paramSelections && executionParams.paramSelections.length > 0) {
|
|
1607
1646
|
jobScheduleParams.executionParameter.parametros.push({
|
|
1608
|
-
selecoes:
|
|
1647
|
+
selecoes: executionParams.paramSelections
|
|
1609
1648
|
});
|
|
1610
1649
|
}
|
|
1611
|
-
|
|
1612
|
-
return this.http.post(`${this.urlJobScheduler}`, jobScheduleParams, this.headers);
|
|
1613
|
-
}
|
|
1614
|
-
else {
|
|
1615
|
-
return this.http.post(`${this.urlJobScheduler}`, jobScheduleParams);
|
|
1616
|
-
}
|
|
1650
|
+
return this.createExecution(jobScheduleParams, loading);
|
|
1617
1651
|
}
|
|
1618
1652
|
getExecutionByJobScheduleID(jobScheduleID, loading = false) {
|
|
1619
1653
|
const url = `${this.urlJobExecution}?jobScheduleID=${jobScheduleID}`;
|
|
@@ -1728,6 +1762,18 @@ class TotvsScheduleExecutionService {
|
|
|
1728
1762
|
}
|
|
1729
1763
|
return str;
|
|
1730
1764
|
}
|
|
1765
|
+
getUuidAccessToken() {
|
|
1766
|
+
let tokenService = localStorage.getItem('token-service.token');
|
|
1767
|
+
if (tokenService) {
|
|
1768
|
+
let jsonTokenService = JSON.parse(tokenService);
|
|
1769
|
+
let accessToken = jsonTokenService['access_token'];
|
|
1770
|
+
let payload = accessToken.split(".");
|
|
1771
|
+
let decodedAccessToken = atob(payload[1]);
|
|
1772
|
+
let jsonDecodedAccessToken = JSON.parse(decodedAccessToken);
|
|
1773
|
+
return jsonDecodedAccessToken['jti'];
|
|
1774
|
+
}
|
|
1775
|
+
return '';
|
|
1776
|
+
}
|
|
1731
1777
|
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: TotvsScheduleExecutionService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1732
1778
|
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: TotvsScheduleExecutionService }); }
|
|
1733
1779
|
}
|