Skip to content

Commit

Permalink
updated remove/rename assay/study ARCtrl API
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasLukasczyk committed Dec 12, 2024
1 parent ae19c39 commit 763da63
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
21 changes: 9 additions & 12 deletions packages/renderer/src/ArcControlService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>{
Expand Down
11 changes: 6 additions & 5 deletions packages/renderer/src/views/ArcTreeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -496,6 +496,7 @@ const onCellContextMenu = async (e,node) => {
$q.dialog({
component: ConfirmationDialog,
componentProps: {
title: `Delete`,
msg: `Are you sure you want to delete:<br><b><i>${node.id}</i></b><br>`,
ok_text: 'Delete',
ok_icon: 'delete',
Expand All @@ -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)
);
}
});
Expand All @@ -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({
Expand All @@ -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)
);
}
});
Expand All @@ -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
Expand Down

0 comments on commit 763da63

Please sign in to comment.