From 04bad1aeef25e268f35fb3ba3a19c5dbc5891cd9 Mon Sep 17 00:00:00 2001 From: CD Cabrera Date: Wed, 13 Jul 2022 15:08:06 -0400 Subject: [PATCH] refactor(creds,sources,scans): discovery-149 emptyState grid (#121) * credentials, sources, scansEmptyState, remove grid --- .../credentialsEmptyState.test.js.snap | 194 +++++++++--------- .../credentials/credentialsEmptyState.js | 56 +++-- .../scansEmptyState.test.js.snap | 172 +++++++--------- src/components/scans/scansEmptyState.js | 25 +-- .../__snapshots__/sources.test.js.snap | 86 ++++---- .../sourcesEmptyState.test.js.snap | 86 ++++---- src/components/sources/sourcesEmptyState.js | 21 +- 7 files changed, 293 insertions(+), 347 deletions(-) diff --git a/src/components/credentials/__tests__/__snapshots__/credentialsEmptyState.test.js.snap b/src/components/credentials/__tests__/__snapshots__/credentialsEmptyState.test.js.snap index ee8663e2..736ef8a7 100644 --- a/src/components/credentials/__tests__/__snapshots__/credentialsEmptyState.test.js.snap +++ b/src/components/credentials/__tests__/__snapshots__/credentialsEmptyState.test.js.snap @@ -2,123 +2,115 @@ exports[`CredentialsEmptyState Component should render a basic component 1`] = `
+ +

+ t(view.empty-state, {"context":"title","name":"Quipucords"}) +

+ t(view.empty-state, {"context":"description_credentials","name":"The Quipucords tool"}) +
+
- -

- t(view.empty-state, {"context":"title","name":"Quipucords"}) -

-
- t(view.empty-state, {"context":"description_credentials","name":"The Quipucords tool"}) -
- -
- -
+ + VCenter Credential + + +
+
+ +
`; diff --git a/src/components/credentials/credentialsEmptyState.js b/src/components/credentials/credentialsEmptyState.js index 34cc0647..33f2755f 100644 --- a/src/components/credentials/credentialsEmptyState.js +++ b/src/components/credentials/credentialsEmptyState.js @@ -12,40 +12,36 @@ import { Title } from '@patternfly/react-core'; import { AddCircleOIcon } from '@patternfly/react-icons'; -import { DropdownButton, Grid, MenuItem, Row } from 'patternfly-react'; +import { DropdownButton, MenuItem } from 'patternfly-react'; import helpers from '../../common/helpers'; import { translate } from '../i18n/i18n'; const CredentialsEmptyState = ({ onAddCredential, onAddSource, t, uiSentenceStartName, uiShortName }) => ( - - - - - {t('view.empty-state', { context: 'title', name: uiShortName })} - - {t('view.empty-state', { context: ['description', 'credentials'], name: uiSentenceStartName })} - - - - onAddCredential('network')}> - Network Credential - - onAddCredential('satellite')}> - Satellite Credential - - onAddCredential('vcenter')}> - VCenter Credential - - - - - - - - - + + + {t('view.empty-state', { context: 'title', name: uiShortName })} + + {t('view.empty-state', { context: ['description', 'credentials'], name: uiSentenceStartName })} + + + + onAddCredential('network')}> + Network Credential + + onAddCredential('satellite')}> + Satellite Credential + + onAddCredential('vcenter')}> + VCenter Credential + + + + + + + ); CredentialsEmptyState.propTypes = { diff --git a/src/components/scans/__tests__/__snapshots__/scansEmptyState.test.js.snap b/src/components/scans/__tests__/__snapshots__/scansEmptyState.test.js.snap index 8371e764..a200fb39 100644 --- a/src/components/scans/__tests__/__snapshots__/scansEmptyState.test.js.snap +++ b/src/components/scans/__tests__/__snapshots__/scansEmptyState.test.js.snap @@ -8,59 +8,51 @@ exports[`ScansEmptyState Component should render a connected component: connecte exports[`ScansEmptyState Component should render a non-connected component: non-connected do not exist 1`] = `
+ +

+ t(view.empty-state, {"context":"title","name":"Quipucords"}) +

+
+ t(view.empty-state, {"context":"description_sources"}) +
-
- -

- t(view.empty-state, {"context":"title","name":"Quipucords"}) -

-
- t(view.empty-state, {"context":"description_sources"}) -
-
- -
-
+ t(view.empty-state, {"context":"label_source"}) +
@@ -68,59 +60,51 @@ exports[`ScansEmptyState Component should render a non-connected component: non- exports[`ScansEmptyState Component should render a non-connected component: non-connected exist 1`] = `
+ +

+ t(view.empty-state, {"context":"title_scans"}) +

+
+ t(view.empty-state, {"context":"description_scans"}) +
-
- -

- t(view.empty-state, {"context":"title_scans"}) -

-
- t(view.empty-state, {"context":"description_scans"}) -
-
- -
-
+ t(view.empty-state, {"context":"label_source-navigate"}) +
diff --git a/src/components/scans/scansEmptyState.js b/src/components/scans/scansEmptyState.js index 7e13f546..51eec323 100644 --- a/src/components/scans/scansEmptyState.js +++ b/src/components/scans/scansEmptyState.js @@ -10,7 +10,6 @@ import { Title } from '@patternfly/react-core'; import { AddCircleOIcon } from '@patternfly/react-icons'; -import { Grid, Row } from 'patternfly-react'; import SourcesEmptyState from '../sources/sourcesEmptyState'; import helpers from '../../common/helpers'; import { connectRouter, reduxActions, reduxSelectors, reduxTypes, store } from '../../redux'; @@ -43,20 +42,16 @@ class ScansEmptyState extends React.Component { if (sourcesExist) { return ( - - - - - {t('view.empty-state', { context: ['title', 'scans'] })} - {t('view.empty-state', { context: ['description', 'scans'] })} - - - - - - + + + {t('view.empty-state', { context: ['title', 'scans'] })} + {t('view.empty-state', { context: ['description', 'scans'] })} + + + + ); } diff --git a/src/components/sources/__tests__/__snapshots__/sources.test.js.snap b/src/components/sources/__tests__/__snapshots__/sources.test.js.snap index 897aad12..b053bce0 100644 --- a/src/components/sources/__tests__/__snapshots__/sources.test.js.snap +++ b/src/components/sources/__tests__/__snapshots__/sources.test.js.snap @@ -96,59 +96,51 @@ exports[`Sources Component should render a non-connected component pending: pend exports[`Sources Component should render a non-connected component with empty state: empty state 1`] = `
+ +

+ t(view.empty-state, {"context":"title","name":"Quipucords"}) +

-
+
+ -
-
+ t(view.empty-state, {"context":"label_source"}) +
diff --git a/src/components/sources/__tests__/__snapshots__/sourcesEmptyState.test.js.snap b/src/components/sources/__tests__/__snapshots__/sourcesEmptyState.test.js.snap index 9f3d010a..ae2ae0ce 100644 --- a/src/components/sources/__tests__/__snapshots__/sourcesEmptyState.test.js.snap +++ b/src/components/sources/__tests__/__snapshots__/sourcesEmptyState.test.js.snap @@ -2,59 +2,51 @@ exports[`SourcesEmptyState Component should render a basic component 1`] = `
+ +

+ t(view.empty-state, {"context":"title","name":"Quipucords"}) +

+
+ t(view.empty-state, {"context":"description_sources"}) +
-
- -

- t(view.empty-state, {"context":"title","name":"Quipucords"}) -

-
- t(view.empty-state, {"context":"description_sources"}) -
-
- -
-
+ t(view.empty-state, {"context":"label_source"}) +
diff --git a/src/components/sources/sourcesEmptyState.js b/src/components/sources/sourcesEmptyState.js index ab818ec2..cb6fc80e 100644 --- a/src/components/sources/sourcesEmptyState.js +++ b/src/components/sources/sourcesEmptyState.js @@ -10,7 +10,6 @@ import { Title } from '@patternfly/react-core'; import { AddCircleOIcon } from '@patternfly/react-icons'; -import { Grid, Row } from 'patternfly-react'; import helpers from '../../common/helpers'; import { translate } from '../i18n/i18n'; @@ -24,18 +23,14 @@ import { translate } from '../i18n/i18n'; * @returns {React.ReactNode} */ const SourcesEmptyState = ({ onAddSource, t, uiShortName }) => ( - - - - - {t('view.empty-state', { context: ['title'], name: uiShortName })} - {t('view.empty-state', { context: ['description', 'sources'] })} - - - - - - + + + {t('view.empty-state', { context: ['title'], name: uiShortName })} + {t('view.empty-state', { context: ['description', 'sources'] })} + + + + ); /**