[Core] [Refactor] [UI] [Dashboard] Replace card to common

This commit is contained in:
qianmoQ 2024-04-10 21:10:30 +08:00
parent 657e29c26f
commit 963da8c510
25 changed files with 310 additions and 1794 deletions

View File

@ -1,87 +1,83 @@
<template>
<div class="w-full">
<Card>
<CardHeader class="border-b p-4">
<CardTitle>{{ $t('dataset.common.list') }}</CardTitle>
</CardHeader>
<CardContent>
<TableCommon :loading="loading" :columns="headers" :data="data" :pagination="pagination" @changePage="handlerChangePage">
<template #source="{row}">
<TooltipProvider>
<Tooltip>
<TooltipTrigger as-child>
<Avatar size="sm">
<AvatarImage :src="'/static/images/plugin/' + row?.source.type + '.png'" :alt="row?.source.type"/>
<AvatarFallback>{{ row?.source.type }}</AvatarFallback>
</Avatar>
</TooltipTrigger>
<TooltipContent align="center">{{ row?.source.type }}</TooltipContent>
</Tooltip>
</TooltipProvider>
</template>
<template #syncMode="{ row }">
<Badge v-if="row?.syncMode === 'MANUAL'">{{ $t('dataset.common.syncModeManual') }}</Badge>
<Badge v-else-if="row?.syncMode === 'TIMING'">{{ $t('dataset.common.syncModeTiming') }}</Badge>
<Badge v-else-if="row?.syncMode === 'OUT_SYNC'">{{ $t('dataset.common.syncModeOutSync') }}</Badge>
</template>
<template #state="{ row }">
<HoverCard>
<HoverCardTrigger>{{ getState(row?.state) }}</HoverCardTrigger>
<HoverCardContent>
<DatasetState class="mt-[25px]" :states="row?.state"/>
</HoverCardContent>
</HoverCard>
</template>
<template #action="{row}">
<DropdownMenu>
<DropdownMenuTrigger as-child>
<Button variant="outline">
<Cog class="w-full justify-center" :size="20"/>
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent>
<DropdownMenuGroup>
<DropdownMenuItem>
<RouterLink :to="`/admin/dataset/info/${row?.code}`" target="_blank" class="flex items-center">
<Info class="mr-2 h-4 w-4"/>
<span>{{ $t('dataset.common.info') }}</span>
</RouterLink>
</DropdownMenuItem>
<DropdownMenuItem :disabled="!isSuccess(row?.state)">
<RouterLink :to="`/admin/dataset/adhoc/${row?.code}`" target="_blank" class="flex items-center">
<BarChart2 class="mr-2 h-4 w-4"/>
<span>{{ $t('dataset.common.adhoc') }}</span>
</RouterLink>
</DropdownMenuItem>
<DropdownMenuSeparator/>
<DropdownMenuItem :disabled="!isSuccess(row?.state)" style="cursor: pointer;" @click="handlerSyncData(row, true)">
<RefreshCcw class="mr-2 h-4 w-4"/>
<span>{{ $t('dataset.common.syncData') }}</span>
</DropdownMenuItem>
<DropdownMenuItem style="cursor: pointer;" @click="handlerHistory(row, true)">
<History class="mr-2 h-4 w-4"/>
<span>{{ $t('dataset.common.history') }}</span>
</DropdownMenuItem>
<DropdownMenuSeparator/>
<DropdownMenuItem :disabled="isSuccess(row?.state)" style="cursor: pointer;" @click="handlerError(row, true)">
<TriangleAlert class="mr-2 h-4 w-4"/>
<span>{{ $t('dataset.common.error') }}</span>
</DropdownMenuItem>
<DropdownMenuItem :disabled="isSuccess(row?.state)" style="cursor: pointer;" @click="handlerRebuild(row, true)">
<CirclePlay v-if="row?.state === 'SUCCESS'" class="mr-2 h-4 w-4"/>
<CircleStop v-else class="mr-2 h-4 w-4"/>
{{ $t('dataset.common.rebuild') }}
</DropdownMenuItem>
<DropdownMenuItem :disabled="!(row?.totalRows > 0)" style="cursor: pointer;" @click="handlerClearData(row, true)">
<SquareX class="mr-2 h-4 w-4"/>
{{ $t('dataset.common.clearData') }}
</DropdownMenuItem>
</DropdownMenuGroup>
</DropdownMenuContent>
</DropdownMenu>
</template>
</TableCommon>
</CardContent>
<template #title>{{ $t('dataset.common.list') }}</template>
<TableCommon :loading="loading" :columns="headers" :data="data" :pagination="pagination" @changePage="handlerChangePage">
<template #source="{row}">
<TooltipProvider>
<Tooltip>
<TooltipTrigger as-child>
<Avatar size="sm">
<AvatarImage :src="'/static/images/plugin/' + row?.source.type + '.png'" :alt="row?.source.type"/>
<AvatarFallback>{{ row?.source.type }}</AvatarFallback>
</Avatar>
</TooltipTrigger>
<TooltipContent align="center">{{ row?.source.type }}</TooltipContent>
</Tooltip>
</TooltipProvider>
</template>
<template #syncMode="{ row }">
<Badge v-if="row?.syncMode === 'MANUAL'">{{ $t('dataset.common.syncModeManual') }}</Badge>
<Badge v-else-if="row?.syncMode === 'TIMING'">{{ $t('dataset.common.syncModeTiming') }}</Badge>
<Badge v-else-if="row?.syncMode === 'OUT_SYNC'">{{ $t('dataset.common.syncModeOutSync') }}</Badge>
</template>
<template #state="{ row }">
<HoverCard>
<HoverCardTrigger>{{ getState(row?.state) }}</HoverCardTrigger>
<HoverCardContent>
<DatasetState class="mt-[25px]" :states="row?.state"/>
</HoverCardContent>
</HoverCard>
</template>
<template #action="{row}">
<DropdownMenu>
<DropdownMenuTrigger as-child>
<Button variant="outline">
<Cog class="w-full justify-center" :size="20"/>
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent>
<DropdownMenuGroup>
<DropdownMenuItem>
<RouterLink :to="`/admin/dataset/info/${row?.code}`" target="_blank" class="flex items-center">
<Info class="mr-2 h-4 w-4"/>
<span>{{ $t('dataset.common.info') }}</span>
</RouterLink>
</DropdownMenuItem>
<DropdownMenuItem :disabled="!isSuccess(row?.state)">
<RouterLink :to="`/admin/dataset/adhoc/${row?.code}`" target="_blank" class="flex items-center">
<BarChart2 class="mr-2 h-4 w-4"/>
<span>{{ $t('dataset.common.adhoc') }}</span>
</RouterLink>
</DropdownMenuItem>
<DropdownMenuSeparator/>
<DropdownMenuItem :disabled="!isSuccess(row?.state)" style="cursor: pointer;" @click="handlerSyncData(row, true)">
<RefreshCcw class="mr-2 h-4 w-4"/>
<span>{{ $t('dataset.common.syncData') }}</span>
</DropdownMenuItem>
<DropdownMenuItem style="cursor: pointer;" @click="handlerHistory(row, true)">
<History class="mr-2 h-4 w-4"/>
<span>{{ $t('dataset.common.history') }}</span>
</DropdownMenuItem>
<DropdownMenuSeparator/>
<DropdownMenuItem :disabled="isSuccess(row?.state)" style="cursor: pointer;" @click="handlerError(row, true)">
<TriangleAlert class="mr-2 h-4 w-4"/>
<span>{{ $t('dataset.common.error') }}</span>
</DropdownMenuItem>
<DropdownMenuItem :disabled="isSuccess(row?.state)" style="cursor: pointer;" @click="handlerRebuild(row, true)">
<CirclePlay v-if="row?.state === 'SUCCESS'" class="mr-2 h-4 w-4"/>
<CircleStop v-else class="mr-2 h-4 w-4"/>
{{ $t('dataset.common.rebuild') }}
</DropdownMenuItem>
<DropdownMenuItem :disabled="!(row?.totalRows > 0)" style="cursor: pointer;" @click="handlerClearData(row, true)">
<SquareX class="mr-2 h-4 w-4"/>
{{ $t('dataset.common.clearData') }}
</DropdownMenuItem>
</DropdownMenuGroup>
</DropdownMenuContent>
</DropdownMenu>
</template>
</TableCommon>
</Card>
<DatasetRebuild v-if="rebuildVisible" :is-visible="rebuildVisible" :data="contextData" @close="handlerRebuild(null, false)"/>
<DatasetHistory v-if="historyVisible" :is-visible="historyVisible" :info="contextData" @close="handlerHistory(null, false)"/>
@ -93,7 +89,7 @@
<script lang="ts">
import { defineComponent } from 'vue'
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
import Card from '@/views/ui/card'
import TableCommon from '@/views/components/table/TableCommon.vue'
import { FilterModel } from '@/model/filter'
import { useI18n } from 'vue-i18n'
@ -137,7 +133,7 @@ export default defineComponent({
AvatarFallback, AvatarImage, Avatar,
TooltipTrigger, TooltipProvider, TooltipContent, Tooltip,
TableCommon,
CardContent, CardHeader, CardTitle, Card,
Card,
Cog, BarChart2, CirclePlay, CircleStop, History, RefreshCcw, SquareX, TriangleAlert, Info
},
setup()
@ -173,13 +169,13 @@ export default defineComponent({
{
this.loading = true
DatasetService.getAll(this.filter)
.then((response) => {
if (response.status) {
this.data = response.data.content
this.pagination = PaginationRequest.of(response.data)
}
})
.finally(() => this.loading = false)
.then((response) => {
if (response.status) {
this.data = response.data.content
this.pagination = PaginationRequest.of(response.data)
}
})
.finally(() => this.loading = false)
},
handlerChangePage(value: PaginationModel)
{

View File

@ -1,10 +1,8 @@
<template>
<div class="w-full">
<Card>
<CardHeader class="flex flex-row items-center border-b p-4">
<div class="grid gap-2">
<CardTitle>{{ $t('function.common.list') }}</CardTitle>
</div>
<template #title>{{ $t('function.common.list') }}</template>
<template #extra>
<Button size="icon" class="ml-auto gap-1 h-6 w-6" @click="handlerInfo(true, null)">
<Plus :size="20"/>
</Button>
@ -23,38 +21,36 @@
</DropdownMenuGroup>
</DropdownMenuContent>
</DropdownMenu>
</CardHeader>
<CardContent>
<TableCommon :loading="loading" :columns="headers" :data="data" :pagination="pagination" @changePage="handlerChangePage">
<template #plugin="{row}">
<div class="flex items-center p-4 sm:justify-between">
<div class="flex -space-x-2 overflow-hidden">
<Avatar v-for="item in row?.plugin" size="sm" class="border-2 border-background w-8 h-8 cursor-pointer">
<AvatarImage :src="'/static/images/plugin/' + item + '.png'"/>
<AvatarFallback>{{ item }}</AvatarFallback>
</Avatar>
</div>
</template>
<TableCommon :loading="loading" :columns="headers" :data="data" :pagination="pagination" @changePage="handlerChangePage">
<template #plugin="{row}">
<div class="flex items-center p-4 sm:justify-between">
<div class="flex -space-x-2 overflow-hidden">
<Avatar v-for="item in row?.plugin" size="sm" class="border-2 border-background w-8 h-8 cursor-pointer">
<AvatarImage :src="'/static/images/plugin/' + item + '.png'"/>
<AvatarFallback>{{ item }}</AvatarFallback>
</Avatar>
</div>
</template>
<template #type="{ row }">
<Badge>{{ $t('function.common.' + row.type.toLowerCase()) }}</Badge>
</template>
<template #action="{row}">
<TooltipProvider :delay-duration="0">
<Tooltip>
<TooltipTrigger as-child>
<Button variant="outline" size="icon" class="rounded-full" @click="handlerInfo(true, row)">
<Pencil :size="15"></Pencil>
</Button>
</TooltipTrigger>
<TooltipContent>
<p>{{ $t('common.editData') }}</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
</template>
</TableCommon>
</CardContent>
</div>
</template>
<template #type="{ row }">
<Badge>{{ $t('function.common.' + row.type.toLowerCase()) }}</Badge>
</template>
<template #action="{row}">
<TooltipProvider :delay-duration="0">
<Tooltip>
<TooltipTrigger as-child>
<Button variant="outline" size="icon" class="rounded-full" @click="handlerInfo(true, row)">
<Pencil :size="15"></Pencil>
</Button>
</TooltipTrigger>
<TooltipContent>
<p>{{ $t('common.editData') }}</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
</template>
</TableCommon>
</Card>
<FunctionInfo v-if="dataInfoVisible" :is-visible="dataInfoVisible" :info="dataInfo" @close="handlerInfo(false, null)"/>
<FunctionImport v-if="dataImportVisible" :is-visible="dataImportVisible" @close="handlerImport(false)"/>
@ -63,7 +59,7 @@
<script lang="ts">
import { defineComponent } from 'vue'
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
import Card from '@/views/ui/card'
import TableCommon from '@/views/components/table/TableCommon.vue'
import { Cog, Import, Pencil, Plus } from 'lucide-vue-next'
import { FilterModel } from '@/model/filter'
@ -96,7 +92,7 @@ export default defineComponent({
Badge,
Button,
FunctionInfo,
Card, CardHeader, CardTitle, CardContent,
Card,
TableCommon,
Avatar, AvatarFallback, AvatarImage,
Tooltip, TooltipContent, TooltipProvider, TooltipTrigger,
@ -132,13 +128,13 @@ export default defineComponent({
{
this.loading = true
FunctionService.getAll(this.filter)
.then((response) => {
if (response.status) {
this.data = response.data.content
this.pagination = PaginationRequest.of(response.data)
}
})
.finally(() => this.loading = false)
.then((response) => {
if (response.status) {
this.data = response.data.content
this.pagination = PaginationRequest.of(response.data)
}
})
.finally(() => this.loading = false)
},
handlerChangePage(value: PaginationModel)
{

View File

@ -1,32 +1,28 @@
<template>
<div class="w-full">
<Card>
<CardHeader class="flex flex-row items-center border-b p-4">
<div class="grid gap-2">
<CardTitle>{{ $t('menu.common.list') }}</CardTitle>
</div>
<template #title>{{ $t('menu.common.list') }}</template>
<template #extra>
<Tooltip :content="$t('menu.common.create')">
<Button size="icon" class="ml-auto gap-1 h-6 w-6" @click="handlerChangeInfo(true, null)">
<Plus :size="20"/>
</Button>
</Tooltip>
</CardHeader>
<CardContent>
<TableCommon :loading="loading" :columns="headers" :data="data" :pagination="pagination" @changePage="handlerChangePage">
<template #active="{row}">
<Switch disabled :default-checked="row?.active"/>
</template>
<template #action="{row}">
<div class="space-x-2">
<Tooltip :content="$t('common.editData')">
<Button variant="outline" size="icon" class="p-2 w-8 h-8 rounded-full" @click="handlerChangeInfo(true, row)">
<Pencil :size="15"/>
</Button>
</Tooltip>
</div>
</template>
</TableCommon>
</CardContent>
</template>
<TableCommon :loading="loading" :columns="headers" :data="data" :pagination="pagination" @changePage="handlerChangePage">
<template #active="{row}">
<Switch disabled :default-checked="row?.active"/>
</template>
<template #action="{row}">
<div class="space-x-2">
<Tooltip :content="$t('common.editData')">
<Button variant="outline" size="icon" class="p-2 w-8 h-8 rounded-full" @click="handlerChangeInfo(true, row)">
<Pencil :size="15"/>
</Button>
</Tooltip>
</div>
</template>
</TableCommon>
</Card>
<MenuInfo v-if="dataInfoVisible" :is-visible="dataInfoVisible" :info="dataInfo" @close="handlerChangeInfo(false, null)"/>
</div>
@ -34,7 +30,7 @@
<script lang="ts">
import { defineComponent } from 'vue'
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
import Card from '@/views/ui/card'
import TableCommon from '@/views/components/table/TableCommon.vue'
import { Pencil, Plus } from 'lucide-vue-next'
import { Button } from '@/components/ui/button'
@ -56,7 +52,8 @@ export default defineComponent({
Switch,
Button,
Pencil, Plus,
CardHeader, CardTitle, TableCommon, CardContent, Card
TableCommon,
Card
},
setup()
{
@ -86,13 +83,13 @@ export default defineComponent({
{
this.loading = true
MenuService.getAll(this.filter)
.then((response) => {
if (response.status) {
this.data = response.data.content
this.pagination = PaginationRequest.of(response.data)
}
})
.finally(() => this.loading = false)
.then((response) => {
if (response.status) {
this.data = response.data.content
this.pagination = PaginationRequest.of(response.data)
}
})
.finally(() => this.loading = false)
},
handlerChangePage(value: PaginationModel)
{

View File

@ -1,46 +1,42 @@
<template>
<div class="w-full">
<Card>
<CardHeader class="flex flex-row items-center border-b p-4">
<div class="grid gap-2">
<CardTitle>{{ $t('role.common.list') }}</CardTitle>
</div>
<template #title>{{ $t('role.common.list') }}</template>
<template #extra>
<Button size="icon" class="ml-auto gap-1 h-6 w-6" @click="handlerChangeInfo(true, null)">
<Plus :size="20"/>
</Button>
</CardHeader>
<CardContent>
<TableCommon :loading="loading" :columns="headers" :data="data" :pagination="pagination" @changePage="handlerChangePage">
<template #action="{row}">
<div class="space-x-2">
<TooltipProvider :delay-duration="0">
<Tooltip>
<TooltipTrigger as-child>
<Button variant="outline" size="icon" class="p-2 w-8 h-8 rounded-full" @click="handlerChangeInfo(true, row)">
<Pencil :size="15"/>
</Button>
</TooltipTrigger>
<TooltipContent>
<p>{{ $t('common.editData') }}</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
<TooltipProvider :delay-duration="0">
<Tooltip>
<TooltipTrigger as-child>
<Button variant="outline" size="icon" class="p-2 w-8 h-8 rounded-full" @click="handlerAssignMenu(true, row)">
<Menu :size="15"/>
</Button>
</TooltipTrigger>
<TooltipContent>
<p>{{ $t('role.common.assignMenu').replace('$NAME', row?.name) }}</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
</div>
</template>
</TableCommon>
</CardContent>
</template>
<TableCommon :loading="loading" :columns="headers" :data="data" :pagination="pagination" @changePage="handlerChangePage">
<template #action="{row}">
<div class="space-x-2">
<TooltipProvider :delay-duration="0">
<Tooltip>
<TooltipTrigger as-child>
<Button variant="outline" size="icon" class="p-2 w-8 h-8 rounded-full" @click="handlerChangeInfo(true, row)">
<Pencil :size="15"/>
</Button>
</TooltipTrigger>
<TooltipContent>
<p>{{ $t('common.editData') }}</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
<TooltipProvider :delay-duration="0">
<Tooltip>
<TooltipTrigger as-child>
<Button variant="outline" size="icon" class="p-2 w-8 h-8 rounded-full" @click="handlerAssignMenu(true, row)">
<Menu :size="15"/>
</Button>
</TooltipTrigger>
<TooltipContent>
<p>{{ $t('role.common.assignMenu').replace('$NAME', row?.name) }}</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
</div>
</template>
</TableCommon>
</Card>
<RoleInfo v-if="dataInfoVisible" :is-visible="dataInfoVisible" :info="dataInfo" @close="handlerChangeInfo(false, null)"/>
<RoleMenu v-if="dataAllocationVisible" :is-visible="dataAllocationVisible" :info="dataInfo" @close="handlerAssignMenu(false, null)"/>
@ -49,7 +45,7 @@
<script lang="ts">
import { defineComponent } from 'vue'
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
import Card from '@/views/ui/card'
import TableCommon from '@/views/components/table/TableCommon.vue'
import { Button } from '@/components/ui/button'
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'
@ -70,7 +66,8 @@ export default defineComponent({
RoleMenu,
RoleInfo,
TooltipContent, TooltipTrigger, TooltipProvider, Tooltip,
Card, CardHeader, CardTitle, TableCommon, CardContent,
Card,
TableCommon,
Pencil, Menu,
Button
},
@ -104,17 +101,17 @@ export default defineComponent({
{
this.loading = true
RoleService.getAll(this.filter)
.then((response) => {
if (response.status) {
this.data = response.data.content
this.pagination = {
pageSize: response.data.size,
total: response.data.total,
currentPage: response.data.page
}
}
})
.finally(() => this.loading = false)
.then((response) => {
if (response.status) {
this.data = response.data.content
this.pagination = {
pageSize: response.data.size,
total: response.data.total,
currentPage: response.data.page
}
}
})
.finally(() => this.loading = false)
},
handlerChangePage(value: PaginationModel)
{

View File

@ -1,33 +1,29 @@
<template>
<div class="w-full">
<Card>
<CardHeader class="border-b p-4">
<CardTitle>{{ $t('schedule.common.list') }}</CardTitle>
</CardHeader>
<CardContent>
<TableCommon :loading="loading" :columns="headers" :data="data" :pagination="pagination" @changePage="handlerChangePage">
<template #active="{row}">
<Switch disabled :default-checked="row.active"/>
</template>
<template #system="{row}">
<Switch disabled :default-checked="row.system"/>
</template>
<template #action="{row}">
<TooltipProvider>
<Tooltip>
<TooltipTrigger as-child>
<Button variant="outline" size="sm" class="p-2" @click="handlerChangeInfo(true, row)">
<History :size="15"></History>
</Button>
</TooltipTrigger>
<TooltipContent>
<p>{{ $t('schedule.common.history') }}</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
</template>
</TableCommon>
</CardContent>
<template #title>{{ $t('schedule.common.list') }}</template>
<TableCommon :loading="loading" :columns="headers" :data="data" :pagination="pagination" @changePage="handlerChangePage">
<template #active="{row}">
<Switch disabled :default-checked="row.active"/>
</template>
<template #system="{row}">
<Switch disabled :default-checked="row.system"/>
</template>
<template #action="{row}">
<TooltipProvider>
<Tooltip>
<TooltipTrigger as-child>
<Button variant="outline" size="sm" class="p-2" @click="handlerChangeInfo(true, row)">
<History :size="15"></History>
</Button>
</TooltipTrigger>
<TooltipContent>
<p>{{ $t('schedule.common.history') }}</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
</template>
</TableCommon>
</Card>
<ScheduleHistory v-if="dataHistoryVisible" :is-visible="dataHistoryVisible" :info="dataInfo" @close="handlerChangeInfo(false, null)"></ScheduleHistory>
</div>
@ -35,7 +31,7 @@
<script lang="ts">
import { defineComponent } from 'vue'
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
import Card from '@/views/ui/card'
import TableCommon from '@/views/components/table/TableCommon.vue'
import { Button } from '@/components/ui/button'
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'
@ -45,7 +41,7 @@ import { createHeaders } from './ScheduleUtils'
import { useI18n } from 'vue-i18n'
import { PaginationModel } from '@/model/pagination'
import ScheduleService from '@/services/schedule'
import { Switch } from '@/components/ui/switch';
import { Switch } from '@/components/ui/switch'
import ScheduleHistory from '@/views/pages/system/schedule/ScheduleHistory.vue'
import { ScheduleModel } from '@/model/schedule'
@ -55,7 +51,7 @@ export default defineComponent({
ScheduleHistory,
ArrowBigUp, History, Pencil,
Button, Switch,
Card, CardHeader, CardTitle, CardContent,
Card,
Tooltip, TooltipProvider, TooltipContent, TooltipTrigger,
TableCommon
},
@ -88,17 +84,17 @@ export default defineComponent({
{
this.loading = true
ScheduleService.getAll(this.filter)
.then((response) => {
if (response.status) {
this.data = response.data.content
this.pagination = {
pageSize: response.data.size,
total: response.data.total,
currentPage: response.data.page
}
}
})
.finally(() => this.loading = false)
.then((response) => {
if (response.status) {
this.data = response.data.content
this.pagination = {
pageSize: response.data.size,
total: response.data.total,
currentPage: response.data.page
}
}
})
.finally(() => this.loading = false)
},
handlerChangePage(value: PaginationModel)
{

View File

@ -1,45 +1,41 @@
<template>
<div class="w-full">
<Card>
<CardHeader class="flex flex-row items-center border-b p-4">
<div class="grid gap-2">
<CardTitle>{{ $t('template.common.list') }}</CardTitle>
</div>
<template #title>{{ $t('template.common.list') }}</template>
<template #extra>
<Button size="icon" class="ml-auto gap-1 h-6 w-6" @click="handlerInfo(true, null)">
<Plus :size="20"/>
</Button>
</CardHeader>
<CardContent>
<TableCommon :loading="loading" :columns="headers" :data="data" :pagination="pagination" @changePage="handlerChangePage">
<template #plugin="{row}">
<div class="flex items-center p-4 sm:justify-between">
<div class="flex -space-x-2 overflow-hidden">
<Avatar v-for="item in row?.plugin.split(',')" size="sm" class="border-2 border-background w-8 h-8">
<AvatarImage :src="'/static/images/plugin/' + item + '.png'"/>
<AvatarFallback>{{ item }}</AvatarFallback>
</Avatar>
</div>
</template>
<TableCommon :loading="loading" :columns="headers" :data="data" :pagination="pagination" @changePage="handlerChangePage">
<template #plugin="{row}">
<div class="flex items-center p-4 sm:justify-between">
<div class="flex -space-x-2 overflow-hidden">
<Avatar v-for="item in row?.plugin.split(',')" size="sm" class="border-2 border-background w-8 h-8">
<AvatarImage :src="'/static/images/plugin/' + item + '.png'"/>
<AvatarFallback>{{ item }}</AvatarFallback>
</Avatar>
</div>
</template>
<template #system="{ row }">
<Switch disabled :default-checked="row?.system"/>
</template>
<template #action="{row}">
<TooltipProvider :delay-duration="0">
<Tooltip>
<TooltipTrigger as-child>
<Button variant="outline" size="icon" class="rounded-full w-8 h-8" @click="handlerInfo(true, row)">
<Pencil :size="15"></Pencil>
</Button>
</TooltipTrigger>
<TooltipContent>
<p>{{ $t('common.editData') }}</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
</template>
</TableCommon>
</CardContent>
</div>
</template>
<template #system="{ row }">
<Switch disabled :default-checked="row?.system"/>
</template>
<template #action="{row}">
<TooltipProvider :delay-duration="0">
<Tooltip>
<TooltipTrigger as-child>
<Button variant="outline" size="icon" class="rounded-full w-8 h-8" @click="handlerInfo(true, row)">
<Pencil :size="15"></Pencil>
</Button>
</TooltipTrigger>
<TooltipContent>
<p>{{ $t('common.editData') }}</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
</template>
</TableCommon>
</Card>
</div>
<TemplateInfo v-if="dataInfoVisible" :is-visible="dataInfoVisible" :info="dataInfo" @close="handlerInfo(false, null)"/>
@ -47,13 +43,13 @@
<script lang="ts">
import { defineComponent } from 'vue'
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
import Card from '@/views/ui/card'
import TableCommon from '@/views/components/table/TableCommon.vue'
import { Cog, Import, Pencil, Plus } from 'lucide-vue-next'
import { Button } from '@/components/ui/button'
import { FilterModel } from '@/model/filter'
import { createHeaders } from '@/views/pages/system/template/TemplateUtils'
import { useI18n } from 'vue-i18n';
import { useI18n } from 'vue-i18n'
import { PaginationModel, PaginationRequest } from '@/model/pagination'
import TemplateService from '@/services/template'
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'
@ -70,7 +66,7 @@ export default defineComponent({
Button,
Pencil, Plus, Import, Cog,
TableCommon,
Card, CardHeader, CardTitle, CardContent,
Card,
Tooltip, TooltipContent, TooltipProvider, TooltipTrigger,
Avatar, AvatarFallback, AvatarImage
},
@ -103,13 +99,13 @@ export default defineComponent({
{
this.loading = true
TemplateService.getAll(this.filter)
.then((response) => {
if (response.status) {
this.data = response.data.content
this.pagination = PaginationRequest.of(response.data)
}
})
.finally(() => this.loading = false)
.then((response) => {
if (response.status) {
this.data = response.data.content
this.pagination = PaginationRequest.of(response.data)
}
})
.finally(() => this.loading = false)
},
handlerChangePage(value: PaginationModel)
{

View File

@ -1,32 +1,28 @@
<template>
<div class="w-full">
<Card>
<CardHeader class="border-b p-4">
<CardTitle>{{ $t('user.common.list') }}</CardTitle>
</CardHeader>
<CardContent>
<TableCommon :loading="loading" :columns="headers" :data="data" :pagination="pagination" @changePage="handlerChangePage">
<template #role="{row}">
<Badge v-for="role in row.roles" class="mt-1">
{{ role.name }}
</Badge>
</template>
<template #action="{row}">
<TooltipProvider>
<Tooltip>
<TooltipTrigger as-child>
<Button variant="outline" size="sm" class="p-3" @click="handlerChangeRole(true, row)">
<ArrowUpFromLine :size="15"></ArrowUpFromLine>
</Button>
</TooltipTrigger>
<TooltipContent>
<p>{{ $t('user.common.assignRole') }}</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
</template>
</TableCommon>
</CardContent>
<template #title>{{ $t('user.common.list') }}</template>
<TableCommon :loading="loading" :columns="headers" :data="data" :pagination="pagination" @changePage="handlerChangePage">
<template #role="{row}">
<Badge v-for="role in row.roles" class="mt-1">
{{ role.name }}
</Badge>
</template>
<template #action="{row}">
<TooltipProvider>
<Tooltip>
<TooltipTrigger as-child>
<Button variant="outline" size="sm" class="p-3" @click="handlerChangeRole(true, row)">
<ArrowUpFromLine :size="15"></ArrowUpFromLine>
</Button>
</TooltipTrigger>
<TooltipContent>
<p>{{ $t('user.common.assignRole') }}</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
</template>
</TableCommon>
</Card>
<UserRole v-if="dataRoleVisible" :is-visible="dataRoleVisible" :info="dataInfo" @close="handlerChangeRole(false, null)"></UserRole>
</div>
@ -40,13 +36,13 @@ import TableCommon from '@/views/components/table/TableCommon.vue'
import { useI18n } from 'vue-i18n'
import { createHeaders } from './UserUtils'
import { ArrowUpFromLine, Loader2 } from 'lucide-vue-next'
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
import Card from '@/views/ui/card'
import { PaginationModel, PaginationRequest } from '@/model/pagination'
import { Button } from '@/components/ui/button'
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'
import UserRole from '@/views/pages/system/user/components/UserRole.vue'
import { UserModel } from '@/model/user'
import { Badge } from '@/components/ui/badge';
import { Badge } from '@/components/ui/badge'
export default defineComponent({
name: 'UserHome',
@ -54,7 +50,7 @@ export default defineComponent({
Badge,
UserRole,
TooltipContent, TooltipTrigger, Tooltip, TooltipProvider,
CardContent, CardHeader, CardTitle, Card,
Card,
Button,
TableCommon,
Loader2, ArrowUpFromLine
@ -89,13 +85,13 @@ export default defineComponent({
{
this.loading = true
UserService.getAll(this.filter)
.then((response) => {
if (response.status) {
this.data = response.data.content
this.pagination = PaginationRequest.of(response.data)
}
})
.finally(() => this.loading = false)
.then((response) => {
if (response.status) {
this.data = response.data.content
this.pagination = PaginationRequest.of(response.data)
}
})
.finally(() => this.loading = false)
},
handlerChangePage(value: PaginationModel)
{

View File

@ -1,46 +0,0 @@
<template>
<div>
<DashboardEditorBeta :obj-info="info"/>
</div>
</template>
<script lang="ts">
import {defineComponent} from 'vue';
import DashboardEditorBeta from "@/components/editor/dashboard-beta/DashboardEditor.vue";
import DashboardService from "@/services/DashboardService";
export default defineComponent({
name: 'DashboardInfo',
components: {DashboardEditorBeta},
data()
{
return {
info: null
}
},
created()
{
this.handlerInitialize()
},
methods: {
async handlerInitialize()
{
const id = this.$router.currentRoute?.value?.params['id']
if (id) {
try {
const response = await DashboardService.getById(id);
if (response.status && response.data) {
this.info = response.data;
}
}
catch (error) {
console.error("An error occurred while getting dashboard information:", error);
}
}
}
}
});
</script>
<style scoped>
</style>

View File

@ -1,53 +0,0 @@
<template>
<div class="layout">
<Layout>
<RouterLink to="/chat/chatgpt">
<Alert style="margin-bottom: 0px;" banner closable type="success">
Support ChatGPT
</Alert>
</RouterLink>
<LayoutHeader @changeLanguage="setLangCondition($event)"/>
<layout-breadcrumb></layout-breadcrumb>
<LayoutContent style="background-color: #FFFFFF; padding: 0; min-height: 560px; min-width: 1080px;"/>
<LayoutFooter/>
<LayoutAffix/>
</Layout>
</div>
</template>
<script lang="ts">
import LayoutContent from "@/views/layout/common/components/LayoutContent.vue";
import LayoutFooter from "@/views/layout/common/components/LayoutFooter.vue";
import LayoutHeader from "@/views/layout/common/components/LayoutHeader.vue";
import {useI18n} from 'vue-i18n';
import LayoutAffix from "@/views/layout/common/components/LayoutAffix.vue";
import LayoutBreadcrumb from "@/views/layout/common/components/LayoutBreadcrumb.vue";
export default {
name: "LayoutContainer",
components: {LayoutBreadcrumb, LayoutHeader, LayoutFooter, LayoutContent, LayoutAffix},
setup()
{
const {locale} = useI18n();
const setLangCondition = (v: string) => {
locale.value = v;
}
return {
setLangCondition
}
}
}
</script>
<style scoped>
.layout {
background: #f5f7f9;
position: relative;
overflow: hidden;
}
.layout-topMiddleBottom .ivu-menu-light {
background: none;
color: #fff
}
</style>

View File

@ -1,62 +0,0 @@
<template>
<div>
<Affix :offset-bottom="20" style="width: 200px; float: right;">
<Dropdown class="datacap-affix">
<Button type="primary" shape="circle" icon="ios-apps"></Button>
<template #list>
<DropdownMenu>
<DropdownItem>
<a target="_blank" href="https://gitee.com/devlive-community/datacap">
<img width="13" src='https://gitee.com/devlive-community/datacap/widgets/widget_5.svg'>
Gitee
</a>
</DropdownItem>
<DropdownItem divided>
<a target="_blank" href="https://gitee.com/devlive-community/datacap/members">
<Icon type="md-infinite"/>
Forks <img src='https://gitee.com/devlive-community/datacap/badge/fork.svg?theme=white' alt='fork'/>
</a>
</DropdownItem>
<DropdownItem>
<a target="_blank" href="https://gitee.com/devlive-community/datacap/stargazers">
<Icon type="md-star"/>
Stars <img src='https://gitee.com/devlive-community/datacap/badge/star.svg?theme=white' alt='star'/>
</a>
</DropdownItem>
<DropdownItem divided>
<a target="_blank" href="https://github.com/devlive-community/datacap">
<Icon type="logo-github"/>
GitHub
</a>
</DropdownItem>
<DropdownItem divided>
<a target="_blank" href="https://github.com/devlive-community/datacap/fork">
<Icon type="md-infinite"/>
Forks <img alt="GitHub stars" src="https://img.shields.io/github/forks/devlive-community/datacap?logo=github">
</a>
</DropdownItem>
<DropdownItem>
<a target="_blank" href="https://github.com/devlive-community/datacap/stargazers">
<Icon type="md-star"/>
Stars <img alt="GitHub stars" src="https://img.shields.io/github/stars/devlive-community/datacap?logo=github">
</a>
</DropdownItem>
</DropdownMenu>
</template>
</Dropdown>
</Affix>
</div>
</template>
<script lang="ts">
export default {
name: "LayoutAffix"
};
</script>
<style scoped>
.datacap-affix {
background-color: transparent;
float: right;
margin-right: 30px;
}
</style>

View File

@ -1,46 +0,0 @@
<template>
<div style="background-color: #FFFFFF;">
<Breadcrumb style="margin: 10px 20px;">
<BreadcrumbItem to="/">{{ $t('common.home') }}</BreadcrumbItem>
<BreadcrumbItem v-for="(item, index) in breadcrumbs"
:key="index"
:to="item.path">
{{ $t(`${item.meta.title}`) }}
</BreadcrumbItem>
</Breadcrumb>
</div>
</template>
<script>
export default {
name: "LayoutBreadcrumb",
data() {
return {
breadcrumbs: [],
};
},
watch: {
$route() {
this.getBreadcrumb();
},
},
methods: {
isHome(route) {
return route.meta.title === "common.home";
},
getBreadcrumb() {
let matched = this.$route['matched'].filter(route => route.meta.title);
if (!this.isHome(matched[0])) {
matched = [].concat(matched);
}
else {
return
}
this.breadcrumbs = matched;
},
},
created() {
this.getBreadcrumb();
},
};
</script>

View File

@ -1,14 +0,0 @@
<template>
<div>
<router-view></router-view>
</div>
</template>
<script>
export default {
name: "LayoutContent"
};
</script>
<style scoped>
</style>

View File

@ -1,64 +0,0 @@
<template>
<div class="layout-footer-center">
<GlobalFooter :links="links">
<template #copyright>
<p>Copyright © 2022 - {{ new Date().getFullYear() }} Devlive Community All Rights Reserved</p>
<br/>
<p>{{ $t('common.version') }}:
<Text type="danger"
strong>
{{ version }}
</Text>
</p>
</template>
</GlobalFooter>
</div>
</template>
<script lang="ts">
import {PackageCommon} from "@/common/Package";
import {useI18n} from "vue-i18n";
export default {
name: "LayoutFooter",
setup()
{
const i18n = useI18n()
const version = PackageCommon.get('version')
return {
i18n,
version
}
},
data()
{
return {
links: [
{
key: 'Documentation',
title: this.i18n.t('common.documentation'),
href: 'https://datacap.edurt.io/reference/getStarted/install.html',
blankTarget: true
},
{
key: 'github',
icon: 'logo-github',
href: 'https://github.com/devlive-community/datacap',
blankTarget: true
},
{
key: 'release_note',
title: this.i18n.t('common.releaseNote'),
href: 'https://datacap.edurt.io/release-latest.html',
blankTarget: true
}
]
}
}
};
</script>
<style scoped>
.layout-footer-center {
text-align: center;
}
</style>

View File

@ -1,188 +0,0 @@
<template>
<div>
<Header>
<Menu mode="horizontal" theme="dark" active-name="dashboard" :style="{'z-index':99}">
<div class="layout-logo">
<div class="layout-logo logo-text">
<RouterLink to="/">
<Avatar style="width: 45px; height: 45px;" src="/static/images/logo.png"></Avatar>
</RouterLink>
</div>
</div>
<div class="layout-nav">
<div v-for="menu in availableMenus" v-bind:key="menu.id">
<Submenu v-if="menu?.children" :name="menu.title">
<template #title>
<Icon v-if="menu?.icon" :type="menu.icon"/>
{{ $t(menu.i18nKey) }}
<span v-if="menu.new">&nbsp;<Badge text="new"/>&nbsp;</span>
</template>
<MenuItem v-for="children in menu.children" v-bind:key="children.id" :name="children.title" :to="children.url">
<Icon v-if="children?.icon" :type="children.icon"/>
{{ $t(children.i18nKey) }}
<span v-if="children.new">&nbsp;<Badge text="new"/>&nbsp;</span>
</MenuItem>
</Submenu>
<MenuItem v-else :name="menu.title" :to="menu.url">
<Icon v-if="menu?.icon" :type="menu.icon"/>
{{ $t(menu.i18nKey) }}
<span v-if="menu.new">&nbsp;<Badge text="new"/>&nbsp;</span>
</MenuItem>
</div>
</div>
<div :style="{lineHeight: '64px', float: 'right', 'margin-right': '10px'}">
<MenuItem name="feedback" target="_blank" to="https://github.com/EdurtIO/datacap/issues/new/choose">
<Tooltip placement="top">
<Icon type="md-help-circle"/>
<template #content>
{{ $t('common.feedback') }}
</template>
</Tooltip>
</MenuItem>
<Submenu name="language">
<template #title>
<Icon type="md-infinite"/>
{{ $t('common.language') }}&nbsp;
</template>
<MenuGroup :title="$t('common.default')">
<MenuItem name="language_en" @click="handlerChangeLang('en')">
<span>🇺🇸</span>&nbsp;&nbsp;{{ $t('common.english') }}
</MenuItem>
<MenuItem name="language_zh" @click="handlerChangeLang('zh_cn')">
<span>🇨🇳</span>&nbsp;&nbsp;{{ $t('common.chinese') }}
</MenuItem>
</MenuGroup>
</Submenu>
<Submenu name="profile">
<template #title>
<Avatar v-if="authUser.avatar"
size="large"
:src="authUser.avatar">
</Avatar>&nbsp;
<Avatar v-else
size="large"
style="background-color: #87d068">
{{ username }}
</Avatar>&nbsp;
</template>
<MenuGroup v-if="username" :title="$t('common.profile')">
<MenuItem name="profile_index" to="/profile/index">
<Icon type="md-contact"/>
{{ $t('common.profile') }}
</MenuItem>
</MenuGroup>
<MenuGroup v-if="username" :title="$t('common.advanced')">
<MenuItem name="advanced_logout" @click="handlerLogout()">
<Icon type="md-log-out"/>
{{ $t('common.logout') }}
</MenuItem>
</MenuGroup>
</Submenu>
</div>
</Menu>
</Header>
</div>
</template>
<script lang="ts">
import {defineComponent} from "vue";
import Common from "@/common/Common";
import router from "@/router";
import config from '../../../../../package.json';
import {createDefaultRouter, createRemoteRouter} from "@/router/default";
import {TokenCommon} from "@/common/TokenCommon";
export default defineComponent({
name: "LayoutHeader",
setup()
{
let username;
const authUser = TokenCommon.getAuthUser();
if (authUser) {
username = authUser.username;
}
const handlerLogout = () => {
localStorage.removeItem(Common.token);
localStorage.removeItem(Common.menu);
localStorage.removeItem(Common.userEditorConfigure);
createDefaultRouter(router);
createRemoteRouter([], router);
router.push('/auth/signin');
}
const language = 'zh_cn';
const version = config.version;
return {
username,
language,
version,
handlerLogout,
authUser
}
},
created()
{
this.handlerInitialize();
},
data()
{
return {
availableMenus: []
}
},
methods: {
handlerInitialize()
{
this.availableMenus = JSON.parse(localStorage.getItem(Common.menu));
},
handlerChangeLang(language: string)
{
this.$emit('changeLanguage', language);
}
}
});
</script>
<style scoped>
.layout-logo {
width: 60px;
height: 35px;
border-radius: 3px;
float: left;
position: relative;
top: 15px;
left: 20px;
margin-right: 40px;
}
.layout-logo .logo-text {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
width: 80px;
color: #F5F5F5;
background-color: transparent;
font-size: 20px;
font-weight: 600;
height: 63px;
}
.layout-nav {
margin: 0 auto;
}
.badge-count {
top: 1px;
}
.ivu-tag {
height: 17px;
line-height: 17px;
margin: 0;
padding: 0px 5px;
font-size: 10px;
}
</style>

View File

@ -1,29 +0,0 @@
<template>
<div>
<Layout class="content">
<Layout class="content" style="padding-top: 15px;">
<Sider hide-trigger class="content">
<ProfileLayoutSidebar/>
</Sider>
<Layout class="content" :style="{padding: '0 12px 12px'}">
<ProfileLayoutContent/>
</Layout>
</Layout>
</Layout>
</div>
</template>
<script lang="ts">
import ProfileLayoutSidebar from "@/views/layout/user-profile/components/ProfileLayoutSidebar.vue";
import ProfileLayoutContent from "@/views/layout/user-profile/components/ProfileLayoutContent.vue";
export default {
name: "ProfileLayout",
components: {ProfileLayoutSidebar, ProfileLayoutContent},
}
</script>
<style scoped>
.content {
background-color: #FFFFFF;
}
</style>

View File

@ -1,13 +0,0 @@
<template>
<transition name="fade" mode="out-in">
<router-view></router-view>
</transition>
</template>
<script>
export default {
name: "ProfileLayoutContent"
};
</script>
<style scoped>
</style>

View File

@ -1,63 +0,0 @@
<template>
<div style="padding: 0 0 15px 15px;">
<Card dis-hover>
<template #title>
<div class="datacap-profile-header">
<router-link to="/profile/index">
<Avatar v-if="authUser.avatar"
size="large"
:src="authUser.avatar">
</Avatar>&nbsp;
<Avatar v-else
size="large"
style="background-color: #87d068">
{{ username }}
</Avatar>&nbsp;
</router-link>
<p style="margin-top: 5px;">{{ username }}</p>
</div>
</template>
<Menu style="width: 184px; margin-left: -16px;">
<MenuItem name="setting" to="/profile/public">
<Icon type="ios-cog"/>
{{ $t('setting.profile') }}
</MenuItem>
<MenuItem name="setting_log" to="/profile/log">
<Icon type="md-egg"/>
{{ $t('setting.log') }}
</MenuItem>
<MenuItem name="security" to="/profile/account">
<Icon type="ios-contact"/>
{{ $t('setting.accountSetting') }}
</MenuItem>
</Menu>
</Card>
</div>
</template>
<script lang="ts">
import Common from "@/common/Common";
import {AuthResponse} from "@/model/AuthResponse";
import {defineComponent} from "vue";
export default defineComponent({
name: "ProfileLayoutSidebar",
setup()
{
let username;
const authUser = JSON.parse(localStorage.getItem(Common.token) || '{}') as AuthResponse;
if (authUser) {
username = authUser.username;
}
return {
username,
authUser
}
}
});
</script>
<style scoped>
.datacap-profile-header {
text-align: center;
}
</style>

View File

@ -1,39 +0,0 @@
<template>
<div class="layout">
<layout>
<Header>
<Menu mode="horizontal" theme="dark" active-name="dashboard" :style="{'z-index':99}">
<div class="layout-logo">
<div class="layout-logo logo-text">
<RouterLink to="/">
<Avatar style="width: 45px; height: 45px;" src="/static/images/logo.png"></Avatar>
</RouterLink>
</div>
</div>
</Menu>
</Header>
<layout-content style="background-color: #FFFFFF; padding: 10px 0px; min-height: 500px"/>
<layout-footer/>
<layout-affix/>
</layout>
</div>
</template>
<script lang="ts">
import LayoutFooter from "@/views/layout/common/components/LayoutFooter.vue";
import LayoutAffix from "@/views/layout/common/components/LayoutAffix.vue";
import LayoutContent from "@/views/layout/common/components/LayoutContent.vue";
export default {
name: "LayoutWebErrorContainer",
components: {LayoutContent, LayoutAffix, LayoutFooter}
}
</script>
<style scoped>
.layout {
background: #f5f7f9;
position: relative;
overflow: hidden;
}
</style>

View File

@ -1,111 +0,0 @@
const createHeaders = (i18n: any) => {
return [
{
title: i18n.t('common.id'),
key: 'id',
ellipsis: true,
tooltip: true
},
{
title: i18n.t('common.name'),
key: 'name',
slot: 'name',
ellipsis: true
},
{
title: i18n.t('common.expression'),
key: 'expression',
ellipsis: true
},
{
title: i18n.t('common.active'),
key: 'active',
slot: 'active'
},
{
title: i18n.t('common.system'),
key: 'system',
slot: 'system'
},
{
title: i18n.t('common.createTime'),
key: 'createTime',
ellipsis: true,
tooltip: true
},
{
title: i18n.t('common.updateTime'),
key: 'updateTime',
ellipsis: true,
tooltip: true
},
{
title: i18n.t('common.action'),
slot: 'action',
align: 'center'
}
];
};
/**
* Generates the history headers for the createHistoryHeaders function.
*
* @param {any} i18n - the i18n object used for translation
* @return {Array} an array of history headers
*/
const createHistoryHeaders = (i18n: any): Array<any> => {
return [
{
title: i18n.t('common.id'),
key: 'id',
ellipsis: true,
tooltip: true,
width: 100
},
{
title: i18n.t('common.name'),
key: 'name',
tooltip: true,
ellipsis: true
},
{
title: i18n.t('common.createTime'),
key: 'createTime',
ellipsis: true,
align: 'center',
tooltip: true
},
{
title: i18n.t('common.updateTime'),
key: 'updateTime',
ellipsis: true,
align: 'center',
tooltip: true
},
{
title: i18n.t('common.elapsed'),
slot: 'elapsed',
align: 'center',
key: 'elapsed'
},
{
title: i18n.t('common.state'),
key: 'state',
tooltip: true,
slot: 'state',
align: 'center',
width: 120
},
{
title: i18n.t('common.result'),
key: 'info',
slot: 'info',
align: 'center'
}
];
};
export {
createHeaders,
createHistoryHeaders
}

View File

@ -1,136 +0,0 @@
<template>
<div>
<Card style="width:100%"
dis-hover
:title="$t('common.schedule')">
<Table :loading="loading"
:columns="headers"
:data="finalData?.content">
<template #name="{row}">
<Tooltip transfer :content="row.description" :max-width="'10%'">
{{ row.name }}
</Tooltip>
</template>
<template #active="{row}">
<Switch v-model="row.active" disabled></Switch>
</template>
<template #system="{row}">
<Switch v-model="row.system" disabled></Switch>
</template>
<template #action="{ row }">
<Space>
<Tooltip transfer
:content="$t('common.history')">
<Button shape="circle"
type="primary"
size="small"
icon="md-eye"
@click="handlerVisibleHistory(row.id, row.name, true)">
</Button>
</Tooltip>
</Space>
</template>
</Table>
<p v-if="!loading"
style="margin-top: 10px;">
<Page v-model="pagination.current"
:total="pagination.total"
:page-size="pagination.size"
show-sizer
show-elevator
show-total
@on-page-size-change="handlerSizeChange"
@on-change="handlerIndexChange">
</Page>
</p>
</Card>
<ScheduleHistory v-if="visibleHistory"
:is-visible="visibleHistory"
:id="applyId"
:name="applyName"
@close="handlerVisibleHistory(null, null,false)">
</ScheduleHistory>
</div>
</template>
<script lang="ts">
import {defineComponent} from 'vue'
import {useI18n} from 'vue-i18n';
import {Filter} from "@/model/Filter";
import {ResponsePage} from "@/model/ResponsePage";
import {Pagination, PaginationBuilder} from "@/model/Pagination";
import {createHeaders} from "@/views/system/schedule/GenertateSchedule";
import ScheduleService from "@/services/admin/ScheduleService";
import ScheduleHistory from "@/views/system/schedule/compoments/ScheduleHistory.vue";
const filter: Filter = new Filter();
const pagination: Pagination = PaginationBuilder.newInstance();
export default defineComponent({
name: 'AdminScheduleHome',
components: {ScheduleHistory},
setup()
{
const i18n = useI18n();
const headers = createHeaders(i18n);
return {
headers,
filter,
pagination
}
},
data()
{
return {
loading: false,
visibleHistory: false,
applyId: null,
applyName: null,
finalData: null as ResponsePage
}
},
created()
{
this.handlerInitialize(this.filter);
},
methods: {
handlerInitialize(filter: Filter)
{
this.loading = true;
ScheduleService.getAll(filter)
.then((response) => {
if (response.status) {
this.finalData = response.data;
this.pagination.total = response.data.total;
}
})
.finally(() => {
this.loading = false
})
},
handlerVisibleHistory(value: number, name: string, isOpened: boolean)
{
this.applyId = value;
this.applyName = name;
this.visibleHistory = isOpened;
},
handlerSizeChange(size: number)
{
this.pagination.size = size;
this.handlerTableChange(this.pagination);
},
handlerIndexChange(index: number)
{
this.pagination.current = index;
this.handlerTableChange(this.pagination);
},
handlerTableChange(pagination: any)
{
this.pagination.current = pagination.current;
this.pagination.size = pagination.size;
this.filter.page = pagination.current;
this.filter.size = pagination.size;
this.handlerInitialize(this.filter);
}
}
})
</script>

View File

@ -1,164 +0,0 @@
<template>
<div>
<Modal v-model="visible"
:title="`[ ${name} ] ${$t('common.history')}`"
width="80%"
:closable="false"
:maskClosable="false">
<Table :loading="loading"
:columns="headers"
:data="finalData?.content">
<template #elapsed="{row}">
{{ (new Date(row.updateTime) - new Date(row.createTime)) / 1000 }}
</template>
<template #state="{row}">
<Tag :color="getColor(row.state)">
{{ getStateText(row.state) }}
</Tag>
</template>
<template #info="{row}">
<Poptip trigger="hover"
padding="2px 10px"
transfer>
<Button type="primary"
size="small"
icon="md-eye">
</Button>
<template #content>
<MarkdownView :content="toMarkdown(row.info)"/>
</template>
</Poptip>
</template>
</Table>
<p v-if="!loading"
style="margin-top: 10px;">
<Page v-model="pagination.current"
:total="pagination.total"
:page-size="pagination.size"
show-sizer
show-elevator
show-total
@on-page-size-change="handlerSizeChange"
@on-change="handlerIndexChange">
</Page>
</p>
<template #footer>
<Button @click="handlerCancel()">
{{ $t('common.cancel') }}
</Button>
</template>
</Modal>
</div>
</template>
<script lang="ts">
import {defineComponent} from 'vue';
import {ResponsePage} from "@/model/ResponsePage";
import {useI18n} from "vue-i18n";
import {createHistoryHeaders} from "@/views/system/schedule/GenertateSchedule";
import {Filter} from "@/model/Filter";
import {Pagination, PaginationBuilder} from "@/model/Pagination";
import ScheduleService from '@/services/admin/ScheduleService';
import {getColor, getText} from "@/views/admin/pipeline/PipelineGenerate";
import MarkdownView from "@/components/markdown/MarkdownView.vue";
const filter: Filter = new Filter();
const pagination: Pagination = PaginationBuilder.newInstance();
export default defineComponent({
name: 'ScheduleHistory',
components: {MarkdownView},
props: {
isVisible: {
type: Boolean,
default: () => false
},
name: {
type: String
},
id: {
type: Number
}
},
setup()
{
const i18n = useI18n();
const headers = createHistoryHeaders(i18n);
return {
headers,
filter,
pagination,
i18n
}
},
created()
{
this.handlerInitialize(this.filter);
},
data()
{
return {
loading: false,
finalData: null as ResponsePage
}
},
methods: {
getColor,
handlerInitialize(filter: Filter)
{
this.loading = true
ScheduleService.getScheduleHistory(filter, this.id)
.then((response) => {
if (response.status) {
this.finalData = response.data;
this.pagination.total = response.data.total;
}
})
.finally(() => {
this.loading = false
})
},
handlerCancel()
{
this.visible = false;
},
handlerSizeChange(size: number)
{
this.pagination.size = size;
this.handlerTableChange(this.pagination);
},
handlerIndexChange(index: number)
{
this.pagination.current = index;
this.handlerTableChange(this.pagination);
},
handlerTableChange(pagination: any)
{
this.pagination.current = pagination.current;
this.pagination.size = pagination.size;
this.filter.page = pagination.current;
this.filter.size = pagination.size;
this.handlerInitialize(this.filter);
},
getStateText(origin: string): string
{
return getText(this.i18n, origin);
},
toMarkdown(content: string)
{
return '```json\n' + JSON.stringify(content, null, 4) + '\n```';
}
},
computed: {
visible: {
get(): boolean
{
return this.isVisible
},
set(value: boolean)
{
this.$emit('close', value)
}
}
},
});
</script>

View File

@ -1,150 +0,0 @@
<template>
<div class="home">
<CircularLoading v-if="loading"
:show="loading">
</CircularLoading>
<Card v-else
dis-hover
:bordered="false">
<template #title>
{{ $t('common.myDashboard') }}
</template>
<template #extra>
<Button type="primary"
shape="circle"
icon="md-add"
size="small"
@click="$router.push('/admin/dashboard/create')">
</Button>
</template>
<Row :gutter="16">
<Col v-for="item in data"
:key="item.id"
span="4">
<Card class="content-center"
padding="0"
style="margin-top: 5px;"
dis-hover>
<template #title>
{{ item.name }}
</template>
<DashboardView :configure="JSON.parse(item.configure)"
:fit-view="true">
</DashboardView>
<div style="text-align: right;">
<Dropdown style="margin-left: 20px; padding: 5px;">
<Button size="small">
<Icon type="ios-more"></Icon>
</Button>
<template #list>
<DropdownMenu>
<RouterLink target="_blank" :to="'/preview/dashboard/'+ item.id">
<DropdownItem>
<FontAwesomeIcon icon="eye"/>
{{ $t('common.preview') }}
</DropdownItem>
</RouterLink>
<DropdownItem @click="handlerInfo(true, item.id, item.version)">
<FontAwesomeIcon icon="pen-square"/>
{{ $t('common.modify') }}
</DropdownItem>
<DropdownItem @click="handlerDelete(true, item)">
<FontAwesomeIcon icon="trash"/>
{{ $t('common.delete') }}
</DropdownItem>
</DropdownMenu>
</template>
</Dropdown>
</div>
</Card>
</Col>
</Row>
</Card>
<DashboardInfo v-if="dashboardInfoVisible"
:is-visible="dashboardInfoVisible"
:id="dashboardId"
@close="handlerInfo(false, null)">
</DashboardInfo>
<DashboardDelete v-if="dashboardDeleteVisible"
:is-visible="dashboardDeleteVisible"
:data="contextData"
@close="handlerDelete(false, null)">
</DashboardDelete>
</div>
</template>
<script lang="ts">
import {defineComponent} from "vue";
import CircularLoading from "@/components/loading/CircularLoading.vue";
import DashboardService from "@/services/DashboardService";
import {Filter} from "@/model/Filter";
import DashboardInfo from "@/views/user/console/DashboardInfo.vue";
import DashboardView from "@/components/editor/dashboard/DashboardView.vue";
import {FontAwesomeIcon} from "@fortawesome/vue-fontawesome";
import DashboardDelete from "@/views/user/console/components/DashboardDelete.vue";
export default defineComponent({
name: "ConsoleDashboard",
components: {DashboardDelete, FontAwesomeIcon, DashboardView, DashboardInfo, CircularLoading},
data()
{
return {
loading: false,
dashboardInfoVisible: false,
dashboardId: null,
data: [],
dashboardDeleteVisible: false,
contextData: null
}
},
created()
{
this.handlerInitialize()
},
methods: {
handlerInitialize()
{
this.loading = true;
const filter = new Filter();
filter.size = 1000;
DashboardService.getAll(filter)
.then(response => {
if (response.status) {
this.data = response.data.content;
}
})
.finally(() => this.loading = false)
},
handlerInfo(opened: boolean, id: number, version?: string)
{
this.dashboardId = id
if (!opened) {
this.handlerInitialize()
}
if (version && version === 'V2') {
const routeData = this.$router.resolve({
path: `/admin/dashboard/edit/${id}`,
})
window.open(routeData.href, '_blank')
}
else {
this.dashboardInfoVisible = opened
}
},
handlerDelete(opened: boolean, data: any)
{
this.dashboardDeleteVisible = opened
this.contextData = data
if (!opened) {
this.handlerInitialize()
}
}
}
});
</script>
<style scoped>
.content-center {
text-align: center;
min-height: 200px;
}
</style>

View File

@ -1,121 +0,0 @@
<template>
<div>
<Modal v-model="visible"
:title="$t('common.dashboard')"
:mask-closable="false"
:width="'98%'"
@cancel="handlerCancel()">
<CircularLoading v-if="loading"
:show="loading"
style="margin-top: 150px;">
</CircularLoading>
<div v-else>
<DashboardEditor :elements="nodes"
:source-configure="sourceConfigure"
@onCommit="handlerCommit">
</DashboardEditor>
</div>
<template #footer>
<Button type="primary"
:loading="saving"
@click="handlerSave">
<FontAwesomeIcon v-if="!saving"
icon="save">
</FontAwesomeIcon>
{{ $t('common.save') }}
</Button>
</template>
</Modal>
</div>
</template>
<script lang="ts">
import {defineComponent} from "vue";
import CircularLoading from "@/components/loading/CircularLoading.vue";
import DashboardEditor from "@/components/editor/dashboard/DashboardEditor.vue";
import DashboardService from "@/services/DashboardService";
export default defineComponent({
name: "DashboardInfo",
components: {DashboardEditor, CircularLoading},
props: {
isVisible: {
type: Boolean,
default: () => false
},
id: {
type: Number
}
},
created()
{
this.handlerInitialize()
},
data()
{
return {
loading: false,
saving: false,
configure: null,
nodes: [],
sourceConfigure: null
}
},
methods: {
handlerInitialize()
{
if (this.id) {
this.loading = true;
DashboardService.getById(this.id)
.then(response => {
if (response.status) {
const configure = JSON.parse(response.data.configure)
configure.nodes?.forEach((node: any) => {
this.nodes.push({id: node.id, type: node.type, label: node.label, position: node.position, data: node.data})
})
this.sourceConfigure = response.data
}
else {
this.$Message.error(response.message)
}
})
.finally(() => this.loading = false)
}
},
handlerSave()
{
this.saving = true
DashboardService.saveOrUpdate(this.configure)
.then(response => {
if (response.status) {
this.$Message.success(this.$t('common.save') + ' [ ' + this.configure.name + ' ] ' + this.$t('common.success'))
this.handlerCancel()
}
else {
this.$Message.error(response.message)
}
})
.finally(() => this.saving = false)
},
handlerCommit(configure: any)
{
this.configure = configure
},
handlerCancel()
{
this.visible = false;
}
},
computed: {
visible: {
get(): boolean
{
return this.isVisible;
},
set(value: boolean)
{
this.$emit('close', value);
}
}
}
});
</script>

View File

@ -1,66 +0,0 @@
<template>
<div :style="{height: height + 'px'}">
<CircularLoading v-if="loading"
:show="loading">
</CircularLoading>
<DashboardView v-if="data && data.version === 'V1'"
style="margin-top: 10px;"
:height="height - 20"
:configure="JSON.parse(data.configure)">
</DashboardView>
<DashboardViewBeta v-else-if="data && data.version === 'V2'"
:layouts="JSON.parse(data.configure)">
</DashboardViewBeta>
<Result v-else
style="margin-top: 80px;"
type="error"
title="Not Found">
</Result>
</div>
</template>
<script lang="ts">
import {defineComponent} from "vue";
import CircularLoading from "@/components/loading/CircularLoading.vue";
import {useRouter} from "vue-router";
import DashboardService from "@/services/DashboardService";
import DashboardView from "@/components/editor/dashboard/DashboardView.vue";
import DashboardViewBeta from "@/components/editor/dashboard-beta/DashboardView.vue";
export default defineComponent({
name: "DashboardPreview",
components: {DashboardViewBeta, DashboardView, CircularLoading},
data()
{
return {
loading: false,
height: 500,
data: null
}
},
created()
{
this.height = window.innerHeight
this.handlerInitialize()
},
methods: {
handlerInitialize()
{
this.loading = true
const router = useRouter()
const params = router.currentRoute.value.params
DashboardService.getById(params['id'] as unknown as number)
.then(response => {
if (response.status) {
this.data = response.data
}
})
.finally(() => this.loading = false)
}
}
});
</script>
<style scoped>
:deep(.ivu-modal-body) {
padding: 0;
}
</style>

View File

@ -1,93 +0,0 @@
<template>
<div class="home">
<Row style="margin: 0px 5px;" :gutter="16">
<Col span="6">
<Card class="content-center" dis-hover>
<NumberInfo>
<template #title>
Source Count
<Tooltip>
<template #content>
<div style="white-space: normal;">
Statistics on the total number of access data sources
</div>
</template>
<Icon type="md-help-circle"/>
</Tooltip>
</template>
<template #total>
<Numeral :value="count.source" format="0,0"/>
</template>
</NumberInfo>
</Card>
</Col>
<Col span="6">
<Card class="content-center" dis-hover>
<NumberInfo>
<template #title>
History Count
<Tooltip>
<template #content>
<div style="white-space: normal;">
Statistics The total number of query histories of access data sources
</div>
</template>
<Icon type="md-help-circle"/>
</Tooltip>
</template>
<template #total>
<Numeral :value="count.history" format="0,0"/>
</template>
</NumberInfo>
</Card>
</Col>
</Row>
</div>
</template>
<script lang="ts">
import {HttpCommon} from "@/common/HttpCommon";
import {AdminService} from "@/services/AdminService";
import {defineComponent} from "vue";
export default defineComponent({
name: "DashboardIndex",
data()
{
return {
summaryLoading: false,
count: {
source: 0,
history: 0
}
}
},
created()
{
this.handlerInitialize()
},
methods: {
handlerInitialize()
{
this.summaryLoading = true;
const adminService = new AdminService();
const axios = new HttpCommon().getAxios();
axios.all([adminService.getSourceCount(), adminService.getPluginHistoryCount()])
.then(axios.spread((sourceCount, pluginHistoryCount) => {
if (sourceCount.status) {
this.count.source = sourceCount.data;
}
if (pluginHistoryCount.status) {
this.count.history = pluginHistoryCount.data;
}
})).finally(() => {
this.summaryLoading = false;
});
}
}
});
</script>
<style scoped>
.content-center {
text-align: center;
}
</style>