Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
65 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<template> | ||
<div class="ui-portlet-limited"> | ||
<div class="portlet-header"> | ||
<div class="portlet-title"> | ||
<i class="portlet-title-icon fa fa-upload"></i> | ||
<span class="portlet-title-text"><b>Import a History from an Archive</b></span> | ||
</div> | ||
</div> | ||
<div class="portlet-content"> | ||
<div v-if="errormessage" class="ui-message alert alert-danger ui-error-message"> | ||
{{ errormessage }} | ||
</div> | ||
<div class="portlet-body"> | ||
<div class="ui-message"/> | ||
<form ref="form"> | ||
<div class="ui-form-element"> | ||
<div class="ui-form-title">Archived History URL</div> | ||
<input class="ui-input" type="text" name="archive_source"/> | ||
</div> | ||
<div class="ui-form-element"> | ||
<div class="ui-form-title">Archived History file</div> | ||
<input type="file" name="archive_file"/> | ||
</div> | ||
</form> | ||
</div> | ||
<div class="portlet-buttons"> | ||
<input class="btn btn-primary" type="button" value="Import History" @click="submit"/> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
<script> | ||
export default { | ||
data() { | ||
return { | ||
errormessage: null | ||
} | ||
}, | ||
methods: { | ||
submit: function() { | ||
$.ajax({ | ||
url: `${Galaxy.root}api/histories`, | ||
data: new FormData(this.$refs.form), | ||
cache: false, | ||
contentType: false, | ||
processData: false, | ||
method: "POST" | ||
}) | ||
.done(response => { | ||
window.location = `${Galaxy.root}histories/list?message=${response.message}&status=success` | ||
}) | ||
.fail(response => { | ||
let message = response.responseJSON && response.responseJSON.err_msg; | ||
this.errormessage = message || "Import failed for unkown reason."; | ||
}); | ||
} | ||
} | ||
}; | ||
</script> | ||
<style> | ||
.ui-error-message { | ||
display: block; | ||
} | ||
</style> |
Large diffs are not rendered by default.
Oops, something went wrong.