fix: missing table on insert new records on session restored tabs

This commit is contained in:
Fabio Di Stasio 2022-07-20 10:41:44 +02:00
parent 985e5d3527
commit 8c83b3f144
5 changed files with 12 additions and 10 deletions

View File

@ -10,7 +10,7 @@
:key="connection.uid"
:connection="connection"
/>
<div class="connection-panel-wrapper">
<div class="connection-panel-wrapper p-relative">
<WorkspaceAddConnectionPanel v-if="selectedWorkspace === 'NEW'" />
</div>
</div>

View File

@ -112,6 +112,8 @@ import BaseSelect from '@/components/BaseSelect.vue';
const props = defineProps({
tabUid: [String, Number],
schema: String,
table: String,
fields: Array as Prop<TableField[]>,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
rowToDuplicate: Object as Prop<any>,
@ -125,8 +127,6 @@ const workspacesStore = useWorkspacesStore();
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
const { getWorkspace } = workspacesStore;
const { trapRef } = useFocusTrap({ disableAutofocus: true });
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@ -136,7 +136,6 @@ const nInserts = ref(1);
const isInserting = ref(false);
const fakerLocale = ref('en');
const workspace = computed(() => getWorkspace(selectedWorkspace.value));
const foreignKeys = computed(() => props.keyUsage.map(key => key.field));
const hasFakes = computed(() => Object.keys(localRow.value).some(field => 'group' in localRow.value[field] && localRow.value[field].group !== 'manual'));
@ -222,8 +221,8 @@ const insertRows = async () => {
try {
const { status, response } = await Tables.insertTableFakeRows({
uid: selectedWorkspace.value,
schema: workspace.value.breadcrumbs.schema,
table: workspace.value.breadcrumbs.table,
schema: props.schema,
table: props.table,
row: rowToInsert,
repeat: nInserts.value,
fields: fieldTypes,

View File

@ -12,7 +12,7 @@
<div class="footer-right-elements">
<ul class="footer-elements">
<li
v-if="workspace.connectionStatus === 'connected' "
v-if="workspace?.connectionStatus === 'connected' "
class="footer-element footer-link"
@click="toggleConsole()"
>

View File

@ -560,7 +560,8 @@ setTimeout(() => {
.connection-panel {
margin-left: auto;
margin-right: auto;
margin-bottom: 1rem;
margin-bottom: .5rem;
margin-top: 1.5rem;
.panel {
min-width: 450px;

View File

@ -163,6 +163,8 @@
:row-to-duplicate="rowToDuplicate"
:key-usage="keyUsage"
:tab-uid="tabUid"
:schema="schema"
:table="table"
@hide="hideFakerModal"
@reload="reloadTable"
/>
@ -237,7 +239,7 @@ const customizations = computed(() => {
});
const isTable = computed(() => {
return !!workspace.value.breadcrumbs.table;
return !workspace.value.breadcrumbs.view;
});
const fields = computed(() => {
@ -355,7 +357,7 @@ const onKey = (e: KeyboardEvent) => {
pageChange('next');
if (e.key === 'ArrowLeft')
pageChange('prev');
if (e.key === 'f') // f
if (e.key === 'f')
isSearch.value = !isSearch.value;
}
}