@stssocialst-stp/fe-payroll 0.3.6 → 0.3.7
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/dist/index.es.js +216 -87
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +216 -87
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -6489,11 +6489,93 @@ function useBeneficiarios() {
|
|
|
6489
6489
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
6490
6490
|
error = _useState6[0],
|
|
6491
6491
|
setError = _useState6[1];
|
|
6492
|
-
function
|
|
6492
|
+
function poll(_x) {
|
|
6493
|
+
return _poll.apply(this, arguments);
|
|
6494
|
+
}
|
|
6495
|
+
function _poll() {
|
|
6496
|
+
_poll = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(clientMutationId) {
|
|
6497
|
+
var INTERVAL_MS, TIMEOUT_MS, started, _result$data, _node$jsonExt$output, _node$jsonExt, resp, result, node;
|
|
6498
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
6499
|
+
while (1) switch (_context.prev = _context.next) {
|
|
6500
|
+
case 0:
|
|
6501
|
+
INTERVAL_MS = 5000;
|
|
6502
|
+
TIMEOUT_MS = 20 * 60 * 1000; // 20 minutos
|
|
6503
|
+
started = Date.now();
|
|
6504
|
+
case 1:
|
|
6505
|
+
if (!(Date.now() - started < TIMEOUT_MS)) {
|
|
6506
|
+
_context.next = 8;
|
|
6507
|
+
break;
|
|
6508
|
+
}
|
|
6509
|
+
_context.next = 2;
|
|
6510
|
+
return new Promise(function (resolve) {
|
|
6511
|
+
return setTimeout(resolve, INTERVAL_MS);
|
|
6512
|
+
});
|
|
6513
|
+
case 2:
|
|
6514
|
+
_context.next = 3;
|
|
6515
|
+
return fetch("".concat(baseApiUrl, "/graphql"), {
|
|
6516
|
+
method: 'POST',
|
|
6517
|
+
headers: buildHeaders(),
|
|
6518
|
+
credentials: 'same-origin',
|
|
6519
|
+
body: JSON.stringify({
|
|
6520
|
+
query: "\n query {\n mutationLogs(clientMutationId: \"".concat(clientMutationId, "\") {\n edges { node { status error jsonExt clientMutationLabel } }\n }\n }\n ")
|
|
6521
|
+
})
|
|
6522
|
+
});
|
|
6523
|
+
case 3:
|
|
6524
|
+
resp = _context.sent;
|
|
6525
|
+
_context.next = 4;
|
|
6526
|
+
return resp.json();
|
|
6527
|
+
case 4:
|
|
6528
|
+
result = _context.sent;
|
|
6529
|
+
node = result === null || result === void 0 || (_result$data = result.data) === null || _result$data === void 0 || (_result$data = _result$data.mutationLogs) === null || _result$data === void 0 || (_result$data = _result$data.edges) === null || _result$data === void 0 || (_result$data = _result$data[0]) === null || _result$data === void 0 ? void 0 : _result$data.node;
|
|
6530
|
+
if (node) {
|
|
6531
|
+
_context.next = 5;
|
|
6532
|
+
break;
|
|
6533
|
+
}
|
|
6534
|
+
return _context.abrupt("continue", 1);
|
|
6535
|
+
case 5:
|
|
6536
|
+
// Update UI with label if needed
|
|
6537
|
+
setOutput("A processar: ".concat(node.clientMutationLabel, "..."));
|
|
6538
|
+
if (!(node.status === 2)) {
|
|
6539
|
+
_context.next = 6;
|
|
6540
|
+
break;
|
|
6541
|
+
}
|
|
6542
|
+
return _context.abrupt("return", {
|
|
6543
|
+
success: true,
|
|
6544
|
+
output: (_node$jsonExt$output = (_node$jsonExt = node.jsonExt) === null || _node$jsonExt === void 0 ? void 0 : _node$jsonExt.output) !== null && _node$jsonExt$output !== void 0 ? _node$jsonExt$output : null,
|
|
6545
|
+
error: null
|
|
6546
|
+
});
|
|
6547
|
+
case 6:
|
|
6548
|
+
if (!(node.status === 1)) {
|
|
6549
|
+
_context.next = 7;
|
|
6550
|
+
break;
|
|
6551
|
+
}
|
|
6552
|
+
return _context.abrupt("return", {
|
|
6553
|
+
success: false,
|
|
6554
|
+
output: null,
|
|
6555
|
+
error: node.error
|
|
6556
|
+
});
|
|
6557
|
+
case 7:
|
|
6558
|
+
_context.next = 1;
|
|
6559
|
+
break;
|
|
6560
|
+
case 8:
|
|
6561
|
+
return _context.abrupt("return", {
|
|
6562
|
+
success: false,
|
|
6563
|
+
output: null,
|
|
6564
|
+
error: 'Timeout: operação excedeu 20 minutos'
|
|
6565
|
+
});
|
|
6566
|
+
case 9:
|
|
6567
|
+
case "end":
|
|
6568
|
+
return _context.stop();
|
|
6569
|
+
}
|
|
6570
|
+
}, _callee);
|
|
6571
|
+
}));
|
|
6572
|
+
return _poll.apply(this, arguments);
|
|
6573
|
+
}
|
|
6574
|
+
function request(_x2) {
|
|
6493
6575
|
return _request.apply(this, arguments);
|
|
6494
6576
|
}
|
|
6495
6577
|
function _request() {
|
|
6496
|
-
_request = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
6578
|
+
_request = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(path) {
|
|
6497
6579
|
var _ref,
|
|
6498
6580
|
_ref$multipart,
|
|
6499
6581
|
multipart,
|
|
@@ -6505,15 +6587,15 @@ function useBeneficiarios() {
|
|
|
6505
6587
|
contentType,
|
|
6506
6588
|
_data,
|
|
6507
6589
|
message,
|
|
6508
|
-
|
|
6590
|
+
_args2 = arguments,
|
|
6509
6591
|
_t;
|
|
6510
|
-
return _regeneratorRuntime.wrap(function (
|
|
6511
|
-
while (1) switch (
|
|
6592
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
6593
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
6512
6594
|
case 0:
|
|
6513
|
-
_ref =
|
|
6595
|
+
_ref = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {}, _ref$multipart = _ref.multipart, multipart = _ref$multipart === void 0 ? false : _ref$multipart, _ref$body = _ref.body, body = _ref$body === void 0 ? null : _ref$body;
|
|
6514
6596
|
setLoading(true);
|
|
6515
6597
|
setError(null);
|
|
6516
|
-
|
|
6598
|
+
_context2.prev = 1;
|
|
6517
6599
|
init = {
|
|
6518
6600
|
method: 'POST',
|
|
6519
6601
|
credentials: 'same-origin'
|
|
@@ -6524,54 +6606,50 @@ function useBeneficiarios() {
|
|
|
6524
6606
|
init.headers = buildHeaders();
|
|
6525
6607
|
if (body) init.body = JSON.stringify(body);
|
|
6526
6608
|
}
|
|
6527
|
-
|
|
6609
|
+
_context2.next = 2;
|
|
6528
6610
|
return fetch("".concat(BASE).concat(path), init);
|
|
6529
6611
|
case 2:
|
|
6530
|
-
response =
|
|
6612
|
+
response = _context2.sent;
|
|
6531
6613
|
data = null;
|
|
6532
6614
|
contentType = response.headers.get('content-type') || '';
|
|
6533
6615
|
if (!contentType.includes('application/json')) {
|
|
6534
|
-
|
|
6616
|
+
_context2.next = 4;
|
|
6535
6617
|
break;
|
|
6536
6618
|
}
|
|
6537
|
-
|
|
6619
|
+
_context2.next = 3;
|
|
6538
6620
|
return response.json();
|
|
6539
6621
|
case 3:
|
|
6540
|
-
data =
|
|
6622
|
+
data = _context2.sent;
|
|
6541
6623
|
case 4:
|
|
6542
6624
|
if (response.ok) {
|
|
6543
|
-
|
|
6625
|
+
_context2.next = 5;
|
|
6544
6626
|
break;
|
|
6545
6627
|
}
|
|
6546
6628
|
message = ((_data = data) === null || _data === void 0 ? void 0 : _data.message) || "HTTP ".concat(response.status);
|
|
6547
6629
|
setError(message);
|
|
6548
|
-
return
|
|
6630
|
+
return _context2.abrupt("return", {
|
|
6549
6631
|
ok: false,
|
|
6550
6632
|
message: message,
|
|
6551
6633
|
data: data
|
|
6552
6634
|
});
|
|
6553
6635
|
case 5:
|
|
6554
|
-
return
|
|
6636
|
+
return _context2.abrupt("return", {
|
|
6555
6637
|
ok: true,
|
|
6556
6638
|
data: data
|
|
6557
6639
|
});
|
|
6558
6640
|
case 6:
|
|
6559
|
-
|
|
6560
|
-
_t =
|
|
6641
|
+
_context2.prev = 6;
|
|
6642
|
+
_t = _context2["catch"](1);
|
|
6561
6643
|
setError(_t.message);
|
|
6562
|
-
return
|
|
6644
|
+
return _context2.abrupt("return", {
|
|
6563
6645
|
ok: false,
|
|
6564
6646
|
message: _t.message
|
|
6565
6647
|
});
|
|
6566
6648
|
case 7:
|
|
6567
|
-
_context.prev = 7;
|
|
6568
|
-
setLoading(false);
|
|
6569
|
-
return _context.finish(7);
|
|
6570
|
-
case 8:
|
|
6571
6649
|
case "end":
|
|
6572
|
-
return
|
|
6650
|
+
return _context2.stop();
|
|
6573
6651
|
}
|
|
6574
|
-
},
|
|
6652
|
+
}, _callee2, null, [[1, 6]]);
|
|
6575
6653
|
}));
|
|
6576
6654
|
return _request.apply(this, arguments);
|
|
6577
6655
|
}
|
|
@@ -6579,50 +6657,53 @@ function useBeneficiarios() {
|
|
|
6579
6657
|
return _backup.apply(this, arguments);
|
|
6580
6658
|
}
|
|
6581
6659
|
function _backup() {
|
|
6582
|
-
_backup = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
6660
|
+
_backup = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
6583
6661
|
var payrollId,
|
|
6584
6662
|
_yield$request,
|
|
6585
6663
|
ok,
|
|
6586
6664
|
data,
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
6665
|
+
pollResult,
|
|
6666
|
+
_args3 = arguments;
|
|
6667
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
6668
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
6592
6669
|
case 0:
|
|
6593
|
-
payrollId =
|
|
6594
|
-
|
|
6670
|
+
payrollId = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : null;
|
|
6671
|
+
_context3.next = 1;
|
|
6595
6672
|
return request('/backup/', {
|
|
6596
6673
|
body: payrollId ? {
|
|
6597
6674
|
payroll_id: payrollId
|
|
6598
6675
|
} : {}
|
|
6599
6676
|
});
|
|
6600
6677
|
case 1:
|
|
6601
|
-
_yield$request =
|
|
6678
|
+
_yield$request = _context3.sent;
|
|
6602
6679
|
ok = _yield$request.ok;
|
|
6603
6680
|
data = _yield$request.data;
|
|
6604
|
-
if (ok) {
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
});
|
|
6608
|
-
a = document.createElement('a');
|
|
6609
|
-
a.href = URL.createObjectURL(blob);
|
|
6610
|
-
a.download = "backup_beneficiarios_".concat(new Date().toISOString().slice(0, 19).replace(/:/g, '-'), ".json");
|
|
6611
|
-
document.body.appendChild(a);
|
|
6612
|
-
a.click();
|
|
6613
|
-
document.body.removeChild(a);
|
|
6614
|
-
URL.revokeObjectURL(a.href);
|
|
6615
|
-
setOutput("Backup conclu\xEDdo: ".concat(JSON.stringify(data.counts)));
|
|
6681
|
+
if (!ok) {
|
|
6682
|
+
_context3.next = 3;
|
|
6683
|
+
break;
|
|
6616
6684
|
}
|
|
6617
|
-
|
|
6685
|
+
setOutput('Backup iniciado. A aguardar conclusão...');
|
|
6686
|
+
_context3.next = 2;
|
|
6687
|
+
return poll(data.clientMutationId);
|
|
6688
|
+
case 2:
|
|
6689
|
+
pollResult = _context3.sent;
|
|
6690
|
+
if (pollResult.success) {
|
|
6691
|
+
setOutput("Backup conclu\xEDdo: ".concat(pollResult.output));
|
|
6692
|
+
// Handle download trigger if file info is in jsonExt
|
|
6693
|
+
} else {
|
|
6694
|
+
setError(pollResult.error);
|
|
6695
|
+
}
|
|
6696
|
+
case 3:
|
|
6697
|
+
setLoading(false);
|
|
6698
|
+
return _context3.abrupt("return", {
|
|
6618
6699
|
ok: ok,
|
|
6619
6700
|
data: data
|
|
6620
6701
|
});
|
|
6621
|
-
case
|
|
6702
|
+
case 4:
|
|
6622
6703
|
case "end":
|
|
6623
|
-
return
|
|
6704
|
+
return _context3.stop();
|
|
6624
6705
|
}
|
|
6625
|
-
},
|
|
6706
|
+
}, _callee3);
|
|
6626
6707
|
}));
|
|
6627
6708
|
return _backup.apply(this, arguments);
|
|
6628
6709
|
}
|
|
@@ -6630,7 +6711,7 @@ function useBeneficiarios() {
|
|
|
6630
6711
|
return _limpar.apply(this, arguments);
|
|
6631
6712
|
}
|
|
6632
6713
|
function _limpar() {
|
|
6633
|
-
_limpar = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
6714
|
+
_limpar = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
6634
6715
|
var _ref2,
|
|
6635
6716
|
_ref2$dryRun,
|
|
6636
6717
|
dryRun,
|
|
@@ -6639,12 +6720,13 @@ function useBeneficiarios() {
|
|
|
6639
6720
|
_yield$request2,
|
|
6640
6721
|
ok,
|
|
6641
6722
|
data,
|
|
6642
|
-
|
|
6643
|
-
|
|
6644
|
-
|
|
6723
|
+
pollResult,
|
|
6724
|
+
_args4 = arguments;
|
|
6725
|
+
return _regeneratorRuntime.wrap(function (_context4) {
|
|
6726
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
6645
6727
|
case 0:
|
|
6646
|
-
_ref2 =
|
|
6647
|
-
|
|
6728
|
+
_ref2 = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {}, _ref2$dryRun = _ref2.dryRun, dryRun = _ref2$dryRun === void 0 ? true : _ref2$dryRun, _ref2$forceSkipFinanc = _ref2.forceSkipFinancial, forceSkipFinancial = _ref2$forceSkipFinanc === void 0 ? false : _ref2$forceSkipFinanc;
|
|
6729
|
+
_context4.next = 1;
|
|
6648
6730
|
return request('/limpar/', {
|
|
6649
6731
|
body: {
|
|
6650
6732
|
username: 'admin',
|
|
@@ -6653,27 +6735,42 @@ function useBeneficiarios() {
|
|
|
6653
6735
|
}
|
|
6654
6736
|
});
|
|
6655
6737
|
case 1:
|
|
6656
|
-
_yield$request2 =
|
|
6738
|
+
_yield$request2 = _context4.sent;
|
|
6657
6739
|
ok = _yield$request2.ok;
|
|
6658
6740
|
data = _yield$request2.data;
|
|
6659
|
-
if (ok)
|
|
6660
|
-
|
|
6741
|
+
if (!ok) {
|
|
6742
|
+
_context4.next = 3;
|
|
6743
|
+
break;
|
|
6744
|
+
}
|
|
6745
|
+
setOutput('Limpeza iniciada. A aguardar conclusão...');
|
|
6746
|
+
_context4.next = 2;
|
|
6747
|
+
return poll(data.clientMutationId);
|
|
6748
|
+
case 2:
|
|
6749
|
+
pollResult = _context4.sent;
|
|
6750
|
+
if (pollResult.success) {
|
|
6751
|
+
setOutput(pollResult.output);
|
|
6752
|
+
} else {
|
|
6753
|
+
setError(pollResult.error);
|
|
6754
|
+
}
|
|
6755
|
+
case 3:
|
|
6756
|
+
setLoading(false);
|
|
6757
|
+
return _context4.abrupt("return", {
|
|
6661
6758
|
ok: ok,
|
|
6662
6759
|
data: data
|
|
6663
6760
|
});
|
|
6664
|
-
case
|
|
6761
|
+
case 4:
|
|
6665
6762
|
case "end":
|
|
6666
|
-
return
|
|
6763
|
+
return _context4.stop();
|
|
6667
6764
|
}
|
|
6668
|
-
},
|
|
6765
|
+
}, _callee4);
|
|
6669
6766
|
}));
|
|
6670
6767
|
return _limpar.apply(this, arguments);
|
|
6671
6768
|
}
|
|
6672
|
-
function importar(
|
|
6769
|
+
function importar(_x3) {
|
|
6673
6770
|
return _importar.apply(this, arguments);
|
|
6674
6771
|
}
|
|
6675
6772
|
function _importar() {
|
|
6676
|
-
_importar = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
6773
|
+
_importar = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(file) {
|
|
6677
6774
|
var _ref3,
|
|
6678
6775
|
_ref3$dryRun,
|
|
6679
6776
|
dryRun,
|
|
@@ -6685,11 +6782,12 @@ function useBeneficiarios() {
|
|
|
6685
6782
|
_yield$request3,
|
|
6686
6783
|
ok,
|
|
6687
6784
|
data,
|
|
6688
|
-
|
|
6689
|
-
|
|
6690
|
-
|
|
6785
|
+
pollResult,
|
|
6786
|
+
_args5 = arguments;
|
|
6787
|
+
return _regeneratorRuntime.wrap(function (_context5) {
|
|
6788
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
6691
6789
|
case 0:
|
|
6692
|
-
_ref3 =
|
|
6790
|
+
_ref3 = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {}, _ref3$dryRun = _ref3.dryRun, dryRun = _ref3$dryRun === void 0 ? false : _ref3$dryRun, payrollId = _ref3.payrollId, benefitPlanId = _ref3.benefitPlanId, benefitType = _ref3.benefitType, sheet = _ref3.sheet;
|
|
6693
6791
|
fd = new FormData();
|
|
6694
6792
|
fd.append('file', file);
|
|
6695
6793
|
fd.append('username', 'admin');
|
|
@@ -6698,33 +6796,48 @@ function useBeneficiarios() {
|
|
|
6698
6796
|
if (benefitPlanId) fd.append('benefit_plan_id', benefitPlanId);
|
|
6699
6797
|
if (benefitType) fd.append('benefit_type', benefitType);
|
|
6700
6798
|
if (sheet) fd.append('sheet', sheet);
|
|
6701
|
-
|
|
6799
|
+
_context5.next = 1;
|
|
6702
6800
|
return request('/importar/', {
|
|
6703
6801
|
multipart: true,
|
|
6704
6802
|
body: fd
|
|
6705
6803
|
});
|
|
6706
6804
|
case 1:
|
|
6707
|
-
_yield$request3 =
|
|
6805
|
+
_yield$request3 = _context5.sent;
|
|
6708
6806
|
ok = _yield$request3.ok;
|
|
6709
6807
|
data = _yield$request3.data;
|
|
6710
|
-
if (ok)
|
|
6711
|
-
|
|
6808
|
+
if (!ok) {
|
|
6809
|
+
_context5.next = 3;
|
|
6810
|
+
break;
|
|
6811
|
+
}
|
|
6812
|
+
setOutput('Importação iniciada. A aguardar conclusão...');
|
|
6813
|
+
_context5.next = 2;
|
|
6814
|
+
return poll(data.clientMutationId);
|
|
6815
|
+
case 2:
|
|
6816
|
+
pollResult = _context5.sent;
|
|
6817
|
+
if (pollResult.success) {
|
|
6818
|
+
setOutput(pollResult.output);
|
|
6819
|
+
} else {
|
|
6820
|
+
setError(pollResult.error);
|
|
6821
|
+
}
|
|
6822
|
+
case 3:
|
|
6823
|
+
setLoading(false);
|
|
6824
|
+
return _context5.abrupt("return", {
|
|
6712
6825
|
ok: ok,
|
|
6713
6826
|
data: data
|
|
6714
6827
|
});
|
|
6715
|
-
case
|
|
6828
|
+
case 4:
|
|
6716
6829
|
case "end":
|
|
6717
|
-
return
|
|
6830
|
+
return _context5.stop();
|
|
6718
6831
|
}
|
|
6719
|
-
},
|
|
6832
|
+
}, _callee5);
|
|
6720
6833
|
}));
|
|
6721
6834
|
return _importar.apply(this, arguments);
|
|
6722
6835
|
}
|
|
6723
|
-
function restore(
|
|
6836
|
+
function restore(_x4) {
|
|
6724
6837
|
return _restore.apply(this, arguments);
|
|
6725
6838
|
}
|
|
6726
6839
|
function _restore() {
|
|
6727
|
-
_restore = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
6840
|
+
_restore = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(file) {
|
|
6728
6841
|
var _ref4,
|
|
6729
6842
|
_ref4$dryRun,
|
|
6730
6843
|
dryRun,
|
|
@@ -6734,35 +6847,51 @@ function useBeneficiarios() {
|
|
|
6734
6847
|
_yield$request4,
|
|
6735
6848
|
ok,
|
|
6736
6849
|
data,
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
|
|
6850
|
+
pollResult,
|
|
6851
|
+
_args6 = arguments;
|
|
6852
|
+
return _regeneratorRuntime.wrap(function (_context6) {
|
|
6853
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
6740
6854
|
case 0:
|
|
6741
|
-
_ref4 =
|
|
6855
|
+
_ref4 = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {}, _ref4$dryRun = _ref4.dryRun, dryRun = _ref4$dryRun === void 0 ? true : _ref4$dryRun, _ref4$skipPhases = _ref4.skipPhases, skipPhases = _ref4$skipPhases === void 0 ? [] : _ref4$skipPhases;
|
|
6742
6856
|
fd = new FormData();
|
|
6743
6857
|
fd.append('file', file);
|
|
6744
6858
|
fd.append('username', 'admin');
|
|
6745
6859
|
fd.append('dry_run', String(dryRun));
|
|
6746
6860
|
if (skipPhases.length) fd.append('skip_phases', skipPhases.join(','));
|
|
6747
|
-
|
|
6861
|
+
_context6.next = 1;
|
|
6748
6862
|
return request('/restore/', {
|
|
6749
6863
|
multipart: true,
|
|
6750
6864
|
body: fd
|
|
6751
6865
|
});
|
|
6752
6866
|
case 1:
|
|
6753
|
-
_yield$request4 =
|
|
6867
|
+
_yield$request4 = _context6.sent;
|
|
6754
6868
|
ok = _yield$request4.ok;
|
|
6755
6869
|
data = _yield$request4.data;
|
|
6756
|
-
if (ok)
|
|
6757
|
-
|
|
6870
|
+
if (!ok) {
|
|
6871
|
+
_context6.next = 3;
|
|
6872
|
+
break;
|
|
6873
|
+
}
|
|
6874
|
+
setOutput('Restore iniciado. A aguardar conclusão...');
|
|
6875
|
+
_context6.next = 2;
|
|
6876
|
+
return poll(data.clientMutationId);
|
|
6877
|
+
case 2:
|
|
6878
|
+
pollResult = _context6.sent;
|
|
6879
|
+
if (pollResult.success) {
|
|
6880
|
+
setOutput(pollResult.output);
|
|
6881
|
+
} else {
|
|
6882
|
+
setError(pollResult.error);
|
|
6883
|
+
}
|
|
6884
|
+
case 3:
|
|
6885
|
+
setLoading(false);
|
|
6886
|
+
return _context6.abrupt("return", {
|
|
6758
6887
|
ok: ok,
|
|
6759
6888
|
data: data
|
|
6760
6889
|
});
|
|
6761
|
-
case
|
|
6890
|
+
case 4:
|
|
6762
6891
|
case "end":
|
|
6763
|
-
return
|
|
6892
|
+
return _context6.stop();
|
|
6764
6893
|
}
|
|
6765
|
-
},
|
|
6894
|
+
}, _callee6);
|
|
6766
6895
|
}));
|
|
6767
6896
|
return _restore.apply(this, arguments);
|
|
6768
6897
|
}
|