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 Completed Job list tab to multiple resources #6058

Conversation

marshmalien
Copy link
Member

@marshmalien marshmalien commented Feb 25, 2020

SUMMARY

Issues: #5890 #5892 #5903 #6061

Template Completed Job List Mockup

Add Completed Jobs tab to:

  • Host
  • Inventory Host
  • Inventory
  • Smart Inventory
  • Template
  • Workflow Template

I decided to move the JobList and JobListItem components to the shared component directory and use them in all of the tab job list views. For this to work in all of the above locations, each parent component passes a defaultParams prop with a query object to < JobList /> which then passes those params to UnifiedJobsAPI.read(). This is exactly how we achieve it in the old UI. I'm open to changing the prop name if it is too generic.

This PR also deletes the HostCompletedJobs, InventoryCompletedJobs, and SmartInventoryCompletedJobs directories; and refactors Jobs.jsx into a functional component.

Only the /jobs list shows a type column. The < Jobs /> component passes a boolean to prop showTypeColumn and drills it down to the < JobListItem /> component which checks the value to show or hide the type DataListCell. It seemed like a simple solution, but I'm also open to other ideas.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME
  • UI
SCREENSHOTS

Smart Inventory List
Screen Shot 2020-02-25 at 1 31 43 PM

Inventory Host List
Screen Shot 2020-02-25 at 2 33 27 PM

Job List
Screen Shot 2020-02-25 at 2 33 38 PM

* Resources include: Host, InventoryHost, Inventory, SmartInventory, Template, and
WFTemplate
* Move JobList into top-level shared component directory
@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.

Copy link
Member

@mabashian mabashian left a comment

Choose a reason for hiding this comment

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

I think defaultParams is fine - defaultSearchParams if you wanted to be more verbose 🤷‍♂

const {
data: { count, results },
} = await UnifiedJobsAPI.read(params);
} = await UnifiedJobsAPI.read({ ...params, ...defaultParams });
Copy link
Member

Choose a reason for hiding this comment

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

is it possible to have some of the same values in params, and defaultParams, and if so will that cause issues with the api?

</DataListCell>,
<DataListCell key="name">
<span>
<Link to={`/jobs/${JOB_TYPE_URL_SEGMENTS[job.type]}/${job.id}`}>
Copy link
Member

Choose a reason for hiding this comment

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

I think if we are going to use constants to help us build our urls for Links we need to be more consistent in doing that throughout the whole project. Just sharing thoughts.

Also, I think you and I talked about the idea that if we are linking to a url that ends in Id, just so it can be redirected to whatever/id/details, we should just link directly to details...or in this case to /output.

);
expect(wrapper.find('DataListCell[aria-label="type"]').length).toBe(1);
});
});
Copy link
Member

Choose a reason for hiding this comment

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

Because you are using this component for so many different types of jobs it might make sense to write a test that asserts that when clicking on the job name it navigates to the correct url.

@@ -64,24 +64,25 @@ class Inventories extends Component {
[`/inventories/${inventoryKind}/${inventory.id}/hosts/add`]: i18n._(
t`Create New Host`
),
[`/inventories/${inventoryKind}/${inventory.id}/hosts/${nestedResource &&
nestedResource.id}`]: i18n._(
Copy link
Member

Choose a reason for hiding this comment

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

I don't think you need to mark these variables for translation...and you could use optional chaining here

Copy link
Member Author

Choose a reason for hiding this comment

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

I didn't notice that they were marked for translation, I only moved its position up in the config. Next time I'm in this file I'll check it out.

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded (gate pipeline).

@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit 5ca73f1 into ansible:devel Feb 27, 2020
AlanCoding pushed a commit to AlanCoding/awx that referenced this pull request Aug 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants