mirror of https://github.com/Fabio286/antares.git
feat: scratchpad to save persistent notes
This commit is contained in:
parent
280697698e
commit
e349dd5eab
|
@ -41,7 +41,8 @@ A modern application created with minimalism and semplicity in mind, with featur
|
||||||
- Fake table data filler.
|
- Fake table data filler.
|
||||||
- Run queries on multiple tabs.
|
- Run queries on multiple tabs.
|
||||||
- Query suggestions and auto complete.
|
- Query suggestions and auto complete.
|
||||||
- Native dark theme.
|
- Dark and light theme.
|
||||||
|
- Scratchpad.
|
||||||
- Multi language.
|
- Multi language.
|
||||||
- Secure password storage.
|
- Secure password storage.
|
||||||
- Auto updates.
|
- Auto updates.
|
||||||
|
@ -51,7 +52,7 @@ A modern application created with minimalism and semplicity in mind, with featur
|
||||||
This is a roadmap with major features will come in near future.
|
This is a roadmap with major features will come in near future.
|
||||||
|
|
||||||
- Support for other databases.
|
- Support for other databases.
|
||||||
- Database tools (variables, process list...).
|
- Database tools.
|
||||||
- SSH tunnel support.
|
- SSH tunnel support.
|
||||||
- Users management (add/edit/delete).
|
- Users management (add/edit/delete).
|
||||||
- UI/UX improvements.
|
- UI/UX improvements.
|
||||||
|
@ -60,7 +61,6 @@ This is a roadmap with major features will come in near future.
|
||||||
- More keyboard shortcuts.
|
- More keyboard shortcuts.
|
||||||
- Query logs console.
|
- Query logs console.
|
||||||
- Import/export and migration.
|
- Import/export and migration.
|
||||||
- Light theme.
|
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
<TheFooter />
|
<TheFooter />
|
||||||
<TheNotificationsBoard />
|
<TheNotificationsBoard />
|
||||||
<ModalNewConnection v-if="isNewConnModal" />
|
<ModalNewConnection v-if="isNewConnModal" />
|
||||||
|
<TheScratchpad v-if="isScratchpad" />
|
||||||
<ModalSettings v-if="isSettingModal" />
|
<ModalSettings v-if="isSettingModal" />
|
||||||
<ModalDiscardChanges v-if="isUnsavedDiscardModal" />
|
<ModalDiscardChanges v-if="isUnsavedDiscardModal" />
|
||||||
</div>
|
</div>
|
||||||
|
@ -37,6 +38,7 @@ export default {
|
||||||
Workspace: () => import(/* webpackChunkName: "Workspace" */'@/components/Workspace'),
|
Workspace: () => import(/* webpackChunkName: "Workspace" */'@/components/Workspace'),
|
||||||
ModalNewConnection: () => import(/* webpackChunkName: "ModalNewConnection" */'@/components/ModalNewConnection'),
|
ModalNewConnection: () => import(/* webpackChunkName: "ModalNewConnection" */'@/components/ModalNewConnection'),
|
||||||
ModalSettings: () => import(/* webpackChunkName: "ModalSettings" */'@/components/ModalSettings'),
|
ModalSettings: () => import(/* webpackChunkName: "ModalSettings" */'@/components/ModalSettings'),
|
||||||
|
TheScratchpad: () => import(/* webpackChunkName: "TheScratchpad" */'@/components/TheScratchpad'),
|
||||||
ModalDiscardChanges: () => import(/* webpackChunkName: "ModalDiscardChanges" */'@/components/ModalDiscardChanges')
|
ModalDiscardChanges: () => import(/* webpackChunkName: "ModalDiscardChanges" */'@/components/ModalDiscardChanges')
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
|
@ -48,6 +50,7 @@ export default {
|
||||||
isNewConnModal: 'application/isNewModal',
|
isNewConnModal: 'application/isNewModal',
|
||||||
isEditModal: 'application/isEditModal',
|
isEditModal: 'application/isEditModal',
|
||||||
isSettingModal: 'application/isSettingModal',
|
isSettingModal: 'application/isSettingModal',
|
||||||
|
isScratchpad: 'application/isScratchpad',
|
||||||
connections: 'connections/getConnections',
|
connections: 'connections/getConnections',
|
||||||
applicationTheme: 'settings/getApplicationTheme',
|
applicationTheme: 'settings/getApplicationTheme',
|
||||||
isUnsavedDiscardModal: 'workspaces/isUnsavedDiscardModal'
|
isUnsavedDiscardModal: 'workspaces/isUnsavedDiscardModal'
|
||||||
|
|
|
@ -22,6 +22,7 @@ export default {
|
||||||
editorClass: { type: String, default: '' },
|
editorClass: { type: String, default: '' },
|
||||||
autoFocus: { type: Boolean, default: false },
|
autoFocus: { type: Boolean, default: false },
|
||||||
readOnly: { type: Boolean, default: false },
|
readOnly: { type: Boolean, default: false },
|
||||||
|
showLineNumbers: { type: Boolean, default: true },
|
||||||
height: { type: Number, default: 200 }
|
height: { type: Number, default: 200 }
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
|
@ -71,7 +72,9 @@ export default {
|
||||||
value: this.value,
|
value: this.value,
|
||||||
fontSize: '14px',
|
fontSize: '14px',
|
||||||
printMargin: false,
|
printMargin: false,
|
||||||
readOnly: this.readOnly
|
readOnly: this.readOnly,
|
||||||
|
showLineNumbers: this.showLineNumbers,
|
||||||
|
showGutter: this.showLineNumbers
|
||||||
});
|
});
|
||||||
|
|
||||||
this.editor.setOptions({
|
this.editor.setOptions({
|
||||||
|
|
|
@ -0,0 +1,75 @@
|
||||||
|
<template>
|
||||||
|
<ConfirmModal
|
||||||
|
:confirm-text="$t('word.update')"
|
||||||
|
:cancel-text="$t('word.close')"
|
||||||
|
size="large"
|
||||||
|
:hide-footer="true"
|
||||||
|
@hide="hideScratchpad"
|
||||||
|
>
|
||||||
|
<template :slot="'header'">
|
||||||
|
<div class="d-flex">
|
||||||
|
<i class="mdi mdi-24px mdi-notebook-edit-outline mr-1" /> {{ $t('word.scratchpad') }}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<div :slot="'body'">
|
||||||
|
<div>
|
||||||
|
<div>
|
||||||
|
<TextEditor
|
||||||
|
:value.sync="localNotes"
|
||||||
|
editor-class="textarea-editor"
|
||||||
|
mode="markdown"
|
||||||
|
:auto-focus="true"
|
||||||
|
:show-line-numbers="false"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<small class="text-gray">{{ $t('message.markdownSupported') }}</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ConfirmModal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { mapActions, mapGetters } from 'vuex';
|
||||||
|
import ConfirmModal from '@/components/BaseConfirmModal';
|
||||||
|
import TextEditor from '@/components/BaseTextEditor';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'TheScratchpad',
|
||||||
|
components: {
|
||||||
|
ConfirmModal,
|
||||||
|
TextEditor
|
||||||
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
localNotes: '',
|
||||||
|
debounceTimeout: null
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapGetters({
|
||||||
|
notes: 'scratchpad/getNotes'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
localNotes () {
|
||||||
|
clearTimeout(this.debounceTimeout);
|
||||||
|
|
||||||
|
this.debounceTimeout = setTimeout(() => {
|
||||||
|
this.changeNotes(this.localNotes);
|
||||||
|
}, 200);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created () {
|
||||||
|
this.localNotes = this.notes;
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
...mapActions({
|
||||||
|
hideScratchpad: 'application/hideScratchpad',
|
||||||
|
changeNotes: 'scratchpad/changeNotes'
|
||||||
|
}),
|
||||||
|
hideModal () {
|
||||||
|
this.$emit('hide');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
|
@ -36,7 +36,7 @@
|
||||||
|
|
||||||
<div class="settingbar-bottom-elements">
|
<div class="settingbar-bottom-elements">
|
||||||
<ul class="settingbar-elements">
|
<ul class="settingbar-elements">
|
||||||
<li class="settingbar-element btn btn-link ex-tooltip">
|
<li class="settingbar-element btn btn-link ex-tooltip" @click="showScratchpad">
|
||||||
<i class="settingbar-element-icon mdi mdi-24px mdi-notebook-edit-outline text-light" />
|
<i class="settingbar-element-icon mdi mdi-24px mdi-notebook-edit-outline text-light" />
|
||||||
<span class="ex-tooltip-content">{{ $t('word.scratchpad') }}</span>
|
<span class="ex-tooltip-content">{{ $t('word.scratchpad') }}</span>
|
||||||
</li>
|
</li>
|
||||||
|
@ -94,6 +94,7 @@ export default {
|
||||||
updateConnections: 'connections/updateConnections',
|
updateConnections: 'connections/updateConnections',
|
||||||
showNewConnModal: 'application/showNewConnModal',
|
showNewConnModal: 'application/showNewConnModal',
|
||||||
showSettingModal: 'application/showSettingModal',
|
showSettingModal: 'application/showSettingModal',
|
||||||
|
showScratchpad: 'application/showScratchpad',
|
||||||
selectWorkspace: 'workspaces/selectWorkspace'
|
selectWorkspace: 'workspaces/selectWorkspace'
|
||||||
}),
|
}),
|
||||||
contextMenu (event, connection) {
|
contextMenu (event, connection) {
|
||||||
|
|
|
@ -205,7 +205,8 @@ module.exports = {
|
||||||
createNewSchema: 'Create new schema',
|
createNewSchema: 'Create new schema',
|
||||||
schemaName: 'Schema name',
|
schemaName: 'Schema name',
|
||||||
editSchema: 'Edit schema',
|
editSchema: 'Edit schema',
|
||||||
deleteSchema: 'Delete schema'
|
deleteSchema: 'Delete schema',
|
||||||
|
markdownSupported: 'Markdown supported'
|
||||||
},
|
},
|
||||||
faker: {
|
faker: {
|
||||||
address: 'Address',
|
address: 'Address',
|
||||||
|
|
|
@ -5,6 +5,7 @@ import Vuex from 'vuex';
|
||||||
|
|
||||||
import application from './modules/application.store';
|
import application from './modules/application.store';
|
||||||
import settings from './modules/settings.store';
|
import settings from './modules/settings.store';
|
||||||
|
import scratchpad from './modules/scratchpad.store';
|
||||||
import connections from './modules/connections.store';
|
import connections from './modules/connections.store';
|
||||||
import workspaces from './modules/workspaces.store';
|
import workspaces from './modules/workspaces.store';
|
||||||
import notifications from './modules/notifications.store';
|
import notifications from './modules/notifications.store';
|
||||||
|
@ -18,6 +19,7 @@ export default new Vuex.Store({
|
||||||
modules: {
|
modules: {
|
||||||
application,
|
application,
|
||||||
settings,
|
settings,
|
||||||
|
scratchpad,
|
||||||
connections,
|
connections,
|
||||||
workspaces,
|
workspaces,
|
||||||
notifications
|
notifications
|
||||||
|
|
|
@ -8,6 +8,7 @@ export default {
|
||||||
is_loading: false,
|
is_loading: false,
|
||||||
is_new_modal: false,
|
is_new_modal: false,
|
||||||
is_setting_modal: false,
|
is_setting_modal: false,
|
||||||
|
is_scratchpad: false,
|
||||||
selected_setting_tab: 'general',
|
selected_setting_tab: 'general',
|
||||||
selected_conection: {},
|
selected_conection: {},
|
||||||
update_status: 'noupdate', // noupdate, available, checking, nocheck, downloading, downloaded, disabled
|
update_status: 'noupdate', // noupdate, available, checking, nocheck, downloading, downloaded, disabled
|
||||||
|
@ -22,6 +23,7 @@ export default {
|
||||||
getSelectedConnection: state => state.selected_conection,
|
getSelectedConnection: state => state.selected_conection,
|
||||||
isNewModal: state => state.is_new_modal,
|
isNewModal: state => state.is_new_modal,
|
||||||
isSettingModal: state => state.is_setting_modal,
|
isSettingModal: state => state.is_setting_modal,
|
||||||
|
isScratchpad: state => state.is_scratchpad,
|
||||||
selectedSettingTab: state => state.selected_setting_tab,
|
selectedSettingTab: state => state.selected_setting_tab,
|
||||||
getUpdateStatus: state => state.update_status,
|
getUpdateStatus: state => state.update_status,
|
||||||
getDownloadProgress: state => Number(state.download_progress.toFixed(1))
|
getDownloadProgress: state => Number(state.download_progress.toFixed(1))
|
||||||
|
@ -46,6 +48,12 @@ export default {
|
||||||
HIDE_SETTING_MODAL (state) {
|
HIDE_SETTING_MODAL (state) {
|
||||||
state.is_setting_modal = false;
|
state.is_setting_modal = false;
|
||||||
},
|
},
|
||||||
|
SHOW_SCRATCHPAD (state) {
|
||||||
|
state.is_scratchpad = true;
|
||||||
|
},
|
||||||
|
HIDE_SCRATCHPAD (state) {
|
||||||
|
state.is_scratchpad = false;
|
||||||
|
},
|
||||||
CHANGE_UPDATE_STATUS (state, status) {
|
CHANGE_UPDATE_STATUS (state, status) {
|
||||||
state.update_status = status;
|
state.update_status = status;
|
||||||
},
|
},
|
||||||
|
@ -72,6 +80,12 @@ export default {
|
||||||
},
|
},
|
||||||
hideSettingModal ({ commit }) {
|
hideSettingModal ({ commit }) {
|
||||||
commit('HIDE_SETTING_MODAL');
|
commit('HIDE_SETTING_MODAL');
|
||||||
|
},
|
||||||
|
showScratchpad ({ commit }) {
|
||||||
|
commit('SHOW_SCRATCHPAD');
|
||||||
|
},
|
||||||
|
hideScratchpad ({ commit }) {
|
||||||
|
commit('HIDE_SCRATCHPAD');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
'use strict';
|
||||||
|
import Store from 'electron-store';
|
||||||
|
const persistentStore = new Store({ name: 'notes' });
|
||||||
|
|
||||||
|
export default {
|
||||||
|
namespaced: true,
|
||||||
|
strict: true,
|
||||||
|
state: {
|
||||||
|
notes: persistentStore.get('notes', '# HOW TO SUPPORT ANTARES\n\n- [ ] Leave a star to Antares [GitHub repo](https://github.com/Fabio286/antares)\n- [ ] Send feedbacks and advices\n- [ ] Report for bugs\n- [ ] If you enjoy, share Antares with friends\n\n# ABOUT SCRATCHPAD\n\nThis is a scratchpad where you can save your **personal notes**. It supports `markdown` format, but you are free to use plain text.\nThis content is just a placeholder, feel free to clear it to make space for your notes.\n')
|
||||||
|
},
|
||||||
|
getters: {
|
||||||
|
getNotes: state => state.notes
|
||||||
|
},
|
||||||
|
mutations: {
|
||||||
|
SET_NOTES (state, notes) {
|
||||||
|
state.notes = notes;
|
||||||
|
persistentStore.set('notes', state.notes);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
changeNotes ({ commit }, notes) {
|
||||||
|
commit('SET_NOTES', notes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
Loading…
Reference in New Issue