Skip to content

FOUR-18766: PI Process creation and redirect to modeler #7351

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

Merged
merged 5 commits into from
Sep 17, 2024
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
8 changes: 6 additions & 2 deletions resources/js/components/shared/DraggableFileUpload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
- {{ $t('or') }} -
</div>
<uploader-btn id="submitFile" class="text-primary">{{ $t('Select file from computer') }}</uploader-btn>
<div v-if="$refs.uploader && inProgress">
<div v-if="$refs.uploader && inProgress || loadingFile">
<i class="fas fa-spinner fa-spin p-0" />
</div>
</uploader-drop>
Expand Down Expand Up @@ -51,10 +51,12 @@ export default {
},
data() {
return {
loadingFile: false
};
},
methods: {
addFile(file) {
this.loadingFile = false;
if (this.accept) {
file.ignored = true;
if (this.accept.indexOf(file.fileType) !== -1) {
Expand All @@ -64,13 +66,15 @@ export default {
ProcessMaker.alert(this.$t("The selected file is invalid or not supported. Please verify that this file is in JSON format."), "danger");
return false
}
this.loadingFile = true;
}
file.ignored = false;

return true;
},
fileUploaded(rootFile, file, message) {
this.$emit('input', file.file);
this.loadingFile = false;
this.$emit('input', file.file);
},
}
};
Expand Down
16 changes: 8 additions & 8 deletions resources/js/processes/import/components/ImportPIModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
:subtitle="subtitle"
:setCustomButtons="true"
:customButtons="buttons"
data-test="import-pi-modal"
@importNewPI="importNewPI()"
@hidden="onClose()"
size="lg"
Expand Down Expand Up @@ -66,6 +67,7 @@ export default {
this.$bvModal.show('importPI');
},
hide() {
this.removeFile();
this.$bvModal.hide('importPI');
},
onClose() {
Expand Down Expand Up @@ -93,16 +95,14 @@ export default {

ProcessMaker.apiClient
.post(`/package-ai/pi_process/import`, formData)
.then((response) => {
// TODO: Make import and redirect to Modeler
.then(response => {
ProcessMaker.alert(this.$t("The PI process was created."), "success");
window.location = `/modeler/${response.data.id}`;
})
.catch((error) => {
window.ProcessMaker.alert(
this.$t("An error ocurred while importing the current PI Process."),
"danger",
);
.catch(error => {
console.error(error);
});
}
},
},
computed: {
title() {
Expand Down
Loading