Skip to content

Commit a45a2e5

Browse files
authored
Add Dashboard Support: #72 Add dashboard related actions (#73)
* Add Dashboard Support: #72 - Create Dashboard Added `create_dashboard` action. * Add Dashboard Support: #72 Add Gadget Action * Added `add_gadget` action. Allows the user to add a gadget to an existing dashboard. * Add Dashboard Support: #72 Add `update_dashboard` Action * Added `update_dashboard` action. It accepts parameters for the update, fetches the dashboard by `id`, runs the `update` method on the `dashboard` resource and returns it's `raw` result (`json` result from the API) * Add Dashboard Support: #72 Add `update_gadget` Action * Added `update_gadget` action to allow a user to modify an existing gadget on a dashboard. * Add Dashboard Support: #72 Add `delete_dashboard` Action * Added an action to delete dashboards by `id`. The `jira` library only returns the raw `requests` response in this case. The return is a dictionary containing the response status code and any text that was included with the response. The action fails if any status code other than 204 is produced. * Add Dashboard Support: #72 Add `remove_gadget` Action * Added `remove_gadget` action to allow users to delete gadgets from dashboards. * Add Dashboard Support: #72 Add `get_gadgets` Action * The `get_gadgets` action just pulls the available list of gadgets from the `jira` instance. This commit also includes a fix to the description of the `remove_gadget` yaml. * Change `get_gadgets` to `get_available_gadgets` This is more in keeping with the API. * Add Dashboard Support: #72 Add `get_dashboard_gadgets` Action * The `get_dashboard_gadgets` action differs from the `get_available_gadgets` action in that, it targets a specific dashboard and returns only the gadgets present on that dashboard. * Add Dashboard Support: #72 Add `copy_dashboard` Action * Added the `copy_dashboard` action. * Updated some descriptions in `update_dashboard` and `create_dashboard` yaml files. * Add `get_dashboard_item_property_keys` Action #72 * Added `get_dashboard_item_property_keys`. This returns a list of dashboard item property keys which are used to identify metadata stores on a given dashboard item (gadget). * Dashboard Support: #72 Add `get_dashboard_item_property` Action * Added `get_dashboard_item_property` action. This gets a dashboard item (gadget) property by key. Typically these hold user specified metadata, or in the case of some gadgets the `config` key can be sent a payload to configure an otherwise unconfigured gadget. * Dashboard Support: #72 Add `set_dashboard_item_property` Action * Allows the user to set the values of item properties on a given dashboard item (gadget). An example of this would be a configuration for a dashboard gadget that is configured with a `Filter Result` module. * Dashboard Support #72: Add `delete_dashboard_item_property` * Added `delete_dashboard_item_property`. Allows the user to delete a dashboard item property (like a config object on a filter module on a gadget). * Dashboard Support: #72 `update_dashboard_item_property` * Added `update_dashboard_item_property` action. This differs from `set_dashboard_item_property` in that, it updates the existing object attributes, instead of simply replacing them. Good for updating specific fields on gadget configuration items. * Dashboard Support: #72 `update_dashboard_automatic_refresh` * Added `update_dashboard_automatic_refresh` action. This let's the user set how often the dashboard refreshes in minutes. * Add Dashboard Support: #72 Tests Added tests for all of the new actions. Included some new fixtures as well for those tests. The report is as follows: ``` (st2) root@e74c68fe6ffa:/opt/stackstorm/packs.dev/jira# st2-run-pack-tests -j -t -c -p /opt/stackstorm/packs.dev/jira Running tests for pack: jira Activating virtualenv in /tmp/st2-pack-tests-virtualenvs/jira... ::/opt/stackstorm/packs.dev/jira/sensors/:/opt/stackstorm/packs.dev/jira/actions/:/opt/stackstorm/packs.dev/jira/actions/lib/:/opt/stackstorm/packs.dev/jira/etc/ WARNING: You are using pip version 20.3.3; however, version 24.0 is available. You should consider upgrading via the '/tmp/st2-pack-tests-virtualenvs/jira/bin/python -m pip install --upgrade pip' command. Running tests... test_add_gadget (tests.test_action_add_gadget.AddGadgetTests) ... passed test_copy_dashboard (tests.test_action_copy_dashboard.CopyDashboardTests) ... passed test_create_dashboard (tests.test_action_create_dashboard.CreateDashboardTests) ... passed test_delete_dashboard (tests.test_action_delete_dashboard.DeleteDashboardTests) ... passed test_delete_dashboard_item_property (tests.test_action_delete_dashboard_item_property.DeleteDashboardItemPropertyTest) ... passed test_get_available_gadgets (tests.test_action_get_available_gadgets.GetAvailableGadgetsTests) ... passed test_get_dashboard_gadgets (tests.test_action_get_dashboard_gadgets.GetDashboardGadgetsTest) ... passed test_get_dashboard_item_property (tests.test_action_get_dashboard_item_property.GetDashboardItemPropertyTests) ... passed test_get_dashboard_item_property_keys (tests.test_action_get_dashboard_item_property_keys.GetDashboardItemPropertyKeysTests) ... passed test_remove_gadget (tests.test_action_remove_gadget.RemoveGadgetTests) ... passed test_run_with_invalid_action (tests.test_action_run.RunTestCase) ... passed test_run_with_jira_exception (tests.test_action_run.RunTestCase) ... passed test_run_without_exception (tests.test_action_run.RunTestCase) ... passed test_transition_name_to_id (tests.test_action_run.RunTestCase) ... passed test_get_dashboard_item_property (tests.test_action_set_dashboard_item_property.SetDashboardItemPropertyTests) ... passed test_update_dashboard (tests.test_action_update_dashboard.UpdateDashboardTests) ... passed test_update_dashboard_automatic_refresh (tests.test_action_update_dashboard_automatic_refresh.UpdateJiraDashboardAutomaticRefreshActionDashboardTests) ... passed test_set_dashboard_item_property (tests.test_action_update_dashboard_property.UpdateDashboardItemPropertyTests) ... passed test_update_gadget (tests.test_action_update_gadget.UpdateGadgetTests) ... passed test_poll (tests.test_sensor_jira_sensor.JIRASensorTestCase) ... passed test_poll (tests.test_sensor_jira_sensor_for_apiv2.JIRASensorForAPIv2TestCase) ... passed TEST RESULT OUTPUT: Name Stmts Miss Cover ------------------------------------------------------------------- actions/add_field_value.py 8 8 0% actions/add_gadget.py 8 0 100% actions/attach_file_to_issue.py 10 10 0% actions/attach_files_to_issue.py 11 11 0% actions/bulk_link_issue.py 27 27 0% actions/comment_issue.py 8 8 0% actions/copy_dashboard.py 8 0 100% actions/create_dashboard.py 8 0 100% actions/create_issue.py 14 14 0% actions/delete_dashboard.py 8 0 100% actions/delete_dashboard_item_property.py 8 0 100% actions/get_available_gadgets.py 6 0 100% actions/get_dashboard_gadgets.py 6 0 100% actions/get_dashboard_item_property.py 6 0 100% actions/get_dashboard_item_property_keys.py 6 0 100% actions/get_issue.py 8 8 0% actions/get_issue_attachments.py 11 11 0% actions/get_issue_comments.py 11 11 0% actions/get_issue_links.py 8 8 0% actions/lib/__init__.py 0 0 100% actions/lib/base.py 41 21 49% actions/lib/formatters.py 57 57 0% actions/lib/utils.py 4 0 100% actions/link_issue.py 6 6 0% actions/remove_gadget.py 9 0 100% actions/run.py 21 3 86% actions/search_issues.py 10 10 0% actions/set_dashboard_item_property.py 6 0 100% actions/transition_issue.py 6 6 0% actions/update_dashboard.py 9 0 100% actions/update_dashboard_automatic_refresh.py 7 0 100% actions/update_dashboard_item_property.py 7 0 100% actions/update_field_value.py 8 8 0% actions/update_gadget.py 10 0 100% sensors/jira_sensor.py 97 45 54% sensors/jira_sensor_for_apiv2.py 96 45 53% ------------------------------------------------------------------- TOTAL 574 317 45% [success] 16.58% tests.test_action_run.RunTestCase.test_run_without_exception: 0.0253s [success] 6.88% tests.test_action_add_gadget.AddGadgetTests.test_add_gadget: 0.0105s [success] 5.61% tests.test_action_delete_dashboard_item_property.DeleteDashboardItemPropertyTest.test_delete_dashboard_item_property: 0.0086s [success] 5.45% tests.test_action_update_gadget.UpdateGadgetTests.test_update_gadget: 0.0083s [success] 5.38% tests.test_action_create_dashboard.CreateDashboardTests.test_create_dashboard: 0.0082s [success] 5.22% tests.test_action_get_available_gadgets.GetAvailableGadgetsTests.test_get_available_gadgets: 0.0080s [success] 5.22% tests.test_action_copy_dashboard.CopyDashboardTests.test_copy_dashboard: 0.0080s [success] 5.09% tests.test_action_update_dashboard_property.UpdateDashboardItemPropertyTests.test_set_dashboard_item_property: 0.0078s [success] 5.06% tests.test_action_delete_dashboard.DeleteDashboardTests.test_delete_dashboard: 0.0077s [success] 4.80% tests.test_action_set_dashboard_item_property.SetDashboardItemPropertyTests.test_get_dashboard_item_property: 0.0073s [success] 4.76% tests.test_action_get_dashboard_gadgets.GetDashboardGadgetsTest.test_get_dashboard_gadgets: 0.0073s [success] 4.68% tests.test_action_get_dashboard_item_property.GetDashboardItemPropertyTests.test_get_dashboard_item_property: 0.0071s [success] 4.66% tests.test_action_remove_gadget.RemoveGadgetTests.test_remove_gadget: 0.0071s [success] 4.64% tests.test_action_update_dashboard_automatic_refresh.UpdateJiraDashboardAutomaticRefreshActionDashboardTests.test_update_dashboard_automatic_refresh: 0.0071s [success] 4.45% tests.test_action_update_dashboard.UpdateDashboardTests.test_update_dashboard: 0.0068s [success] 4.09% tests.test_action_get_dashboard_item_property_keys.GetDashboardItemPropertyKeysTests.test_get_dashboard_item_property_keys: 0.0063s [success] 2.27% tests.test_action_run.RunTestCase.test_transition_name_to_id: 0.0035s [success] 2.25% tests.test_action_run.RunTestCase.test_run_with_jira_exception: 0.0034s [success] 1.90% tests.test_action_run.RunTestCase.test_run_with_invalid_action: 0.0029s [success] 0.51% tests.test_sensor_jira_sensor_for_apiv2.JIRASensorForAPIv2TestCase.test_poll: 0.0008s [success] 0.50% tests.test_sensor_jira_sensor.JIRASensorTestCase.test_poll: 0.0008s ----------------------------------------------------------------------------- 21 tests run in 0.159 seconds (21 tests passed) ``` All changes are covered at 100%. * Add Dashboard Support: #72 Finishing touches. * Updated `CHANGES.md` * Updated `README.md` * Bumped `pack` version. * Committed missed addition to `test/lib/actions.py` * Dashboard Support #72: Update `jira` version The changes necessary for these pack updates have been merged into the `jira` package and that package has had a release to `pypi`. * Force Tests * Add Dashboard Actions #72: Update Had to update some tests/class references/method calls to match the final interface over in the `jira` lib. * `Gadget` renamed to `DashboardGadget`. * `gadgets` method renamed to `all_dashboard_gadgets`. * Update `%s/update_dashboard_automatic_refresh_seconds/update_dashboard/automatic_refresh_minutes` * Add Dashboard Support #72: CI && Pack bump The latest versions of the `jira` library require `python >= 3.8`. In light of the fact that `StackStorm` is going to shed support for `python3.6` (which is EOL https://www.python.org/downloads/release/python-360/) this pack is updating to stop testing `3.6` and bumping the pack to the next major version to signal a potentially breaking change. * Add Dashboard Support #72: Try CI again Cutting this down to the lowest common denominator in terms of working tests for `StackStorm`. `3.11` is breaking on installing some dev dependencies: ``` ERROR: Command errored out with exit status 1: command: /home/runner/virtualenv/bin/python /home/runner/virtualenv/lib/python3.11/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmp_5anenlq cwd: /tmp/pip-install-mj_5c6wi/pyyaml_3973c6602d81416aa8ada0b8d43f48a5 Complete output (54 lines): running egg_info writing lib3/PyYAML.egg-info/PKG-INFO writing dependency_links to lib3/PyYAML.egg-info/dependency_links.txt writing top-level names to lib3/PyYAML.egg-info/top_level.txt Traceback (most recent call last): File "/home/runner/virtualenv/lib/python3.11/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module> main() File "/home/runner/virtualenv/lib/python3.11/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main json_out['return_val'] = hook(**hook_input['kwargs']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/runner/virtualenv/lib/python3.11/site-packages/pip/_vendor/pep517/_in_process.py", line 114, in get_requires_for_build_wheel return hook(config_settings) ^^^^^^^^^^^^^^^^^^^^^ File "/tmp/pip-build-env-e17od6z2/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=['wheel']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/pip-build-env-e17od6z2/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires self.run_setup() File "/tmp/pip-build-env-e17od6z2/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 311, in run_setup exec(code, locals()) File "<string>", line 271, in <module> File "/tmp/pip-build-env-e17od6z2/overlay/lib/python3.11/site-packages/setuptools/__init__.py", line 104, in setup return distutils.core.setup(**attrs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/pip-build-env-e17od6z2/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 185, in setup return run_commands(dist) ^^^^^^^^^^^^^^^^^^ File "/tmp/pip-build-env-e17od6z2/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 201, in run_commands dist.run_commands() File "/tmp/pip-build-env-e17od6z2/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands self.run_command(cmd) File "/tmp/pip-build-env-e17od6z2/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 967, in run_command super().run_command(command) File "/tmp/pip-build-env-e17od6z2/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command cmd_obj.run() File "/tmp/pip-build-env-e17od6z2/overlay/lib/python3.11/site-packages/setuptools/command/egg_info.py", line 321, in run self.find_sources() File "/tmp/pip-build-env-e17od6z2/overlay/lib/python3.11/site-packages/setuptools/command/egg_info.py", line 329, in find_sources mm.run() File "/tmp/pip-build-env-e17od6z2/overlay/lib/python3.11/site-packages/setuptools/command/egg_info.py", line 550, in run self.add_defaults() File "/tmp/pip-build-env-e17od6z2/overlay/lib/python3.11/site-packages/setuptools/command/egg_info.py", line 588, in add_defaults sdist.add_defaults(self) File "/tmp/pip-build-env-e17od6z2/overlay/lib/python3.11/site-packages/setuptools/command/sdist.py", line 102, in add_defaults super().add_defaults() File "/tmp/pip-build-env-e17od6z2/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/sdist.py", line 251, in add_defaults self._add_defaults_ext() File "/tmp/pip-build-env-e17od6z2/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/sdist.py", line 336, in _add_defaults_ext self.filelist.extend(build_ext.get_source_files()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<string>", line 201, in get_source_files File "/tmp/pip-build-env-e17od6z2/overlay/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 107, in __getattr__ raise AttributeError(attr) AttributeError: cython_sources ---------------------------------------- ERROR: Command errored out with exit status 1: /home/runner/virtualenv/bin/python /home/runner/virtualenv/lib/python3.11/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmp_5anenlq Check the logs for full command output. WARNING: You are using pip version 20.3.3; however, version 24.0 is available. You should consider upgrading via the '/home/runner/virtualenv/bin/python -m pip install --upgrade pip' command. ``` * Add Dashboard Support #72: Updated CHANGES && Import Paths This PR updates the CHANGES.md to include the deprecation of `python 3.6`. Further, it updates the paths to the `utils` function `remove_empty_attributes`. The test set up puts the * Add Dashboard Support #72: More pathing issues Turns out the `.gitignore` ignores the `lib/` dir. This applies to the `lib` dir within the `actions` dir. Caused me to miss the fact that I didn't actually commit the `utils.py` file. * Add Dashboard Support #72: Update `release.yaml` I just realized the `release.yaml` GHA also uses the upstream `pack-build_and_test` workflow. It would have failed when an attempt was released because of our now deprecating `python 3.6`. Updating this to mirror the `build_and_test.yaml` workflow.
1 parent c3de69a commit a45a2e5

File tree

57 files changed

+1106
-8
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1106
-8
lines changed

.github/workflows/build_and_test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ jobs:
1515
enable-common-libs: true
1616
#apt-cache-version: v0
1717
#py-cache-version: v0
18+
python-version: '["3.8", "3.9"]'

.github/workflows/release.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
enable-common-libs: true
1919
#apt-cache-version: v0
2020
#py-cache-version: v0
21+
python-version: '["3.8", "3.9"]'
2122

2223
tag_release:
2324
needs: build_and_test

CHANGES.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,27 @@
11
# Change Log
22

3+
## 3.0.0
4+
5+
- Drop support for `python 3.6`
6+
- Add new ``jira.add_gadget`` action
7+
- Add new ``jira.copy_dashboard`` action
8+
- Add new ``jira.create_dashboard`` action
9+
- Add new ``jira.delete_dashboard_item_property`` action
10+
- Add new ``jira.delete_dashboard`` action
11+
- Add new ``jira.get_available_gadgets`` action
12+
- Add new ``jira.get_dashboard_gadgets`` action
13+
- Add new ``jira.get_dashboard_item_property_keys`` action
14+
- Add new ``jira.get_dashboard_item_property`` action
15+
- Add new ``jira.remove_gadget`` actionn
16+
- Add new ``jira.set_dashboard_item_property`` action
17+
- Add new ``jira.update_dashboard_automatic_refresh`` action
18+
- Add new ``jira.update_dashboard_item_property`` action
19+
- Add new ``jira.update_dashboard`` action
20+
- Add new ``jira.update_gadget`` action
21+
322
## 2.6.0
423

5-
- Add new ``jira.get_issue_links`` action
24+
- Add new ``jira.get_issue_links`` action
625

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

@@ -17,7 +36,7 @@
1736
## 2.4.2
1837

1938
- Update `formatters.py` to include `priority` field
20-
39+
2140
## 2.4.1
2241

2342
- Update `search_issue` to include `include_components` and `include_subtasks` as flags

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,21 @@ The sensor monitors for new tickets and sends a trigger into the system whenever
131131
* ``transition_issue`` - Do a transition on a JIRA issue / ticket.
132132
* ``transition_issue_by_name`` - Do a transition on a JIRA issue / ticket.
133133
* ``update_field_value`` - Update a field in a particular JIRA issue.
134+
* ``add_gadget`` - Add a gadget to an existing JIRA dashboard.
135+
* ``copy_dashboard`` - Copy an existing JIRA dashboard
136+
* ``create_dashboard`` - Create a JIRA dashboard
137+
* ``delete_dashboard_item_property`` - Delete a JIRA dashboard item property.
138+
* ``delete_dashboard`` - Delete a JIRA dashboard.
139+
* ``get_available_gadgets`` - Get all available JIRA dashboard gadgets.
140+
* ``get_dashboard_gadgets`` - Get all JIRA dashboard gadgets for an existing dashboard.
141+
* ``get_dashboard_item_property_keys`` - Get the dashboard item (gadget) property keys for an existing dashboard.
142+
* ``get_dashboard_item_property`` - Get a dashboard item (gadget) property from a gadget on JIRA dashboard.
143+
* ``remove_gadget`` - Remove a gadget from a JIRA dashboard.
144+
* ``set_dashboard_item_property`` - Set the value of a dashboard item (gadget) property on a JIRA dashboard.
145+
* ``update_dashboard_automatic_refresh`` - Set the refresh interval for JIRA dashboard in minutes.
146+
* ``update_dashboard_item_property`` - Update the value of a dashboard item (gadget) property on a JIRA dashboard.
147+
* ``update_dashboard`` - Update an existing JIRA dashboard.
148+
* ``update_gadget`` - Update an existing gadget on a JIRA dashboard.
134149

135150
## Maintainers
136151
Active pack maintainers with review & write repository access and expertise with JIRA:

actions/add_gadget.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
from lib.base import BaseJiraAction
2+
from lib.utils import remove_empty_attributes
3+
4+
__all__ = ["AddGadgetAction"]
5+
6+
7+
class AddGadgetAction(BaseJiraAction):
8+
def run(
9+
self,
10+
dashboard_id,
11+
color=None,
12+
ignore_uri_and_module_key_validation=None,
13+
module_key=None,
14+
position=None,
15+
title=None,
16+
uri=None,
17+
):
18+
data = remove_empty_attributes(
19+
{
20+
"dashboard_id": dashboard_id,
21+
"color": color,
22+
"ignore_uri_and_module_key_validation": ignore_uri_and_module_key_validation,
23+
"module_key": module_key,
24+
"position": position,
25+
"title": title,
26+
"uri": uri,
27+
}
28+
)
29+
30+
gadget = self._client.add_gadget_to_dashboard(**data)
31+
return gadget.raw

actions/add_gadget.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
name: add_gadget
3+
runner_type: python-script
4+
description: Add a gadget to a dashboard.
5+
enabled: true
6+
entry_point: add_gadget.py
7+
parameters:
8+
dashboard_id:
9+
type: string
10+
description: The ID of the Dashboard to add the gadget to.
11+
required: true
12+
color:
13+
type: string
14+
description: The color of the gadget.
15+
default: blue
16+
enum:
17+
- blue
18+
- red
19+
- yellow
20+
- green
21+
- cyan
22+
- purple
23+
- gray
24+
- white
25+
required: false
26+
ignore_uri_and_module_key_validation:
27+
type: boolean
28+
description: |
29+
Whether to ignore the validation of the module key and URI.
30+
For example, when a gadget is created that is part of an
31+
application that is not installed.
32+
default: false
33+
required: false
34+
module_key:
35+
type: string
36+
description: |
37+
The module to use in the gadget. Mutually exclusive with `uri`.
38+
required: false
39+
position:
40+
type: object
41+
description: |
42+
A dictionary (object) containing positioning information for the
43+
gadget like - {"column": 0, "row": 0}
44+
required: false
45+
title:
46+
type: string
47+
description: The title of the gadget.
48+
required: false
49+
uri:
50+
type: string
51+
description: |
52+
The uri to the module to use in the gadget. Mutually exclusive
53+
with `uri`.

actions/copy_dashboard.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from lib.base import BaseJiraAction
2+
from lib.utils import remove_empty_attributes
3+
4+
__all__ = ["CopyJiraDashboardAction"]
5+
6+
7+
class CopyJiraDashboardAction(BaseJiraAction):
8+
def run(
9+
self,
10+
id,
11+
name,
12+
description=None,
13+
edit_permissions=None,
14+
share_permissions=None,
15+
):
16+
data = remove_empty_attributes(
17+
{
18+
"id": id,
19+
"name": name,
20+
"description": description,
21+
"edit_permissions": edit_permissions,
22+
"share_permissions": share_permissions,
23+
}
24+
)
25+
26+
dashboard = self._client.copy_dashboard(**data)
27+
return dashboard.raw

actions/copy_dashboard.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
name: copy_dashboard
3+
runner_type: python-script
4+
description: Copy an existing JIRA dashboard.
5+
enabled: true
6+
entry_point: copy_dashboard.py
7+
parameters:
8+
id:
9+
type: string
10+
description: The ID of the Dashboard to copy.
11+
required: true
12+
name:
13+
type: string
14+
description: The name of the new dashboard.
15+
required: true
16+
description:
17+
type: string
18+
description: A description of the dashboard.
19+
required: false
20+
edit_permissions:
21+
type: array
22+
items:
23+
type: object
24+
required: false
25+
description: A list of permission objects to grant editing permissions.
26+
share_permissions:
27+
type: array
28+
items:
29+
type: object
30+
required: false
31+
description: A list of permissions objects to grant sharing permissions.

actions/create_dashboard.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from lib.base import BaseJiraAction
2+
from lib.utils import remove_empty_attributes
3+
4+
__all__ = ["CreateJiraDashboardAction"]
5+
6+
7+
class CreateJiraDashboardAction(BaseJiraAction):
8+
def run(
9+
self, name, description=None, edit_permissions=None, share_permissions=None
10+
):
11+
data = remove_empty_attributes(
12+
{
13+
"name": name,
14+
"description": description,
15+
"edit_permissions": edit_permissions,
16+
"share_permissions": share_permissions,
17+
}
18+
)
19+
20+
dashboard = self._client.create_dashboard(**data)
21+
return dashboard.raw

actions/create_dashboard.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: create_dashboard
3+
runner_type: python-script
4+
description: Create a new JIRA dashboard.
5+
enabled: true
6+
entry_point: create_dashboard.py
7+
parameters:
8+
name:
9+
type: string
10+
description: The name of the new dashboard.
11+
required: true
12+
description:
13+
type: string
14+
description: A description of the dashboard.
15+
required: false
16+
edit_permissions:
17+
type: array
18+
items:
19+
type: object
20+
required: false
21+
description: A list of permission objects to grant editing permissions.
22+
share_permissions:
23+
type: array
24+
items:
25+
type: object
26+
required: false
27+
description: A list of permissions objects to grant sharing permissions.

0 commit comments

Comments
 (0)