mdEditor icon indicating copy to clipboard operation
mdEditor copied to clipboard

Exporting mdJson as array items

Open stansmith907 opened this issue 6 years ago • 6 comments

Question: When exporting multiple mdJson files at one time, should the mdJson be exported as individual files rather than an array of mdJson? mdTranslator can not handle the array so the user will need to do some manual file manipulation to process these. Using a array could also make it more confusing for users to share individual files with others for review or edit.

stansmith907 avatar Nov 22 '18 00:11 stansmith907

There's not really a practical way to export individual files. The best way would be to generate the individual mdJSON files and zip them up using something like jszip. Support would also have to be added to read and unzip the files for import.

jlblcc avatar Nov 23 '18 21:11 jlblcc

On import contacts are duplicated (if a contact is used in more than one record) and all links between records, contacts, and dictionaries are broken. It's quite a mess, unless I'm missing something.

If there is no way to initiate multiple downloads then can we disable "mdJson Export" if more than one record is selected? I see the problem with zip, but an array of mdJson also needs special software to rescue. In the meantime I'll encourage users not to export more than one mdJson file at a time. Can you see a good use for arrays of mdJson files?

stansmith907 avatar Nov 24 '18 22:11 stansmith907

Are you meaning to translate multiple files read from the file system at one time?

On Sat, Nov 24, 2018 at 1:21 PM stansmith907 [email protected] wrote:

If there is no way to initiate multiple downloads then I'll encourage users not to export more than one mdJson file at a time. Can you see a good use for arrays of mdJson files?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/adiwg/mdEditor/issues/254#issuecomment-441399578, or mute the thread https://github.com/notifications/unsubscribe-auth/AF6hLwPleAeM9VbrTTwJX9sSTAj64Bz6ks5uycZOgaJpZM4YucpO .

dwalt avatar Nov 26 '18 18:11 dwalt

@dwalt, Translation of multiple files is not currently supported by the mdTranslator or the Rails API. In theory, you could do this from a third-party application, e.g. mdEditor, by making multiple requests.

@stansmith907, the recommendation is to export to the mdEditor format if the intent is to work with the mdEditor. The relationships in the mdEditor are largely maintained outside of the mdJSON(the mdJSON is compiled dynamically on export or validation). The main reason to use the mdJSON export is if you want to preserve the "raw" mdJSON or would like to work with it directly. Most users should only need to import/export the mdEditor format which will preserve the relationships.

The plan is to improve the import process and make the mdEditor capable of matching imported items with existing items, and presenting the users with the option of inserting, upserting, or skipping the item. That will make import of mdJSON less problematic.

jlblcc avatar Nov 26 '18 19:11 jlblcc

I'm with you on all of that. I'm interested in exploring whether we should preempt export of arrays of mdJSON files until import can handle it safely. Otherwise user could get records messed up.

stansmith907 avatar Nov 26 '18 20:11 stansmith907

I'm not sure we finalized our thoughts during this morning's conference call, but here are the open items:

  • [ ] When exporting a single mdJSON record do not wrap it in array brackets.
  • [ ] Prevent export of arrays of mdJSON records.
  • [ ] Re-evaluate import of mdJSON arrays after the import process has been modified to assist in merging duplicate items.

stansmith907 avatar Nov 27 '18 22:11 stansmith907