diff --git a/packages/renderer/src/App.vue b/packages/renderer/src/App.vue
index c69dd17..64688b8 100644
--- a/packages/renderer/src/App.vue
+++ b/packages/renderer/src/App.vue
@@ -62,15 +62,11 @@ const openLocalArc = async (path: string | null | void) =>{
iProps.error = true;
return;
}
- const git_initialized = await window.ipc.invoke('GitService.run',{
- args: [`status`],
- cwd: path
- });
- ArcControlService.props.arc.git_initialized = git_initialized[0];
- if(!ArcControlService.props.arc.git_initialized){
+ if(!ArcControlService.props.git_initialized){
$q.dialog({
component: ConfirmationDialog,
componentProps: {
+ title: `Warning`,
msg: `ARC is not a Git repository.
Do you want to initialize Git?`,
ok_text: 'Initialize Git',
ok_icon: 'sym_r_folder_data',
@@ -97,7 +93,7 @@ const openLocalArc = async (path: string | null | void) =>{
args: ['init','-b','main'],
cwd: path
});
- dialogProps.state = response[0] ? 1 : 2;
+ dialogProps.state=response[0]?1:2;
});
}
};
diff --git a/packages/renderer/src/ArcControlService.ts b/packages/renderer/src/ArcControlService.ts
index 90a3054..bc6578e 100644
--- a/packages/renderer/src/ArcControlService.ts
+++ b/packages/renderer/src/ArcControlService.ts
@@ -22,11 +22,13 @@ export const Workflows = 'workflows';
let init: {
arc_root: undefined | string ,
busy: boolean,
- arc: null | ARC
+ arc: null | ARC,
+ git_initialized: boolean
} = {
arc_root: undefined ,
busy: false,
- arc: null
+ arc: null,
+ git_initialized: false
}
function relative_to_absolute_path(relativePath: string) {
@@ -69,6 +71,13 @@ const ArcControlService = {
arc.SetISAFromContracts(contracts);
ArcControlService.props.arc = arc;
ArcControlService.props.arc_root = arc_root;
+
+ const git_initialized = await window.ipc.invoke('GitService.run',{
+ args: [`status`],
+ cwd: arc_root
+ });
+ ArcControlService.props.git_initialized = git_initialized[0];
+
ArcControlService.props.busy = false;
console.log(arc);
return true;
@@ -153,7 +162,8 @@ const ArcControlService = {
arc_root + '/.gitignore'
);
if(!ignore_exists)
- contracts.push(gitignoreContract);
+ contracts.push(
+ );
await ArcControlService.handleARCContracts(contracts, arc, arc_root);
diff --git a/packages/renderer/src/components/ToolbarButton.vue b/packages/renderer/src/components/ToolbarButton.vue
index e0b6fa0..9825c3d 100644
--- a/packages/renderer/src/components/ToolbarButton.vue
+++ b/packages/renderer/src/components/ToolbarButton.vue
@@ -22,7 +22,7 @@ const props = withDefaults(defineProps(), {
const emit = defineEmits(['clicked']);
const enabled = ()=>{
- return (!props.requiresARC || ArcControlService.props.arc_root) && (!props.requiresUser || appProperties.user) && (!props.requiresGit || (ArcControlService.props.arc && ArcControlService.props.arc.git_initialized));
+ return (!props.requiresARC || ArcControlService.props.arc_root) && (!props.requiresUser || appProperties.user) && (!props.requiresGit || ArcControlService.props.git_initialized);
}
diff --git a/packages/renderer/src/dialogs/ConfirmationDialog.vue b/packages/renderer/src/dialogs/ConfirmationDialog.vue
index c2d0125..db7722b 100644
--- a/packages/renderer/src/dialogs/ConfirmationDialog.vue
+++ b/packages/renderer/src/dialogs/ConfirmationDialog.vue
@@ -2,22 +2,24 @@
import { useDialogPluginComponent } from 'quasar';
export interface Props {
+ title: String,
msg: String,
- ok_text: String,
- ok_icon: String,
- ok_color: String,
- cancel_text: String,
- cancel_icon: String,
- cancel_color: String
+ ok_text?: String,
+ ok_icon?: String,
+ ok_color?: String,
+ cancel_text?: String,
+ cancel_icon?: String,
+ cancel_color?: String
};
const props = withDefaults(defineProps(), {
+ title: '',
msg: '',
ok_text: 'OK',
ok_icon: 'check_circle',
ok_color: 'secondary',
- cancel_text: 'Cancel',
- cancel_icon: 'cancel',
- cancel_color: 'secondary'
+ cancel_text: '',
+ cancel_icon: '',
+ cancel_color: ''
});
const { dialogRef, onDialogHide, onDialogOK, onDialogCancel } = useDialogPluginComponent();
@@ -29,7 +31,7 @@ const { dialogRef, onDialogHide, onDialogOK, onDialogCancel } = useDialogPluginC
- Confirm
+ {{props.title}}
@@ -38,8 +40,8 @@ const { dialogRef, onDialogHide, onDialogOK, onDialogCancel } = useDialogPluginC
-
-
+
+
diff --git a/packages/renderer/src/dialogs/ErrorDialog.vue b/packages/renderer/src/dialogs/ErrorDialog.vue
deleted file mode 100644
index 91770ec..0000000
--- a/packages/renderer/src/dialogs/ErrorDialog.vue
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
-
- Error
-
-
-
-
- {{props.error}}
-
-
-
-
-
-
-
-
-
diff --git a/packages/renderer/src/dialogs/GitDialog.vue b/packages/renderer/src/dialogs/GitDialog.vue
index d86aa1a..b153462 100644
--- a/packages/renderer/src/dialogs/GitDialog.vue
+++ b/packages/renderer/src/dialogs/GitDialog.vue
@@ -27,7 +27,6 @@ defineEmits([
]);
const processGitStream = async row=>{
- if(props.state===1) return;
const last_row = iProps.rows[iProps.rows.length-1];
let replace = false;
for(let p of [
@@ -47,7 +46,7 @@ const processGitStream = async row=>{
iProps.rows.push(row);
};
-onMounted( ()=>{
+onMounted( ()=>{
iProps.rows = [''];
window.ipc.on('GitService.MSG', processGitStream);
});
diff --git a/packages/renderer/src/views/ArcTreeView.vue b/packages/renderer/src/views/ArcTreeView.vue
index bb754d4..12e6198 100644
--- a/packages/renderer/src/views/ArcTreeView.vue
+++ b/packages/renderer/src/views/ArcTreeView.vue
@@ -10,7 +10,6 @@ import ConfirmationDialog from '../dialogs/ConfirmationDialog.vue';
import StringDialog from '../dialogs/StringDialog.vue';
import AddProtocolDialog from '../dialogs/AddProtocolDialog.vue';
import GitDialog from '../dialogs/GitDialog.vue';
-import ErrorDialog from '../dialogs/ErrorDialog.vue';
import { useQuasar } from 'quasar'
import {ArcStudy, ArcAssay} from '@nfdi4plants/arctrl';
import IdentifierDialog from '../dialogs/IdentifierDialog.vue';
@@ -385,9 +384,10 @@ const onCellContextMenu = async (e,node) => {
cwd: ArcControlService.props.arc_root
});
if(!response[0]) return $q.dialog({
- component: ErrorDialog,
+ component: ConfirmationDialog,
componentProps: {
- error: 'Unable to determine remote name'
+ title: 'Error',
+ msg: 'Unable to determine remote name'
}
});
const remote_name = response[1].split('\n')[0];
@@ -396,9 +396,10 @@ const onCellContextMenu = async (e,node) => {
cwd: ArcControlService.props.arc_root
});
if(!response[0]) return $q.dialog({
- component: ErrorDialog,
+ component: ConfirmationDialog,
componentProps: {
- error: 'Unable to determine remote url'
+ title: 'Error',
+ msg: 'Unable to determine remote url'
}
});
const remote_url = response[1].split('\n')[0];
@@ -407,9 +408,10 @@ const onCellContextMenu = async (e,node) => {
const patched_remote_url = patchRemote(remote_url);
if(!patched_remote_url){
return $q.dialog({
- component: ErrorDialog,
+ component: ConfirmationDialog,
componentProps: {
- error: 'LFS download requires login'
+ title: 'Error',
+ msg: 'LFS download requires login'
}
});
}
diff --git a/packages/renderer/src/views/GitCommitView.vue b/packages/renderer/src/views/GitCommitView.vue
index 1896c68..560d110 100644
--- a/packages/renderer/src/views/GitCommitView.vue
+++ b/packages/renderer/src/views/GitCommitView.vue
@@ -27,8 +27,7 @@ interface Props {
email: string,
msg: string
}
-}
-
+};
const iProps : Props = reactive({
git_status: [],
@@ -171,7 +170,6 @@ const isTrackedWithLFS = item=>{
};
const reset = async()=>{
-
const dialogProps = reactive({
title: 'Resetting ARC',
ok_title: 'Ok',
diff --git a/packages/renderer/src/views/GitSyncView.vue b/packages/renderer/src/views/GitSyncView.vue
index 521d796..111cfae 100644
--- a/packages/renderer/src/views/GitSyncView.vue
+++ b/packages/renderer/src/views/GitSyncView.vue
@@ -11,12 +11,12 @@ import AppProperties from '../AppProperties.ts';
import AddRemoteDialog from '../dialogs/AddRemoteDialog.vue';
import GitDialog from '../dialogs/GitDialog.vue';
+import ConfirmationDialog from '../dialogs/ConfirmationDialog.vue';
import { useQuasar } from 'quasar'
const $q = useQuasar();
const iProps = reactive({
git_status: [],
- error: '',
use_lfs: true,
@@ -26,11 +26,6 @@ const iProps = reactive({
userListener: ()=>{}
});
-const raiseError = err => {
- iProps.error = err;
- return false;
-};
-
const getStatus = async()=>{
const response = await window.ipc.invoke('GitService.run', {
args: [`status`,`-z`,`-u`],
@@ -77,18 +72,20 @@ const patchRemote = url => {
: url;
};
-const push = async()=>{
- iProps.error = '';
-
- if(!iProps.remote)
- return raiseError('Pushing requires remote.');
-
- if(!AppProperties.user)
- return raiseError('Pushing requires login.');
+const showError = async msg=>{
+ $q.dialog({
+ component: ConfirmationDialog,
+ componentProps: {
+ title: 'Error',
+ msg: msg
+ }
+ });
+};
+const push = async()=>{
await getStatus();
if(iProps.git_status.length>0)
- return raiseError('Commit changes before pushing.');
+ return showError('Commit changes before pulling.');
const dialogProps = reactive({
title: 'Pushing ARC',
@@ -100,9 +97,10 @@ const push = async()=>{
$q.dialog({
component: GitDialog,
componentProps: dialogProps
+ }).onOk(async ()=>{
+ await checkRemotes();
});
-
let response = null;
// get current branch
@@ -143,19 +141,12 @@ const push = async()=>{
});
dialogProps.state=1;
-
- await checkRemotes();
};
const pull = async()=>{
- iProps.error = '';
-
- if(!iProps.remote)
- return raiseError('Pulling requires remote.');
-
await getStatus();
if(iProps.git_status.length>0)
- return raiseError('Commit changes before pulling.');
+ return showError('Commit changes before pulling.');
const dialogProps = reactive({
title: 'Pulling ARC',
@@ -167,6 +158,8 @@ const pull = async()=>{
$q.dialog({
component: GitDialog,
componentProps: dialogProps
+ }).onOk(async ()=>{
+ await checkRemotes();
});
let response = null;
@@ -207,8 +200,6 @@ const pull = async()=>{
});
dialogProps.state=1;
-
- await checkRemotes();
};
const checkRemotes = async()=>{
@@ -254,7 +245,6 @@ const getRemotes = async()=>{
};
const init = async()=>{
- iProps.error = '';
await getRemotes();
await checkRemotes();
};
diff --git a/packages/renderer/src/views/LoginView.vue b/packages/renderer/src/views/LoginView.vue
index a37d9c0..90a6b13 100644
--- a/packages/renderer/src/views/LoginView.vue
+++ b/packages/renderer/src/views/LoginView.vue
@@ -6,7 +6,7 @@ import ArcCommanderService from '../ArcCommanderService.ts';
import AppProperties from '../AppProperties.ts';
import SelectionDialog from '../dialogs/SelectionDialog.vue';
import UserDialog from '../dialogs/UserDialog.vue';
-import ErrorDialog from '../dialogs/ErrorDialog.vue';
+import ConfirmationDialog from '../dialogs/ConfirmationDialog.vue';
import { useQuasar } from 'quasar'
const $q = useQuasar();
@@ -16,9 +16,10 @@ const authenticate = async host=>{
if(res) return;
$q.dialog({
- component: ErrorDialog,
+ component: ConfirmationDialog,
componentProps: {
- error: `Unable to authenticate at host "${host}"`,
+ title: 'Error',
+ msg: `Unable to authenticate at host "${host}"`
}
});
};