From c080346751b1316c04ea7602cf2b51150465a6ea Mon Sep 17 00:00:00 2001 From: Keith Grant Date: Wed, 17 Jul 2019 09:25:40 -0700 Subject: [PATCH] start on InventoriesLookup --- awx/ui_next/src/api/index.js | 3 + awx/ui_next/src/api/models/Inventories.js | 10 +++ awx/ui_next/src/app.scss | 5 -- awx/ui_next/src/components/Lookup/Lookup.jsx | 14 +++- .../shared/InstanceGroupsLookup.jsx | 1 + .../Template/shared/InventoriesLookup.jsx | 71 +++++++++++++++++++ .../Template/shared/JobTemplateForm.jsx | 35 ++++++++- awx/ui_next/src/util/strings.js | 11 ++- awx/ui_next/src/util/strings.test.js | 4 ++ 9 files changed, 144 insertions(+), 10 deletions(-) create mode 100644 awx/ui_next/src/api/models/Inventories.js create mode 100644 awx/ui_next/src/screens/Template/shared/InventoriesLookup.jsx diff --git a/awx/ui_next/src/api/index.js b/awx/ui_next/src/api/index.js index 204985b31d..5e7b221c77 100644 --- a/awx/ui_next/src/api/index.js +++ b/awx/ui_next/src/api/index.js @@ -1,5 +1,6 @@ import Config from './models/Config'; import InstanceGroups from './models/InstanceGroups'; +import Inventories from './models/Inventories'; import JobTemplates from './models/JobTemplates'; import Jobs from './models/Jobs'; import Me from './models/Me'; @@ -13,6 +14,7 @@ import WorkflowJobTemplates from './models/WorkflowJobTemplates'; const ConfigAPI = new Config(); const InstanceGroupsAPI = new InstanceGroups(); +const InventoriesAPI = new Inventories(); const JobTemplatesAPI = new JobTemplates(); const JobsAPI = new Jobs(); const MeAPI = new Me(); @@ -27,6 +29,7 @@ const WorkflowJobTemplatesAPI = new WorkflowJobTemplates(); export { ConfigAPI, InstanceGroupsAPI, + InventoriesAPI, JobTemplatesAPI, JobsAPI, MeAPI, diff --git a/awx/ui_next/src/api/models/Inventories.js b/awx/ui_next/src/api/models/Inventories.js new file mode 100644 index 0000000000..9c9f86754a --- /dev/null +++ b/awx/ui_next/src/api/models/Inventories.js @@ -0,0 +1,10 @@ +import Base from '../Base'; + +class Inventories extends Base { + constructor(http) { + super(http); + this.baseUrl = '/api/v2/inventories/'; + } +} + +export default Inventories; diff --git a/awx/ui_next/src/app.scss b/awx/ui_next/src/app.scss index 22a874d349..4f0b81df21 100644 --- a/awx/ui_next/src/app.scss +++ b/awx/ui_next/src/app.scss @@ -155,11 +155,6 @@ // and bem style, as well as moved into component-based scss files // -.awx-lookup .pf-c-form-control { - --pf-c-form-control--Height: 90px; - overflow-y: auto; -} - .at-c-listCardBody { --pf-c-card__footer--PaddingX: 0; --pf-c-card__footer--PaddingY: 0; diff --git a/awx/ui_next/src/components/Lookup/Lookup.jsx b/awx/ui_next/src/components/Lookup/Lookup.jsx index 92c72a8856..b9a417cb55 100644 --- a/awx/ui_next/src/components/Lookup/Lookup.jsx +++ b/awx/ui_next/src/components/Lookup/Lookup.jsx @@ -5,11 +5,12 @@ import { SearchIcon } from '@patternfly/react-icons'; import { Button, ButtonVariant, - InputGroup, + InputGroup as PFInputGroup, Modal, } from '@patternfly/react-core'; import { withI18n } from '@lingui/react'; import { t } from '@lingui/macro'; +import styled from 'styled-components'; import PaginatedDataList from '../PaginatedDataList'; import DataListToolbar from '../DataListToolbar'; @@ -18,6 +19,13 @@ import SelectedList from '../SelectedList'; import { ChipGroup, Chip } from '../Chip'; import { getQSConfig, parseNamespacedQueryString } from '../../util/qs'; +const InputGroup = styled(PFInputGroup)` + ${props => props.multiple && (` + --pf-c-form-control--Height: 90px; + overflow-y: auto; + `)} +`; + class Lookup extends React.Component { constructor(props) { super(props); @@ -145,7 +153,7 @@ class Lookup extends React.Component { return ( - +