-
Notifications
You must be signed in to change notification settings - Fork 210
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
FOUR-18762: Added PI Process Import to New Process modal #7319
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
<template> | ||
<div> | ||
<modal | ||
id="importPI" | ||
:title="title" | ||
:subtitle="subtitle" | ||
:setCustomButtons="true" | ||
:customButtons="buttons" | ||
@importNewPI="importNewPI()" | ||
@hidden="onClose()" | ||
size="lg" | ||
> | ||
<template> | ||
<div class="card-body"> | ||
<div id="pre-import"> | ||
<draggable-file-upload class="text-center" v-if="!file || file && !fileIsValid" ref="file" v-model="file" :options="{singleFile: true}" :displayUploaderList="false" :accept="['image/png', 'image/jpg', 'image/jpeg']"></draggable-file-upload> | ||
<div v-else class="text-left"> | ||
<h5> {{ $t("You are about to import") }} <strong>{{processName}}</strong></h5> | ||
<div class="border-dotted p-3 col-4 text-center font-weight-bold my-3"> | ||
{{file.name}} | ||
<b-button | ||
variant="link" | ||
@click="removeFile" | ||
class="p-0" | ||
aria-describedby="" | ||
> | ||
<i class="fas fa-times-circle text-danger"></i> | ||
</b-button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
</modal> | ||
</div> | ||
</template> | ||
<script> | ||
import Modal from "../../../components/shared/Modal.vue"; | ||
import DraggableFileUpload from '../../../components/shared/DraggableFileUpload.vue'; | ||
|
||
export default { | ||
components: { Modal, DraggableFileUpload }, | ||
data() { | ||
return { | ||
file: '', | ||
uploaded: false, | ||
fileIsValid: false, | ||
processName: '', | ||
importDisabled: true, | ||
}; | ||
}, | ||
watch: { | ||
file() { | ||
this.fileIsValid = false; | ||
if (!this.file) { | ||
this.importDisabled = true; | ||
return | ||
} | ||
this.importDisabled = false; | ||
this.validatePIProcess(); | ||
this.processName = this.file.name.split('.').slice(0,-1).toString(); | ||
} | ||
}, | ||
methods: { | ||
show() { | ||
this.$bvModal.show('importPI'); | ||
}, | ||
hide() { | ||
this.$bvModal.hide('importPI'); | ||
}, | ||
onClose() { | ||
this.$emit('onClose'); | ||
}, | ||
validatePIProcess() { | ||
if (!this.file) { | ||
return; | ||
} | ||
this.$root.file = this.file; | ||
|
||
let formData = new FormData(); | ||
formData.append('file', this.file); | ||
|
||
this.fileIsValid = true; | ||
}, | ||
removeFile() { | ||
this.file = ''; | ||
this.fileIsValid = false; | ||
}, | ||
importNewPI() {} | ||
}, | ||
computed: { | ||
title() { | ||
return this.$t('Import Process'); | ||
}, | ||
subtitle() { | ||
return this.$t('Import a process from Workfellow PI (.jpg, .jpeg, .png) to this ProcessMaker environment'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This text is not the same as the Figma. Should be: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In sync with Claudia Iriarte and Franz Villaroel this text was to be included here to indicate the file type that the import accepts There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The file type should be JSON. Also need to update the figma |
||
}, | ||
buttons() { | ||
return [ | ||
{'content': 'Cancel', 'action': 'hide()', 'variant': 'outline-secondary', 'disabled': false, 'hidden': false}, | ||
{'content': 'Import', 'action': 'importNewPI', 'variant': 'primary', 'disabled': this.importDisabled, 'hidden': false} | ||
]; | ||
} | ||
} | ||
} | ||
</script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we included into SelectTemplateModal? The name is confusing. Maybe we should have our own selectImportPIModal, or change the names to make it reusable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was to keep consistency with how the other 2 buttons (Create a new Process and Generate a Process with AI) work, since the TemplateSearch component emits these events to the SelectTemplateModal component. Let's sync to take a look at it!