Hi Kasun,
I understand what you said earlier. What happens is that the Application
Progress window and Application Creation page are both displayed in
parallel. Therefore by setting the notification timeout as follows I will
be able to keep the notification displayed for 3.5 seconds.
jagg.message({content: "Displayed Message", type: 'info', timeout: 3500});
And I can postpone redirecting to the application home page by increasing
the time out at [1] to 4500 ms. The setTimeout() method after displaying
the notification is unnecessary.
Although I have a question as to how both elements are rendered in
parallel. Is it done from the method executeAsync as in [2].?
Thanks for your help.
[1]
https://github.com/wso2/app-cloud/blob/master/modules/jaggeryapps/appmgt/src/site/themes/default/templates/application/template.jag#L360
[2]
https://github.com/wso2/app-cloud/blob/master/modules/jaggeryapps/appmgt/src/site/themes/default/templates/application/template.jag#L186
Regards.
On Sun, May 1, 2016 at 11:11 PM, Sabra Ossen <[email protected]> wrote:
> Hi Kasun,
>
> I am writing it in
> jaggeryapps/appmgt/src/site/themes/default/templates/application/template.jag
> within [1] when the application creation request is submitted (after
> clicking "Create"). So basically does creating the application and showing
> the notification happen in two separate threads? So according to my code 20
> seconds after the application creation is complete the page will be
> redirected to the application home page and the notification will be shown
> for a for only a few seconds, which is what anyways happen.
>
> What I am trying to achieve is to display the notification for a time
> period of about 5 (or any amount of time until we can assure the user saw
> the notification) seconds and then allow the page to be redirected to the
> application home page.
>
> [1]
> https://github.com/wso2/app-cloud/blob/master/modules/jaggeryapps/appmgt/src/site/themes/default/templates/application/template.jag#L241
>
> On Thu, Apr 28, 2016 at 9:23 PM, Kasun De Silva <[email protected]> wrote:
>
>>
>> ​Hi Sabra,
>>
>> Where are you writing this ? There is a separate method to check
>> application creation status and it does it in a parallel thread. Anything
>> you have to do regarding application creation status, you have to write it
>> here. And obviously red highlighted line will overriding your code after
>> application creation completes.
>>
>> check function pollEvents() in
>> jaggeryapps/appmgt/src/site/themes/default/templates/application/template.jag.
>>
>>
>>
>> ​​
>>> for(var i = 0; i < result.length; i++){
>>> var statusStyle;
>>> var event = result[i];
>>> if(event.name === "Status" && event.status ==
>>> "success"){
>>> setTimeout(redirectAppHome, 2000);
>>> function redirectAppHome(){
>>>
>>> window.location.replace("home.jag?applicationName="
>>> + $("#applicationName").val());
>>> }
>>> } else if(event.status == "failed"){
>>> var alert = "<p>Application creation failed.
>>> </p><p>Reason: " + event.description + "</p>";
>>> var retry_button = "<button type=\"button\"
>>> class=\"btn btn-primary\" data-dismiss=\"modal\"
>>> onclick=\"redirectAppListing();\">cancel</button>" +
>>> "<button type=\"button\"
>>> class=\"btn btn-primary\" data-dismiss=\"modal\"
>>> onclick=\"retryAppCreation();\">Back to Application Creation</button>";
>>> setTimeout(showErrorPopup, 2000);
>>> function showErrorPopup(){
>>> $("#app-creation-model-body").html(alert);
>>> $("#app-creation-model-footer"
>>> ).html(retry_button);
>>> }
>>> }
>>> }​
>>
>>
>> On Thu, Apr 28, 2016 at 4:53 AM, Sabra Ossen <[email protected]> wrote:
>>
>>> Hi All,
>>>
>>> I am using the setTimeout() method to delay redirection to the
>>> application homepage after creating a new application version. The code is
>>> as follows.
>>>
>>> $.ajax({
>>> url: $(this).attr("action"),
>>> type: 'POST',
>>> data: formData,
>>> async: true,
>>> success: function (data) {
>>> if(isNewVersion){
>>> jagg.message({content: "Displayed Message.", type: 'info'});
>>> setTimeout(redirectAppHome, 20000);
>>> function redirectAppHome(){
>>> window.location.replace("home.jag?applicationKey=" +
>>> applicationHashId);
>>> }
>>> }
>>> },
>>> cache: false,
>>> contentType: false,
>>> processData: false
>>> });
>>>
>>>
>>> Note that this notification is given after the successful creation of an
>>> application. According to the code it should be redirected to the
>>> application home page after 20 seconds. I even tested out with giving a
>>> number such as 1000 seconds, but still within 2 or 3 seconds of displaying
>>> the message ("Displayed Message") the page gets redirected.
>>>
>>> Any help on understanding the issue is appreciated.
>>>
>>> Thanks and Regards.
>>> --
>>> *Sabra Ossen*
>>> *Software Engineer*
>>> Email: [email protected]
>>> Mobile: +94 767 837356
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> [email protected]
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> *Kasun de Silva*
>> Software Engineer | *WSO2 Inc.*; http://wso2.com
>> lean.enterprise.middleware
>>
>> email : [email protected]
>> mobile : +94 77 794 4260
>>
>>
>
>
> --
> *Sabra Ossen*
> *Software Engineer*
> Email: [email protected]
> Mobile: +94 767 837356
>
--
*Sabra Ossen*
*Software Engineer*
Email: [email protected]
Mobile: +94 767 837356
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev