diff --git a/package.json b/package.json index b808b36..9e87895 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ARCitect", - "version": "v0.0.51", + "version": "v0.0.52", "author": "nfdi4plants.org", "description": "Tool to edit Annotated Research Contexts (ARCs).", "private": true, diff --git a/packages/renderer/src/ArcControlService.ts b/packages/renderer/src/ArcControlService.ts index bfae8f3..6c54c0d 100644 --- a/packages/renderer/src/ArcControlService.ts +++ b/packages/renderer/src/ArcControlService.ts @@ -172,22 +172,19 @@ const ArcControlService = { ArcControlService.props.busy = false; }, - deleteAssay: async (assay_identifier: string) => { - let contracts = ArcControlService.props.arc.RemoveAssay(assay_identifier) - await ArcControlService.handleARCContracts(contracts); + delete: async (method:string, identifier:string) => { + await ArcControlService.handleARCContracts( + ArcControlService.props.arc[method](identifier) + ); }, rename: async (method:string, old_identifier:string, new_identifier:string) => { - const contracts = ArcControlService.props.arc[method]( - old_identifier, - new_identifier + await ArcControlService.handleARCContracts( + ArcControlService.props.arc[method]( + old_identifier, + new_identifier + ) ); - ArcControlService.handleARCContracts(contracts); - }, - - deleteStudy: async (study_identifier: string) => { - let contracts = ArcControlService.props.arc.RemoveStudy(study_identifier) - await ArcControlService.handleARCContracts(contracts); }, newARC: async (path: string) =>{ diff --git a/packages/renderer/src/views/ArcTreeView.vue b/packages/renderer/src/views/ArcTreeView.vue index 4fc02a1..4863422 100644 --- a/packages/renderer/src/views/ArcTreeView.vue +++ b/packages/renderer/src/views/ArcTreeView.vue @@ -278,7 +278,7 @@ const updatePath = async ([path,type]) => { if(type==='dir_rm'){ const elements = path.replace(ArcControlService.props.arc_root+'/','').split('/'); // if a study or assay was deleted/renamed that is currently opened in swate then close the view - if(elements.length===2 && ['assays','studies'].includes(elements[0]) && SwateControlService.props.object.Identifier===elements[1]) + if(elements.length===2 && ['assays','studies'].includes(elements[0]) && SwateControlService.props.object && SwateControlService.props.object.Identifier===elements[1]) AppProperties.state=AppProperties.STATES.HOME; } @@ -496,6 +496,7 @@ const onCellContextMenu = async (e,node) => { $q.dialog({ component: ConfirmationDialog, componentProps: { + title: `Delete`, msg: `Are you sure you want to delete:
${node.id}
`, ok_text: 'Delete', ok_icon: 'delete', @@ -521,7 +522,7 @@ const onCellContextMenu = async (e,node) => { initial_value: node.label, } }).onOk( - async new_identifier => ArcControlService.rename('RenameAssay',node.label,new_identifier) + async new_identifier => ArcControlService.rename('GetAssayRenameContracts',node.label,new_identifier) ); } }); @@ -533,7 +534,7 @@ const onCellContextMenu = async (e,node) => { items.push({ label: "Delete", icon: h( 'i', icon_style, ['delete'] ), - onClick: ()=>confirm_delete(node,()=>ArcControlService.deleteAssay(node.label)) + onClick: ()=>confirm_delete(node,()=>ArcControlService.delete('GetAssayRemoveContracts',node.label)) }); } else if (node.type===formatNodeEditString(Studies)){ items.push({ @@ -549,7 +550,7 @@ const onCellContextMenu = async (e,node) => { initial_value: node.label, } }).onOk( - async new_identifier => ArcControlService.rename('RenameStudy',node.label,new_identifier) + async new_identifier => ArcControlService.rename('GetStudyRenameContracts',node.label,new_identifier) ); } }); @@ -561,7 +562,7 @@ const onCellContextMenu = async (e,node) => { items.push({ label: "Delete", icon: h( 'i', icon_style, ['delete'] ), - onClick: ()=>confirm_delete(node,()=>ArcControlService.deleteStudy(node.label)) + onClick: ()=>confirm_delete(node,()=>ArcControlService.delete('GetStudyRemoveContracts',node.label)) }); } else { //verify that the file/directory is not a MUST keep file/directory