Skip to content

Commit fd43931

Browse files
committed
Merge branch 'main' of https://github.com/dataease/SQLBot
2 parents 663ad45 + 4ebef86 commit fd43931

File tree

3 files changed

+32
-14
lines changed

3 files changed

+32
-14
lines changed

backend/apps/datasource/api/datasource.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
from apps.db.engine import create_table, get_data_engine, insert_data
1010
from common.core.deps import SessionDep, CurrentUser
1111
from ..crud.datasource import get_datasource_list, check_status, create_ds, update_ds, delete_ds, getTables, getFields, \
12-
execSql, update_table_and_fields, getTablesByDs, chooseTables, preview
12+
execSql, update_table_and_fields, getTablesByDs, chooseTables, preview, updateTable, updateField
1313
from ..crud.field import get_fields_by_table_id
1414
from ..crud.table import get_tables_by_ds_id
15-
from ..models.datasource import CoreDatasource, CreateDatasource, TableObj, CoreTable
15+
from ..models.datasource import CoreDatasource, CreateDatasource, TableObj, CoreTable, CoreField
1616

1717
router = APIRouter(tags=["datasource"], prefix="/datasource")
1818
path = "/opt/sqlbot/data/excel"
@@ -83,6 +83,16 @@ async def edit_local(session: SessionDep, data: TableObj):
8383
update_table_and_fields(session, data)
8484

8585

86+
@router.post("/editTable")
87+
async def edit_table(session: SessionDep, table: CoreTable):
88+
updateTable(session, table)
89+
90+
91+
@router.post("/editField")
92+
async def edit_field(session: SessionDep, field: CoreField):
93+
updateField(session, field)
94+
95+
8696
@router.post("/previewData/{id}")
8797
async def edit_local(session: SessionDep, id: int, data: TableObj):
8898
return preview(session, id, data)

backend/apps/datasource/crud/datasource.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,14 @@ def update_table_and_fields(session: SessionDep, data: TableObj):
192192
update_field(session, field)
193193

194194

195+
def updateTable(session: SessionDep, table: CoreTable):
196+
update_table(session, table)
197+
198+
199+
def updateField(session: SessionDep, field: CoreField):
200+
update_field(session, field)
201+
202+
195203
def preview(session: SessionDep, id: int, data: TableObj):
196204
ds = session.query(CoreDatasource).filter(CoreDatasource.id == id).first()
197205
conf = DatasourceConf(**json.loads(aes_decrypt(ds.configuration))) if ds.type != "excel" else get_engine_config()

frontend/src/views/ds/DatasourceItemCard.vue

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ defineProps<{
1111
ds: any
1212
}>()
1313
14-
const getStatus = (status: string) => {
15-
if (status === 'Success') {
16-
return 'connected'
17-
}
18-
if (status === 'Fail') {
19-
return 'failed'
20-
}
21-
if (status === 'Checking') {
22-
return 'needs-verification'
23-
}
24-
}
14+
// const getStatus = (status: string) => {
15+
// if (status === 'Success') {
16+
// return 'connected'
17+
// }
18+
// if (status === 'Fail') {
19+
// return 'failed'
20+
// }
21+
// if (status === 'Checking') {
22+
// return 'needs-verification'
23+
// }
24+
// }
2525
2626
</script>
2727

@@ -44,7 +44,7 @@ const getStatus = (status: string) => {
4444
<div class="connection-host">{{ ds.description }}</div>
4545
<div class="connection-last">{{ datetimeFormat(ds.create_time) }}</div>
4646
</div>
47-
<div class="connection-status" :class="`${getStatus(ds.status)}`">{{ ds.status }}</div>
47+
<!-- <div class="connection-status" :class="`${getStatus(ds.status)}`">{{ ds.status }}</div> -->
4848
<slot></slot>
4949
</div>
5050
</template>

0 commit comments

Comments
 (0)