(core) Filter out pages for hidden views from the page list.

Summary:
- Filters out hidden pages from docModel.allPagesList (used for knowing default page, and for search iteration).
- Filters out hidden pages from TreeModel (uses raw tableData, so has a different way to filter).

Test Plan: WIP

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D2996
This commit is contained in:
Dmitry S
2021-08-27 13:25:20 -04:00
parent 90d1340b64
commit 3edb3a6826
7 changed files with 51 additions and 30 deletions

View File

@@ -61,7 +61,6 @@ import { CursorMonitor, ViewCursorPos } from "app/client/components/CursorMonito
import { EditorMonitor } from "app/client/components/EditorMonitor";
import { FieldEditor } from "app/client/widgets/FieldEditor";
import { Drafts } from "app/client/components/Drafts";
import {findIndex} from "lodash";
const G = getBrowserGlobals('document', 'window');
@@ -97,7 +96,6 @@ export class GristDoc extends DisposableWithEvents {
public viewModel: ViewRec;
public activeViewId: Computed<IDocPage>;
public currentPageName: Observable<string>;
public showDocTourTable: boolean = false;
public docData: DocData;
public docInfo: DocInfoRec;
public docPluginManager: DocPluginManager;
@@ -168,11 +166,7 @@ export class GristDoc extends DisposableWithEvents {
if (result === 'GristDocTour') {
// GristDocTour is a special table that is usually hidden from users, but putting /p/GristDocTour
// in the URL navigates to it and makes it visible in the list of pages in the sidebar
this.showDocTourTable = true;
result = findIndex(this.docModel.views.rowModels, view => view?.name.peek() === result);
if (result === -1) {
result = undefined; // not found, back to the default
}
result = this.docModel.views.tableData.findRow('name', result);
}
return result || use(defaultViewId);
});