Dynamic Conditions for atlassian connect?

I’m not sure if I should ask here, or in the atlassian connect tools thing.

I have an addon created with a webpanel that only shows up when the project_type is service_desk.
Ideally I would like to make this something I can configure in the settings page. Only show up for specific project/project types.

Is this something that can be managed dynamically? Maybe a specific return code to hide the webpanel?

One way to do it would be to have a composite condition that exhibits this logic:

(The project type is "business" and "business" is in the list of selected project types in this other property) OR
(The project type is "service_desk" and "service_desk" is in the list of selected project types in this other property) OR
(The project type is "software" and "software" is in the list of selected project types in this other property)

You’d cringe if you saw that construct in, say, a Java program, but the web panel conditions aren’t exactly Turing-complete, and you can get away with it because there are only three project types.

Interesting interesting.

I was more thinking about the selected project types in this other property bits.

I’ve set attributes for issues in past projects, but issues is too late I think. Is it possible to set attributes on projects? https://developer.atlassian.com/jiradev/jira-platform/building-jira-add-ons/jira-entity-properties-overview only mentions issues

bah, logged in with the wrong account again, it still me~

Oh my wordy, yes indeedy.

1 Like

Okay awesome, I’ll poke around for that.

I also have now seen you can set properties on plugins.

Which would be nicer for me to say “selected project types in this other property” I’m thinking project based on this specific example (now that I know what I’m looking for) - https://developer.atlassian.com/static/connect/docs/latest/concepts/conditions.html#property-conditions-example

My assumption is that you will have a settings page in the Administration area of JIRA - a global administration page rather than a project administration page. The user will select one or more project types on that settings page. Your web panel will appear when the current project context (an issue, say) matches one of the selected project types on your settings page.

If my assumptions are correct, then I’d advise you to store the list of selected project types in add-on properties.

You can set a property on the project (either let admins select all of the projects or just have the project admin toggle on/off):
https://docs.atlassian.com/jira/REST/cloud/#api/2/project/{projectIdOrKey}/properties

Then just use the entity property condition:
https://developer.atlassian.com/static/connect/docs/latest/concepts/conditions.html#property-conditions

1 Like

I love this idea and have it mostly working.

Is there a way to make the rest api for getting projects return properties?

‘/rest/api/2/project?expand=id,key,name,project.properties’
‘/rest/api/2/project?expand=id,key,name,properties’
‘/rest/api/2/project?expand=id,key,name,propertyname

None of those so far have seemed to return the properties. Do I need to use the project/{}/properties call for each project?

Looking at the Schema at https://docs.atlassian.com/jira/REST/cloud/#api/2/project-getAllProjects - I believe you have call the project/{}/properties on by one… :frowning: Doesn’t look like the properties are in the expansions. I would suggest dropping in a feature request at https://ecosystem.atlassian.net/projects/ACJIRA . Unless somebody like @dmeyer knows some other magic trick…

1 Like

No unfortunately we don’t support property expansions in the projects resource right now, to my knowledge.

Sweet. I’ll create a ticket when I have a few min.

Its the configure page, its not going to be hit that often, so shouldn’t be a big deal to do a bunch of requests. We’ll see when I move it to our real instance.

I’ll do a bit more polishing but I think I should be allowed to open source the whole project :smiley: