@lingk/sync 1.1.12 → 1.1.14
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/build/credentialSections.js +26 -11
- package/build/credentialSections.js.map +1 -1
- package/build/css/main.css +4 -0
- package/build/lightning.js.map +1 -1
- package/build/lightningStyles.js.map +1 -1
- package/build/lingk.js.map +1 -1
- package/build/lingkStyles.js.map +1 -1
- package/build/loadData.js.map +1 -1
- package/build/main.js +90 -67
- package/build/main.js.map +1 -1
- package/build/metadataDropdown.js.map +1 -1
- package/build/metadataFunctions.js.map +1 -1
- package/build/reducer.js.map +1 -1
- package/build/saveData.js.map +1 -1
- package/package.json +1 -1
package/build/main.js
CHANGED
|
@@ -5733,8 +5733,8 @@ module.exports =
|
|
|
5733
5733
|
meta: [],
|
|
5734
5734
|
fileContents: [],
|
|
5735
5735
|
uploading: false,
|
|
5736
|
-
dropError: null
|
|
5737
|
-
|
|
5736
|
+
dropError: null,
|
|
5737
|
+
sortFileTableBy: 'uploadedTime' };
|
|
5738
5738
|
return _this;
|
|
5739
5739
|
}
|
|
5740
5740
|
|
|
@@ -5746,15 +5746,24 @@ module.exports =
|
|
|
5746
5746
|
var _state = this.state,
|
|
5747
5747
|
meta = _state.meta,
|
|
5748
5748
|
uploading = _state.uploading,
|
|
5749
|
-
dropError = _state.dropError
|
|
5750
|
-
|
|
5751
|
-
|
|
5752
|
-
inputs = _props.inputs;
|
|
5749
|
+
dropError = _state.dropError,
|
|
5750
|
+
sortFileTableBy = _state.sortFileTableBy;
|
|
5751
|
+
var inputs = this.props.inputs;
|
|
5753
5752
|
|
|
5754
5753
|
var Button = inputs.Button;
|
|
5755
5754
|
var Spinner = inputs.Spinner;
|
|
5756
5755
|
var hasFile = meta && meta.length > 0;
|
|
5757
5756
|
|
|
5757
|
+
var fileSchema = [];
|
|
5758
|
+
if (this.props.fileSchema && this.props.fileSchema.length) {
|
|
5759
|
+
fileSchema = [].concat(_toConsumableArray(this.props.fileSchema));
|
|
5760
|
+
fileSchema = fileSchema.sort(function (a, b) {
|
|
5761
|
+
var term = sortFileTableBy;
|
|
5762
|
+
if (term === 'uploadedTime') {}
|
|
5763
|
+
return a[term] > b[term];
|
|
5764
|
+
});
|
|
5765
|
+
}
|
|
5766
|
+
|
|
5758
5767
|
return _react2.default.createElement(
|
|
5759
5768
|
'div',
|
|
5760
5769
|
null,
|
|
@@ -5847,7 +5856,7 @@ module.exports =
|
|
|
5847
5856
|
),
|
|
5848
5857
|
_react2.default.createElement(
|
|
5849
5858
|
_reactBootstrap.Table,
|
|
5850
|
-
{ bordered: true, condensed: true },
|
|
5859
|
+
{ bordered: true, condensed: true, className: 'file-manager-table' },
|
|
5851
5860
|
_react2.default.createElement(
|
|
5852
5861
|
'thead',
|
|
5853
5862
|
null,
|
|
@@ -5856,18 +5865,24 @@ module.exports =
|
|
|
5856
5865
|
null,
|
|
5857
5866
|
_react2.default.createElement(
|
|
5858
5867
|
'th',
|
|
5859
|
-
|
|
5868
|
+
{ onClick: function onClick() {
|
|
5869
|
+
return _this2.setState({ sortFileTableBy: 'name' });
|
|
5870
|
+
} },
|
|
5860
5871
|
'Name'
|
|
5861
5872
|
),
|
|
5862
5873
|
_react2.default.createElement(
|
|
5863
5874
|
'th',
|
|
5864
|
-
|
|
5875
|
+
{ onClick: function onClick() {
|
|
5876
|
+
return _this2.setState({ sortFileTableBy: 'byteSize' });
|
|
5877
|
+
} },
|
|
5865
5878
|
'Size'
|
|
5866
5879
|
),
|
|
5867
5880
|
_react2.default.createElement(
|
|
5868
5881
|
'th',
|
|
5869
|
-
|
|
5870
|
-
|
|
5882
|
+
{ onClick: function onClick() {
|
|
5883
|
+
return _this2.setState({ sortFileTableBy: 'uploadedTime' });
|
|
5884
|
+
} },
|
|
5885
|
+
'Date uploaded'
|
|
5871
5886
|
)
|
|
5872
5887
|
)
|
|
5873
5888
|
),
|
|
@@ -50689,7 +50704,7 @@ module.exports =
|
|
|
50689
50704
|
data: { name: 'flatfile', resources: metadata, providerType: providerType, isSource: isSource }
|
|
50690
50705
|
}).then(function (data) {
|
|
50691
50706
|
d = data;
|
|
50692
|
-
return dispatch(uploadFilesToS3(tenantKey, appKey, metadata, data, contents));
|
|
50707
|
+
return dispatch(uploadFilesToS3(tenantKey, appKey, envId, metadata, data, contents));
|
|
50693
50708
|
}).then(function () {
|
|
50694
50709
|
return dispatch(postCredentials(tenantId, appId, providerType, d.guids, mode, envId, 'FlatFile')).then(function () {
|
|
50695
50710
|
dispatch({
|
|
@@ -50731,10 +50746,9 @@ module.exports =
|
|
|
50731
50746
|
};
|
|
50732
50747
|
}
|
|
50733
50748
|
|
|
50734
|
-
function uploadFilesToS3(tenantKey, appKey, metadata, d, contents) {
|
|
50735
|
-
console.log("UPLOAD", metadata, contents);
|
|
50749
|
+
function uploadFilesToS3(tenantKey, appKey, envId, metadata, d, contents) {
|
|
50736
50750
|
var args = contents.map(function (fileContent, i) {
|
|
50737
|
-
return { tenantKey: tenantKey, appKey: appKey, fileContent: fileContent, d: d, fileName: metadata[i].
|
|
50751
|
+
return { tenantKey: tenantKey, appKey: appKey, envId: envId, fileContent: fileContent, d: d, fileName: metadata[i].name };
|
|
50738
50752
|
});
|
|
50739
50753
|
return function (dispatch, getState, api) {
|
|
50740
50754
|
return Promise.all(args.map(singleFileToS3));
|
|
@@ -50744,24 +50758,22 @@ module.exports =
|
|
|
50744
50758
|
function singleFileToS3(_ref) {
|
|
50745
50759
|
var tenantKey = _ref.tenantKey,
|
|
50746
50760
|
appKey = _ref.appKey,
|
|
50761
|
+
envId = _ref.envId,
|
|
50747
50762
|
d = _ref.d,
|
|
50748
50763
|
fileContent = _ref.fileContent,
|
|
50749
50764
|
fileName = _ref.fileName;
|
|
50750
50765
|
|
|
50751
|
-
if
|
|
50752
|
-
return
|
|
50753
|
-
|
|
50754
|
-
};
|
|
50755
|
-
}
|
|
50766
|
+
/*if(!d.guids.files[fileName]){
|
|
50767
|
+
return () => Promise.resolve(null)
|
|
50768
|
+
}*/
|
|
50756
50769
|
var p = JSON.parse(atob(d.policy));
|
|
50757
|
-
console.log(p);
|
|
50758
50770
|
var pFind = function pFind(s) {
|
|
50759
50771
|
return p.conditions.find(function (pf) {
|
|
50760
50772
|
return Object.keys(pf).includes(s);
|
|
50761
50773
|
})[s];
|
|
50762
50774
|
};
|
|
50763
50775
|
var fd = new FormData();
|
|
50764
|
-
fd.append('key', tenantKey + '/' + appKey + '/' +
|
|
50776
|
+
fd.append('key', tenantKey + '/' + appKey + '/' + envId + '/' + fileName);
|
|
50765
50777
|
fd.append('policy', d.policy);
|
|
50766
50778
|
fd.append('acl', pFind('acl'));
|
|
50767
50779
|
fd.append('success_action_status', pFind('success_action_status'));
|
|
@@ -50778,43 +50790,52 @@ module.exports =
|
|
|
50778
50790
|
});
|
|
50779
50791
|
}
|
|
50780
50792
|
|
|
50781
|
-
function downloadFileFromAws(tenantId, appId, tenantKey, appKey, file) {
|
|
50793
|
+
function downloadFileFromAws(tenantId, appId, tenantKey, appKey, envId, file) {
|
|
50782
50794
|
return function (dispatch, getState, api) {
|
|
50783
50795
|
var _getState5 = getState(),
|
|
50784
50796
|
config = _getState5.config;
|
|
50785
50797
|
|
|
50786
|
-
return api.get(tenantId + '/' + appId + '/downloadpolicy/' + file.
|
|
50798
|
+
return api.get(tenantId + '/' + appId + '/' + envId + '/downloadpolicy/' + file.name, {
|
|
50787
50799
|
endpoint: config.TRANS_API_URL
|
|
50788
50800
|
}).then(function (d) {
|
|
50789
|
-
|
|
50801
|
+
var element = document.createElement('a');
|
|
50802
|
+
element.setAttribute('href', d);
|
|
50803
|
+
element.style.display = 'none';
|
|
50804
|
+
document.body.appendChild(element);
|
|
50805
|
+
element.click();
|
|
50806
|
+
document.body.removeChild(element);
|
|
50807
|
+
});
|
|
50808
|
+
/*.then(d => {
|
|
50809
|
+
return axios({
|
|
50790
50810
|
method: 'get',
|
|
50791
|
-
url: d
|
|
50792
|
-
})
|
|
50793
|
-
})
|
|
50794
|
-
|
|
50795
|
-
|
|
50796
|
-
|
|
50797
|
-
|
|
50798
|
-
|
|
50799
|
-
|
|
50800
|
-
|
|
50801
|
-
|
|
50802
|
-
|
|
50803
|
-
|
|
50804
|
-
|
|
50805
|
-
|
|
50806
|
-
|
|
50807
|
-
|
|
50808
|
-
|
|
50811
|
+
url: d,
|
|
50812
|
+
})
|
|
50813
|
+
})
|
|
50814
|
+
.then((f)=>{
|
|
50815
|
+
const extension = file.name.substr(file.name.lastIndexOf('.')+1, file.name.length)
|
|
50816
|
+
let mime = 'data:text/plain;charset=utf-8,' // csv
|
|
50817
|
+
let data = f.data
|
|
50818
|
+
if(extension==='json'){
|
|
50819
|
+
console.log('json!!!!')
|
|
50820
|
+
mime = 'data:text/json;charset=utf-8,'
|
|
50821
|
+
data = encodeURIComponent(JSON.stringify(f.data))
|
|
50822
|
+
} else if(extension==='xls'){
|
|
50823
|
+
mime = 'data:application/vnd.ms-excel;charset=utf-8,'
|
|
50824
|
+
data = encodeURIComponent(f.data)
|
|
50825
|
+
} else if(extension==='xlsx'){
|
|
50826
|
+
mime = 'data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8,'
|
|
50827
|
+
data = encodeURIComponent(f.data)
|
|
50828
|
+
}
|
|
50829
|
+
console.log(data)
|
|
50809
50830
|
// NEED TO DOWNLOAD DEPENDING ON TYPE, JSON VS XLS
|
|
50810
|
-
|
|
50831
|
+
const element = document.createElement('a');
|
|
50811
50832
|
element.setAttribute('href', mime + data);
|
|
50812
50833
|
element.setAttribute('download', 'hi.xlsx');
|
|
50813
50834
|
element.style.display = 'none';
|
|
50814
50835
|
document.body.appendChild(element);
|
|
50815
50836
|
element.click();
|
|
50816
50837
|
document.body.removeChild(element);
|
|
50817
|
-
})
|
|
50838
|
+
})*/
|
|
50818
50839
|
};
|
|
50819
50840
|
}
|
|
50820
50841
|
|
|
@@ -50828,7 +50849,7 @@ module.exports =
|
|
|
50828
50849
|
};
|
|
50829
50850
|
return (0, _axios2.default)({
|
|
50830
50851
|
method: 'get',
|
|
50831
|
-
url: 'https://' + pFind('bucket') + '.s3.amazonaws.com/' + tenantKey + '/' + appKey + '/' + file.
|
|
50852
|
+
url: 'https://' + pFind('bucket') + '.s3.amazonaws.com/' + tenantKey + '/' + appKey + '/' + file.name,
|
|
50832
50853
|
config: { headers: { 'Content-Type': 'multipart/form-data' } }
|
|
50833
50854
|
});
|
|
50834
50855
|
}
|
|
@@ -55354,16 +55375,16 @@ module.exports =
|
|
|
55354
55375
|
accountId = _this$props3.accountId,
|
|
55355
55376
|
tenantKey = _this$props3.tenantKey,
|
|
55356
55377
|
accountKey = _this$props3.accountKey,
|
|
55357
|
-
actions = _this$props3.actions
|
|
55378
|
+
actions = _this$props3.actions,
|
|
55379
|
+
formValues = _this$props3.formValues;
|
|
55358
55380
|
|
|
55359
|
-
return actions.downloadFileFromAws(tenantId, accountId, tenantKey, accountKey, file);
|
|
55381
|
+
return actions.downloadFileFromAws(tenantId, accountId, tenantKey, accountKey, formValues['environmentId'], file);
|
|
55360
55382
|
};
|
|
55361
55383
|
|
|
55362
55384
|
_this.state = {
|
|
55363
55385
|
selectedProvider: null,
|
|
55364
55386
|
sourceEnvChecking: null,
|
|
55365
|
-
destinationEnvChecking: null
|
|
55366
|
-
selectedEnvironment: null
|
|
55387
|
+
destinationEnvChecking: null
|
|
55367
55388
|
};
|
|
55368
55389
|
_this.check = _this.check.bind(_this);
|
|
55369
55390
|
_this.tryGetCredentialAndCheck = _this.tryGetCredentialAndCheck.bind(_this);
|
|
@@ -55452,20 +55473,23 @@ module.exports =
|
|
|
55452
55473
|
if (_this2.props.formValues[mode + 'FileSchema']) {
|
|
55453
55474
|
savedFileSchema = [].concat(_toConsumableArray(formValues[mode + 'FileSchema']));
|
|
55454
55475
|
}
|
|
55455
|
-
change(mode + 'FileSchema', {
|
|
55456
|
-
|
|
55457
|
-
|
|
55458
|
-
|
|
55459
|
-
|
|
55460
|
-
|
|
55461
|
-
|
|
55462
|
-
|
|
55463
|
-
|
|
55464
|
-
|
|
55465
|
-
})
|
|
55466
|
-
});
|
|
55476
|
+
change(mode + 'FileSchema', metadata.map(function (r) {
|
|
55477
|
+
var existing = savedFileSchema.find(function (rsc) {
|
|
55478
|
+
return r.name === rsc.name && r.type === rsc.type;
|
|
55479
|
+
});
|
|
55480
|
+
if (existing) return existing;
|
|
55481
|
+
return Object.assign({}, r, {
|
|
55482
|
+
filePattern: r.name,
|
|
55483
|
+
delimiter: ','
|
|
55484
|
+
});
|
|
55485
|
+
}));
|
|
55467
55486
|
})();
|
|
55468
55487
|
}
|
|
55488
|
+
|
|
55489
|
+
var isFlat = metadata && metadata[0] && metadata[0].uploadedTime;
|
|
55490
|
+
if (isFlat) {
|
|
55491
|
+
change(mode + 'FileSchema', metadata);
|
|
55492
|
+
}
|
|
55469
55493
|
});
|
|
55470
55494
|
}
|
|
55471
55495
|
}, {
|
|
@@ -55561,7 +55585,7 @@ module.exports =
|
|
|
55561
55585
|
}
|
|
55562
55586
|
}, {
|
|
55563
55587
|
key: 'setCsvFields',
|
|
55564
|
-
value: function setCsvFields(
|
|
55588
|
+
value: function setCsvFields(meta, contents, mode, providerType) {
|
|
55565
55589
|
var _this4 = this;
|
|
55566
55590
|
|
|
55567
55591
|
var _props7 = this.props,
|
|
@@ -55569,12 +55593,11 @@ module.exports =
|
|
|
55569
55593
|
accountId = _props7.accountId,
|
|
55570
55594
|
tenantKey = _props7.tenantKey,
|
|
55571
55595
|
accountKey = _props7.accountKey,
|
|
55572
|
-
wizard = _props7.wizard,
|
|
55573
55596
|
actions = _props7.actions,
|
|
55574
55597
|
formValues = _props7.formValues;
|
|
55598
|
+
//let meta = wizard[`${mode}Metadata`] || []
|
|
55599
|
+
//meta = meta.concat(metadata)
|
|
55575
55600
|
|
|
55576
|
-
var meta = wizard[mode + 'Metadata'] || [];
|
|
55577
|
-
meta = meta.concat(metadata);
|
|
55578
55601
|
return actions.setCsvFields(tenantId, accountId, tenantKey, accountKey, meta, contents, mode, providerType, mode === 'source', formValues['environmentId']).then(function (d) {
|
|
55579
55602
|
// get the new list of files
|
|
55580
55603
|
return _this4.check(mode, null, d, null, '');
|
|
@@ -55737,7 +55760,7 @@ module.exports =
|
|
|
55737
55760
|
return _this5.generateNewAdapterSecret(m);
|
|
55738
55761
|
},
|
|
55739
55762
|
seeFields: _this5.seeFields.bind(_this5),
|
|
55740
|
-
fileSchema:
|
|
55763
|
+
fileSchema: formValues[m + 'FileSchema'],
|
|
55741
55764
|
check: function check(actualCreds, extraQuery) {
|
|
55742
55765
|
_this5.check(m, null, actualCreds, null, extraQuery);
|
|
55743
55766
|
}, change: change,
|