From 3e8a6e322c2bb9691f9ab80471db75c86b33de14 Mon Sep 17 00:00:00 2001 From: Alvin Sebastian Date: Fri, 17 May 2024 02:02:35 +0000 Subject: [PATCH] UI changes, bug fixes --- package.json | 2 +- src/app/components/Help.vue | 4 +- src/app/utils/profiles.js | 8 +-- src/app/views/CrateoView.vue | 80 +++++++++++++++---------- src/lib/components/ControlAdd.vue | 8 +-- src/lib/components/CrateEditor.vue | 94 +++++++++++++++++------------- src/lib/components/Entity.vue | 48 +++++++-------- src/lib/components/InputGeo.vue | 1 + src/lib/components/LinkEntity.vue | 16 ++++- src/lib/components/Property.vue | 15 ++--- src/lib/lookups/ror.js | 2 +- 11 files changed, 161 insertions(+), 117 deletions(-) diff --git a/package.json b/package.json index 85aaa47..5f70890 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "crate-o", - "version": "0.3.6", + "version": "0.3.7", "description": "A VueJS UI component to create and edit Research Object Crate (RO-Crate) metadata", "keywords": [ "RO-Crate", diff --git a/src/app/components/Help.vue b/src/app/components/Help.vue index 7ff3a3c..e149829 100644 --- a/src/app/components/Help.vue +++ b/src/app/components/Help.vue @@ -43,10 +43,10 @@ import { ElRow, ElCol } from 'element-plus'; Closes without saving.

- Profile + Mode

- Select a predefined profile or load one from your computer. + Select a predefined mode or load one from your computer.

diff --git a/src/app/utils/profiles.js b/src/app/utils/profiles.js index 953c2cb..f1f3568 100644 --- a/src/app/utils/profiles.js +++ b/src/app/utils/profiles.js @@ -1,8 +1,8 @@ const profileUrls = [ - 'https://language-research-technology.github.io/ro-crate-editor-profiles/profiles/base-profile.json', - 'https://language-research-technology.github.io/ro-crate-editor-profiles/profiles/schema.json', - 'https://language-research-technology.github.io/ro-crate-editor-profiles/profiles/language-data-commons-collection-profile.json', - 'https://language-research-technology.github.io/ro-crate-editor-profiles/profiles/software-profile.json' + 'https://language-research-technology.github.io/ro-crate-modes/modes/base.json', + 'https://language-research-technology.github.io/ro-crate-modes/modes/schema.json', + 'https://language-research-technology.github.io/ro-crate-modes/modes/language-data-commons-collection.json', + 'https://language-research-technology.github.io/ro-crate-modes/modes/software.json' ]; export const profiles = profileUrls.map(p => null); const p = profileUrls.map((url, i) => fetch(url).then(r => r.ok ? r.json().then(json => profiles[i] = json) : null)); diff --git a/src/app/views/CrateoView.vue b/src/app/views/CrateoView.vue index fe6069b..8dec578 100644 --- a/src/app/views/CrateoView.vue +++ b/src/app/views/CrateoView.vue @@ -6,7 +6,8 @@ import Help from "../components/Help.vue"; import SpreadSheet from "../components/SpreadSheet.vue"; import { Validator } from "../utils/profileValidator.js"; import { ROCrate } from "ro-crate"; -import { ElRow, ElCol, ElMenu, ElMenuItem, ElDivider, ElSelect, ElOption, ElDialog, ElButton } from 'element-plus'; +import { ElRow, ElCol, ElMenu, ElMenuItem, ElDivider, ElSelect, ElOption, + ElDialog, ElButton, ElCollapse, ElCollapseItem, ElAlert } from 'element-plus'; import { handleRoute } from '../../lib/DefaultRouteHandler.js' import { CrateEditor } from '../../lib' @@ -78,8 +79,6 @@ const commands = { console.log('open'); try { data.dirHandle = await window.showDirectoryPicker(); - // reset crate - resetData(); data.loading = true; try { data.metadataHandle = await data.dirHandle.getFileHandle('ro-crate-metadata.json'); @@ -100,12 +99,13 @@ const commands = { data.crate = crate; //navigate(); //data.loading = false; - console.log('end open') + // reset crate + resetData(); } catch (error) { console.error(error); window.alert(error); - resetData(); } + console.log('end open') }, async addFiles() { @@ -115,6 +115,7 @@ const commands = { }, async save() { + console.log('save!!!!!!!!!!!'); if (data.dirHandle) { // create new crate metadata data.metadataHandle = await data.dirHandle.getFileHandle('ro-crate-metadata.json', { create: true }); @@ -136,9 +137,9 @@ const commands = { const content = JSON.stringify(crate, null, 2); await writable.write(content); await writable.close(); - data.crate = crate; - data.entityId = ''; - data.validationResult = validate(data.crate, profile.value); + //data.crate = crate; + //data.entityId = ''; + data.validationResult = validate(crate, profile.value); data.validationResultDialog = !!data.validationResult; } }, @@ -304,7 +305,7 @@ function selectProfile(v) { data.selectedProfile = v; } } - +const activeNames = ref(['1']);