- Archive in progress task id = {{ taskId }}
+ Archive in progress task id = {{ taskId }}
- Archived successfully with id {{ taskId }} available here.
+ Archived successfully with id {{ archiveResult.id }}
+ available here.
+ no archived content to show.
Failure: {{ archiveFailure }}
@@ -115,8 +116,9 @@ export default {
urlValidator() {
return urlValidator;
},
- getUrlFromResult() {
- return getUrlFromResult;
+ urlFromResult() {
+ if (!this.archiveResult) return null;
+ return getUrlFromResult(this.archiveResult);
},
validUrl() {
return this.url && this.urlValidator(this.url) === true;
@@ -156,6 +158,10 @@ export default {
this.archiveResult = null;
this.archiveFailure = null;
this.taskId = null;
+ if (this.loadingArchive) {
+ this.loadingArchive = false;
+ this.showSnackbar("Your previous archive will run in the background.", "yellow");
+ }
},
},
methods: {
@@ -197,13 +203,15 @@ export default {
.catch(error => {
console.error("/archive ", error);
this.showSnackbar(`Unable to archive URL: ${error.message}`);
- }).finally(() => {
this.loadingArchive = false;
});
},
pollForArchiveResults() {
this.loadingArchive = true;
const poll = () => {
+ if (!this.loadingArchive) {
+ return;
+ }
fetch(`${this.$store.state.API_ENDPOINT}/task/${this.taskId}`, {
method: "GET",
headers: {
@@ -216,8 +224,8 @@ export default {
if (task.status === "SUCCESS") {
this.showSnackbar(`URL archived successfully with id ${task.result.id}!`, "green");
this.loadingArchive = false;
- this.taskId = null;
this.archiveResult = task;
+ this.taskId = task.id;
} else if (task.status === "FAILURE") {
this.showSnackbar(`Failed to archive URL: ${task.result.error}`);
this.loadingArchive = false;