From 98cb8c6f6ecc414d61664938ea1ad657a688ae08 Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Wed, 30 Jan 2019 14:48:38 -0500 Subject: [PATCH 1/4] update scss patternfly override file and add center empty list tweak --- src/app.scss | 131 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 85 insertions(+), 46 deletions(-) diff --git a/src/app.scss b/src/app.scss index 8997ddb56c..aff7aff7a3 100644 --- a/src/app.scss +++ b/src/app.scss @@ -2,26 +2,35 @@ // masthead overrides // -.pf-l-page__header-brand { +.pf-c-page__header-brand { max-width: 255px; } -.pf-l-page__header-brand-link { +.pf-c-page__header-brand-link { max-width: 85px; } -.pf-l-page__header-brand-link img { +.pf-c-page__header-brand-link img { transform: scale(1.1, 1.1); position: relative; - top: -4px; +} + +.pf-c-page__header-tools .pf-l-toolbar__item { + margin-left: 20px; +} + +.pf-c-page__header-tools .pf-c-dropdown__toggle:before { + --pf-c-dropdown__toggle--BorderBottomColor: var(--pf-global--BackgroundColor--light-100); + --pf-c-dropdown__toggle--hover--BorderBottomColor: var(--pf-global--BackgroundColor--light-100); + --pf-c-dropdown__toggle--expanded--BorderBottomColor: var(--pf-global--BackgroundColor--light-100); } // // sidebar overrides // -.pf-l-page__sidebar{ - --pf-l-page__sidebar--md--Width: 255px; +.pf-c-page__sidebar{ + --pf-c-page__sidebar--md--Width: 255px; .pf-c-nav { overflow-y: auto; @@ -114,6 +123,7 @@ // // about modal overrides // + .pf-c-backdrop .pf-c-about-modal-box { --pf-c-about-modal-box--MaxHeight: 40rem; --pf-c-about-modal-box--MaxWidth: 63rem; @@ -127,61 +137,25 @@ } } -.awx-lookup { - min-height: 36px; -} .pf-c-input-group__text { &:hover { cursor: pointer; } } -.awx-c-tag--pill { - color: white; - background-color: rgb(0, 123, 186); - border-radius: 3px; - margin: 1px 2px; - padding: 0 10px; - display: inline-block; -} + // -// layout styles +// data list overrides // -.at-align-right { - display: flex; - flex-direction: row; - justify-content: flex-end; -} -// -// list styles -// -.awx-c-list { - border-top: 1px solid #d7d7d7; - border-bottom: 1px solid #d7d7d7; -} -.at-c-listCardBody { - --pf-c-card__footer--PaddingX: 0; - --pf-c-card__footer--PaddingY: 0; - --pf-c-card__body--PaddingX: 0; - --pf-c-card__body--PaddingY: 0; -} + .pf-c-data-list__item { --pf-c-data-list__item--PaddingLeft: 20px; --pf-c-data-list__item--PaddingRight: 20px; } + // // pf modal overrides // -.awx-c-modal { - width: 550px; - margin: 0; -} -.awx-c-icon--remove { - padding-left: 10px; - &:hover { - cursor: pointer; - } -} .pf-c-modal-box__footer { --pf-c-modal-box__footer--PaddingTop: 0; --pf-c-modal-box__footer--PaddingBottom: 0; @@ -198,3 +172,68 @@ --pf-c-modal-box__body--PaddingLeft: 20px; --pf-c-modal-box__body--PaddingRight: 20px; } + +// +// pf card overrides +// + +.pf-c-card { + display: flex; +} + +// +// pf empty state overrides +// + +.pf-c-empty-state { + align-self: center; +} + +// +// assorted custom component styles +// note that these should be given a consistent prefix +// and bem style, as well as moved into component-based scss files +// + +.awx-lookup { + min-height: 36px; +} + +.awx-c-modal { + width: 550px; + margin: 0; +} + +.awx-c-icon--remove { + padding-left: 10px; + &:hover { + cursor: pointer; + } +} + +.at-align-right { + display: flex; + flex-direction: row; + justify-content: flex-end; +} + +.awx-c-list { + border-top: 1px solid #d7d7d7; + border-bottom: 1px solid #d7d7d7; +} + +.awx-c-tag--pill { + color: var(--pf-global--BackgroundColor--light-100); + background-color: rgb(0, 123, 186); + border-radius: 3px; + margin: 1px 2px; + padding: 0 10px; + display: inline-block; +} + +.at-c-listCardBody { + --pf-c-card__footer--PaddingX: 0; + --pf-c-card__footer--PaddingY: 0; + --pf-c-card__body--PaddingX: 0; + --pf-c-card__body--PaddingY: 0; +} \ No newline at end of file From 4ce19a4b42595eb233c914c464be034f0a47a2fe Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Wed, 30 Jan 2019 14:48:54 -0500 Subject: [PATCH 2/4] add empty list functionality to org list --- .../screens/OrganizationsList.jsx | 133 +++++++++++------- 1 file changed, 83 insertions(+), 50 deletions(-) diff --git a/src/pages/Organizations/screens/OrganizationsList.jsx b/src/pages/Organizations/screens/OrganizationsList.jsx index 57c6c742cb..20a662c6df 100644 --- a/src/pages/Organizations/screens/OrganizationsList.jsx +++ b/src/pages/Organizations/screens/OrganizationsList.jsx @@ -6,13 +6,17 @@ import { withRouter } from 'react-router-dom'; import { I18n, i18nMark } from '@lingui/react'; -import { t } from '@lingui/macro'; +import { Trans, t } from '@lingui/macro'; import { Card, + EmptyState, + EmptyStateIcon, + EmptyStateBody, PageSection, PageSectionVariants, + Title } from '@patternfly/react-core'; - +import { CubesIcon } from '@patternfly/react-icons'; import DataListToolbar from '../../../components/DataListToolbar'; import OrganizationListItem from '../components/OrganizationListItem'; import Pagination from '../../../components/Pagination'; @@ -157,7 +161,7 @@ class OrganizationsList extends Component { const pageCount = Math.ceil(count / page_size); - this.setState({ + const stateToUpdate = { count, page, pageCount, @@ -166,7 +170,17 @@ class OrganizationsList extends Component { sortedColumnKey, results, selected: [], - }); + }; + + // This is in place to track whether or not the initial request + // return any results. If it did not, we show the empty state. + // This will become problematic once search is in play because + // the first load may have query params (think bookmarked search) + if (typeof noInitialResults === 'undefined') { + stateToUpdate.noInitialResults = results.length === 0; + } + + this.setState(stateToUpdate); this.updateUrl(queryParams); } catch (err) { this.setState({ error: true }); @@ -183,6 +197,7 @@ class OrganizationsList extends Component { count, error, loading, + noInitialResults, page, pageCount, page_size, @@ -194,52 +209,70 @@ class OrganizationsList extends Component { const { match } = this.props; return ( - - - - - - {({ i18n }) => ( -
    - { results.map(o => ( - this.onSelect(o.id)} - /> - ))} -
- )} -
- - { loading ?
loading...
: '' } - { error ?
error
: '' } -
-
-
+ + + {noInitialResults && ( + + + + <Trans>No Organizations Found</Trans> + + + Please add an organization to populate this list + + + )} + {( + typeof noInitialResults !== 'undefined' + && !noInitialResults + && !loading + && !error + ) && ( + + + + {({ i18n }) => ( +
    + { results.map(o => ( + this.onSelect(o.id)} + /> + ))} +
+ )} +
+ + { loading ?
loading...
: '' } + { error ?
error
: '' } +
+ )} +
+
); } } From 21bdd487e6efebb70bd2eb768929c4b2328ccee0 Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Wed, 30 Jan 2019 16:32:42 -0500 Subject: [PATCH 3/4] fix to tabs -- padding around and left most border --- src/app.scss | 4 ++++ src/components/Tabs/tabs.scss | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/app.scss b/src/app.scss index aff7aff7a3..555c87ecbc 100644 --- a/src/app.scss +++ b/src/app.scss @@ -181,6 +181,10 @@ display: flex; } +.pf-c-card__header { + padding: 0; +} + // // pf empty state overrides // diff --git a/src/components/Tabs/tabs.scss b/src/components/Tabs/tabs.scss index 15c557dea8..7bdad3a81f 100644 --- a/src/components/Tabs/tabs.scss +++ b/src/components/Tabs/tabs.scss @@ -35,6 +35,10 @@ } } + .pf-c-tabs__item:first-child .pf-c-tabs__button:before { + border-left: 0; + } + .pf-c-tabs__item:not(.pf-m-current):hover .pf-c-tabs__button::after { border-top: none; From 736f1e17750c9c9e1036da80bd21e50a76beff3a Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Mon, 4 Feb 2019 15:39:44 -0500 Subject: [PATCH 4/4] update conditional showing of empty list component --- src/pages/Organizations/screens/OrganizationsList.jsx | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/pages/Organizations/screens/OrganizationsList.jsx b/src/pages/Organizations/screens/OrganizationsList.jsx index 20a662c6df..d19078b575 100644 --- a/src/pages/Organizations/screens/OrganizationsList.jsx +++ b/src/pages/Organizations/screens/OrganizationsList.jsx @@ -221,13 +221,7 @@ class OrganizationsList extends Component { Please add an organization to populate this list - )} - {( - typeof noInitialResults !== 'undefined' - && !noInitialResults - && !loading - && !error - ) && ( + ) || (