Slack modal is not cleared from a Updated view - slack

I have modal flow in my Slack App. I have some issues with the end of the flow however.
Basic idea of the flow. You get a Modal, you do a selection, you get another modal, you perform an action and then Modal disappears.
I have tried two different ways both with problems but with different result
Flow 1: response_action: "update"
You press a button on home tab that opens a modal with bot.views.open
You make a selection
In the response I send {response_action: 'update', view: }
User gets the new Modal without any errors. They then click a button.
Now I would like the modal to disappear. So on the result of the action I send {response_action: 'clear'}
Nothing happens :(. I would like the modal to disappear of course :)
Flow 2: bot.views.update
You press a button on home tab that opens a modal with bot.views.open
You make a selection
I create the same view as above but I run bot.views.update{view_id: , view: }
New view comes up however it has an error in the top: We had some trouble connecting. Try again?
Now I would like the modal to disappear. So on the result of the action I send {response_action: 'clear'}
Nothing happens :(. I would like the modal to disappear of course :)
So second flow has annoying error but same result with not disappearing.
Feels like Im missing something here.
Somebody have an Idea what Im missing?

Related

Livewire Event Causing Route Change Results in Nav Buttons Not Being Active

So I have this Laravel 9 project. In this view below you can see the navigation bar:
The menu above for the active link (Overview) styling (Tailwind) is active via the check below in the view for the component looking at the request information:
#if(request()->is('dashboard/*/overview'))
This works great as the url currently is
localhost/dashboard/{ID}/overview
When clicking the bottom nav link for the Dividends this fires a livewire event for this account as they don't have permissions to access the page. No navigation away from the page Overview is performed. This event is used to setup a popup when the user doesn't have access to a feature. (I have these in a few places)
The issue is that when one of these fires it sets the 'is' check value in the request to
/livewire/message/{COMPONENT_NAME}
This seems to be the expected behaviour of the livewire events. I attempted a similar check using the code below but the same result occurred as the data is still tied to the request.
#if(request()->pathInfo == "dashboard/7/overview")
If anyone knows of another way or a better way I could have the intended functionality so that the button keeps it's 'active' properties after a livewire event has ran, I'd appreciate it :)

How can I show new modal or update the existed one after an input submit in Slack via API?

I need to show new modal after the submit of the previous one, but I need a trigger_id for it, and there is nothing about it after the submit.
I can use views.update API only instead, and I have a valid response, but the submit button closes the window and nothing happens on the client side after it all.
Slack doesn't show an input in modals without a submit button, so I can't use alternative buttons in the modal too, because a user anyway can click on the submit button and it will be closed.
Is it possible to show or update the modal after an input submit? For example, I need to take a data from the input and show it in the modal after, is it possible?
You could try updating the view using the response_action. That needs to happen within 3 seconds, but doesn't require a trigger_id. Docs for that are here.

Modal dialog - refresh the parent page on close modal dialog or submit button

Using Apex 5.1.3
I have everyting working, but I have a requreimet to refresh the entire page (parent page) on the close of the modal page or press submit button.
I have tried quite a few things in dynamic actions on the parent page etc, but nothing is working.
How can I get the parent page to fully refresh when the modal dialog is submitted and closed.
Your help would be most appreciated.
Regards,
Morshed
You could either place a branch after processing on your modal that redirects to the parent page, or create a dynamic action 'on dialog close' on the button/region that invokes the dialog page, which then submits/refreshes the page.
If you think 'nothing is working', put APEX in debug mode, open your browser console, and check if the dynamic actions are actually firing.

How to close modal dialog windows from javascript

I have a page from which modal dialog page gets opened. After page is opened, the user makes some selections and clicks on the button and some javascript gets executed. After it is done, I need to close the modal page. I tried window.close() but it did not work. How can I close the modal dialog page from javascript?
Try this:
apex.navigation.dialog.close(true)
https://docs.oracle.com/cd/E59726_01/doc.50/e39149/javascript_api.htm#AEAPI30096
I have rarely seen the documentation on the method below. I had to read a book to find out.
Try this:
redirect to URL:
javascript:closeModal();
You can also pass the modal parameter if necessary:
javascript:closeModal('P2_HELP_MODAL');
You can also open the same way:
javascript:openModal('P2_HELP_MODAL');

Wicket: Modal Windows and callback functionality

I have a modal window that shows a panel which contains a form that has some textfields and a submit button
on submit an insert into the database occurs and then I have some ajax behaviour that i want to activate on the modal windows containing page on click of the button.
So flow is at present:
click link
modal window appears
user fills out form
user submits form
form data persisted to db
modal window closes
I need it to do this in addition:
activate some ajax behaviour on the page that contains the panel
any help on how best to do this in the wicket way is appreciated.
I resolved this by passing an instance of the page containing the panel to the panel (i.e. - in the constructor), then calling a method on the page from the panel to perform the Ajax update.
I would be interested to see what others have done or to hear if there are issues with the approach I have taken.
Set up a WindowClose callback.
In the WicketStuff project called ModelX (Disclaimer: I'm the developer of that) I have created an IWindowClosedListener interface which has a method:
void windowClosed(Panel panel, AjaxRequestTarget target)
So then any Page or Panel that can open a modal that needs to do something when that modal is closed simply implements that interface and its windowClosed method gets called at the right time.

Resources