Skip to content
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

Integration improvements #18

Merged
merged 3 commits into from
Jan 10, 2024
Merged

Integration improvements #18

merged 3 commits into from
Jan 10, 2024

Conversation

julien-nc
Copy link
Member

@julien-nc julien-nc commented Dec 7, 2023

refs nextcloud/text#4686

  • The main promise always resolves the task with its current status
  • Assistant will offer a flag to close the modal after a successful sync task
  • There will be a list of action buttons that can be provided
vokoscreenNG-2023-12-07_14-54-52.mp4
const params = {
	appId: 'plopApp',
	identifier: 'idid',
	input: 'give me a short summary of a simple settings section about GitHub',
	closeOnResult: false,
	actionButtons: [
		{
			label: 'Put in field 1',
			title: 'Title 1',
			type: 'warning',
			iconSvg: cogSvg,
			onClick: (task) => { this.field1 = task.output },
		},
		{
			label: 'Put in field 2',
			title: 'Title 2',
			onClick: (task) => { this.field2 = task.output },
		},
	],
}
OCA.TPAssistant.openAssistantForm(params)

Is it enough to get the task output as parameter of button callbacks? I could refactor a bit and make it possible to get the task itself if necessary.

@juliushaertl
Copy link
Member

Awesome. The task would be nice as we maintain the list of tasks as local state in text, so we could update that right away.

@julien-nc
Copy link
Member Author

Done.

One little detail: If the user edits the result before pressing the action button, the value of the text area is passed to the action button, not the value that we really got in the task. I thought it would make sense as users might want to adjust the result in the Assistant UI before pressing a button.

@julien-nc
Copy link
Member Author

Oh and the code example has been adjusted.

Copy link
Member

@juliushaertl juliushaertl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I won't get to testing/integrating this now, but code looks good 👍

@julien-nc julien-nc merged commit 31eb629 into main Jan 10, 2024
1 check passed
@delete-merged-branch delete-merged-branch bot deleted the enh/integration-improvements branch January 10, 2024 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants