diff --git a/src/assistant.js b/src/assistant.js index bbf8fdbc..270d9d13 100644 --- a/src/assistant.js +++ b/src/assistant.js @@ -38,6 +38,7 @@ export async function openAssistantForm({ appId, identifier = '', taskType = nul isInsideViewer, input, selectedTaskTypeId: taskType, + showScheduleConfirmation: false, }, }).$mount(modalElement) @@ -46,12 +47,13 @@ export async function openAssistantForm({ appId, identifier = '', taskType = nul reject(new Error('User cancellation')) }) view.$on('submit', (data) => { - view.$destroy() scheduleTask(appId, identifier, data.taskTypeId, data.input) .then((response) => { + view.showScheduleConfirmation = true resolve(response.data?.ocs?.data?.task) }) .catch(error => { + view.$destroy() console.error('Assistant scheduling error', error) reject(new Error('Assistant scheduling error')) }) @@ -140,6 +142,7 @@ async function openAssistantResult(task) { input: task.input, output: task.output ?? '', selectedTaskTypeId: task.type, + showScheduleConfirmation: false, }, }).$mount(modalElement) @@ -147,12 +150,13 @@ async function openAssistantResult(task) { view.$destroy() }) view.$on('submit', (data) => { - view.$destroy() scheduleTask(task.appId, task.identifier, data.taskTypeId, data.input) .then((response) => { + view.showScheduleConfirmation = true console.debug('scheduled task', response.data?.ocs?.data?.task) }) .catch(error => { + view.$destroy() console.error('Assistant scheduling error', error) }) }) diff --git a/src/components/AssistantModal.vue b/src/components/AssistantModal.vue index 8cc75116..f3928242 100644 --- a/src/components/AssistantModal.vue +++ b/src/components/AssistantModal.vue @@ -15,7 +15,26 @@ + + + + import CloseIcon from 'vue-material-design-icons/Close.vue' +import AssistantIcon from './icons/AssistantIcon.vue' + import NcModal from '@nextcloud/vue/dist/Components/NcModal.js' import NcButton from '@nextcloud/vue/dist/Components/NcButton.js' +import NcEmptyContent from '@nextcloud/vue/dist/Components/NcEmptyContent.js' import AssistantForm from './AssistantForm.vue' @@ -40,9 +62,11 @@ import { emit } from '@nextcloud/event-bus' export default { name: 'AssistantModal', components: { + AssistantIcon, AssistantForm, NcModal, NcButton, + NcEmptyContent, CloseIcon, }, props: { @@ -65,6 +89,10 @@ export default { type: [String, null], default: null, }, + showScheduleConfirmation: { + type: Boolean, + required: true, + }, }, emits: [ 'cancel', @@ -92,7 +120,7 @@ export default { this.$emit('cancel') }, onSubmit(params) { - this.show = false + // this.show = false this.$emit('submit', params) }, }, diff --git a/src/views/TaskResultPage.vue b/src/views/TaskResultPage.vue index bf90450d..795356f8 100644 --- a/src/views/TaskResultPage.vue +++ b/src/views/TaskResultPage.vue @@ -3,7 +3,17 @@
+ + +