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

Add Dashboard Support: #72 Add dashboard related actions #73

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
0f45868
Add Dashboard Support: #72 - Create Dashboard
jpavlav Mar 14, 2024
a044aba
Add Dashboard Support: #72 Add Gadget Action
jpavlav Mar 14, 2024
dead5b3
Add Dashboard Support: #72 Add `update_dashboard` Action
jpavlav Mar 14, 2024
62f334f
Add Dashboard Support: #72 Add `update_gadget` Action
jpavlav Mar 14, 2024
9675556
Add Dashboard Support: #72 Add `delete_dashboard` Action
jpavlav Mar 14, 2024
b61a2d4
Add Dashboard Support: #72 Add `remove_gadget` Action
jpavlav Mar 14, 2024
6fc5e44
Add Dashboard Support: #72 Add `get_gadgets` Action
jpavlav Mar 15, 2024
012a030
Change `get_gadgets` to `get_available_gadgets`
jpavlav Mar 15, 2024
bab7b01
Add Dashboard Support: #72 Add `get_dashboard_gadgets` Action
jpavlav Mar 15, 2024
2c5a44e
Add Dashboard Support: #72 Add `copy_dashboard` Action
jpavlav Mar 15, 2024
56e6a54
Add `get_dashboard_item_property_keys` Action #72
jpavlav Mar 15, 2024
e3ef743
Dashboard Support: #72 Add `get_dashboard_item_property` Action
jpavlav Mar 15, 2024
a8b4664
Dashboard Support: #72 Add `set_dashboard_item_property` Action
jpavlav Mar 15, 2024
78540d3
Dashboard Support #72: Add `delete_dashboard_item_property`
jpavlav Mar 15, 2024
ad0be22
Dashboard Support: #72 `update_dashboard_item_property`
jpavlav Mar 15, 2024
a2cbbb7
Dashboard Support: #72 `update_dashboard_automatic_refresh`
jpavlav Mar 15, 2024
1afbe8a
Add Dashboard Support: #72 Tests
jpavlav Mar 15, 2024
e36ab73
Add Dashboard Support: #72 Finishing touches.
jpavlav Mar 15, 2024
8a9af23
Dashboard Support #72: Update `jira` version
jpavlav Mar 25, 2024
8874181
Force Tests
jpavlav Mar 25, 2024
22ad346
Add Dashboard Actions #72: Update
jpavlav Mar 26, 2024
495ed68
Add Dashboard Support #72: CI && Pack bump
jpavlav Mar 26, 2024
2a06827
Add Dashboard Support #72: Try CI again
jpavlav Mar 26, 2024
f26bfe1
Add Dashboard Support #72: Updated CHANGES && Import Paths
jpavlav Mar 26, 2024
fd21727
Add Dashboard Support #72: More pathing issues
jpavlav Mar 26, 2024
b56bb20
Add Dashboard Support #72: Update `release.yaml`
jpavlav Mar 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build_and_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ jobs:
enable-common-libs: true
#apt-cache-version: v0
#py-cache-version: v0
python-version: '["3.8", "3.9"]'
1 change: 1 addition & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
enable-common-libs: true
#apt-cache-version: v0
#py-cache-version: v0
python-version: '["3.8", "3.9"]'

tag_release:
needs: build_and_test
Expand Down
23 changes: 21 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
# Change Log

## 3.0.0

- Drop support for `python 3.6`
- Add new ``jira.add_gadget`` action
- Add new ``jira.copy_dashboard`` action
- Add new ``jira.create_dashboard`` action
- Add new ``jira.delete_dashboard_item_property`` action
- Add new ``jira.delete_dashboard`` action
- Add new ``jira.get_available_gadgets`` action
- Add new ``jira.get_dashboard_gadgets`` action
- Add new ``jira.get_dashboard_item_property_keys`` action
- Add new ``jira.get_dashboard_item_property`` action
- Add new ``jira.remove_gadget`` actionn
- Add new ``jira.set_dashboard_item_property`` action
- Add new ``jira.update_dashboard_automatic_refresh`` action
- Add new ``jira.update_dashboard_item_property`` action
- Add new ``jira.update_dashboard`` action
- Add new ``jira.update_gadget`` action

## 2.6.0

- Add new ``jira.get_issue_links`` action
- Add new ``jira.get_issue_links`` action

- Evaluate if an issue has a priority set before attempting to get the priority

Expand All @@ -17,7 +36,7 @@
## 2.4.2

- Update `formatters.py` to include `priority` field

## 2.4.1

- Update `search_issue` to include `include_components` and `include_subtasks` as flags
Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,21 @@ The sensor monitors for new tickets and sends a trigger into the system whenever
* ``transition_issue`` - Do a transition on a JIRA issue / ticket.
* ``transition_issue_by_name`` - Do a transition on a JIRA issue / ticket.
* ``update_field_value`` - Update a field in a particular JIRA issue.
* ``add_gadget`` - Add a gadget to an existing JIRA dashboard.
* ``copy_dashboard`` - Copy an existing JIRA dashboard
* ``create_dashboard`` - Create a JIRA dashboard
* ``delete_dashboard_item_property`` - Delete a JIRA dashboard item property.
* ``delete_dashboard`` - Delete a JIRA dashboard.
* ``get_available_gadgets`` - Get all available JIRA dashboard gadgets.
* ``get_dashboard_gadgets`` - Get all JIRA dashboard gadgets for an existing dashboard.
* ``get_dashboard_item_property_keys`` - Get the dashboard item (gadget) property keys for an existing dashboard.
* ``get_dashboard_item_property`` - Get a dashboard item (gadget) property from a gadget on JIRA dashboard.
* ``remove_gadget`` - Remove a gadget from a JIRA dashboard.
* ``set_dashboard_item_property`` - Set the value of a dashboard item (gadget) property on a JIRA dashboard.
* ``update_dashboard_automatic_refresh`` - Set the refresh interval for JIRA dashboard in minutes.
* ``update_dashboard_item_property`` - Update the value of a dashboard item (gadget) property on a JIRA dashboard.
* ``update_dashboard`` - Update an existing JIRA dashboard.
* ``update_gadget`` - Update an existing gadget on a JIRA dashboard.

## Maintainers
Active pack maintainers with review & write repository access and expertise with JIRA:
Expand Down
31 changes: 31 additions & 0 deletions actions/add_gadget.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from lib.base import BaseJiraAction
from lib.utils import remove_empty_attributes

__all__ = ["AddGadgetAction"]


class AddGadgetAction(BaseJiraAction):
def run(
self,
dashboard_id,
color=None,
ignore_uri_and_module_key_validation=None,
module_key=None,
position=None,
title=None,
uri=None,
):
data = remove_empty_attributes(
{
"dashboard_id": dashboard_id,
"color": color,
"ignore_uri_and_module_key_validation": ignore_uri_and_module_key_validation,
"module_key": module_key,
"position": position,
"title": title,
"uri": uri,
}
)

gadget = self._client.add_gadget_to_dashboard(**data)
return gadget.raw
53 changes: 53 additions & 0 deletions actions/add_gadget.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
name: add_gadget
runner_type: python-script
description: Add a gadget to a dashboard.
enabled: true
entry_point: add_gadget.py
parameters:
dashboard_id:
type: string
description: The ID of the Dashboard to add the gadget to.
required: true
color:
type: string
description: The color of the gadget.
default: blue
enum:
- blue
- red
- yellow
- green
- cyan
- purple
- gray
- white
required: false
ignore_uri_and_module_key_validation:
type: boolean
description: |
Whether to ignore the validation of the module key and URI.
For example, when a gadget is created that is part of an
application that is not installed.
default: false
required: false
module_key:
type: string
description: |
The module to use in the gadget. Mutually exclusive with `uri`.
required: false
position:
type: object
description: |
A dictionary (object) containing positioning information for the
gadget like - {"column": 0, "row": 0}
required: false
title:
type: string
description: The title of the gadget.
required: false
uri:
type: string
description: |
The uri to the module to use in the gadget. Mutually exclusive
with `uri`.
27 changes: 27 additions & 0 deletions actions/copy_dashboard.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from lib.base import BaseJiraAction
from lib.utils import remove_empty_attributes

__all__ = ["CopyJiraDashboardAction"]


class CopyJiraDashboardAction(BaseJiraAction):
def run(
self,
id,
name,
description=None,
edit_permissions=None,
share_permissions=None,
):
data = remove_empty_attributes(
{
"id": id,
"name": name,
"description": description,
"edit_permissions": edit_permissions,
"share_permissions": share_permissions,
}
)

dashboard = self._client.copy_dashboard(**data)
return dashboard.raw
31 changes: 31 additions & 0 deletions actions/copy_dashboard.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: copy_dashboard
runner_type: python-script
description: Copy an existing JIRA dashboard.
enabled: true
entry_point: copy_dashboard.py
parameters:
id:
type: string
description: The ID of the Dashboard to copy.
required: true
name:
type: string
description: The name of the new dashboard.
required: true
description:
type: string
description: A description of the dashboard.
required: false
edit_permissions:
type: array
items:
type: object
required: false
description: A list of permission objects to grant editing permissions.
share_permissions:
type: array
items:
type: object
required: false
description: A list of permissions objects to grant sharing permissions.
21 changes: 21 additions & 0 deletions actions/create_dashboard.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from lib.base import BaseJiraAction
from lib.utils import remove_empty_attributes

__all__ = ["CreateJiraDashboardAction"]


class CreateJiraDashboardAction(BaseJiraAction):
def run(
self, name, description=None, edit_permissions=None, share_permissions=None
):
data = remove_empty_attributes(
{
"name": name,
"description": description,
"edit_permissions": edit_permissions,
"share_permissions": share_permissions,
}
)

dashboard = self._client.create_dashboard(**data)
return dashboard.raw
27 changes: 27 additions & 0 deletions actions/create_dashboard.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: create_dashboard
runner_type: python-script
description: Create a new JIRA dashboard.
enabled: true
entry_point: create_dashboard.py
parameters:
name:
type: string
description: The name of the new dashboard.
required: true
description:
type: string
description: A description of the dashboard.
required: false
edit_permissions:
type: array
items:
type: object
required: false
description: A list of permission objects to grant editing permissions.
share_permissions:
type: array
items:
type: object
required: false
description: A list of permissions objects to grant sharing permissions.
11 changes: 11 additions & 0 deletions actions/delete_dashboard.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from lib.base import BaseJiraAction

__all__ = ["DeleteJiraDashboardAction"]


class DeleteJiraDashboardAction(BaseJiraAction):
def run(self, dashboard_id):
dashboard = self._client.dashboard(dashboard_id)
response = dashboard.delete()
result = {"status_code": response.status_code, "response_text": response.text}
return bool(response.status_code == 204), result
15 changes: 15 additions & 0 deletions actions/delete_dashboard_item_property.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from lib.base import BaseJiraAction

__all__ = ["DeleteDashboardItemPropertyAction"]


class DeleteDashboardItemPropertyAction(BaseJiraAction):
def run(self, dashboard_id, item_id, property_key):
dashboard_item_property = self._client.dashboard_item_property(
dashboard_id,
item_id,
property_key,
)
response = dashboard_item_property.delete(dashboard_id, item_id)
result = {"status_code": response.status_code, "response_text": response.text}
return bool(response.status_code == 204), result
19 changes: 19 additions & 0 deletions actions/delete_dashboard_item_property.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: delete_dashboard_item_property
runner_type: python-script
description: Delete the property of an item (gadget) on a dashboard.
enabled: true
entry_point: delete_dashboard_item_property.py
parameters:
dashboard_id:
type: string
description: The ID of the Dashboard.
required: true
item_id:
type: string
description: The ID of the dashboard item (gadget).
required: true
property_key:
type: string
description: The item property key.
required: true
11 changes: 11 additions & 0 deletions actions/delete_dashbord.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: delete_dashboard
runner_type: python-script
description: delete an existing JIRA dashboard.
enabled: true
entry_point: delete_dashboard.py
parameters:
dashboard_id:
type: string
description: The ID of the Dashboard to delete.
required: true
9 changes: 9 additions & 0 deletions actions/get_available_gadgets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from lib.base import BaseJiraAction

__all__ = ["GetAvailableGadgetsAction"]


class GetAvailableGadgetsAction(BaseJiraAction):
def run(self):
gadgets = self._client.all_dashboard_gadgets()
return [gadget.raw for gadget in gadgets]
6 changes: 6 additions & 0 deletions actions/get_available_gadgets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
name: get_available_gadgets
runner_type: python-script
description: Get a list of available gadgets.
enabled: true
entry_point: get_available_gadgets.py
9 changes: 9 additions & 0 deletions actions/get_dashboard_gadgets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from lib.base import BaseJiraAction

__all__ = ["GetDashboardGadgetsAction"]


class GetDashboardGadgetsAction(BaseJiraAction):
def run(self, dashboard_id):
gadgets = self._client.dashboard_gadgets(dashboard_id)
return [gadget.raw for gadget in gadgets]
11 changes: 11 additions & 0 deletions actions/get_dashboard_gadgets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: get_dashboard_gadgets
runner_type: python-script
description: Get all the gadgets on a dashboard.
enabled: true
entry_point: get_dashboard_gadgets.py
parameters:
dashboard_id:
type: string
description: The ID of the Dashboard get gadgets from.
required: true
11 changes: 11 additions & 0 deletions actions/get_dashboard_item_property.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from lib.base import BaseJiraAction

__all__ = ["GetDashboardItemPropertyAction"]


class GetDashboardItemPropertyAction(BaseJiraAction):
def run(self, dashboard_id, item_id, property_key):
dashboard_item_property = self._client.dashboard_item_property(
dashboard_id, item_id, property_key
)
return dashboard_item_property.raw
19 changes: 19 additions & 0 deletions actions/get_dashboard_item_property.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: get_dashboard_item_property
runner_type: python-script
description: Get the property of an item (gadget) on a dashboard.
enabled: true
entry_point: get_dashboard_item_property.py
parameters:
dashboard_id:
type: string
description: The ID of the Dashboard.
required: true
item_id:
type: string
description: The ID of the dashboard item (gadget).
required: true
property_key:
type: string
description: The item property key.
required: true
Loading
Loading