Skip to content

Commit c3c8507

Browse files
committed
feat: datasource ui
1 parent 2e41831 commit c3c8507

File tree

3 files changed

+24
-11
lines changed

3 files changed

+24
-11
lines changed

frontend/src/style.less

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,6 @@ button {
6666
cursor: pointer;
6767
transition: border-color 0.25s;
6868
}
69-
button:hover {
70-
border-color: #646cff;
71-
}
72-
button:focus,
73-
button:focus-visible {
74-
outline: 4px auto -webkit-focus-ring-color;
75-
}
7669

7770
.card {
7871
padding: 2em;

frontend/src/views/ds/form.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
import { ref } from 'vue'
5050
import { datasourceApi } from '@/api/datasource'
5151
import { encrypted, decrypted } from './js/aes'
52+
import { ElMessage } from 'element-plus'
5253
5354
const emit = defineEmits(['refresh'])
5455
@@ -141,6 +142,13 @@ const check = () => {
141142
}))
142143
datasourceApi.check(form.value).then((res: any) => {
143144
console.log(res)
145+
if(res) {
146+
ElMessage({
147+
message: 'Connect success',
148+
type: 'success',
149+
showClose: true
150+
})
151+
}
144152
})
145153
}
146154

frontend/src/views/ds/index.vue

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
<div class="header">
44
<div class="mt-4">
55
<el-input
6-
v-model="search"
6+
v-model="searchValue"
77
style="max-width: 300px"
88
placeholder="Search Datasource..."
99
class="input-with-select"
10+
clearable
11+
@change="searchHandle"
1012
>
1113
<template #prepend>
1214
<el-icon><Search /></el-icon>
@@ -52,9 +54,10 @@ import { datasourceApi } from '@/api/datasource'
5254
import { datetimeFormat } from '@/utils/utils'
5355
import { ElMessageBox } from 'element-plus'
5456
55-
const search = ref<string>('')
57+
const searchValue = ref<string>('')
5658
const dsForm = ref()
57-
const dsList = ref<any>([])
59+
const dsList = ref<any>([])// show ds list
60+
const allDsList = ref<any>([])// all ds list
5861
5962
const getStatus = (status: string) => {
6063
if (status === 'Success') {
@@ -68,13 +71,22 @@ const getStatus = (status: string) => {
6871
}
6972
}
7073
74+
function searchHandle() {
75+
if(searchValue.value) {
76+
dsList.value = JSON.parse(JSON.stringify(allDsList.value)).filter((item: any) => {return item.name.toLowerCase().includes(searchValue.value.toLowerCase())})
77+
} else {
78+
dsList.value = JSON.parse(JSON.stringify(allDsList.value))
79+
}
80+
}
81+
7182
const refresh = () => {
7283
list()
7384
}
7485
7586
const list = () => {
7687
datasourceApi.list().then((res) => {
77-
dsList.value = res
88+
allDsList.value = res
89+
dsList.value = JSON.parse(JSON.stringify(allDsList.value))
7890
})
7991
}
8092

0 commit comments

Comments
 (0)