Feature sql snippet (#105)

This commit is contained in:
qianmoQ 2022-10-27 00:45:17 +08:00 committed by GitHub
commit 2c379d2610
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 118 additions and 42 deletions

View File

@ -72,6 +72,10 @@ Here are some of the major database solutions that are supported:
</a>
</p>
## Contributors
---
## Stargazers over time
---

View File

@ -36,5 +36,6 @@ export default {
format: 'Format',
snippet: 'Snippet',
submit: 'Submit',
updateTime: 'Update Time'
updateTime: 'Update Time',
quote: 'Quote'
}

View File

@ -36,5 +36,6 @@ export default {
format: '格式化',
snippet: '片段',
submit: '提交',
updateTime: "更新时间"
updateTime: '更新时间',
quote: '引用'
}

View File

@ -46,6 +46,7 @@ const routes: Array<RouteRecordRaw> = [
},
children: [
{
name: 'ConsoleIndex',
path: "index",
component: () => import("../views/pages/console/ConsoleOnline.vue")
}

View File

@ -9,37 +9,7 @@
</a-layout-content>
</a-layout>
<LayoutFooter/>
<div style="float: right; margin-right: 60px;">
<a-affix :offsetBottom="20">
<a-dropdown placement="top">
<a-button type="primary" shape="circle">
<template #icon>
<github-outlined/>
</template>
</a-button>
<template #overlay>
<a-menu>
<a-menu-item>
<a target="_blank" href="https://github.com/EdurtIO/incubator-datacap/fork">
Forks <img alt="GitHub forks" src="https://img.shields.io/github/forks/EdurtIO/incubator-datacap?color=%20&label=%20&logo=%20&style=flat">
</a>
</a-menu-item>
<a-menu-item>
<a href="https://github.com/EdurtIO/incubator-datacap/stargazers">
Stars <img alt="GitHub forks" src="https://img.shields.io/github/stars/EdurtIO/incubator-datacap?color=%20&label=%20&logo=%20&style=flat">
</a>
</a-menu-item>
<a-menu-item>
<a target="_blank" href="https://github.com/EdurtIO/incubator-datacap">
<code-outlined/>
GitHub
</a>
</a-menu-item>
</a-menu>
</template>
</a-dropdown>
</a-affix>
</div>
<LayoutAffix></LayoutAffix>
</div>
</template>
@ -48,10 +18,11 @@ import LayoutContent from "@/views/layout/components/LayoutContent.vue";
import LayoutFooter from "@/views/layout/components/LayoutFooter.vue";
import LayoutHeader from "@/views/layout/components/LayoutHeader.vue";
import {useI18n} from 'vue-i18n';
import LayoutAffix from "@/views/layout/components/LayoutAffix.vue";
export default {
name: "LayoutContainer",
components: {LayoutHeader, LayoutContent, LayoutFooter},
components: {LayoutAffix, LayoutHeader, LayoutContent, LayoutFooter},
computed: {},
setup()
{

View File

@ -0,0 +1,65 @@
<template>
<div style="float: right; margin-right: 60px;">
<a-affix :offsetBottom="20">
<a-dropdown placement="top">
<a-button type="primary" shape="circle">
<template #icon>
<appstore-outlined/>
</template>
</a-button>
<template #overlay>
<a-menu>
<a-menu-item-group>
<template #title>
<a target="_blank" href="https://gitee.com/EdurtIO/incubator-datacap">
<img width="15" src='https://gitee.com/EdurtIO/incubator-datacap/widgets/widget_5.svg'>
Gitee
</a>
</template>
<a-menu-item>
<a target="_blank" href="https://gitee.com/EdurtIO/incubator-datacap/members">
<fork-outlined/>
Forks <img src='https://gitee.com/EdurtIO/incubator-datacap/badge/fork.svg?theme=white' alt='fork'/>
</a>
</a-menu-item>
<a-menu-item>
<a target="_blank" href="https://gitee.com/EdurtIO/incubator-datacap/stargazers">
<star-outlined/>
Stars <img src='https://gitee.com/EdurtIO/incubator-datacap/badge/star.svg?theme=white' alt='star'/>
</a>
</a-menu-item>
</a-menu-item-group>
<a-menu-item-group>
<template #title>
<a target="_blank" href="https://github.com/EdurtIO/incubator-datacap">
<github-outlined/>
GitHub
</a>
</template>
<a-menu-item>
<a target="_blank" href="https://github.com/EdurtIO/incubator-datacap/fork">
<fork-outlined/>
Forks <img alt="GitHub stars" src="https://img.shields.io/github/forks/EdurtIO/incubator-datacap?logo=github">
</a>
</a-menu-item>
<a-menu-item>
<a target="_blank" href="https://github.com/EdurtIO/incubator-datacap/stargazers">
<star-outlined/>
Stars <img alt="GitHub stars" src="https://img.shields.io/github/stars/EdurtIO/incubator-datacap?logo=github">
</a>
</a-menu-item>
</a-menu-item-group>
</a-menu>
</template>
</a-dropdown>
</a-affix>
</div>
</template>
<script lang="ts">
export default {
name: "LayoutAffix",
components: {},
computed: {}
};
</script>

View File

@ -16,14 +16,18 @@
<eye-outlined/>
</a-tooltip>
</a-button>
<a-button type="primary" shape="circle" size="small" :disabled="currentUserId !== record.user.id" @click="handlerCreateOrUpdate(record.id)">
<a-tooltip>
<template #title>{{ $t('common.modify') }}</template>
<a-button type="primary" shape="circle" size="small" :disabled="currentUserId !== record.user.id" @click="handlerCreateOrUpdate(record.id)">
<template #icon>
<edit-outlined/>
</template>
</a-button>
</a-tooltip>
</a-button>
<a-button shape="circle" size="small" @click="handlerGoConsoleIndex(record.id)">
<a-tooltip>
<template #title>{{ $t('common.quote') }}</template>
<aim-outlined/>
</a-tooltip>
</a-button>
<a-popconfirm title="Are you sure delete?" ok-text="Yes" cancel-text="No" :disabled="currentUserId !== record.user.id"
@confirm="handlerDeleteRecord(record.id)">
<a-tooltip>
@ -58,6 +62,7 @@ import {useI18n} from 'vue-i18n';
import Common from "@/common/Common";
import {createHeaders} from "@/views/pages/admin/snippet/SnippetGenerate";
import {SnippetService} from "@/services/SnippetService";
import router from "@/router";
export default defineComponent({
name: "SnippetConsoleView",
@ -148,6 +153,10 @@ export default defineComponent({
this.visibleSnippetInfo = false;
this.applyId = 0;
this.handlerInitialize(this.pagination.current, this.pagination.pageSize);
},
handlerGoConsoleIndex(id: number)
{
router.push('/console/index?id=' + id + '&from=snippet');
}
}
});

View File

@ -113,6 +113,8 @@ import * as monaco from 'monaco-editor';
import MonacoEditor from 'monaco-editor-vue3';
import {defineComponent} from "vue";
import SnippetDetails from "@/views/pages/admin/snippet/SnippetDetails.vue";
import {useRouter} from "vue-router";
import {SnippetService} from "@/services/SnippetService";
export default defineComponent({
name: "DashboardConsoleView",
@ -139,7 +141,29 @@ export default defineComponent({
snippetDetails: false
}
},
created()
{
this.handlerInitialize();
},
methods: {
handlerInitialize()
{
const router = useRouter();
if (router.currentRoute?.value?.query) {
const id = router.currentRoute.value.query.id as unknown as number;
const from = router.currentRoute.value.query.from;
if (id && from) {
if (from === 'snippet') {
new SnippetService().getById(id)
.then((response) => {
if (response.status) {
this.editorValue = response.data.code;
}
});
}
}
}
},
handlerEditorDidMount(editor: any)
{
const suggestions = new LanguageService().transSuggestions([]);