Added JSON validation for imports.

This commit is contained in:
PeekabooSteam
2023-12-27 16:26:31 +00:00
parent de14f6c738
commit 955057183d
7 changed files with 503 additions and 71 deletions

View File

@@ -25,6 +25,10 @@ export class UnitDataFileExport extends UnitDataFile {
* Show the form to start the export journey
*/
showForm(units: Unit[]) {
this.dialog.getElement().querySelectorAll("[data-on-error]").forEach((el:Element) => {
el.classList.toggle("hide", el.getAttribute("data-on-error") === "show");
});
const data: any = {};
const unitCanBeExported = (unit: Unit) => !["Aircraft", "Helicopter"].includes(unit.getCategory());