(core) Update export CSV and Excel endpoints

Summary:
The endpoints for exporting CSV and Excel are now under
/api/docs/:docId/ and are forwarded to a doc worker for export.

The Share Menu has been updated to use the new endpoints.

Test Plan: No new tests. Existing tests that verify endpoints work correctly.

Reviewers: paulfitz

Reviewed By: paulfitz

Subscribers: paulfitz

Differential Revision: https://phab.getgrist.com/D3007
This commit is contained in:
George Gevoian
2021-08-30 13:06:40 -07:00
parent 5258fa649d
commit ef5da42378
7 changed files with 25 additions and 36 deletions

View File

@@ -626,11 +626,11 @@ export class GristDoc extends DisposableWithEvents {
}
public getXlsxLink() {
const baseUrl = this.docPageModel.appModel.api.getDocAPI(this.docId()).getGenerateXlsxUrl();
const params = {
...this.docComm.getUrlParams(),
title: this.docPageModel.currentDocTitle.get(),
};
return this.docComm.docUrl(`gen_xlsx`) + '?' + encodeQueryParams(params);
return baseUrl + '?' + encodeQueryParams(params);
}
public getCsvLink() {
@@ -638,15 +638,16 @@ export class GristDoc extends DisposableWithEvents {
colRef : field.colRef.peek(),
filter : field.activeFilter.peek()
}));
const baseUrl = this.docPageModel.appModel.api.getDocAPI(this.docId()).getGenerateCsvUrl();
const params = {
...this.docComm.getUrlParams(),
title: this.docPageModel.currentDocTitle.get(),
viewSection: this.viewModel.activeSectionId(),
tableId: this.viewModel.activeSection().table().tableId(),
activeSortSpec: JSON.stringify(this.viewModel.activeSection().activeSortSpec()),
filters : JSON.stringify(filters),
};
return this.docComm.docUrl(`gen_csv`) + '?' + encodeQueryParams(params);
return baseUrl + '?' + encodeQueryParams(params);
}
public hasGranularAccessRules(): boolean {