Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed some issues with dump #904

Merged
merged 5 commits into from
Dec 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions cvat-core/src/server-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -563,20 +563,18 @@

return new Promise((resolve, reject) => {
async function request() {
try {
const response = await Axios
.get(`${url}`, {
proxy: config.proxy,
});
Axios.get(`${url}`, {
proxy: config.proxy,
}).then((response) => {
if (response.status === 202) {
setTimeout(request, 3000);
} else {
url = `${url}&action=download`;
resolve(url);
}
} catch (errorData) {
}).catch((errorData) => {
reject(generateError(errorData));
}
});
}

setTimeout(request);
Expand Down
12 changes: 6 additions & 6 deletions cvat-ui/src/actions/tasks-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,9 @@ ThunkAction<Promise<void>, {}, {}, AnyAction> {
try {
dispatch(dumpAnnotation(task, dumper));
const url = await task.annotations.dump(task.name, dumper);
// false positive
// eslint-disable-next-line security/detect-non-literal-fs-filename
window.open(url);
const downloadAnchor = (window.document.getElementById('downloadAnchor') as HTMLAnchorElement);
downloadAnchor.href = url;
downloadAnchor.click();
} catch (error) {
dispatch(dumpAnnotationFailed(task, dumper, error));
return;
Expand Down Expand Up @@ -270,9 +270,9 @@ ThunkAction<Promise<void>, {}, {}, AnyAction> {

try {
const url = await task.annotations.exportDataset(exporter.tag);
// false positive
// eslint-disable-next-line security/detect-non-literal-fs-filename
window.open(url, '_blank');
const downloadAnchor = (window.document.getElementById('downloadAnchor') as HTMLAnchorElement);
downloadAnchor.href = url;
downloadAnchor.click();
} catch (error) {
dispatch(exportDatasetFailed(task, exporter, error));
}
Expand Down
1 change: 1 addition & 0 deletions cvat-ui/src/components/cvat-app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ export default class CVATApplication extends React.PureComponent<CVATAppProps> {
</Switch>
<FeedbackComponent/>
<ModelRunnerModalContainer/>
<a id='downloadAnchor' style={{ display: 'none' }} download/>
</Layout.Content>
</Layout>
</BrowserRouter>
Expand Down
2 changes: 1 addition & 1 deletion cvat/apps/engine/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ def dump(self, request, pk, filename):
"{}.{}.{}.{}".format(filename, username, timestamp, db_dumper.format.lower()))

queue = django_rq.get_queue("default")
rq_id = "{}@/api/v1/tasks/{}/annotations/{}".format(username, pk, filename)
rq_id = "{}@/api/v1/tasks/{}/annotations/{}/{}".format(username, pk, dump_format, filename)
rq_job = queue.fetch_job(rq_id)

if rq_job:
Expand Down