Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix FileImport Issues #909

Open
1fifoto opened this issue Apr 14, 2024 · 2 comments
Open

Fix FileImport Issues #909

1fifoto opened this issue Apr 14, 2024 · 2 comments
Assignees
Milestone

Comments

@1fifoto
Copy link
Collaborator

1fifoto commented Apr 14, 2024

Secondary problem with FileImport does not show the filename instead it shows "undefined". Change from migrated_design.name to filename.

if (migrated_design.jsontype === "ODOP") {
  dispatch(load(migrated_design));
  dispatch(changeName(filename));
  dispatch(deleteAutoSave());
  logUsage('event', 'FileImport', { event_label: migrated_design.type + ' ' + migrated_design.name });
} else {
  displayMessage('Invalid JSON type, function ignored');
}

to

if (migrated_design.jsontype === "ODOP") {
  dispatch(load(migrated_design));
  dispatch(changeName(filename));
  dispatch(deleteAutoSave());
  logUsage('event', 'FileImport', { event_label: migrated_design.type + ' ' + filename });
} else {
  displayMessage('Invalid JSON type, function ignored');
}
@1fifoto
Copy link
Collaborator Author

1fifoto commented Apr 14, 2024

Change displayMessage text from

  const onError = (e) => {
//    console.log('In FileImport.onError e=',e);
    displayMessage('GET of design names failed with message: \'' + fileReader.error.message + '\'');
    displaySpinner(false);
  }

to

  const onError = (e) => {
//    console.log('In FileImport.onError e=',e);
    displayMessage('Read of Import File failed with message: \'' + fileReader.error.message + '\'');
    displaySpinner(false);
  }

@1fifoto
Copy link
Collaborator Author

1fifoto commented Apr 14, 2024

Reorder file read operation. Set on handlers before doing the read. Change from

fileReader.readAsText(selectedFile); // Begin Reading Text File
fileReader.onloadend = onLoadEnd; // On Load End callback
fileReader.onError = onError; // On Error callback

to

fileReader.onloadend = onLoadEnd; // On Load End callback
fileReader.onError = onError; // On Error callback
fileReader.readAsText(selectedFile); // Begin Reading Text File

@1fifoto 1fifoto added this to the ODOP 4.6 milestone Apr 14, 2024
@1fifoto 1fifoto self-assigned this Apr 14, 2024
@1fifoto 1fifoto changed the title Fix FileImport Issue Fix FileImport Issues Apr 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant