@lingk/sync 1.0.2 → 1.0.4
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 +173 -58
- package/build/credentialSections.js.map +1 -1
- 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 +366 -163
- package/build/main.js.map +1 -1
- package/build/metadataFunctions.js +4 -4
- package/build/metadataFunctions.js.map +1 -1
- package/build/reducer.js +4 -4
- package/build/reducer.js.map +1 -1
- package/build/saveData.js.map +1 -1
- package/package.json +1 -1
|
@@ -67,6 +67,8 @@ module.exports =
|
|
|
67
67
|
value: true
|
|
68
68
|
});
|
|
69
69
|
|
|
70
|
+
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
|
71
|
+
|
|
70
72
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
71
73
|
|
|
72
74
|
var _react = __webpack_require__(1);
|
|
@@ -99,6 +101,13 @@ module.exports =
|
|
|
99
101
|
|
|
100
102
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
101
103
|
|
|
104
|
+
function formatBytes(a, b) {
|
|
105
|
+
if (0 === a) return "0 Bytes";var c = 1024,
|
|
106
|
+
d = b || 2,
|
|
107
|
+
e = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"],
|
|
108
|
+
f = Math.floor(Math.log(a) / Math.log(c));return parseFloat((a / Math.pow(c, f)).toFixed(d)) + " " + e[f];
|
|
109
|
+
}
|
|
110
|
+
|
|
102
111
|
// SKIP ON SERVER-SIDE RENDERING
|
|
103
112
|
var codemirror = null;
|
|
104
113
|
if (typeof window !== 'undefined' && typeof window.navigator !== 'undefined') {
|
|
@@ -170,6 +179,7 @@ module.exports =
|
|
|
170
179
|
wizard = _props.wizard,
|
|
171
180
|
adapterSecret = _props.adapterSecret,
|
|
172
181
|
checkOauthCreds = _props.checkOauthCreds,
|
|
182
|
+
metadata = _props.metadata,
|
|
173
183
|
getOauthUrl = _props.getOauthUrl,
|
|
174
184
|
generateNewAdapterSecret = _props.generateNewAdapterSecret,
|
|
175
185
|
setCsvFields = _props.setCsvFields,
|
|
@@ -194,7 +204,7 @@ module.exports =
|
|
|
194
204
|
|
|
195
205
|
var isOauth = config.credentials && config.credentials.length === 1 && config.credentials[0] === 'Oauth';
|
|
196
206
|
|
|
197
|
-
var
|
|
207
|
+
var isFlatFile = config.credentials && config.credentials.length === 1 && config.credentials[0] === 'FlatFile';
|
|
198
208
|
|
|
199
209
|
var isGoogle = config.type.startsWith('Google');
|
|
200
210
|
|
|
@@ -203,22 +213,23 @@ module.exports =
|
|
|
203
213
|
return _react2.default.createElement(
|
|
204
214
|
'div',
|
|
205
215
|
{ className: 'env-section-body' },
|
|
206
|
-
config.message && !isGoogle && _react2.default.createElement(
|
|
216
|
+
config.message && !isGoogle && !isFlatFile ? _react2.default.createElement(
|
|
207
217
|
'p',
|
|
208
218
|
null,
|
|
209
219
|
config.message,
|
|
210
220
|
_react2.default.createElement('br', null),
|
|
211
221
|
_react2.default.createElement('br', null)
|
|
212
|
-
),
|
|
222
|
+
) : _react2.default.createElement('div', { style: { height: 13 } }),
|
|
213
223
|
isOauth ? _react2.default.createElement(Oauth, { wizard: wizard, onCheck: check,
|
|
214
224
|
creds: this.props.creds, providerType: providerType,
|
|
215
225
|
onGenerateUrl: function onGenerateUrl(urlType) {
|
|
216
226
|
return getOauthUrl(urlType, providerType);
|
|
217
227
|
},
|
|
218
228
|
checkOauthCreds: checkOauthCreds, envCheckResult: envCheckResult,
|
|
219
|
-
checking: checking, inputs: inputs }) :
|
|
229
|
+
checking: checking, inputs: inputs }) : isFlatFile ? _react2.default.createElement(FlatFile, { wizard: wizard, onCheck: check, metadata: metadata,
|
|
220
230
|
checking: checking, setCsvFields: setCsvFields,
|
|
221
|
-
providerType: providerType
|
|
231
|
+
providerType: providerType, inputs: inputs,
|
|
232
|
+
accountKey: accountKey, tenantKey: tenantKey }) : isGoogle ? _react2.default.createElement(Google, { config: config, creds: creds, onChange: this.onChange,
|
|
222
233
|
credsDisabledCheck: credsDisabledCheck, inputs: inputs,
|
|
223
234
|
onCheck: check }) : _react2.default.createElement(
|
|
224
235
|
'div',
|
|
@@ -399,64 +410,100 @@ module.exports =
|
|
|
399
410
|
);
|
|
400
411
|
};
|
|
401
412
|
|
|
402
|
-
var
|
|
403
|
-
_inherits(
|
|
413
|
+
var FlatFile = function (_Component2) {
|
|
414
|
+
_inherits(FlatFile, _Component2);
|
|
404
415
|
|
|
405
416
|
// react-dropzone
|
|
406
417
|
// papaparse
|
|
407
418
|
|
|
408
|
-
function
|
|
409
|
-
_classCallCheck(this,
|
|
419
|
+
function FlatFile() {
|
|
420
|
+
_classCallCheck(this, FlatFile);
|
|
410
421
|
|
|
411
|
-
var _this3 = _possibleConstructorReturn(this, (
|
|
422
|
+
var _this3 = _possibleConstructorReturn(this, (FlatFile.__proto__ || Object.getPrototypeOf(FlatFile)).call(this));
|
|
412
423
|
|
|
413
424
|
_this3.onDrop = function (fs) {
|
|
414
|
-
var
|
|
415
|
-
setCsvFields = _this3$props.setCsvFields,
|
|
416
|
-
providerType = _this3$props.providerType,
|
|
417
|
-
wizard = _this3$props.wizard;
|
|
418
|
-
|
|
419
|
-
var m = wizard['metadata'] || [];
|
|
420
|
-
var files = [].concat(_toConsumableArray(_this3.state.files));
|
|
425
|
+
var meta = [].concat(_toConsumableArray(_this3.state.meta));
|
|
421
426
|
var counter = 0;
|
|
427
|
+
var fileContents = [].concat(_toConsumableArray(_this3.state.fileContents));
|
|
428
|
+
var contentCounter = 0;
|
|
422
429
|
fs.forEach(function (file) {
|
|
423
430
|
_papaparse2.default.parse(file, {
|
|
424
431
|
header: true,
|
|
432
|
+
dynamicTyping: true,
|
|
425
433
|
complete: function complete(result) {
|
|
426
|
-
|
|
427
|
-
name: file.name
|
|
428
|
-
type: file.name.
|
|
434
|
+
meta = meta.concat({
|
|
435
|
+
name: file.name,
|
|
436
|
+
type: file.name.substr(0, file.name.lastIndexOf('.')).split(' ').join(),
|
|
437
|
+
byteSize: file.size,
|
|
429
438
|
properties: result.meta.fields.map(function (f) {
|
|
430
439
|
return {
|
|
431
440
|
label: f,
|
|
432
|
-
name: f,
|
|
433
|
-
type:
|
|
441
|
+
name: f.split(' ').join(),
|
|
442
|
+
type: result.data[0] && _typeof(result.data[0][f])
|
|
434
443
|
};
|
|
435
|
-
})
|
|
444
|
+
}),
|
|
445
|
+
delimiter: result.meta.delimiter
|
|
436
446
|
});
|
|
437
|
-
files = files.concat(file);
|
|
438
447
|
counter += 1;
|
|
439
448
|
if (counter === fs.length) {
|
|
440
|
-
|
|
441
|
-
|
|
449
|
+
// after last one is done
|
|
450
|
+
_this3.setState({ meta: meta });
|
|
442
451
|
}
|
|
443
452
|
}
|
|
444
453
|
});
|
|
454
|
+
var reader = new FileReader();
|
|
455
|
+
reader.addEventListener("loadend", function (event) {
|
|
456
|
+
fileContents = fileContents.concat(event.target.result);
|
|
457
|
+
contentCounter += 1;
|
|
458
|
+
if (contentCounter === fs.length) {
|
|
459
|
+
_this3.setState({ fileContents: fileContents });
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
reader.readAsText(file);
|
|
463
|
+
});
|
|
464
|
+
};
|
|
465
|
+
|
|
466
|
+
_this3.onReject = function () {
|
|
467
|
+
_this3.setState({ dropError: 'File is too big!' });
|
|
468
|
+
setTimeout(function () {
|
|
469
|
+
_this3.setState({ dropError: null });
|
|
470
|
+
}, 3500);
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
_this3.upload = function () {
|
|
474
|
+
var _this3$props = _this3.props,
|
|
475
|
+
setCsvFields = _this3$props.setCsvFields,
|
|
476
|
+
providerType = _this3$props.providerType;
|
|
477
|
+
|
|
478
|
+
_this3.setState({ uploading: true });
|
|
479
|
+
setCsvFields(_this3.state.meta, _this3.state.fileContents, providerType).then(function () {
|
|
480
|
+
_this3.setState({ meta: [], uploading: false });
|
|
445
481
|
});
|
|
446
482
|
};
|
|
447
483
|
|
|
448
484
|
_this3.state = {
|
|
449
|
-
|
|
485
|
+
meta: [],
|
|
486
|
+
fileContents: [],
|
|
487
|
+
uploading: false,
|
|
488
|
+
dropError: null
|
|
450
489
|
};
|
|
451
490
|
return _this3;
|
|
452
491
|
}
|
|
453
492
|
|
|
454
|
-
_createClass(
|
|
493
|
+
_createClass(FlatFile, [{
|
|
455
494
|
key: 'render',
|
|
456
495
|
value: function render() {
|
|
457
|
-
var
|
|
496
|
+
var _state = this.state,
|
|
497
|
+
meta = _state.meta,
|
|
498
|
+
uploading = _state.uploading,
|
|
499
|
+
dropError = _state.dropError;
|
|
500
|
+
var _props2 = this.props,
|
|
501
|
+
metadata = _props2.metadata,
|
|
502
|
+
inputs = _props2.inputs;
|
|
458
503
|
|
|
459
|
-
var
|
|
504
|
+
var Button = inputs.Button;
|
|
505
|
+
var Spinner = inputs.Spinner;
|
|
506
|
+
var hasFile = meta && meta.length > 0;
|
|
460
507
|
return _react2.default.createElement(
|
|
461
508
|
'div',
|
|
462
509
|
null,
|
|
@@ -465,12 +512,16 @@ module.exports =
|
|
|
465
512
|
{ style: { display: 'inline-block' } },
|
|
466
513
|
_react2.default.createElement(
|
|
467
514
|
_reactDropzone2.default,
|
|
468
|
-
{
|
|
469
|
-
className: 'dropzone' },
|
|
470
|
-
_react2.default.createElement(
|
|
515
|
+
{ onDropAccepted: this.onDrop, onDropRejected: this.onReject,
|
|
516
|
+
className: 'dropzone', maxSize: 1000000 },
|
|
517
|
+
!dropError ? _react2.default.createElement(
|
|
471
518
|
'p',
|
|
472
519
|
null,
|
|
473
|
-
'Drop one or more files here, or click to select files to upload.'
|
|
520
|
+
'Drop one or more CSV files here, or click to select files to upload.'
|
|
521
|
+
) : _react2.default.createElement(
|
|
522
|
+
'p',
|
|
523
|
+
{ style: { color: '#c9302c', fontWeight: 'bold' } },
|
|
524
|
+
dropError
|
|
474
525
|
)
|
|
475
526
|
)
|
|
476
527
|
),
|
|
@@ -478,21 +529,76 @@ module.exports =
|
|
|
478
529
|
'aside',
|
|
479
530
|
{ style: { marginLeft: 30, display: 'inline-block' } },
|
|
480
531
|
_react2.default.createElement(
|
|
481
|
-
'
|
|
482
|
-
|
|
483
|
-
|
|
532
|
+
'div',
|
|
533
|
+
null,
|
|
534
|
+
_react2.default.createElement(
|
|
535
|
+
'h3',
|
|
536
|
+
{ style: { marginTop: 10, display: 'inline-block', verticalAlign: 'top' } },
|
|
537
|
+
'Dropped files'
|
|
538
|
+
),
|
|
539
|
+
_react2.default.createElement(
|
|
540
|
+
Button,
|
|
541
|
+
{
|
|
542
|
+
onClick: this.upload,
|
|
543
|
+
style: { marginTop: 4, marginLeft: 20, verticalAlign: 'top', height: 36 },
|
|
544
|
+
disabled: uploading },
|
|
545
|
+
_react2.default.createElement(
|
|
546
|
+
'span',
|
|
547
|
+
{ style: { display: 'inline-block', verticalAlign: 'top', marginTop: 3 } },
|
|
548
|
+
'Upload'
|
|
549
|
+
),
|
|
550
|
+
'\xA0\xA0',
|
|
551
|
+
_react2.default.createElement(UploadIcon, null)
|
|
552
|
+
),
|
|
553
|
+
uploading && _react2.default.createElement(
|
|
554
|
+
'div',
|
|
555
|
+
{ style: { paddingLeft: 12, paddingTop: 12, display: 'inline-block' } },
|
|
556
|
+
_react2.default.createElement(Spinner, null)
|
|
557
|
+
)
|
|
484
558
|
),
|
|
485
559
|
_react2.default.createElement(
|
|
486
560
|
'ul',
|
|
487
561
|
null,
|
|
488
|
-
|
|
562
|
+
meta.map(function (f, i) {
|
|
489
563
|
return _react2.default.createElement(
|
|
490
564
|
'li',
|
|
491
|
-
{ key: i },
|
|
565
|
+
{ key: i, style: { listStyle: 'none' } },
|
|
492
566
|
f.name,
|
|
493
567
|
' - ',
|
|
494
|
-
f.
|
|
495
|
-
|
|
568
|
+
formatBytes(f.byteSize)
|
|
569
|
+
);
|
|
570
|
+
})
|
|
571
|
+
)
|
|
572
|
+
),
|
|
573
|
+
!uploading && !hasFile && metadata && metadata.length > 0 && _react2.default.createElement(
|
|
574
|
+
'div',
|
|
575
|
+
{ style: {
|
|
576
|
+
marginLeft: 20, display: 'inline-block', marginTop: 13, verticalAlign: 'top'
|
|
577
|
+
} },
|
|
578
|
+
_react2.default.createElement(
|
|
579
|
+
'div',
|
|
580
|
+
{ style: { marginBottom: 4 } },
|
|
581
|
+
_react2.default.createElement(
|
|
582
|
+
'strong',
|
|
583
|
+
{ style: { marginRight: 5 } },
|
|
584
|
+
metadata && metadata.length
|
|
585
|
+
),
|
|
586
|
+
_react2.default.createElement(
|
|
587
|
+
'strong',
|
|
588
|
+
null,
|
|
589
|
+
'file' + (metadata.length === 1 ? '' : 's') + ' uploaded'
|
|
590
|
+
)
|
|
591
|
+
),
|
|
592
|
+
_react2.default.createElement(
|
|
593
|
+
'ul',
|
|
594
|
+
null,
|
|
595
|
+
metadata.map(function (f, i) {
|
|
596
|
+
return _react2.default.createElement(
|
|
597
|
+
'li',
|
|
598
|
+
{ key: i, style: { listStyle: 'none' } },
|
|
599
|
+
f.name,
|
|
600
|
+
' - ',
|
|
601
|
+
formatBytes(f.byteSize)
|
|
496
602
|
);
|
|
497
603
|
})
|
|
498
604
|
)
|
|
@@ -501,9 +607,18 @@ module.exports =
|
|
|
501
607
|
}
|
|
502
608
|
}]);
|
|
503
609
|
|
|
504
|
-
return
|
|
610
|
+
return FlatFile;
|
|
505
611
|
}(_react.Component);
|
|
506
612
|
|
|
613
|
+
var UploadIcon = function UploadIcon() {
|
|
614
|
+
return _react2.default.createElement(
|
|
615
|
+
'svg',
|
|
616
|
+
{ fill: '#666', height: '24', viewBox: '0 0 24 24', width: '24' },
|
|
617
|
+
_react2.default.createElement('path', { d: 'M0 0h24v24H0z', fill: 'none' }),
|
|
618
|
+
_react2.default.createElement('path', { d: 'M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z' })
|
|
619
|
+
);
|
|
620
|
+
};
|
|
621
|
+
|
|
507
622
|
var Oauth = function (_Component3) {
|
|
508
623
|
_inherits(Oauth, _Component3);
|
|
509
624
|
|
|
@@ -550,15 +665,15 @@ module.exports =
|
|
|
550
665
|
}, {
|
|
551
666
|
key: 'render',
|
|
552
667
|
value: function render() {
|
|
553
|
-
var
|
|
554
|
-
wizard =
|
|
555
|
-
onGenerateUrl =
|
|
556
|
-
onCheck =
|
|
557
|
-
providerType =
|
|
558
|
-
checking =
|
|
559
|
-
creds =
|
|
560
|
-
inputs =
|
|
561
|
-
envCheckResult =
|
|
668
|
+
var _props3 = this.props,
|
|
669
|
+
wizard = _props3.wizard,
|
|
670
|
+
onGenerateUrl = _props3.onGenerateUrl,
|
|
671
|
+
onCheck = _props3.onCheck,
|
|
672
|
+
providerType = _props3.providerType,
|
|
673
|
+
checking = _props3.checking,
|
|
674
|
+
creds = _props3.creds,
|
|
675
|
+
inputs = _props3.inputs,
|
|
676
|
+
envCheckResult = _props3.envCheckResult;
|
|
562
677
|
|
|
563
678
|
var Spinner = inputs.Spinner;
|
|
564
679
|
var Button = inputs.Button;
|
|
@@ -750,13 +865,13 @@ module.exports =
|
|
|
750
865
|
value: function render() {
|
|
751
866
|
var _this8 = this;
|
|
752
867
|
|
|
753
|
-
var
|
|
754
|
-
generateNewAdapterSecret =
|
|
755
|
-
tenantKey =
|
|
756
|
-
accountKey =
|
|
757
|
-
providerType =
|
|
758
|
-
secret =
|
|
759
|
-
inputs =
|
|
868
|
+
var _props4 = this.props,
|
|
869
|
+
generateNewAdapterSecret = _props4.generateNewAdapterSecret,
|
|
870
|
+
tenantKey = _props4.tenantKey,
|
|
871
|
+
accountKey = _props4.accountKey,
|
|
872
|
+
providerType = _props4.providerType,
|
|
873
|
+
secret = _props4.secret,
|
|
874
|
+
inputs = _props4.inputs;
|
|
760
875
|
|
|
761
876
|
var Spinner = inputs.Spinner;
|
|
762
877
|
var Button = inputs.Button;
|