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