Skip to content

Commit 56f14cb

Browse files
[sync] fix: initialize api dialog with current view (#1506) (#2817)
Synced from teableio/teable-ee@f5f6b95 Co-authored-by: nichenqin <nichenqin@hotmail.com>
1 parent df0b2c1 commit 56f14cb

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

apps/nextjs-app/src/features/app/blocks/view/tool-bar/APIDialogContent.tsx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -338,9 +338,17 @@ const TokenSection = ({
338338
};
339339

340340
// Advanced Query Builder Panel Component
341-
const AdvancedQueryPanel = ({ tableId, baseId }: { tableId: string; baseId: string }) => {
341+
const AdvancedQueryPanel = ({
342+
tableId,
343+
baseId,
344+
initialViewId,
345+
}: {
346+
tableId: string;
347+
baseId: string;
348+
initialViewId?: string;
349+
}) => {
342350
const { t } = useTranslation(tableConfig.i18nNamespaces);
343-
const [viewId, setViewId] = useState<string>();
351+
const [viewId, setViewId] = useState<string | undefined>(initialViewId);
344352
const [filter, setFilter] = useState<IFilterSet | null>(null);
345353
const [fieldKeyType, setFieldKeyType] = useState<FieldKeyType>(FieldKeyType.Name);
346354
const [cellFormat, setCellFormat] = useState<CellFormat>(CellFormat.Json);
@@ -470,9 +478,9 @@ export interface APIDialogContentProps {
470478
onOpenChange: (open: boolean) => void;
471479
}
472480

473-
export const APIDialogContent = ({ onOpenChange }: APIDialogContentProps) => {
481+
export const APIDialogContent = ({ onOpenChange: _onOpenChange }: APIDialogContentProps) => {
474482
const { t } = useTranslation(tableConfig.i18nNamespaces);
475-
const { baseId, tableId } = useBaseResource() as IBaseResourceTable;
483+
const { baseId, tableId, viewId } = useBaseResource() as IBaseResourceTable;
476484
const [copied, setCopied] = useState(false);
477485
const [currentUrl, setCurrentUrl] = useState('');
478486
const [generatedToken, setGeneratedToken] = useState<CreateAccessTokenVo | null>(null);
@@ -646,7 +654,7 @@ export const APIDialogContent = ({ onOpenChange }: APIDialogContentProps) => {
646654

647655
<TabsContent value="advanced" className="mt-0 min-h-0 flex-1 overflow-auto">
648656
<ScrollArea className="h-full">
649-
<AdvancedQueryPanel tableId={tableId} baseId={baseId} />
657+
<AdvancedQueryPanel tableId={tableId} baseId={baseId} initialViewId={viewId} />
650658
</ScrollArea>
651659
</TabsContent>
652660
</Tabs>

packages/openapi/src/record/get-list.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const queryBaseSchema = z.object({
2121
viewId: z.string().startsWith(IdPrefix.View).optional().meta({
2222
example: 'viwXXXXXXX',
2323
description:
24-
'Set the view you want to fetch, default is first view. result will filter and sort by view options.',
24+
"Set the view you want to fetch. When provided, records will follow that view's filter and sort settings. When omitted, the API queries the table without applying a view.",
2525
}),
2626
ignoreViewQuery: z
2727
.string()

0 commit comments

Comments
 (0)