mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-21 17:36:01 +00:00
renamed groupId => pairingId
This commit is contained in:
@@ -1,16 +1,16 @@
|
|||||||
import { TableInfo } from 'dbgate-types';
|
import { TableInfo } from 'dbgate-types';
|
||||||
import uuidv1 from 'uuid/v1';
|
import uuidv1 from 'uuid/v1';
|
||||||
|
|
||||||
export function generateTableGroupId(table: TableInfo): TableInfo {
|
export function generateTablePairingId(table: TableInfo): TableInfo {
|
||||||
if (!table) return table;
|
if (!table) return table;
|
||||||
if (!table.groupId) {
|
if (!table.pairingId) {
|
||||||
return {
|
return {
|
||||||
...table,
|
...table,
|
||||||
columns: table.columns.map(col => ({
|
columns: table.columns.map(col => ({
|
||||||
...col,
|
...col,
|
||||||
groupid: uuidv1(),
|
pairingId: col.pairingId || uuidv1(),
|
||||||
})),
|
})),
|
||||||
groupId: uuidv1(),
|
pairingId: table.pairingId || uuidv1(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return table;
|
return table;
|
||||||
|
|||||||
6
packages/types/dbinfo.d.ts
vendored
6
packages/types/dbinfo.d.ts
vendored
@@ -9,7 +9,7 @@ export interface ColumnReference {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface ConstraintInfo extends NamedObjectInfo {
|
export interface ConstraintInfo extends NamedObjectInfo {
|
||||||
groupId?: string;
|
pairingId?: string;
|
||||||
constraintName: string;
|
constraintName: string;
|
||||||
constraintType: 'primaryKey' | 'foreignKey' | 'index' | 'check' | 'unique';
|
constraintType: 'primaryKey' | 'foreignKey' | 'index' | 'check' | 'unique';
|
||||||
}
|
}
|
||||||
@@ -39,7 +39,7 @@ export interface CheckInfo extends ConstraintInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface ColumnInfo extends NamedObjectInfo {
|
export interface ColumnInfo extends NamedObjectInfo {
|
||||||
groupId?: string;
|
pairingId?: string;
|
||||||
columnName: string;
|
columnName: string;
|
||||||
notNull: boolean;
|
notNull: boolean;
|
||||||
autoIncrement: boolean;
|
autoIncrement: boolean;
|
||||||
@@ -55,7 +55,7 @@ export interface ColumnInfo extends NamedObjectInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface DatabaseObjectInfo extends NamedObjectInfo {
|
export interface DatabaseObjectInfo extends NamedObjectInfo {
|
||||||
groupId?: string;
|
pairingId?: string;
|
||||||
objectId?: string;
|
objectId?: string;
|
||||||
createDate?: string;
|
createDate?: string;
|
||||||
modifyDate?: string;
|
modifyDate?: string;
|
||||||
|
|||||||
@@ -37,12 +37,12 @@
|
|||||||
if (columnInfo) {
|
if (columnInfo) {
|
||||||
setTableInfo(tbl => ({
|
setTableInfo(tbl => ({
|
||||||
...tbl,
|
...tbl,
|
||||||
columns: tbl.columns.map(col => (col.groupId == columnInfo.groupId ? e.detail : col)),
|
columns: tbl.columns.map(col => (col.pairingId == columnInfo.pairingId ? e.detail : col)),
|
||||||
}));
|
}));
|
||||||
} else {
|
} else {
|
||||||
setTableInfo(tbl => ({
|
setTableInfo(tbl => ({
|
||||||
...tbl,
|
...tbl,
|
||||||
columns: [...tbl.columns, { ...e.detail, groupId: uuidv1() }],
|
columns: [...tbl.columns, { ...e.detail, pairingId: uuidv1() }],
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
// onConfirm();
|
// onConfirm();
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
closeCurrentModal();
|
closeCurrentModal();
|
||||||
setTableInfo(tbl => ({
|
setTableInfo(tbl => ({
|
||||||
...tbl,
|
...tbl,
|
||||||
columns: tbl.columns.filter(col => col.groupId != columnInfo.groupId),
|
columns: tbl.columns.filter(col => col.pairingId != columnInfo.pairingId),
|
||||||
}));
|
}));
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { generateTableGroupId } from 'dbgate-tools';
|
import { generateTablePairingId } from 'dbgate-tools';
|
||||||
|
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
|
||||||
@@ -27,11 +27,11 @@
|
|||||||
export let objectTypeField = 'tables';
|
export let objectTypeField = 'tables';
|
||||||
|
|
||||||
$: tableInfo = useDbCore({ conid, database, schemaName, pureName, objectTypeField });
|
$: tableInfo = useDbCore({ conid, database, schemaName, pureName, objectTypeField });
|
||||||
$: tableInfoWithGroupId = $tableInfo ? generateTableGroupId($tableInfo) : null;
|
$: tableInfoWithPairingId = $tableInfo ? generateTablePairingId($tableInfo) : null;
|
||||||
|
|
||||||
const { editorState, editorValue, setEditorData } = useEditorData({ tabid });
|
const { editorState, editorValue, setEditorData } = useEditorData({ tabid });
|
||||||
|
|
||||||
$: showTable = $editorValue || tableInfoWithGroupId;
|
$: showTable = $editorValue || tableInfoWithPairingId;
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
? tableInfoUpdater =>
|
? tableInfoUpdater =>
|
||||||
setEditorData(tbl => {
|
setEditorData(tbl => {
|
||||||
if (tbl) return tableInfoUpdater(tbl);
|
if (tbl) return tableInfoUpdater(tbl);
|
||||||
return tableInfoUpdater(tableInfoWithGroupId);
|
return tableInfoUpdater(tableInfoWithPairingId);
|
||||||
})
|
})
|
||||||
: null}
|
: null}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user