-
-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
901 additions
and
3 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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { ipcMain } from 'electron'; | ||
|
||
export default (connections) => { | ||
ipcMain.handle('get-function-informations', async (event, params) => { | ||
try { | ||
const result = await connections[params.uid].getFunctionInformations(params); | ||
return { status: 'success', response: result }; | ||
} | ||
catch (err) { | ||
return { status: 'error', response: err.toString() }; | ||
} | ||
}); | ||
|
||
ipcMain.handle('drop-function', async (event, params) => { | ||
try { | ||
await connections[params.uid].dropFunction(params); | ||
return { status: 'success' }; | ||
} | ||
catch (err) { | ||
return { status: 'error', response: err.toString() }; | ||
} | ||
}); | ||
|
||
ipcMain.handle('alter-function', async (event, params) => { | ||
try { | ||
await connections[params.uid].alterFunction(params); | ||
return { status: 'success' }; | ||
} | ||
catch (err) { | ||
return { status: 'error', response: err.toString() }; | ||
} | ||
}); | ||
|
||
ipcMain.handle('create-function', async (event, params) => { | ||
try { | ||
await connections[params.uid].createFunction(params); | ||
return { status: 'success' }; | ||
} | ||
catch (err) { | ||
return { status: 'error', response: err.toString() }; | ||
} | ||
}); | ||
}; |
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
180 changes: 180 additions & 0 deletions
180
src/renderer/components/WorkspacePropsFunctionOptionsModal.vue
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,180 @@ | ||
<template> | ||
<ConfirmModal | ||
:confirm-text="$t('word.confirm')" | ||
size="400" | ||
@confirm="confirmOptionsChange" | ||
@hide="$emit('hide')" | ||
> | ||
<template :slot="'header'"> | ||
<div class="d-flex"> | ||
<i class="mdi mdi-24px mdi-cogs mr-1" /> {{ $t('word.options') }} "{{ localOptions.name }}" | ||
</div> | ||
</template> | ||
<div :slot="'body'"> | ||
<form class="form-horizontal"> | ||
<div class="form-group"> | ||
<label class="form-label col-4"> | ||
{{ $t('word.name') }} | ||
</label> | ||
<div class="column"> | ||
<input | ||
ref="firstInput" | ||
v-model="optionsProxy.name" | ||
class="form-input" | ||
:class="{'is-error': !isTableNameValid}" | ||
type="text" | ||
> | ||
</div> | ||
</div> | ||
<div class="form-group"> | ||
<label class="form-label col-4"> | ||
{{ $t('word.definer') }} | ||
</label> | ||
<div class="column"> | ||
<select | ||
v-if="workspace.users.length" | ||
v-model="optionsProxy.definer" | ||
class="form-select" | ||
> | ||
<option value=""> | ||
{{ $t('message.currentUser') }} | ||
</option> | ||
<option | ||
v-for="user in workspace.users" | ||
:key="`${user.name}@${user.host}`" | ||
:value="`\`${user.name}\`@\`${user.host}\``" | ||
> | ||
{{ user.name }}@{{ user.host }} | ||
</option> | ||
</select> | ||
<select v-if="!workspace.users.length" class="form-select"> | ||
<option value=""> | ||
{{ $t('message.currentUser') }} | ||
</option> | ||
</select> | ||
</div> | ||
</div> | ||
<div class="form-group"> | ||
<label class="form-label col-4"> | ||
{{ $t('word.returns') }} | ||
</label> | ||
<div class="column"> | ||
<div class="input-group"> | ||
<select | ||
v-model="optionsProxy.returns" | ||
class="form-select text-uppercase" | ||
style="width: 0;" | ||
> | ||
<optgroup | ||
v-for="group in workspace.dataTypes" | ||
:key="group.group" | ||
:label="group.group" | ||
> | ||
<option | ||
v-for="type in group.types" | ||
:key="type.name" | ||
:selected="optionsProxy.returns === type.name" | ||
:value="type.name" | ||
> | ||
{{ type.name }} | ||
</option> | ||
</optgroup> | ||
</select> | ||
<input | ||
v-model="optionsProxy.returnsLength" | ||
class="form-input" | ||
type="number" | ||
min="0" | ||
> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="form-group"> | ||
<label class="form-label col-4"> | ||
{{ $t('word.comment') }} | ||
</label> | ||
<div class="column"> | ||
<input | ||
v-model="optionsProxy.comment" | ||
class="form-input" | ||
type="text" | ||
> | ||
</div> | ||
</div> | ||
<div class="form-group"> | ||
<label class="form-label col-4"> | ||
{{ $t('message.sqlSecurity') }} | ||
</label> | ||
<div class="column"> | ||
<select v-model="optionsProxy.security" class="form-select"> | ||
<option>DEFINER</option> | ||
<option>INVOKER</option> | ||
</select> | ||
</div> | ||
</div> | ||
<div class="form-group"> | ||
<label class="form-label col-4"> | ||
{{ $t('message.dataAccess') }} | ||
</label> | ||
<div class="column"> | ||
<select v-model="optionsProxy.dataAccess" class="form-select"> | ||
<option>CONTAINS SQL</option> | ||
<option>NO SQL</option> | ||
<option>READS SQL DATA</option> | ||
<option>MODIFIES SQL DATA</option> | ||
</select> | ||
</div> | ||
</div> | ||
<div class="form-group"> | ||
<div class="col-4" /> | ||
<div class="column"> | ||
<label class="form-checkbox form-inline"> | ||
<input v-model="optionsProxy.deterministic" type="checkbox"><i class="form-icon" /> {{ $t('word.deterministic') }} | ||
</label> | ||
</div> | ||
</div> | ||
</form> | ||
</div> | ||
</ConfirmModal> | ||
</template> | ||
|
||
<script> | ||
import ConfirmModal from '@/components/BaseConfirmModal'; | ||
export default { | ||
name: 'WorkspacePropsFunctionOptionsModal', | ||
components: { | ||
ConfirmModal | ||
}, | ||
props: { | ||
localOptions: Object, | ||
workspace: Object | ||
}, | ||
data () { | ||
return { | ||
optionsProxy: {}, | ||
isOptionsChanging: false | ||
}; | ||
}, | ||
computed: { | ||
isTableNameValid () { | ||
return this.optionsProxy.name !== ''; | ||
} | ||
}, | ||
created () { | ||
this.optionsProxy = JSON.parse(JSON.stringify(this.localOptions)); | ||
setTimeout(() => { | ||
this.$refs.firstInput.focus(); | ||
}, 20); | ||
}, | ||
methods: { | ||
confirmOptionsChange () { | ||
if (!this.isTableNameValid) | ||
this.optionsProxy.name = this.localOptions.name; | ||
this.$emit('options-update', this.optionsProxy); | ||
} | ||
} | ||
}; | ||
</script> |
Oops, something went wrong.