1
0
Fork 0
forked from lthn/blockchain

add type '.csv',validation empty contact list/file (#105)

* test details & close btn

* compiled

* confirm modal

* delete "cancel" btn from aliases

* fix copy btn

* text alias fix

* confirm pop up

* lock & unlock transaction

* confirm pop up comment fix

* compiled

* rebuild html

* contact service

* rebuild html

* fix add contact + rebuild html

* allow symbols at name field diffrent from latin

* fix export import

* alias fix

* fix master pass (immigration 41 > 43)

* rebuild html

* commit

* fix

* rebuild

* fix modal width

* add type '.csv',validation empty contact list/file

* merge
This commit is contained in:
zetov 2019-08-18 15:39:20 +03:00 committed by cryptozoidberg
parent ec8dd9ee25
commit 58c850fa99
6 changed files with 35 additions and 15 deletions

View file

@ -535,8 +535,10 @@
"SUCCESS_IMPORT": "Contacts are imported",
"SUCCESS_EXPORT": "Contacts are exported",
"ERROR_IMPORT": "Error is occured while reading file!",
"ERROR_TYPE_FILE": "Please import valid .csv file.",
"ERROR_EXPORT": "Invalid file type. Save file as .csv"
"ERROR_TYPE_FILE": "Please import valid .csv file",
"ERROR_EXPORT": "Invalid file type. Save file as .csv",
"ERROR_EMPTY_LIST": "Contact list is empty",
"ERROR_IMPORT_EMPTY": "File is empty"
},
"ERRORS": {
"NO_MONEY": "Not enough money",

View file

@ -4751,7 +4751,10 @@ var ExportImportComponent = /** @class */ (function () {
_this.variablesService.settings.default_path = file_data.path.substr(0, file_data.path.lastIndexOf('/'));
if (_this.isValid(file_data.path)) {
_this.backend.loadFile(file_data.path, function (status, data) {
if (status) {
if (!status) {
_this.modalService.prepareModal('error', 'CONTACTS.ERROR_IMPORT_EMPTY');
}
else {
var options = {
header: true
};
@ -4802,11 +4805,15 @@ var ExportImportComponent = /** @class */ (function () {
contacts.push(contact);
});
this.backend.saveFileDialog('', '*', this.variablesService.settings.default_path, function (file_status, file_data) {
if (file_status && _this.isValid(file_data.path)) {
_this.backend.storeFile(file_data.path, _this.papa.unparse(contacts));
if (!_this.variablesService.contacts.length && !(file_data.error_code === 'CANCELED')) {
_this.modalService.prepareModal('error', 'CONTACTS.ERROR_EMPTY_LIST');
}
var path = _this.isValid(file_data.path) ? file_data.path : file_data.path + ".csv";
if (file_status && _this.isValid(path) && _this.variablesService.contacts.length) {
_this.backend.storeFile(path, _this.papa.unparse(contacts));
_this.modalService.prepareModal('success', 'CONTACTS.SUCCESS_EXPORT');
}
if (!(file_data.error_code === 'CANCELED') && !_this.isValid(file_data.path)) {
if (!(file_data.error_code === 'CANCELED') && !_this.isValid(path)) {
_this.modalService.prepareModal('error', 'CONTACTS.ERROR_EXPORT');
}
});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -39,7 +39,12 @@ export class ExportImportComponent implements OnInit {
);
if (this.isValid(file_data.path)) {
this.backend.loadFile(file_data.path, (status, data) => {
if (status) {
if (!status) {
this.modalService.prepareModal(
'error',
'CONTACTS.ERROR_IMPORT_EMPTY'
);
} else {
const options = {
header: true
};
@ -101,20 +106,24 @@ export class ExportImportComponent implements OnInit {
delete contact.alias;
contacts.push(contact);
});
this.backend.saveFileDialog(
'',
'*',
this.variablesService.settings.default_path,
(file_status, file_data) => {
if (file_status && this.isValid(file_data.path)) {
this.backend.storeFile(file_data.path, this.papa.unparse(contacts));
if (!this.variablesService.contacts.length && !(file_data.error_code === 'CANCELED')) {
this.modalService.prepareModal('error', 'CONTACTS.ERROR_EMPTY_LIST');
}
const path = this.isValid(file_data.path) ? file_data.path : `${file_data.path}.csv`;
if (file_status && this.isValid(path) && this.variablesService.contacts.length) {
this.backend.storeFile(path, this.papa.unparse(contacts));
this.modalService.prepareModal(
'success',
'CONTACTS.SUCCESS_EXPORT'
);
}
if (!(file_data.error_code === 'CANCELED') && !this.isValid(file_data.path)) {
if (!(file_data.error_code === 'CANCELED') && !this.isValid(path)) {
this.modalService.prepareModal('error', 'CONTACTS.ERROR_EXPORT');
}
}

View file

@ -535,8 +535,10 @@
"SUCCESS_IMPORT": "Contacts are imported",
"SUCCESS_EXPORT": "Contacts are exported",
"ERROR_IMPORT": "Error is occured while reading file!",
"ERROR_TYPE_FILE": "Please import valid .csv file.",
"ERROR_EXPORT": "Invalid file type. Save file as .csv"
"ERROR_TYPE_FILE": "Please import valid .csv file",
"ERROR_EXPORT": "Invalid file type. Save file as .csv",
"ERROR_EMPTY_LIST": "Contact list is empty",
"ERROR_IMPORT_EMPTY": "File is empty"
},
"ERRORS": {
"NO_MONEY": "Not enough money",