mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 23:35:59 +00:00
refresh schema list
This commit is contained in:
@@ -42,7 +42,7 @@
|
||||
return res;
|
||||
}
|
||||
|
||||
$: schemaList = _.uniq(
|
||||
$: realSchemaList = _.uniq(
|
||||
_.compact([selectedSchema, ...Object.keys(countBySchema), ...(schemaList?.map(x => x.schemaName) ?? [])])
|
||||
);
|
||||
$: countBySchema = computeCountBySchema(objectList ?? []);
|
||||
@@ -54,10 +54,14 @@
|
||||
label: 'Schema name',
|
||||
onConfirm: async name => {
|
||||
const dbid = { conid, database };
|
||||
await runOperationOnDatabase(dbid, {
|
||||
type: 'createSchema',
|
||||
schemaName: name,
|
||||
});
|
||||
await runOperationOnDatabase(
|
||||
dbid,
|
||||
{
|
||||
type: 'createSchema',
|
||||
schemaName: name,
|
||||
},
|
||||
'schema-list-changed'
|
||||
);
|
||||
if (selectedSchema) {
|
||||
selectedSchema = name;
|
||||
}
|
||||
@@ -69,10 +73,14 @@
|
||||
message: `Really drop schema ${$appliedCurrentSchema}?`,
|
||||
onConfirm: async () => {
|
||||
const dbid = { conid, database };
|
||||
runOperationOnDatabase(dbid, {
|
||||
type: 'dropSchema',
|
||||
schemaName: $appliedCurrentSchema,
|
||||
});
|
||||
runOperationOnDatabase(
|
||||
dbid,
|
||||
{
|
||||
type: 'dropSchema',
|
||||
schemaName: $appliedCurrentSchema,
|
||||
},
|
||||
'schema-list-changed'
|
||||
);
|
||||
selectedSchema = null;
|
||||
},
|
||||
});
|
||||
@@ -81,14 +89,14 @@
|
||||
$: selectedSchema = localStorage.getItem(valueStorageKey ?? '');
|
||||
</script>
|
||||
|
||||
{#if schemaList.length > 0}
|
||||
{#if realSchemaList.length > 0}
|
||||
<div class="wrapper">
|
||||
<div class="mr-1">Schema:</div>
|
||||
<SelectField
|
||||
isNative
|
||||
options={[
|
||||
{ label: `All schemas (${objectList?.length ?? 0})`, value: '' },
|
||||
...schemaList.map(x => ({ label: `${x} (${countBySchema[x] ?? 0})`, value: x })),
|
||||
...realSchemaList.map(x => ({ label: `${x} (${countBySchema[x] ?? 0})`, value: x })),
|
||||
// ...schemaList.filter(x => countBySchema[x]).map(x => ({ label: `${x} (${countBySchema[x] ?? 0})`, value: x })),
|
||||
// ...schemaList.filter(x => !countBySchema[x]).map(x => ({ label: `${x} (${countBySchema[x] ?? 0})`, value: x })),
|
||||
]}
|
||||
|
||||
Reference in New Issue
Block a user