-
-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #735 from antares-sql/feat/new-scratchpad
Feat/new scratchpad
- Loading branch information
Showing
23 changed files
with
1,178 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ name: Test end-to-end [WINDOWS] | |
on: | ||
push: | ||
branches: | ||
- master | ||
- develop | ||
|
||
jobs: | ||
release: | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
<template> | ||
<ConfirmModal | ||
size="medium" | ||
:disable-autofocus="true" | ||
:close-on-confirm="!!localNote.note.length" | ||
:confirm-text="t('general.save')" | ||
@confirm="updateNote" | ||
@hide="$emit('hide')" | ||
> | ||
<template #header> | ||
<div class="d-flex"> | ||
<BaseIcon | ||
icon-name="mdiNoteEditOutline" | ||
class="mr-1" | ||
:size="24" | ||
/> {{ t('application.editNote') }} | ||
</div> | ||
</template> | ||
<template #body> | ||
<form class="form"> | ||
<div class="form-group columns"> | ||
<div class="column col-8"> | ||
<label class="form-label">{{ t('connection.connection') }}</label> | ||
<BaseSelect | ||
v-model="localNote.cUid" | ||
class="form-select" | ||
:options="connectionOptions" | ||
option-track-by="code" | ||
option-label="name" | ||
@change="null" | ||
/> | ||
</div> | ||
<div class="column col-4"> | ||
<label class="form-label">{{ t('application.tag') }}</label> | ||
<BaseSelect | ||
v-model="localNote.type" | ||
class="form-select" | ||
:options="noteTags" | ||
option-track-by="code" | ||
option-label="name" | ||
@change="null" | ||
/> | ||
</div> | ||
</div> | ||
<div class="form-group"> | ||
<label class="form-label">{{ t('general.content') }} <small | ||
v-if="localNote.type !== 'query'" | ||
style="line-height: 1;" | ||
class="text-gray" | ||
>({{ t('application.markdownSupported') }})</small></label> | ||
<BaseTextEditor | ||
v-model="localNote.note" | ||
:mode="editorMode" | ||
:show-line-numbers="false" | ||
/> | ||
</div> | ||
</form> | ||
</template> | ||
</ConfirmModal> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { inject, onBeforeMount, PropType, Ref, ref, watch } from 'vue'; | ||
import { useI18n } from 'vue-i18n'; | ||
import ConfirmModal from '@/components/BaseConfirmModal.vue'; | ||
import BaseIcon from '@/components/BaseIcon.vue'; | ||
import BaseSelect from '@/components/BaseSelect.vue'; | ||
import BaseTextEditor from '@/components/BaseTextEditor.vue'; | ||
import { ConnectionNote, TagCode, useScratchpadStore } from '@/stores/scratchpad'; | ||
const { t } = useI18n(); | ||
const { editNote } = useScratchpadStore(); | ||
const emit = defineEmits(['hide']); | ||
const props = defineProps({ | ||
note: { | ||
type: Object as PropType<ConnectionNote>, | ||
required: true | ||
} | ||
}); | ||
const noteTags = inject<{code: TagCode; name: string}[]>('noteTags'); | ||
const connectionOptions = inject<{code: string; name: string}[]>('connectionOptions'); | ||
const editorMode = ref('markdown'); | ||
const localNote: Ref<ConnectionNote> = ref({ | ||
uid: 'dummy', | ||
cUid: null, | ||
title: undefined, | ||
note: '', | ||
date: new Date(), | ||
type: 'note', | ||
isArchived: false | ||
}); | ||
const updateNote = () => { | ||
if (localNote.value.note) { | ||
if (!localNote.value.title)// Set a default title | ||
localNote.value.title = `${localNote.value.type.toLocaleUpperCase()}: ${localNote.value.uid}`; | ||
localNote.value.date = new Date(); | ||
editNote(localNote.value); | ||
emit('hide'); | ||
} | ||
}; | ||
watch(() => localNote.value.type, () => { | ||
if (localNote.value.type === 'query') | ||
editorMode.value = 'sql'; | ||
else | ||
editorMode.value = 'markdown'; | ||
}); | ||
onBeforeMount(() => { | ||
localNote.value = JSON.parse(JSON.stringify(props.note)); | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
<template> | ||
<ConfirmModal | ||
size="medium" | ||
:disable-autofocus="true" | ||
:close-on-confirm="!!newNote.note.length" | ||
:confirm-text="t('general.save')" | ||
@confirm="createNote" | ||
@hide="$emit('hide')" | ||
> | ||
<template #header> | ||
<div class="d-flex"> | ||
<BaseIcon | ||
icon-name="mdiNotePlusOutline" | ||
class="mr-1" | ||
:size="24" | ||
/> {{ t('application.addNote') }} | ||
</div> | ||
</template> | ||
<template #body> | ||
<form class="form"> | ||
<div class="form-group columns"> | ||
<div class="column col-8"> | ||
<label class="form-label">{{ t('connection.connection') }}</label> | ||
<BaseSelect | ||
v-model="newNote.cUid" | ||
class="form-select" | ||
:options="connectionOptions" | ||
option-track-by="code" | ||
option-label="name" | ||
@change="null" | ||
/> | ||
</div> | ||
<div class="column col-4"> | ||
<label class="form-label">{{ t('application.tag') }}</label> | ||
<BaseSelect | ||
v-model="newNote.type" | ||
class="form-select" | ||
:options="noteTags" | ||
option-track-by="code" | ||
option-label="name" | ||
@change="null" | ||
/> | ||
</div> | ||
</div> | ||
<div class="form-group"> | ||
<label class="form-label">{{ t('general.content') }} <small | ||
v-if="newNote.type !== 'query'" | ||
style="line-height: 1;" | ||
class="text-gray" | ||
>({{ t('application.markdownSupported') }})</small></label> | ||
<BaseTextEditor | ||
v-model="newNote.note" | ||
:mode="editorMode" | ||
:show-line-numbers="false" | ||
/> | ||
</div> | ||
</form> | ||
</template> | ||
</ConfirmModal> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { uidGen } from 'common/libs/uidGen'; | ||
import { inject, Ref, ref, watch } from 'vue'; | ||
import { useI18n } from 'vue-i18n'; | ||
import ConfirmModal from '@/components/BaseConfirmModal.vue'; | ||
import BaseIcon from '@/components/BaseIcon.vue'; | ||
import BaseSelect from '@/components/BaseSelect.vue'; | ||
import BaseTextEditor from '@/components/BaseTextEditor.vue'; | ||
import { ConnectionNote, TagCode, useScratchpadStore } from '@/stores/scratchpad'; | ||
const { t } = useI18n(); | ||
const { addNote } = useScratchpadStore(); | ||
const emit = defineEmits(['hide']); | ||
const noteTags = inject<{code: TagCode; name: string}[]>('noteTags'); | ||
const selectedConnection = inject<Ref<null | string>>('selectedConnection'); | ||
const selectedTag = inject<Ref<TagCode>>('selectedTag'); | ||
const connectionOptions = inject<{code: string; name: string}[]>('connectionOptions'); | ||
const editorMode = ref('markdown'); | ||
const newNote: Ref<ConnectionNote> = ref({ | ||
uid: uidGen('N'), | ||
cUid: null, | ||
title: undefined, | ||
note: '', | ||
date: new Date(), | ||
type: 'note', | ||
isArchived: false | ||
}); | ||
const createNote = () => { | ||
if (newNote.value.note) { | ||
if (!newNote.value.title)// Set a default title | ||
newNote.value.title = `${newNote.value.type.toLocaleUpperCase()}: ${newNote.value.uid}`; | ||
newNote.value.date = new Date(); | ||
addNote(newNote.value); | ||
emit('hide'); | ||
} | ||
}; | ||
watch(() => newNote.value.type, () => { | ||
if (newNote.value.type === 'query') | ||
editorMode.value = 'sql'; | ||
else | ||
editorMode.value = 'markdown'; | ||
}); | ||
newNote.value.cUid = selectedConnection.value; | ||
if (selectedTag.value !== 'all') | ||
newNote.value.type = selectedTag.value; | ||
</script> |
Oops, something went wrong.