mirror of
https://github.com/Fabio286/antares.git
synced 2025-06-05 21:59:22 +02:00
refactor: simplified and improved project structure
This commit is contained in:
@ -10,7 +10,7 @@
|
||||
</div>
|
||||
<a class="btn btn-clear c-hand" @click.stop="closeModal" />
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="modal-body pb-0">
|
||||
<div class="content">
|
||||
<form class="form-horizontal">
|
||||
<div class="form-group">
|
||||
|
@ -10,7 +10,7 @@
|
||||
</div>
|
||||
<a class="btn btn-clear c-hand" @click="closeModal" />
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="modal-body pb-0">
|
||||
<div class="content">
|
||||
<form class="form-horizontal">
|
||||
<fieldset class="m-0" :disabled="isTesting">
|
||||
@ -113,13 +113,13 @@
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer text-light">
|
||||
<BaseToast
|
||||
class="mb-2"
|
||||
:message="toast.message"
|
||||
:status="toast.status"
|
||||
/>
|
||||
</div>
|
||||
<div class="modal-footer text-light">
|
||||
<button
|
||||
class="btn btn-gray mr-2"
|
||||
:class="{'loading': isTesting}"
|
||||
|
@ -10,7 +10,7 @@
|
||||
</div>
|
||||
<a class="btn btn-clear c-hand" @click="closeModal" />
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="modal-body pb-0">
|
||||
<div class="content">
|
||||
<form class="form-horizontal">
|
||||
<fieldset class="m-0" :disabled="isTesting">
|
||||
@ -117,13 +117,13 @@
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer text-light">
|
||||
<BaseToast
|
||||
class="mb-2"
|
||||
:message="toast.message"
|
||||
:status="toast.status"
|
||||
/>
|
||||
</div>
|
||||
<div class="modal-footer text-light">
|
||||
<button
|
||||
class="btn btn-gray mr-2"
|
||||
:class="{'loading': isTesting}"
|
||||
|
@ -10,7 +10,7 @@
|
||||
</div>
|
||||
<a class="btn btn-clear c-hand" @click.stop="closeModal" />
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="modal-body pb-0">
|
||||
<div class="content">
|
||||
<form class="form-horizontal">
|
||||
<fieldset :disabled="isInserting">
|
||||
|
@ -156,6 +156,7 @@ export default {
|
||||
|
||||
try { // Key usage (foreign keys)
|
||||
const { status, response } = await Tables.getKeyUsage(params);
|
||||
|
||||
if (status === 'success') {
|
||||
this.keyUsage = response;// Needed to add new rows
|
||||
keysArr.push(response);
|
||||
|
@ -39,7 +39,9 @@ module.exports = {
|
||||
data: 'Data',
|
||||
properties: 'Properties',
|
||||
insert: 'Insert',
|
||||
connecting: 'Connecting'
|
||||
connecting: 'Connecting',
|
||||
name: 'Name',
|
||||
collation: 'Collation'
|
||||
},
|
||||
message: {
|
||||
appWelcome: 'Welcome to Antares SQL Client!',
|
||||
@ -71,7 +73,9 @@ module.exports = {
|
||||
addNewRow: 'Add new row',
|
||||
numberOfInserts: 'Number of inserts',
|
||||
openNewTab: 'Open a new tab',
|
||||
affectedRows: 'Affected rows'
|
||||
affectedRows: 'Affected rows',
|
||||
createNewDatabase: 'Create new Database',
|
||||
databaseName: 'Database name'
|
||||
},
|
||||
// Date and Time
|
||||
short: {
|
||||
|
@ -18,8 +18,12 @@ export default class {
|
||||
return ipcRenderer.invoke('disconnect', uid);
|
||||
}
|
||||
|
||||
static refresh (uid) {
|
||||
return ipcRenderer.invoke('refresh', uid);
|
||||
static getStructure (uid) {
|
||||
return ipcRenderer.invoke('get-structure', uid);
|
||||
}
|
||||
|
||||
static getCollations (uid) {
|
||||
return ipcRenderer.invoke('get-collations', uid);
|
||||
}
|
||||
|
||||
static rawQuery (params) {
|
||||
|
@ -57,6 +57,9 @@ export default {
|
||||
REFRESH_STRUCTURE (state, { uid, structure }) {
|
||||
state.workspaces = state.workspaces.map(workspace => workspace.uid === uid ? { ...workspace, structure } : workspace);
|
||||
},
|
||||
REFRESH_COLLATIONS (state, { uid, collations }) { // TODO: Save collations
|
||||
// state.workspaces = state.workspaces.map(workspace => workspace.uid === uid ? { ...workspace, structure } : workspace);
|
||||
},
|
||||
ADD_WORKSPACE (state, workspace) {
|
||||
state.workspaces.push(workspace);
|
||||
},
|
||||
@ -136,7 +139,7 @@ export default {
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
selectWorkspace ({ commit }, uid) {
|
||||
selectWorkspace ({ commit, dispatch }, uid) {
|
||||
commit('SELECT_WORKSPACE', uid);
|
||||
},
|
||||
async connectWorkspace ({ dispatch, commit }, connection) {
|
||||
@ -144,8 +147,10 @@ export default {
|
||||
const { status, response } = await Connection.connect(connection);
|
||||
if (status === 'error')
|
||||
dispatch('notifications/addNotification', { status, message: response }, { root: true });
|
||||
else
|
||||
else {
|
||||
commit('ADD_CONNECTED', { uid: connection.uid, structure: remapStructure(response) });
|
||||
dispatch('refreshCollations', connection.uid);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
dispatch('notifications/addNotification', { status: 'error', message: err.stack }, { root: true });
|
||||
@ -153,7 +158,7 @@ export default {
|
||||
},
|
||||
async refreshStructure ({ dispatch, commit }, uid) {
|
||||
try {
|
||||
const { status, response } = await Connection.refresh(uid);
|
||||
const { status, response } = await Connection.getStructure(uid);
|
||||
if (status === 'error')
|
||||
dispatch('notifications/addNotification', { status, message: response }, { root: true });
|
||||
else
|
||||
@ -163,6 +168,18 @@ export default {
|
||||
dispatch('notifications/addNotification', { status: 'error', message: err.stack }, { root: true });
|
||||
}
|
||||
},
|
||||
async refreshCollations ({ dispatch, commit }, uid) {
|
||||
try {
|
||||
const { status, response } = await Connection.getCollations(uid);
|
||||
if (status === 'error')
|
||||
dispatch('notifications/addNotification', { status, message: response }, { root: true });
|
||||
else
|
||||
commit('REFRESH_COLLATIONS', { uid, collations: response });
|
||||
}
|
||||
catch (err) {
|
||||
dispatch('notifications/addNotification', { status: 'error', message: err.stack }, { root: true });
|
||||
}
|
||||
},
|
||||
removeConnected ({ commit }, uid) {
|
||||
Connection.disconnect(uid);
|
||||
commit('REMOVE_CONNECTED', uid);
|
||||
|
Reference in New Issue
Block a user