1
1
mirror of https://github.com/Fabio286/antares.git synced 2024-12-24 16:00:54 +01:00

feat: stored routines delete

This commit is contained in:
Fabio Di Stasio 2021-01-06 11:07:55 +01:00
parent 82fdc0bcd7
commit aa33850286
4 changed files with 31 additions and 12 deletions

View File

@ -440,9 +440,12 @@ export class MySQLClient extends AntaresCore {
.split(',')
.map(el => {
const param = el.split(' ');
const type = param[2] ? param[2].replace(')', '').split('(') : ['', null];
return {
name: param[1] ? param[1].replaceAll('`', '') : '',
type: param[2] ? param[2].replace(',', '') : '',
type: type[0],
length: +type[1],
context: param[0] ? param[0].replace('\n', '') : ''
};
}).filter(el => el.name);
@ -509,7 +512,7 @@ export class MySQLClient extends AntaresCore {
*/
async createRoutine (routine) {
const parameters = routine.parameters.reduce((acc, curr) => {
acc.push(`${curr.context} \`${curr.name}\` ${curr.type}`);
acc.push(`${curr.context} \`${curr.name}\` ${curr.type}${curr.length ? `(${curr.length})` : ''}`);
return acc;
}, []).join(',');

View File

@ -37,6 +37,7 @@ import { mapGetters, mapActions } from 'vuex';
import BaseContextMenu from '@/components/BaseContextMenu';
import ConfirmModal from '@/components/BaseConfirmModal';
import Triggers from '@/ipc-api/Triggers';
import Routines from '@/ipc-api/Routines';
export default {
name: 'WorkspaceExploreBarMiscContext',
@ -66,7 +67,8 @@ export default {
switch (this.selectedMisc.type) {
case 'trigger':
return this.$t('message.deleteTrigger');
case 'procedure':
return this.$t('message.deleteRoutine');
default:
return '';
}
@ -106,12 +108,12 @@ export default {
trigger: this.selectedMisc.name
});
break;
// case 'procedure':
// res = await Tables.dropProcedure({
// uid: this.selectedWorkspace,
// procedure: this.selectedMisc.name
// });
// break;
case 'procedure':
res = await Routines.dropRoutine({
uid: this.selectedWorkspace,
routine: this.selectedMisc.name
});
break;
// case 'schedules':
// res = await Tables.dropScheduler({
// uid: this.selectedWorkspace,

View File

@ -48,7 +48,7 @@
<div class="tile-title">
{{ param.name }}
</div>
<small class="tile-subtitle text-gray">{{ param.type }} · {{ param.context }}</small>
<small class="tile-subtitle text-gray">{{ param.type }}{{ param.length ? `(${param.length})` : '' }} · {{ param.context }}</small>
</div>
<div class="tile-action">
<button
@ -105,6 +105,18 @@
</select>
</div>
</div>
<div class="form-group">
<label class="form-label col-3">
{{ $t('word.length') }}
</label>
<div class="column">
<input
v-model="selectedParamObj.length"
class="form-input"
type="number"
>
</div>
</div>
<div class="form-group">
<label class="form-label col-3">
{{ $t('word.context') }}
@ -216,7 +228,8 @@ export default {
this.parametersProxy = [...this.parametersProxy, {
name: `Param${this.i++}`,
type: 'INT',
context: 'IN'
context: 'IN',
length: 10
}];
if (this.parametersProxy.length === 1)

View File

@ -156,7 +156,8 @@ module.exports = {
routineBody: 'Routine body',
dataAccess: 'Data access',
thereAreNoParameters: 'There are no parameters',
createNewParameter: 'Create new parameter'
createNewParameter: 'Create new parameter',
deleteRoutine: 'Delete stored routine'
},
// Date and Time
short: {