Revize 9e60bee1
Přidáno uživatelem Lukáš Vlček před téměř 3 roky(ů)
webapp/api/api.ts | ||
---|---|---|
3240 | 3240 |
* @param {*} [options] Override http request option. |
3241 | 3241 |
* @throws {RequiredError} |
3242 | 3242 |
*/ |
3243 |
async documentsExportPost(exportRequest?: ExportRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
|
3243 |
async documentsExportPost(exportRequest?: ExportRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<string>> {
|
|
3244 | 3244 |
const localVarAxiosArgs = await localVarAxiosParamCreator.documentsExportPost(exportRequest, options); |
3245 | 3245 |
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); |
3246 | 3246 |
}, |
... | ... | |
3345 | 3345 |
* @param {*} [options] Override http request option. |
3346 | 3346 |
* @throws {RequiredError} |
3347 | 3347 |
*/ |
3348 |
documentsExportPost(exportRequest?: ExportRequest, options?: any): AxiosPromise<void> {
|
|
3348 |
documentsExportPost(exportRequest?: ExportRequest, options?: any): AxiosPromise<string> {
|
|
3349 | 3349 |
return localVarFp.documentsExportPost(exportRequest, options).then((request) => request(axios, basePath)); |
3350 | 3350 |
}, |
3351 | 3351 |
/** |
webapp/pages/documents/admin/index.tsx | ||
---|---|---|
235 | 235 |
}, 'dokumenty'); |
236 | 236 |
}; |
237 | 237 |
|
238 |
const exportDocuments = () => { |
|
238 |
const exportDocuments = async () => {
|
|
239 | 239 |
const req: ExportRequest = { documentIds: selectedDocs }; |
240 |
documentController.documentsExportPost(req); |
|
240 |
const res = await documentController.documentsExportPost(req); |
|
241 |
if (res?.data) { |
|
242 |
download(res.data, 'export.zip'); |
|
243 |
} |
|
241 | 244 |
}; |
242 | 245 |
|
246 |
function download(baseData: string, filename: string) { |
|
247 |
if (!baseData) { |
|
248 |
console.log('base data null'); |
|
249 |
return; |
|
250 |
} |
|
251 |
|
|
252 |
const linkSource = `data:application/zip;base64,${baseData}`; |
|
253 |
const downloadLink = document.createElement('a'); |
|
254 |
|
|
255 |
downloadLink.href = linkSource; |
|
256 |
downloadLink.download = filename; |
|
257 |
downloadLink.click(); |
|
258 |
|
|
259 |
// Clean up and remove the link |
|
260 |
// downloadLink.parentNode.removeChild(downloadLink); |
|
261 |
} |
|
262 |
|
|
243 | 263 |
const changeDefaultAnotationCount = (e: FocusEvent<HTMLInputElement>) => { |
244 | 264 |
documentController.documentsRequiredAnnotationsGlobalPost({ |
245 | 265 |
requiredAnnotations: parseInt(e.currentTarget.value), |
... | ... | |
535 | 555 |
Nahrát dokument |
536 | 556 |
</Button> |
537 | 557 |
|
538 |
<div style={{ display: 'flex', gap: '3px' }}> |
|
558 |
<div style={{ display: 'flex', gap: '3px', flexWrap: 'wrap' }}>
|
|
539 | 559 |
<Button |
540 | 560 |
danger |
541 | 561 |
disabled={!(selectedDocs?.length > 0)} |
Také k dispozici: Unified diff
Export fixed