Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Message dialog web-item

T I
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 2, 2013

Hi,

I need my plugin to show a message like the one after you created a issue.

"Issue XXX has been successfully created."

My plugin is a web-item+webwork.

I tried it by adding styleClass to my web-item:

<styleClass>custom-context</styleClass>

web-resources:

  <web-resource key="last-check-updater-resources" name="last-check-updater Web Resources">
    <dependency>com.atlassian.auiplugin:ajs</dependency>
    <resource type="download" name="last-check-updater.css" location="/css/last-check-updater.css"/>
    <resource type="download" name="last-check-updater.js" location="/js/last-check-updater.js"/>
    <resource type="download" name="images/" location="/images"/>
    <context>last-check-updater</context>
  </web-resource>

.js:

AJS.messages.generic("#custom-context", {
   title:"Custom Context Demo",
   body: '&lt;p&gt;Because you often need to specify where the message goes.&lt;/p&gt;'
});

But the message doesn't show up.

Is it the right way to do own messages or is there some other solution?

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Mizan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 5, 2013

I assume you want to display a message box after your action is completed , right ?

If yes , you will need to add a script somthing similar to this in the .vm file which is returned after the action (webwork).

T I
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 7, 2013

I don't use a .vm for this plugin. My plugin just updates a custom field and I want to display a notification after it's done. Is it possible to start .js from java?

Maybe start the .js as return in the below method?

public String doUpdate() throws Exception {
    	
    	if (customFieldManager.getCustomFieldObjectByName(LastCheckUpdater.CUSTOM_FIELD_LAST_CHECK) != null) {
    		issue = getCurrentIssue();
    		lastCheckField = customFieldManager.getCustomFieldObjectByName(LastCheckUpdater.CUSTOM_FIELD_LAST_CHECK);
    		fieldLayoutItem = fieldLayoutManager.getFieldLayout(issue).getFieldLayoutItem(lastCheckField);
    		lastCheckFieldValue = issue.getCustomFieldValue(lastCheckField);
    		modifiedValue = new ModifiedValue(lastCheckFieldValue, new Timestamp(new Date().getTime()));
    		lastCheckField.updateValue(fieldLayoutItem, issue, modifiedValue, new DefaultIssueChangeHolder());
    	}
    	
    	return returnComplete("/browse/"+getCurrentIssue().getKey());
    }

Mizan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 7, 2013

You can add a view to your webwork plugin module .. this view will be a VM file in that vm file you can add a js which will display a message . refer the webwork plugin module documentation

https://developer.atlassian.com/display/JIRADEV/Webwork+plugin+module

see the view attribute

T I
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 7, 2013

This is my atlassian-plugin.xml:

&lt;web-item name="Last-Check-Button" i18n-name-key="last---check---button.name" key="last---check---button" section="operations-top-level" weight="19"&gt;
    &lt;description key="last---check---button.description"&gt;The Last-Check-Button Plugin&lt;/description&gt;
    &lt;label key="last---check---button.label"/&gt;
    &lt;link linkId="last---check---button-link"&gt;/secure/LastCheckWebWorkAction!Update.jspa?id=${issue.key}&lt;/link&gt;
    &lt;tooltip key="last---check---button.tooltip"/&gt;
    &lt;conditions type="and"&gt;
    	&lt;condition class="com.capgemini.plugins.jira.webwork.RiskIssueCondition" /&gt;
    	&lt;condition class="com.atlassian.jira.plugin.webfragment.conditions.IsIssueUnresolvedCondition" /&gt;
   	&lt;/conditions&gt;  
   	&lt;styleClass&gt;last-check-updater&lt;/styleClass&gt;
  &lt;/web-item&gt;
    
  &lt;webwork1 key="last-check-web-work" name="LastCheckWebWork" i18n-name-key="last-check-web-work.name"&gt;
    &lt;description key="last-check-web-work.description"&gt;The LastCheckWebWork Plugin&lt;/description&gt;
    &lt;actions&gt;
      &lt;action name="com.capgemini.plugins.jira.webwork.LastCheckWebWorkAction" alias="LastCheckWebWorkAction"&gt;
      &lt;/action&gt;
    &lt;/actions&gt;
  &lt;/webwork1&gt;

I have a web-item and a webwork. Now I just need something to start a message like the one JIRA gives you after "Issue created".

0 votes
Colin Goudie
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 5, 2013

Did something go wrong with your paste of the code? It looks like you have XML and Javascript mashed together. Was this intentional?

TAGS
AUG Leaders

Atlassian Community Events