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

ui: add parameterized dispatch interface #10675

Merged
merged 23 commits into from
Jul 20, 2021

Conversation

nicholascioli
Copy link
Contributor

Closes #9313

This commit adds a new interface for dispatching parameteried jobs, if
the user has the right permissions. The UI can be accessed by viewing a
parameterized job and clicking on the "Dispatch Job" button located in
the "Job Launches" section.

(Note: This commit adds one dependency title-case for pretty printing of
meta names. This can be removed if necessary.)

Given the following configuration:

...
"Meta": {
    "traefik_service_name": "traefik",
    "another_optional_item": "item-default",
    "server_name": "server-name-1"
  },
"ParameterizedJob": {
  "MetaOptional": [
    "traefik_service_name",
    "another_optional_item"
  ],
  "MetaRequired": [
    "server_name"
  ],
  "Payload": "optional"
},
...

The following screenshots show the generated interface.

Parameterized Job Overview

Creating the dispatched job

Showing an error when applicable

Dispatched job with supplied meta

This commit adds a new interface for dispatching parameteried jobs, if
the user has the right permissions. The UI can be accessed by viewing a
parameterized job and clicking on the "Dispatch Job" button located in
the "Job Launches" section.
@hashicorp-cla
Copy link

hashicorp-cla commented Jun 1, 2021

CLA assistant check
All committers have signed the CLA.

@nicholascioli
Copy link
Contributor Author

Is that failing test something that I can address? I don't know what is meant by Resource not accessible by integration...

@tgross
Copy link
Member

tgross commented Jun 3, 2021

Wow, thanks @nicholascioli! Just a heads up that it might take us a little bit to get to reviewing this one as we're in the middle of bringing on new UI folks who will want to have a say here.

I think the "resource not available by integration" is a GitHub Actions auth issue... it looks like that specific test needs a GitHub token but we don't want to expose those to PRs from the community. So don't worry about that for now.

@tgross tgross requested a review from ChaiWithJai June 3, 2021 13:09
@tgross tgross added the theme/ui label Jun 3, 2021
@tgross tgross added this to Needs Triage in Nomad - Community Issues Triage via automation Jun 3, 2021
This commit cleans up a few things that had typos and
inconsistent naming. In line with this, the custom
`meta` view was removed in favor of using the
included `AttributesTable`.
@nicholascioli
Copy link
Contributor Author

I cleaned up a few things that seemed inconsistent in both my changes and the interface. Updated screenshots are attached below:

Screenshot 2021-06-08 at 00-02-50 Dispatch new traefik - Nomad

Screenshot 2021-06-08 at 00-03-29 Job traefik dispatch-1623125004-a86da8ee - Nomad

Copy link
Contributor

@lgfa29 lgfa29 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this wonderful feature PR @nicholascioli!

I flagged some issues that we found while reviewing, but most are small style changes. The main blockers is the lack of bas64 encoding of the payload and the use of originalTarget, which causes the form to fail on non-Firefox browsers.

You don't have to worry about making any of these changes, @JBhagat841 and I will work on them, but if you feel like tackling some of them before we do feel free to go ahead 😄

Thank you again for the contribution!

ui/app/adapters/job.js Outdated Show resolved Hide resolved
ui/app/abilities/job.js Outdated Show resolved Hide resolved
ui/app/abilities/job.js Show resolved Hide resolved
ui/app/components/job-dispatch.js Outdated Show resolved Hide resolved
ui/app/components/job-dispatch.js Outdated Show resolved Hide resolved
ui/app/templates/components/job-dispatch.hbs Outdated Show resolved Hide resolved
ui/app/templates/components/job-dispatch.hbs Outdated Show resolved Hide resolved
ui/app/templates/components/job-dispatch.hbs Outdated Show resolved Hide resolved
ui/app/templates/components/job-page/parts/children.hbs Outdated Show resolved Hide resolved
ui/app/templates/components/job-dispatch.hbs Outdated Show resolved Hide resolved
@lgfa29 lgfa29 moved this from Needs Triage to In Progress in Nomad - Community Issues Triage Jul 6, 2021
@lgfa29 lgfa29 added stage/accepted Confirmed, and intend to work on. No timeline committment though. type/enhancement labels Jul 6, 2021
Copy link
Contributor

@ChaiWithJai ChaiWithJai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, will take another look in the afternoon after we chat.

ui/app/abilities/job.js Show resolved Hide resolved
ui/tests/unit/adapters/job-test.js Show resolved Hide resolved
ui/app/components/job-dispatch.js Outdated Show resolved Hide resolved
ui/app/components/job-dispatch.js Outdated Show resolved Hide resolved
ui/app/components/job-dispatch.js Outdated Show resolved Hide resolved
ui/app/utils/encode.js Outdated Show resolved Hide resolved
Copy link
Contributor

@ChaiWithJai ChaiWithJai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lgfa29 lgfa29 merged commit 801a732 into hashicorp:main Jul 20, 2021
Nomad - Community Issues Triage automation moved this from In Progress to Done Jul 20, 2021
lgfa29 added a commit that referenced this pull request Jul 20, 2021
lgfa29 added a commit that referenced this pull request Jul 21, 2021
@notnoop notnoop mentioned this pull request Jul 28, 2021
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
stage/accepted Confirmed, and intend to work on. No timeline committment though. theme/ui type/enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dispatch parameterized jobs from UI [feature request]
5 participants