From a369ab33b3789dec0a4240fcd0ab1126d5ccd327 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 14:41:18 +0200 Subject: [PATCH 01/71] Adjust imports at cves list page --- gsa/src/web/pages/cves/listpage.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gsa/src/web/pages/cves/listpage.js b/gsa/src/web/pages/cves/listpage.js index 01a42fa956..e51dddd6cf 100644 --- a/gsa/src/web/pages/cves/listpage.js +++ b/gsa/src/web/pages/cves/listpage.js @@ -27,17 +27,17 @@ import _ from 'gmp/locale'; import {CVES_FILTER_FILTER} from 'gmp/models/filter'; -import EntitiesPage from '../../entities/page.js'; -import withEntitiesContainer from '../../entities/withEntitiesContainer.js'; +import EntitiesPage from 'web/entities/page'; +import withEntitiesContainer from 'web/entities/withEntitiesContainer'; -import DashboardControls from '../../components/dashboard/controls'; +import DashboardControls from 'web/components/dashboard/controls'; -import ManualIcon from '../../components/icon/manualicon.js'; +import ManualIcon from 'web/components/icon/manualicon'; -import CveFilterDialog from './filterdialog.js'; -import CvesTable from './table.js'; +import CveFilterDialog from './filterdialog'; +import CvesTable from './table'; -import CvesDashboard, {CVES_DASHBOARD_ID} from './dashboard/index.js'; +import CvesDashboard, {CVES_DASHBOARD_ID} from './dashboard'; const ToolBarIcons = props => { return ( From b9be65e192a0290613bb2da19e09443b5222a9a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 14:46:51 +0200 Subject: [PATCH 02/71] Extract EntitiesPage props from withEntitiesContainer HOC Don't pass props for the EntitiesPage through withEntitiesContainer HOC. --- gsa/src/web/pages/cves/listpage.js | 44 ++++++++++++++++-------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/gsa/src/web/pages/cves/listpage.js b/gsa/src/web/pages/cves/listpage.js index e51dddd6cf..f35928b3e7 100644 --- a/gsa/src/web/pages/cves/listpage.js +++ b/gsa/src/web/pages/cves/listpage.js @@ -39,28 +39,32 @@ import CvesTable from './table'; import CvesDashboard, {CVES_DASHBOARD_ID} from './dashboard'; -const ToolBarIcons = props => { - return ( - - ); -}; +const ToolBarIcons = () => ( + +); + +const Page = props => ( + ( + + )} + filterEditDialog={CveFilterDialog} + sectionIcon="cve.svg" + table={CvesTable} + title={_('CVEs')} + toolBarIcons={ToolBarIcons} + /> +); export default withEntitiesContainer('cve', { - createFilterType: 'info', - dashboard2: CvesDashboard, - dashboardControls: () => ( - - ), - filterEditDialog: CveFilterDialog, filtersFilter: CVES_FILTER_FILTER, - sectionIcon: 'cve.svg', - table: CvesTable, - title: _('CVEs'), - toolBarIcons: ToolBarIcons, -})(EntitiesPage); +})(Page); // vim: set ts=2 sw=2 tw=80: From 08d0c6969e7d9db2ffbc4fea920d0244131e33ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 14:49:30 +0200 Subject: [PATCH 03/71] Load cves from the redux store at cves list page --- gsa/src/web/pages/cves/listpage.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gsa/src/web/pages/cves/listpage.js b/gsa/src/web/pages/cves/listpage.js index f35928b3e7..73b3e5db51 100644 --- a/gsa/src/web/pages/cves/listpage.js +++ b/gsa/src/web/pages/cves/listpage.js @@ -28,12 +28,17 @@ import _ from 'gmp/locale'; import {CVES_FILTER_FILTER} from 'gmp/models/filter'; import EntitiesPage from 'web/entities/page'; -import withEntitiesContainer from 'web/entities/withEntitiesContainer'; +import withEntitiesContainer from 'web/entities/withEntitiesContainer2'; import DashboardControls from 'web/components/dashboard/controls'; import ManualIcon from 'web/components/icon/manualicon'; +import { + loadEntities, + selector as entitiesSelector, +} from 'web/store/entities/cves'; + import CveFilterDialog from './filterdialog'; import CvesTable from './table'; @@ -64,7 +69,9 @@ const Page = props => ( ); export default withEntitiesContainer('cve', { + entitiesSelector, filtersFilter: CVES_FILTER_FILTER, + loadEntities, })(Page); // vim: set ts=2 sw=2 tw=80: From 8f19390a2e2b1a14b2ecb3540f5a56dc817b9b07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 14:51:07 +0200 Subject: [PATCH 04/71] Adjust imports at dfncerts list page --- gsa/src/web/pages/dfncert/listpage.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gsa/src/web/pages/dfncert/listpage.js b/gsa/src/web/pages/dfncert/listpage.js index 80d067431e..3113a560c0 100644 --- a/gsa/src/web/pages/dfncert/listpage.js +++ b/gsa/src/web/pages/dfncert/listpage.js @@ -27,19 +27,19 @@ import _ from 'gmp/locale'; import {DFNCERT_FILTER_FILTER} from 'gmp/models/filter'; - // DFN-CERT uses same filter dialog as CERT-Bund -import FilterDialog from '../certbund/filterdialog.js'; +import EntitiesPage from 'web/entities/page'; +import withEntitiesContainer from 'web/entities/withEntitiesContainer'; -import EntitiesPage from '../../entities/page.js'; -import withEntitiesContainer from '../../entities/withEntitiesContainer.js'; +import DashboardControls from 'web/components/dashboard/controls'; -import DashboardControls from '../../components/dashboard/controls'; +import ManualIcon from 'web/components/icon/manualicon'; -import ManualIcon from '../../components/icon/manualicon.js'; + // DFN-CERT uses same filter dialog as CERT-Bund +import FilterDialog from '../certbund/filterdialog'; -import DfnCertTable from './table.js'; +import DfnCertTable from './table'; -import DfnCertDashboard, {DFNCERT_DASHBOARD_ID} from './dashboard/index.js'; +import DfnCertDashboard, {DFNCERT_DASHBOARD_ID} from './dashboard'; const ToolBarIcons = props => { return ( From 7db59c1fec697c29efacfecc1e1db36132c76451 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 14:53:38 +0200 Subject: [PATCH 05/71] Extract EntitesPage props from withEntitiesContainer HOC Don't pass the props through withEntititesContainer HOC. --- gsa/src/web/pages/dfncert/listpage.js | 44 +++++++++++++++------------ 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/gsa/src/web/pages/dfncert/listpage.js b/gsa/src/web/pages/dfncert/listpage.js index 3113a560c0..e09018083a 100644 --- a/gsa/src/web/pages/dfncert/listpage.js +++ b/gsa/src/web/pages/dfncert/listpage.js @@ -41,28 +41,32 @@ import DfnCertTable from './table'; import DfnCertDashboard, {DFNCERT_DASHBOARD_ID} from './dashboard'; -const ToolBarIcons = props => { - return ( - - ); -}; +const ToolBarIcons = () => ( + +); + +const Page = props => ( + ( + + )} + filterEditDialog={FilterDialog} + sectionIcon="dfn_cert_adv.svg" + table={DfnCertTable} + title={_('DFN-CERT Advisories')} + toolBarIcons={ToolBarIcons} + /> +); export default withEntitiesContainer('dfncert', { - createFilterType: 'info', - dashboard2: DfnCertDashboard, - dashboardControls: () => ( - - ), - filterEditDialog: FilterDialog, filtersFilter: DFNCERT_FILTER_FILTER, - sectionIcon: 'dfn_cert_adv.svg', - table: DfnCertTable, - title: _('DFN-CERT Advisories'), - toolBarIcons: ToolBarIcons, -})(EntitiesPage); +})(Page); // vim: set ts=2 sw=2 tw=80: From 6d1dfe067aeb0689e418e4d29f130ddd47c6e1a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 14:55:46 +0200 Subject: [PATCH 06/71] Use the redux store to load dfncert entities --- gsa/src/web/pages/dfncert/listpage.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gsa/src/web/pages/dfncert/listpage.js b/gsa/src/web/pages/dfncert/listpage.js index e09018083a..49af2e23dd 100644 --- a/gsa/src/web/pages/dfncert/listpage.js +++ b/gsa/src/web/pages/dfncert/listpage.js @@ -28,12 +28,17 @@ import _ from 'gmp/locale'; import {DFNCERT_FILTER_FILTER} from 'gmp/models/filter'; import EntitiesPage from 'web/entities/page'; -import withEntitiesContainer from 'web/entities/withEntitiesContainer'; +import withEntitiesContainer from 'web/entities/withEntitiesContainer2'; import DashboardControls from 'web/components/dashboard/controls'; import ManualIcon from 'web/components/icon/manualicon'; +import { + loadEntities, + selector as entitiesSelector, +} from 'web/store/entities/dfncerts'; + // DFN-CERT uses same filter dialog as CERT-Bund import FilterDialog from '../certbund/filterdialog'; @@ -66,7 +71,9 @@ const Page = props => ( ); export default withEntitiesContainer('dfncert', { + entitiesSelector, filtersFilter: DFNCERT_FILTER_FILTER, + loadEntities, })(Page); // vim: set ts=2 sw=2 tw=80: From 1b0d7eb1de7577f80c3c3b325df16af7250dff15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 14:57:07 +0200 Subject: [PATCH 07/71] Adjust imports for groups list page --- gsa/src/web/pages/groups/listpage.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/gsa/src/web/pages/groups/listpage.js b/gsa/src/web/pages/groups/listpage.js index 99da0ecd4f..17b09f0472 100644 --- a/gsa/src/web/pages/groups/listpage.js +++ b/gsa/src/web/pages/groups/listpage.js @@ -24,22 +24,22 @@ import React from 'react'; import _ from 'gmp/locale'; -import PropTypes from '../../utils/proptypes.js'; +import {GROUPS_FILTER_FILTER} from 'gmp/models/filter'; -import EntitiesPage from '../../entities/page.js'; -import withEntitiesContainer from '../../entities/withEntitiesContainer.js'; +import PropTypes from 'web/utils/proptypes'; -import ManualIcon from '../../components/icon/manualicon.js'; -import NewIcon from '../../components/icon/newicon.js'; +import EntitiesPage from 'web/entities/page'; +import withEntitiesContainer from 'web/entities/withEntitiesContainer'; -import IconDivider from '../../components/layout/icondivider.js'; +import ManualIcon from 'web/components/icon/manualicon'; +import NewIcon from 'web/components/icon/newicon'; -import {createFilterDialog} from '../../components/powerfilter/dialog.js'; +import IconDivider from 'web/components/layout/icondivider'; -import {GROUPS_FILTER_FILTER} from 'gmp/models/filter.js'; +import {createFilterDialog} from 'web/components/powerfilter/dialog'; -import GroupComponent from './component.js'; -import Table, {SORT_FIELDS} from './table.js'; +import GroupComponent from './component'; +import Table, {SORT_FIELDS} from './table'; const ToolBarIcons = ({ onGroupCreateClick, From 2b4c5589df093189bda739aac2977544ee46f92c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 14:58:51 +0200 Subject: [PATCH 08/71] Use withCapabilities HOC for group list page ToolBarIcons --- gsa/src/web/pages/groups/listpage.js | 38 +++++++++++++--------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/gsa/src/web/pages/groups/listpage.js b/gsa/src/web/pages/groups/listpage.js index 17b09f0472..a8cbc0a31e 100644 --- a/gsa/src/web/pages/groups/listpage.js +++ b/gsa/src/web/pages/groups/listpage.js @@ -27,6 +27,7 @@ import _ from 'gmp/locale'; import {GROUPS_FILTER_FILTER} from 'gmp/models/filter'; import PropTypes from 'web/utils/proptypes'; +import withCapabilities from 'web/utils/withCapabilities'; import EntitiesPage from 'web/entities/page'; import withEntitiesContainer from 'web/entities/withEntitiesContainer'; @@ -41,34 +42,29 @@ import {createFilterDialog} from 'web/components/powerfilter/dialog'; import GroupComponent from './component'; import Table, {SORT_FIELDS} from './table'; -const ToolBarIcons = ({ +const ToolBarIcons = withCapabilities(({ + capabilities, onGroupCreateClick, -}, {capabilities}) => { - return ( - - ( + + + {capabilities.mayCreate('group') && + - {capabilities.mayCreate('group') && - - } - - ); -}; + } + +)); ToolBarIcons.propTypes = { onGroupCreateClick: PropTypes.func.isRequired, }; -ToolBarIcons.contextTypes = { - capabilities: PropTypes.capabilities.isRequired, -}; - const GroupsFilterDialog = createFilterDialog({sortFields: SORT_FIELDS}); const GroupsPage = ({ From 4272eeed52f8a3d7a9c9d03bd0442363a15c079e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 15:00:06 +0200 Subject: [PATCH 09/71] Load groups from redux store at groups list page --- gsa/src/web/pages/groups/listpage.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gsa/src/web/pages/groups/listpage.js b/gsa/src/web/pages/groups/listpage.js index a8cbc0a31e..90217d9f86 100644 --- a/gsa/src/web/pages/groups/listpage.js +++ b/gsa/src/web/pages/groups/listpage.js @@ -30,7 +30,7 @@ import PropTypes from 'web/utils/proptypes'; import withCapabilities from 'web/utils/withCapabilities'; import EntitiesPage from 'web/entities/page'; -import withEntitiesContainer from 'web/entities/withEntitiesContainer'; +import withEntitiesContainer from 'web/entities/withEntitiesContainer2'; import ManualIcon from 'web/components/icon/manualicon'; import NewIcon from 'web/components/icon/newicon'; @@ -39,6 +39,11 @@ import IconDivider from 'web/components/layout/icondivider'; import {createFilterDialog} from 'web/components/powerfilter/dialog'; +import { + loadEntities, + selector as entitiesSelector, +} from 'web/store/entities/groups'; + import GroupComponent from './component'; import Table, {SORT_FIELDS} from './table'; @@ -119,7 +124,9 @@ GroupsPage.propTypes = { }; export default withEntitiesContainer('group', { + entitiesSelector, filtersFilter: GROUPS_FILTER_FILTER, + loadEntities, })(GroupsPage); // vim: set ts=2 sw=2 tw=80: From 36fc1210593f249e658ecaf317a3a403ca752c07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 15:01:50 +0200 Subject: [PATCH 10/71] Adjust imports at host list page --- gsa/src/web/pages/hosts/listpage.js | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/gsa/src/web/pages/hosts/listpage.js b/gsa/src/web/pages/hosts/listpage.js index 3244ecfb77..51f719bfd2 100644 --- a/gsa/src/web/pages/hosts/listpage.js +++ b/gsa/src/web/pages/hosts/listpage.js @@ -27,28 +27,27 @@ import _ from 'gmp/locale'; import {HOSTS_FILTER_FILTER} from 'gmp/models/filter'; -import IconDivider from '../../components/layout/icondivider.js'; +import IconDivider from 'web/components/layout/icondivider'; -import PropTypes from '../../utils/proptypes.js'; -import withCapabilities from '../../utils/withCapabilities'; +import PropTypes from 'web/utils/proptypes'; +import withCapabilities from 'web/utils/withCapabilities'; -import EntitiesPage from '../../entities/page.js'; -import withEntitiesContainer from '../../entities/withEntitiesContainer.js'; +import EntitiesPage from 'web/entities/page'; +import withEntitiesContainer from 'web/entities/withEntitiesContainer'; -import {goto_details} from '../../entity/component.js'; +import {goto_details} from 'web/entity/component'; -import DashboardControls from '../../components/dashboard/controls'; +import DashboardControls from 'web/components/dashboard/controls'; -import ManualIcon from '../../components/icon/manualicon.js'; -import NewIcon from '../../components/icon/newicon.js'; +import ManualIcon from 'web/components/icon/manualicon'; +import NewIcon from 'web/components/icon/newicon'; -import HostsFilterDialog from './filterdialog.js'; -import HostsTable from './table.js'; -import HostComponent from './component.js'; +import HostsFilterDialog from './filterdialog'; +import HostsTable from './table'; +import HostComponent from './component'; import HostsDashboard, {HOSTS_DASHBOARD_ID} from './dashboard'; - const ToolBarIcons = withCapabilities(({ capabilities, onHostCreateClick, From c69be6aaa277ed9b9fbf54bf7eedec81b128eb1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 15:03:38 +0200 Subject: [PATCH 11/71] Use redux store to load host entities at its list page --- gsa/src/web/pages/hosts/listpage.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gsa/src/web/pages/hosts/listpage.js b/gsa/src/web/pages/hosts/listpage.js index 51f719bfd2..9f0496c59b 100644 --- a/gsa/src/web/pages/hosts/listpage.js +++ b/gsa/src/web/pages/hosts/listpage.js @@ -33,7 +33,7 @@ import PropTypes from 'web/utils/proptypes'; import withCapabilities from 'web/utils/withCapabilities'; import EntitiesPage from 'web/entities/page'; -import withEntitiesContainer from 'web/entities/withEntitiesContainer'; +import withEntitiesContainer from 'web/entities/withEntitiesContainer2'; import {goto_details} from 'web/entity/component'; @@ -42,6 +42,11 @@ import DashboardControls from 'web/components/dashboard/controls'; import ManualIcon from 'web/components/icon/manualicon'; import NewIcon from 'web/components/icon/newicon'; +import { + loadEntities, + selector as entitiesSelector, +} from 'web/store/entities/hosts'; + import HostsFilterDialog from './filterdialog'; import HostsTable from './table'; import HostComponent from './component'; @@ -125,7 +130,9 @@ Page.propTypes = { }; export default withEntitiesContainer('host', { + entitiesSelector, filtersFilter: HOSTS_FILTER_FILTER, + loadEntities, })(Page); // vim: set ts=2 sw=2 tw=80: From 74a720e32dadc0e3d7c27576554228ac002e706b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 15:04:59 +0200 Subject: [PATCH 12/71] Adjust imports at notes list page --- gsa/src/web/pages/notes/listpage.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/gsa/src/web/pages/notes/listpage.js b/gsa/src/web/pages/notes/listpage.js index 6422586769..9630dcc833 100644 --- a/gsa/src/web/pages/notes/listpage.js +++ b/gsa/src/web/pages/notes/listpage.js @@ -25,25 +25,25 @@ import React from 'react'; import _ from 'gmp/locale'; -import IconDivider from '../../components/layout/icondivider.js'; +import {NOTES_FILTER_FILTER} from 'gmp/models/filter'; -import PropTypes from '../../utils/proptypes.js'; +import IconDivider from 'web/components/layout/icondivider'; -import EntitiesPage from '../../entities/page.js'; -import withEntitiesContainer from '../../entities/withEntitiesContainer.js'; +import PropTypes from 'web/utils/proptypes'; -import DashboardControls from '../../components/dashboard/controls'; +import EntitiesPage from 'web/entities/page'; +import withEntitiesContainer from 'web/entities/withEntitiesContainer'; -import ManualIcon from '../../components/icon/manualicon.js'; -import NewIcon from '../../components/icon/newicon.js'; +import DashboardControls from 'web/components/dashboard/controls'; -import FilterDialog from './filterdialog.js'; -import NotesTable from './table.js'; -import NoteComponent from './component.js'; +import ManualIcon from 'web/components/icon/manualicon'; +import NewIcon from 'web/components/icon/newicon'; -import {NOTES_FILTER_FILTER} from 'gmp/models/filter.js'; +import FilterDialog from './filterdialog'; +import NotesTable from './table'; +import NoteComponent from './component'; -import NotesDashboard, {NOTES_DASHBOARD_ID} from './dashboard/index.js'; +import NotesDashboard, {NOTES_DASHBOARD_ID} from './dashboard'; const ToolBarIcons = ({onNoteCreateClick}, {capabilities}) => { return ( From 3b943625a3063f6fb952fdfc68098654b36145fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 15:06:17 +0200 Subject: [PATCH 13/71] Use withCapabilities for notes ToolBarIcons --- gsa/src/web/pages/notes/listpage.js | 38 ++++++++++++++--------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/gsa/src/web/pages/notes/listpage.js b/gsa/src/web/pages/notes/listpage.js index 9630dcc833..042c0d0b14 100644 --- a/gsa/src/web/pages/notes/listpage.js +++ b/gsa/src/web/pages/notes/listpage.js @@ -30,6 +30,7 @@ import {NOTES_FILTER_FILTER} from 'gmp/models/filter'; import IconDivider from 'web/components/layout/icondivider'; import PropTypes from 'web/utils/proptypes'; +import withCapabilities from 'web/utils/withCapabilities'; import EntitiesPage from 'web/entities/page'; import withEntitiesContainer from 'web/entities/withEntitiesContainer'; @@ -45,27 +46,24 @@ import NoteComponent from './component'; import NotesDashboard, {NOTES_DASHBOARD_ID} from './dashboard'; -const ToolBarIcons = ({onNoteCreateClick}, {capabilities}) => { - return ( - - ( + + + {capabilities.mayCreate('note') && + - {capabilities.mayCreate('note') && - - } - - ); -}; - -ToolBarIcons.contextTypes = { - capabilities: PropTypes.capabilities.isRequired, -}; + } + +)); ToolBarIcons.propTypes = { onNoteCreateClick: PropTypes.func, From 3865274be8960e55083a32f8fd4f6d93b258aefb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 15:09:41 +0200 Subject: [PATCH 14/71] Always load details of the notes When calling gmp.notes.get and gmp.notes.getAll always load the whole details of the note entities. --- gsa/src/gmp/commands/notes.js | 1 + 1 file changed, 1 insertion(+) diff --git a/gsa/src/gmp/commands/notes.js b/gsa/src/gmp/commands/notes.js index 34beaf3fb6..b7a9b0a5bd 100644 --- a/gsa/src/gmp/commands/notes.js +++ b/gsa/src/gmp/commands/notes.js @@ -99,6 +99,7 @@ class NotesCommand extends EntitiesCommand { constructor(http) { super(http, 'note', Note); + this.setParam('details', 1); } getEntitiesResponse(root) { From 615735b92ff22bdb933f065e55ecbb2a67279aeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 15:10:33 +0200 Subject: [PATCH 15/71] Move EntitiesPage params to the EntitiesPage at notes list page --- gsa/src/web/pages/notes/listpage.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/gsa/src/web/pages/notes/listpage.js b/gsa/src/web/pages/notes/listpage.js index 042c0d0b14..16cdd7bd42 100644 --- a/gsa/src/web/pages/notes/listpage.js +++ b/gsa/src/web/pages/notes/listpage.js @@ -94,6 +94,10 @@ const Page = ({ }) => ( ( + + )} filterEditDialog={FilterDialog} sectionIcon="note.svg" table={NotesTable} @@ -117,11 +121,6 @@ Page.propTypes = { }; export default withEntitiesContainer('note', { - dashboard2: NotesDashboard, - dashboardControls: () => ( - - ), - extraLoadParams: {details: 1}, filtersFilter: NOTES_FILTER_FILTER, })(Page); From 8237e0ae88508e17f89e479cc439f57e57fdfd59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 15:12:28 +0200 Subject: [PATCH 16/71] Load notes from the redux store at notes list page --- gsa/src/web/pages/notes/listpage.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gsa/src/web/pages/notes/listpage.js b/gsa/src/web/pages/notes/listpage.js index 16cdd7bd42..e71ccc431a 100644 --- a/gsa/src/web/pages/notes/listpage.js +++ b/gsa/src/web/pages/notes/listpage.js @@ -33,13 +33,18 @@ import PropTypes from 'web/utils/proptypes'; import withCapabilities from 'web/utils/withCapabilities'; import EntitiesPage from 'web/entities/page'; -import withEntitiesContainer from 'web/entities/withEntitiesContainer'; +import withEntitiesContainer from 'web/entities/withEntitiesContainer2'; import DashboardControls from 'web/components/dashboard/controls'; import ManualIcon from 'web/components/icon/manualicon'; import NewIcon from 'web/components/icon/newicon'; +import { + loadEntities, + selector as entitiesSelector, +} from 'web/store/entities/notes'; + import FilterDialog from './filterdialog'; import NotesTable from './table'; import NoteComponent from './component'; @@ -121,7 +126,9 @@ Page.propTypes = { }; export default withEntitiesContainer('note', { + entitiesSelector, filtersFilter: NOTES_FILTER_FILTER, + loadEntities, })(Page); // vim: set ts=2 sw=2 tw=80: From e467f09e95bb8487944666fc364fd50ee19d0a79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 15:14:01 +0200 Subject: [PATCH 17/71] Adjust import at nvts list page --- gsa/src/web/pages/nvts/listpage.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gsa/src/web/pages/nvts/listpage.js b/gsa/src/web/pages/nvts/listpage.js index 523054a30e..28e7a49647 100644 --- a/gsa/src/web/pages/nvts/listpage.js +++ b/gsa/src/web/pages/nvts/listpage.js @@ -26,17 +26,17 @@ import _ from 'gmp/locale'; import {NVTS_FILTER_FILTER} from 'gmp/models/filter'; -import EntitiesPage from '../../entities/page.js'; -import withEntitiesContainer from '../../entities/withEntitiesContainer.js'; +import EntitiesPage from 'web/entities/page'; +import withEntitiesContainer from 'web/entities/withEntitiesContainer'; -import DashboardControls from '../../components/dashboard/controls'; +import DashboardControls from 'web/components/dashboard/controls'; -import ManualIcon from '../../components/icon/manualicon.js'; +import ManualIcon from 'web/components/icon/manualicon'; -import NvtsFilterDialog from './filterdialog.js'; -import NvtsTable from './table.js'; +import NvtsFilterDialog from './filterdialog'; +import NvtsTable from './table'; -import NvtsDashboard, {NVTS_DASHBOARD_ID} from './dashboard/index.js'; +import NvtsDashboard, {NVTS_DASHBOARD_ID} from './dashboard'; const ToolBarIcons = props => { return ( From 826d91fa772bcf2c869f80b30e76dc516a8a4651 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 15:16:38 +0200 Subject: [PATCH 18/71] Don't pass EntitiesPage props through withEntitiesContainer HOC --- gsa/src/web/pages/nvts/listpage.js | 44 ++++++++++++++++-------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/gsa/src/web/pages/nvts/listpage.js b/gsa/src/web/pages/nvts/listpage.js index 28e7a49647..23c141d011 100644 --- a/gsa/src/web/pages/nvts/listpage.js +++ b/gsa/src/web/pages/nvts/listpage.js @@ -38,28 +38,32 @@ import NvtsTable from './table'; import NvtsDashboard, {NVTS_DASHBOARD_ID} from './dashboard'; -const ToolBarIcons = props => { - return ( - - ); -}; +const ToolBarIcons = () => ( + +); + +const Page = props => ( + ( + + )} + filterEditDialog={NvtsFilterDialog} + sectionIcon="nvt.svg" + table={NvtsTable} + title={_('NVTs')} + toolBarIcons={ToolBarIcons} + /> +); export default withEntitiesContainer('nvt', { - createFilterType: 'info', - dashboard2: NvtsDashboard, - dashboardControls: () => ( - - ), - filterEditDialog: NvtsFilterDialog, filtersFilter: NVTS_FILTER_FILTER, - sectionIcon: 'nvt.svg', - table: NvtsTable, - title: _('NVTs'), - toolBarIcons: ToolBarIcons, -})(EntitiesPage); +})(Page); // vim: set ts=2 sw=2 tw=80: From 1478b3865c8af7449eb0c067c3ff9137402447b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 15:18:59 +0200 Subject: [PATCH 19/71] Fix reducer prop for nvt entities The "path" to the nvt entities must be rootState.entities.nvt --- gsa/src/web/store/entities/reducers.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gsa/src/web/store/entities/reducers.js b/gsa/src/web/store/entities/reducers.js index cf34ff4cad..be9ef19adc 100644 --- a/gsa/src/web/store/entities/reducers.js +++ b/gsa/src/web/store/entities/reducers.js @@ -34,7 +34,7 @@ import {reducer as filter} from './filters'; import {reducer as group} from './groups'; import {reducer as host} from './hosts'; import {reducer as note} from './notes'; -import {reducer as nvts} from './nvts'; +import {reducer as nvt} from './nvts'; import {reducer as os} from './os'; import {reducer as ovaldef} from './ovaldefs'; import {reducer as permission} from './permissions'; @@ -65,7 +65,7 @@ const entitiesReducer = combineReducers({ group, host, note, - nvts, + nvt, os, ovaldef, permission, From 314dbd13fbf20c7f45718e5dd25def05b690df77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 15:19:54 +0200 Subject: [PATCH 20/71] Load nvts from the redux store --- gsa/src/web/pages/nvts/listpage.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gsa/src/web/pages/nvts/listpage.js b/gsa/src/web/pages/nvts/listpage.js index 23c141d011..7b19f2eba6 100644 --- a/gsa/src/web/pages/nvts/listpage.js +++ b/gsa/src/web/pages/nvts/listpage.js @@ -27,12 +27,17 @@ import _ from 'gmp/locale'; import {NVTS_FILTER_FILTER} from 'gmp/models/filter'; import EntitiesPage from 'web/entities/page'; -import withEntitiesContainer from 'web/entities/withEntitiesContainer'; +import withEntitiesContainer from 'web/entities/withEntitiesContainer2'; import DashboardControls from 'web/components/dashboard/controls'; import ManualIcon from 'web/components/icon/manualicon'; +import { + loadEntities, + selector as entitiesSelector, +} from 'web/store/entities/nvts'; + import NvtsFilterDialog from './filterdialog'; import NvtsTable from './table'; @@ -63,7 +68,9 @@ const Page = props => ( ); export default withEntitiesContainer('nvt', { + entitiesSelector, filtersFilter: NVTS_FILTER_FILTER, + loadEntities, })(Page); // vim: set ts=2 sw=2 tw=80: From 63dc87c90788f9fd1e59e1df85b37c108d7d7872 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 15:20:54 +0200 Subject: [PATCH 21/71] Adjust imports at os list page --- gsa/src/web/pages/os/listpage.js | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/gsa/src/web/pages/os/listpage.js b/gsa/src/web/pages/os/listpage.js index 4ebe59e4be..d56225e879 100644 --- a/gsa/src/web/pages/os/listpage.js +++ b/gsa/src/web/pages/os/listpage.js @@ -27,23 +27,22 @@ import _ from 'gmp/locale'; import {OS_FILTER_FILTER} from 'gmp/models/filter'; -import PropTypes from '../../utils/proptypes.js'; +import PropTypes from 'web/utils/proptypes'; -import Layout from '../../components/layout/layout.js'; +import Layout from 'web/components/layout/layout'; -import EntitiesPage from '../../entities/page.js'; -import withEntitiesContainer from '../../entities/withEntitiesContainer.js'; +import EntitiesPage from 'web/entities/page'; +import withEntitiesContainer from 'web/entities/withEntitiesContainer'; -import DashboardControls from '../../components/dashboard/controls.js'; +import DashboardControls from 'web/components/dashboard/controls'; -import ManualIcon from '../../components/icon/manualicon.js'; +import ManualIcon from 'web/components/icon/manualicon'; -import OsFilterDialog from './filterdialog.js'; -import OsTable from './table.js'; -import OsComponent from './component.js'; +import OsFilterDialog from './filterdialog'; +import OsTable from './table'; +import OsComponent from './component'; -import OsDashboard from './dashboard'; -import {OS_DASHBOARD_ID} from './dashboard/index.js'; +import OsDashboard, {OS_DASHBOARD_ID} from './dashboard'; const ToolBarIcons = () => ( From 70c325f9f85752d9d9c788fdd6196fd6cbca0a23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 15:24:22 +0200 Subject: [PATCH 22/71] Rename os => operatingsystem We are using operatingsystem as command name. Therefore the entities functions must use it too. --- gsa/CMakeLists.txt | 2 +- .../store/entities/__tests__/{os.js => operatingsystems.js} | 4 ++-- gsa/src/web/store/entities/{os.js => operatingsystems.js} | 2 +- gsa/src/web/store/entities/reducers.js | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) rename gsa/src/web/store/entities/__tests__/{os.js => operatingsystems.js} (92%) rename gsa/src/web/store/entities/{os.js => operatingsystems.js} (97%) diff --git a/gsa/CMakeLists.txt b/gsa/CMakeLists.txt index e12aa016d9..33a5babb60 100644 --- a/gsa/CMakeLists.txt +++ b/gsa/CMakeLists.txt @@ -785,7 +785,7 @@ set (GSA_JS_SRC_FILES ${GSA_SRC_DIR}/src/web/store/entities/hosts.js ${GSA_SRC_DIR}/src/web/store/entities/notes.js ${GSA_SRC_DIR}/src/web/store/entities/nvts.js - ${GSA_SRC_DIR}/src/web/store/entities/os.js + ${GSA_SRC_DIR}/src/web/store/entities/operatingsystems.js ${GSA_SRC_DIR}/src/web/store/entities/ovaldefs.js ${GSA_SRC_DIR}/src/web/store/entities/permissions.js ${GSA_SRC_DIR}/src/web/store/entities/portlists.js diff --git a/gsa/src/web/store/entities/__tests__/os.js b/gsa/src/web/store/entities/__tests__/operatingsystems.js similarity index 92% rename from gsa/src/web/store/entities/__tests__/os.js rename to gsa/src/web/store/entities/__tests__/operatingsystems.js index 65312c16d3..5b022cff1e 100644 --- a/gsa/src/web/store/entities/__tests__/os.js +++ b/gsa/src/web/store/entities/__tests__/operatingsystems.js @@ -22,8 +22,8 @@ */ import {testAll} from '../utils/testing'; -import * as funcs from '../os'; +import * as funcs from '../operatingsystems'; -testAll('os', funcs); +testAll('operatingsystem', funcs); // vim: set ts=2 sw=2 tw=80: diff --git a/gsa/src/web/store/entities/os.js b/gsa/src/web/store/entities/operatingsystems.js similarity index 97% rename from gsa/src/web/store/entities/os.js rename to gsa/src/web/store/entities/operatingsystems.js index 55c17e8871..a6dbeb5883 100644 --- a/gsa/src/web/store/entities/os.js +++ b/gsa/src/web/store/entities/operatingsystems.js @@ -29,7 +29,7 @@ const { selector, entitiesActions, entityActions, -} = createAll('os'); +} = createAll('operatingsystem'); export { loadEntities, diff --git a/gsa/src/web/store/entities/reducers.js b/gsa/src/web/store/entities/reducers.js index be9ef19adc..3c829baf30 100644 --- a/gsa/src/web/store/entities/reducers.js +++ b/gsa/src/web/store/entities/reducers.js @@ -35,7 +35,7 @@ import {reducer as group} from './groups'; import {reducer as host} from './hosts'; import {reducer as note} from './notes'; import {reducer as nvt} from './nvts'; -import {reducer as os} from './os'; +import {reducer as operatingsystem} from './operatingsystems'; import {reducer as ovaldef} from './ovaldefs'; import {reducer as permission} from './permissions'; import {reducer as portlist} from './portlists'; @@ -66,7 +66,7 @@ const entitiesReducer = combineReducers({ host, note, nvt, - os, + operatingsystem, ovaldef, permission, portlist, From 79bf3585dab6b298b1eabc446d5fdba3385a2a4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 15:29:54 +0200 Subject: [PATCH 23/71] Use redux store to load operatingsystem entities --- gsa/src/web/pages/os/listpage.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gsa/src/web/pages/os/listpage.js b/gsa/src/web/pages/os/listpage.js index d56225e879..0774be20eb 100644 --- a/gsa/src/web/pages/os/listpage.js +++ b/gsa/src/web/pages/os/listpage.js @@ -32,12 +32,17 @@ import PropTypes from 'web/utils/proptypes'; import Layout from 'web/components/layout/layout'; import EntitiesPage from 'web/entities/page'; -import withEntitiesContainer from 'web/entities/withEntitiesContainer'; +import withEntitiesContainer from 'web/entities/withEntitiesContainer2'; import DashboardControls from 'web/components/dashboard/controls'; import ManualIcon from 'web/components/icon/manualicon'; +import { + loadEntities, + selector as entitiesSelector, +} from 'web/store/entities/operatingsystems'; + import OsFilterDialog from './filterdialog'; import OsTable from './table'; import OsComponent from './component'; @@ -109,4 +114,7 @@ Page.propTypes = { onError: PropTypes.func.isRequired, }; -export default withEntitiesContainer('operatingsystem')(Page); +export default withEntitiesContainer('operatingsystem', { + entitiesSelector, + loadEntities, +})(Page); From f9ed8b29874f512bd2ae8192806218dc8f87ab6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 15:55:18 +0200 Subject: [PATCH 24/71] Pass filterFilter prop to EntitiesPage directly filterFilter prop isn't used in EntitiesContainer therefore it should be passed directly to EntitiesPage. --- gsa/src/web/entities/withEntitiesContainer2.js | 4 +--- gsa/src/web/pages/agents/listpage.js | 2 +- gsa/src/web/pages/alerts/listpage.js | 2 +- gsa/src/web/pages/certbund/listpage.js | 2 +- gsa/src/web/pages/cpes/listpage.js | 2 +- gsa/src/web/pages/credentials/listpage.js | 2 +- gsa/src/web/pages/cves/listpage.js | 2 +- gsa/src/web/pages/dfncert/listpage.js | 2 +- gsa/src/web/pages/filters/listpage.js | 2 +- gsa/src/web/pages/groups/listpage.js | 2 +- gsa/src/web/pages/hosts/listpage.js | 2 +- gsa/src/web/pages/notes/listpage.js | 2 +- gsa/src/web/pages/nvts/listpage.js | 2 +- gsa/src/web/pages/portlists/listpage.js | 2 +- gsa/src/web/pages/reportformats/listpage.js | 2 +- gsa/src/web/pages/scanconfigs/listpage.js | 2 +- gsa/src/web/pages/scanners/listpage.js | 2 +- gsa/src/web/pages/schedules/listpage.js | 2 +- gsa/src/web/pages/tags/listpage.js | 2 +- gsa/src/web/pages/targets/listpage.js | 2 +- gsa/src/web/pages/tasks/listpage.js | 2 +- 21 files changed, 21 insertions(+), 23 deletions(-) diff --git a/gsa/src/web/entities/withEntitiesContainer2.js b/gsa/src/web/entities/withEntitiesContainer2.js index 4ecd3a9a77..c4e2714b1a 100644 --- a/gsa/src/web/entities/withEntitiesContainer2.js +++ b/gsa/src/web/entities/withEntitiesContainer2.js @@ -40,8 +40,7 @@ import {isDefined} from 'gmp/utils/identity'; const withEntitiesContainer = (gmpname, { entitiesSelector, loadEntities, - filtersFilter, -} = {}) => Component => { +}) => Component => { let EntitiesContainerWrapper = props => ( {({notify}) => ( @@ -53,7 +52,6 @@ const withEntitiesContainer = (gmpname, { {pageProps => ( )} diff --git a/gsa/src/web/pages/agents/listpage.js b/gsa/src/web/pages/agents/listpage.js index f703eca040..670fa4b6b9 100644 --- a/gsa/src/web/pages/agents/listpage.js +++ b/gsa/src/web/pages/agents/listpage.js @@ -106,6 +106,7 @@ const AgentsPage = ({ ( )} filterEditDialog={CertBundFilterDialog} + filtersFilter={CERTBUND_FILTER_FILTER} sectionIcon="cert_bund_adv.svg" table={CertBundTable} title={_('CERT-Bund Advisories')} @@ -70,7 +71,6 @@ const Page = props => ( export default withEntitiesContainer('certbund', { entitiesSelector, - filtersFilter: CERTBUND_FILTER_FILTER, loadEntities, })(Page); diff --git a/gsa/src/web/pages/cpes/listpage.js b/gsa/src/web/pages/cpes/listpage.js index 94e55ea254..0a37a5b1ae 100644 --- a/gsa/src/web/pages/cpes/listpage.js +++ b/gsa/src/web/pages/cpes/listpage.js @@ -61,6 +61,7 @@ const Page = props => ( )} filterEditDialog={CpeFilterDialog} + filtersFilter={CPES_FILTER_FILTER} sectionIcon="cpe.svg" table={CpesTable} title={_('CPEs')} @@ -70,7 +71,6 @@ const Page = props => ( export default withEntitiesContainer('cpe', { entitiesSelector, - filtersFilter: CPES_FILTER_FILTER, loadEntities, })(Page); diff --git a/gsa/src/web/pages/credentials/listpage.js b/gsa/src/web/pages/credentials/listpage.js index 92b6eeabde..4a9cdf095f 100644 --- a/gsa/src/web/pages/credentials/listpage.js +++ b/gsa/src/web/pages/credentials/listpage.js @@ -103,6 +103,7 @@ const CredentialsPage = ({ ( )} filterEditDialog={CveFilterDialog} + filtersFilter={CVES_FILTER_FILTER} sectionIcon="cve.svg" table={CvesTable} title={_('CVEs')} @@ -70,7 +71,6 @@ const Page = props => ( export default withEntitiesContainer('cve', { entitiesSelector, - filtersFilter: CVES_FILTER_FILTER, loadEntities, })(Page); diff --git a/gsa/src/web/pages/dfncert/listpage.js b/gsa/src/web/pages/dfncert/listpage.js index 49af2e23dd..09f90c44b2 100644 --- a/gsa/src/web/pages/dfncert/listpage.js +++ b/gsa/src/web/pages/dfncert/listpage.js @@ -63,6 +63,7 @@ const Page = props => ( )} filterEditDialog={FilterDialog} + filtersFilter={DFNCERT_FILTER_FILTER} sectionIcon="dfn_cert_adv.svg" table={DfnCertTable} title={_('DFN-CERT Advisories')} @@ -72,7 +73,6 @@ const Page = props => ( export default withEntitiesContainer('dfncert', { entitiesSelector, - filtersFilter: DFNCERT_FILTER_FILTER, loadEntities, })(Page); diff --git a/gsa/src/web/pages/filters/listpage.js b/gsa/src/web/pages/filters/listpage.js index f28c928b4e..7bf4d386d2 100644 --- a/gsa/src/web/pages/filters/listpage.js +++ b/gsa/src/web/pages/filters/listpage.js @@ -100,6 +100,7 @@ const FiltersPage = ({ )} filterEditDialog={HostsFilterDialog} + filtersFilter={HOSTS_FILTER_FILTER} sectionIcon="host.svg" table={HostsTable} title={_('Hosts')} @@ -131,7 +132,6 @@ Page.propTypes = { export default withEntitiesContainer('host', { entitiesSelector, - filtersFilter: HOSTS_FILTER_FILTER, loadEntities, })(Page); diff --git a/gsa/src/web/pages/notes/listpage.js b/gsa/src/web/pages/notes/listpage.js index e71ccc431a..456ff21a5c 100644 --- a/gsa/src/web/pages/notes/listpage.js +++ b/gsa/src/web/pages/notes/listpage.js @@ -104,6 +104,7 @@ const Page = ({ )} filterEditDialog={FilterDialog} + filtersFilter={NOTES_FILTER_FILTER} sectionIcon="note.svg" table={NotesTable} title={_('Notes')} @@ -127,7 +128,6 @@ Page.propTypes = { export default withEntitiesContainer('note', { entitiesSelector, - filtersFilter: NOTES_FILTER_FILTER, loadEntities, })(Page); diff --git a/gsa/src/web/pages/nvts/listpage.js b/gsa/src/web/pages/nvts/listpage.js index 7b19f2eba6..e7cb04cc3d 100644 --- a/gsa/src/web/pages/nvts/listpage.js +++ b/gsa/src/web/pages/nvts/listpage.js @@ -60,6 +60,7 @@ const Page = props => ( )} filterEditDialog={NvtsFilterDialog} + filtersFilter={NVTS_FILTER_FILTER} sectionIcon="nvt.svg" table={NvtsTable} title={_('NVTs')} @@ -69,7 +70,6 @@ const Page = props => ( export default withEntitiesContainer('nvt', { entitiesSelector, - filtersFilter: NVTS_FILTER_FILTER, loadEntities, })(Page); diff --git a/gsa/src/web/pages/portlists/listpage.js b/gsa/src/web/pages/portlists/listpage.js index 3cbc117887..2355043318 100644 --- a/gsa/src/web/pages/portlists/listpage.js +++ b/gsa/src/web/pages/portlists/listpage.js @@ -106,6 +106,7 @@ const PortListsPage = ({ )} filterEditDialog={TaskFilterDialog} + filtersFilter={TASKS_FILTER_FILTER} sectionIcon="task.svg" table={Table} title={_('Tasks')} @@ -192,7 +193,6 @@ Page.propTypes = { export default withEntitiesContainer('task', { entitiesSelector, - filtersFilter: TASKS_FILTER_FILTER, loadEntities, })(Page); From 3a8aec6eace830eaec2ec788a1326f0dccdbe4c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 15:57:23 +0200 Subject: [PATCH 25/71] Remove unnecessary params from Layout flex is by default true and box isn't used anymore. --- gsa/src/web/pages/os/listpage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gsa/src/web/pages/os/listpage.js b/gsa/src/web/pages/os/listpage.js index 0774be20eb..fbac5c4352 100644 --- a/gsa/src/web/pages/os/listpage.js +++ b/gsa/src/web/pages/os/listpage.js @@ -50,7 +50,7 @@ import OsComponent from './component'; import OsDashboard, {OS_DASHBOARD_ID} from './dashboard'; const ToolBarIcons = () => ( - + Date: Thu, 26 Jul 2018 16:07:28 +0200 Subject: [PATCH 26/71] Rename web/pages/os into web/pages/operatingsystems Make the operatingsystem path more consistent and use the gsa name for os. --- gsa/CMakeLists.txt | 22 +++++++++---------- gsa/src/web/pages/assets/dashboard.js | 6 ++--- .../{os => operatingsystems}/component.js | 0 .../dashboard/cvssdisplay.js | 0 .../dashboard/index.js | 0 .../dashboard/loaders.js | 0 .../dashboard/severityclassdisplay.js | 0 .../dashboard/vulnscoredisplay.js | 0 .../{os => operatingsystems}/detailspage.js | 0 .../{os => operatingsystems}/filterdialog.js | 0 .../{os => operatingsystems}/listpage.js | 0 .../web/pages/{os => operatingsystems}/row.js | 0 .../pages/{os => operatingsystems}/table.js | 0 gsa/src/web/pages/start/dashboard.js | 2 +- gsa/src/web/routes.js | 4 ++-- 15 files changed, 17 insertions(+), 17 deletions(-) rename gsa/src/web/pages/{os => operatingsystems}/component.js (100%) rename gsa/src/web/pages/{os => operatingsystems}/dashboard/cvssdisplay.js (100%) rename gsa/src/web/pages/{os => operatingsystems}/dashboard/index.js (100%) rename gsa/src/web/pages/{os => operatingsystems}/dashboard/loaders.js (100%) rename gsa/src/web/pages/{os => operatingsystems}/dashboard/severityclassdisplay.js (100%) rename gsa/src/web/pages/{os => operatingsystems}/dashboard/vulnscoredisplay.js (100%) rename gsa/src/web/pages/{os => operatingsystems}/detailspage.js (100%) rename gsa/src/web/pages/{os => operatingsystems}/filterdialog.js (100%) rename gsa/src/web/pages/{os => operatingsystems}/listpage.js (100%) rename gsa/src/web/pages/{os => operatingsystems}/row.js (100%) rename gsa/src/web/pages/{os => operatingsystems}/table.js (100%) diff --git a/gsa/CMakeLists.txt b/gsa/CMakeLists.txt index 33a5babb60..30deb0d580 100644 --- a/gsa/CMakeLists.txt +++ b/gsa/CMakeLists.txt @@ -528,17 +528,17 @@ set (GSA_JS_SRC_FILES ${GSA_SRC_DIR}/src/web/pages/nvts/dashboard/severityclassdisplay.js ${GSA_SRC_DIR}/src/web/pages/nvts/dashboard/qoddisplay.js ${GSA_SRC_DIR}/src/web/pages/nvts/dashboard/qodtypedisplay.js - ${GSA_SRC_DIR}/src/web/pages/os/component.js - ${GSA_SRC_DIR}/src/web/pages/os/detailspage.js - ${GSA_SRC_DIR}/src/web/pages/os/filterdialog.js - ${GSA_SRC_DIR}/src/web/pages/os/listpage.js - ${GSA_SRC_DIR}/src/web/pages/os/row.js - ${GSA_SRC_DIR}/src/web/pages/os/table.js - ${GSA_SRC_DIR}/src/web/pages/os/dashboard/cvssdisplay.js - ${GSA_SRC_DIR}/src/web/pages/os/dashboard/index.js - ${GSA_SRC_DIR}/src/web/pages/os/dashboard/loaders.js - ${GSA_SRC_DIR}/src/web/pages/os/dashboard/severityclassdisplay.js - ${GSA_SRC_DIR}/src/web/pages/os/dashboard/vulnscoredisplay.js + ${GSA_SRC_DIR}/src/web/pages/operatingsystems/component.js + ${GSA_SRC_DIR}/src/web/pages/operatingsystems/detailspage.js + ${GSA_SRC_DIR}/src/web/pages/operatingsystems/filterdialog.js + ${GSA_SRC_DIR}/src/web/pages/operatingsystems/listpage.js + ${GSA_SRC_DIR}/src/web/pages/operatingsystems/row.js + ${GSA_SRC_DIR}/src/web/pages/operatingsystems/table.js + ${GSA_SRC_DIR}/src/web/pages/operatingsystems/dashboard/cvssdisplay.js + ${GSA_SRC_DIR}/src/web/pages/operatingsystems/dashboard/index.js + ${GSA_SRC_DIR}/src/web/pages/operatingsystems/dashboard/loaders.js + ${GSA_SRC_DIR}/src/web/pages/operatingsystems/dashboard/severityclassdisplay.js + ${GSA_SRC_DIR}/src/web/pages/operatingsystems/dashboard/vulnscoredisplay.js ${GSA_SRC_DIR}/src/web/pages/ovaldefs/details.js ${GSA_SRC_DIR}/src/web/pages/ovaldefs/detailspage.js ${GSA_SRC_DIR}/src/web/pages/ovaldefs/filterdialog.js diff --git a/gsa/src/web/pages/assets/dashboard.js b/gsa/src/web/pages/assets/dashboard.js index 04d2a88d41..8c97634d17 100644 --- a/gsa/src/web/pages/assets/dashboard.js +++ b/gsa/src/web/pages/assets/dashboard.js @@ -33,11 +33,11 @@ import compose from 'web/utils/compose'; import withGmp from 'web/utils/withGmp'; import {HOSTS_DISPLAYS} from '../hosts/dashboard'; -import {OS_DISPLAYS} from '../os/dashboard/index'; +import {OS_DISPLAYS} from '../operatingsystems/dashboard'; import {HostsVulnScoreDisplay} from '../hosts/dashboard/vulnscoredisplay'; import {HostsTopologyDisplay} from '../hosts/dashboard/topologydisplay'; -import {OsVulnScoreDisplay} from '../os/dashboard/vulnscoredisplay'; -import {OsSeverityClassDisplay} from '../os/dashboard/severityclassdisplay'; +import {OsVulnScoreDisplay} from '../operatingsystems/dashboard/vulnscoredisplay'; // eslint-disable-line max-len +import {OsSeverityClassDisplay} from '../operatingsystems/dashboard/severityclassdisplay'; // eslint-disable-line max-len import {HostsModifiedDisplay} from '../hosts/dashboard/modifieddisplay'; diff --git a/gsa/src/web/pages/os/component.js b/gsa/src/web/pages/operatingsystems/component.js similarity index 100% rename from gsa/src/web/pages/os/component.js rename to gsa/src/web/pages/operatingsystems/component.js diff --git a/gsa/src/web/pages/os/dashboard/cvssdisplay.js b/gsa/src/web/pages/operatingsystems/dashboard/cvssdisplay.js similarity index 100% rename from gsa/src/web/pages/os/dashboard/cvssdisplay.js rename to gsa/src/web/pages/operatingsystems/dashboard/cvssdisplay.js diff --git a/gsa/src/web/pages/os/dashboard/index.js b/gsa/src/web/pages/operatingsystems/dashboard/index.js similarity index 100% rename from gsa/src/web/pages/os/dashboard/index.js rename to gsa/src/web/pages/operatingsystems/dashboard/index.js diff --git a/gsa/src/web/pages/os/dashboard/loaders.js b/gsa/src/web/pages/operatingsystems/dashboard/loaders.js similarity index 100% rename from gsa/src/web/pages/os/dashboard/loaders.js rename to gsa/src/web/pages/operatingsystems/dashboard/loaders.js diff --git a/gsa/src/web/pages/os/dashboard/severityclassdisplay.js b/gsa/src/web/pages/operatingsystems/dashboard/severityclassdisplay.js similarity index 100% rename from gsa/src/web/pages/os/dashboard/severityclassdisplay.js rename to gsa/src/web/pages/operatingsystems/dashboard/severityclassdisplay.js diff --git a/gsa/src/web/pages/os/dashboard/vulnscoredisplay.js b/gsa/src/web/pages/operatingsystems/dashboard/vulnscoredisplay.js similarity index 100% rename from gsa/src/web/pages/os/dashboard/vulnscoredisplay.js rename to gsa/src/web/pages/operatingsystems/dashboard/vulnscoredisplay.js diff --git a/gsa/src/web/pages/os/detailspage.js b/gsa/src/web/pages/operatingsystems/detailspage.js similarity index 100% rename from gsa/src/web/pages/os/detailspage.js rename to gsa/src/web/pages/operatingsystems/detailspage.js diff --git a/gsa/src/web/pages/os/filterdialog.js b/gsa/src/web/pages/operatingsystems/filterdialog.js similarity index 100% rename from gsa/src/web/pages/os/filterdialog.js rename to gsa/src/web/pages/operatingsystems/filterdialog.js diff --git a/gsa/src/web/pages/os/listpage.js b/gsa/src/web/pages/operatingsystems/listpage.js similarity index 100% rename from gsa/src/web/pages/os/listpage.js rename to gsa/src/web/pages/operatingsystems/listpage.js diff --git a/gsa/src/web/pages/os/row.js b/gsa/src/web/pages/operatingsystems/row.js similarity index 100% rename from gsa/src/web/pages/os/row.js rename to gsa/src/web/pages/operatingsystems/row.js diff --git a/gsa/src/web/pages/os/table.js b/gsa/src/web/pages/operatingsystems/table.js similarity index 100% rename from gsa/src/web/pages/os/table.js rename to gsa/src/web/pages/operatingsystems/table.js diff --git a/gsa/src/web/pages/start/dashboard.js b/gsa/src/web/pages/start/dashboard.js index 44c662f83d..618eef3521 100644 --- a/gsa/src/web/pages/start/dashboard.js +++ b/gsa/src/web/pages/start/dashboard.js @@ -43,7 +43,7 @@ import {NOTES_DISPLAYS} from '../notes/dashboard'; import {OVERRIDES_DISPLAYS} from '../overrides/dashboard'; import {VULNS_DISPLAYS} from '../vulns/dashboard'; import {HOSTS_DISPLAYS} from '../hosts/dashboard'; -import {OS_DISPLAYS} from '../os/dashboard'; +import {OS_DISPLAYS} from '../operatingsystems/dashboard'; import {NVTS_DISPLAYS} from '../nvts/dashboard'; import {OVALDEF_DISPLAYS} from '../ovaldefs/dashboard'; import {CERTBUND_DISPLAYS} from '../certbund/dashboard'; diff --git a/gsa/src/web/routes.js b/gsa/src/web/routes.js index b0038612d3..faa6454ce4 100644 --- a/gsa/src/web/routes.js +++ b/gsa/src/web/routes.js @@ -67,8 +67,8 @@ import NotesPage from './pages/notes/listpage'; import NoteDetailsPage from './pages/notes/detailspage'; import NvtsPage from './pages/nvts/listpage'; import NvtDetailsPage from './pages/nvts/detailspage'; -import OperatingSystemsPage from './pages/os/listpage'; -import OperatingSystemDetailsPage from './pages/os/detailspage'; +import OperatingSystemsPage from './pages/operatingsystems/listpage'; +import OperatingSystemDetailsPage from './pages/operatingsystems/detailspage'; import OvaldefsPage from './pages/ovaldefs/listpage'; import OvaldefDetailsPage from './pages/ovaldefs/detailspage'; import OverridesPage from './pages/overrides/listpage'; From 25abc60913103f33419434e8311c749f73a7eb04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 16:09:14 +0200 Subject: [PATCH 27/71] Adjust imports for ovaldefs list page --- gsa/src/web/pages/ovaldefs/listpage.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gsa/src/web/pages/ovaldefs/listpage.js b/gsa/src/web/pages/ovaldefs/listpage.js index bf3ecdf0ac..77d1e10a82 100644 --- a/gsa/src/web/pages/ovaldefs/listpage.js +++ b/gsa/src/web/pages/ovaldefs/listpage.js @@ -27,17 +27,17 @@ import _ from 'gmp/locale'; import {OVALDEFS_FILTER_FILTER} from 'gmp/models/filter'; -import EntitiesPage from '../../entities/page.js'; -import withEntitiesContainer from '../../entities/withEntitiesContainer.js'; +import EntitiesPage from 'web/entities/page'; +import withEntitiesContainer from 'web/entities/withEntitiesContainer'; -import DashboardControls from '../../components/dashboard/controls'; +import DashboardControls from 'web/components/dashboard/controls'; -import ManualIcon from '../../components/icon/manualicon.js'; +import ManualIcon from 'web/components/icon/manualicon'; -import OvaldefFilterDialog from './filterdialog.js'; -import OvaldefsTable from './table.js'; +import OvaldefFilterDialog from './filterdialog'; +import OvaldefsTable from './table'; -import OvaldefDashboard, {OVALDEF_DASHBOARD_ID} from './dashboard/index.js'; +import OvaldefDashboard, {OVALDEF_DASHBOARD_ID} from './dashboard'; const ToolBarIcons = props => { From 12e24151f6e11568df62d0824033b3c9eefd8004 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 16:11:35 +0200 Subject: [PATCH 28/71] Pass props directly to EntitiesPage at ovaldefs list page Don't pass EntitiesPage props through the withEntitesContainer HOC. --- gsa/src/web/pages/ovaldefs/listpage.js | 45 ++++++++++++++------------ 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/gsa/src/web/pages/ovaldefs/listpage.js b/gsa/src/web/pages/ovaldefs/listpage.js index 77d1e10a82..2523c7ca1b 100644 --- a/gsa/src/web/pages/ovaldefs/listpage.js +++ b/gsa/src/web/pages/ovaldefs/listpage.js @@ -39,29 +39,32 @@ import OvaldefsTable from './table'; import OvaldefDashboard, {OVALDEF_DASHBOARD_ID} from './dashboard'; +const ToolBarIcons = () => ( + +); -const ToolBarIcons = props => { - return ( - - ); -}; +const Page = props => ( + ( + + )} + filterEditDialog={OvaldefFilterDialog} + filtersFilter={OVALDEFS_FILTER_FILTER} + sectionIcon="ovaldef.svg" + table={OvaldefsTable} + title={_('OVAL Definitions')} + toolBarIcons={ToolBarIcons} + /> +); export default withEntitiesContainer('ovaldef', { - createFilterType: 'info', - dashboard2: OvaldefDashboard, - dashboardControls: () => ( - - ), - filterEditDialog: OvaldefFilterDialog, - filtersFilter: OVALDEFS_FILTER_FILTER, - sectionIcon: 'ovaldef.svg', - table: OvaldefsTable, - title: _('OVAL Definitions'), - toolBarIcons: ToolBarIcons, -})(EntitiesPage); +})(Page); // vim: set ts=2 sw=2 tw=80: From acd463897441a789e5b36951df6e0ce2713dace8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 16:14:44 +0200 Subject: [PATCH 29/71] Load entities from redux store for ovaldefs list page --- gsa/src/web/pages/ovaldefs/listpage.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gsa/src/web/pages/ovaldefs/listpage.js b/gsa/src/web/pages/ovaldefs/listpage.js index 2523c7ca1b..5ce3bfdaff 100644 --- a/gsa/src/web/pages/ovaldefs/listpage.js +++ b/gsa/src/web/pages/ovaldefs/listpage.js @@ -28,12 +28,17 @@ import _ from 'gmp/locale'; import {OVALDEFS_FILTER_FILTER} from 'gmp/models/filter'; import EntitiesPage from 'web/entities/page'; -import withEntitiesContainer from 'web/entities/withEntitiesContainer'; +import withEntitiesContainer from 'web/entities/withEntitiesContainer2'; import DashboardControls from 'web/components/dashboard/controls'; import ManualIcon from 'web/components/icon/manualicon'; +import { + loadEntities, + selector as entitiesSelector, +} from 'web/store/entities/ovaldefs'; + import OvaldefFilterDialog from './filterdialog'; import OvaldefsTable from './table'; @@ -65,6 +70,8 @@ const Page = props => ( ); export default withEntitiesContainer('ovaldef', { + entitiesSelector, + loadEntities, })(Page); // vim: set ts=2 sw=2 tw=80: From 246a81392cc19826b958590bddf876316d478854 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 16:16:04 +0200 Subject: [PATCH 30/71] Adjust imports at overrides list page --- gsa/src/web/pages/overrides/listpage.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/gsa/src/web/pages/overrides/listpage.js b/gsa/src/web/pages/overrides/listpage.js index 6b17f936fd..395056eebd 100644 --- a/gsa/src/web/pages/overrides/listpage.js +++ b/gsa/src/web/pages/overrides/listpage.js @@ -25,25 +25,25 @@ import React from 'react'; import _ from 'gmp/locale'; -import PropTypes from '../../utils/proptypes.js'; +import {OVERRIDES_FILTER_FILTER} from 'gmp/models/filter'; -import EntitiesPage from '../../entities/page.js'; -import withEntitiesContainer from '../../entities/withEntitiesContainer.js'; +import PropTypes from 'web/utils/proptypes'; -import DashboardControls from '../../components/dashboard/controls'; +import EntitiesPage from 'web/entities/page'; +import withEntitiesContainer from 'web/entities/withEntitiesContainer'; -import ManualIcon from '../../components/icon/manualicon.js'; -import NewIcon from '../../components/icon/newicon.js'; +import DashboardControls from 'web/components/dashboard/controls'; -import IconDivider from '../../components/layout/icondivider.js'; +import ManualIcon from 'web/components/icon/manualicon'; +import NewIcon from 'web/components/icon/newicon'; -import FilterDialog from './filterdialog.js'; -import OverridesTable from './table.js'; -import OverrideComponent from './component.js'; +import IconDivider from 'web/components/layout/icondivider'; -import OverridesDashboard, {OVERRIDES_DASHBOARD_ID} from './dashboard/index.js'; +import FilterDialog from './filterdialog'; +import OverridesTable from './table'; +import OverrideComponent from './component'; -import {OVERRIDES_FILTER_FILTER} from 'gmp/models/filter.js'; +import OverridesDashboard, {OVERRIDES_DASHBOARD_ID} from './dashboard'; const ToolBarIcons = ({ onOverrideCreateClick, From 99b074fe64e546355fb483240352935b0b7ff8d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 16:18:24 +0200 Subject: [PATCH 31/71] Always load details for overrides When calling gmp.overrides.get and getAll always load all entities details. --- gsa/src/gmp/commands/overrides.js | 1 + 1 file changed, 1 insertion(+) diff --git a/gsa/src/gmp/commands/overrides.js b/gsa/src/gmp/commands/overrides.js index 8604957d79..aa469e78b7 100644 --- a/gsa/src/gmp/commands/overrides.js +++ b/gsa/src/gmp/commands/overrides.js @@ -108,6 +108,7 @@ class OverridesCommand extends EntitiesCommand { constructor(http) { super(http, 'override', Override); + this.setParam('details', 1); } getEntitiesResponse(root) { From 2309b06bcf88038a422dfb7689b034adfbd4abad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 16:19:09 +0200 Subject: [PATCH 32/71] Don't pass EntitiesPages props through withEntitiesContainer HOC --- gsa/src/web/pages/overrides/listpage.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/gsa/src/web/pages/overrides/listpage.js b/gsa/src/web/pages/overrides/listpage.js index 395056eebd..222698a6be 100644 --- a/gsa/src/web/pages/overrides/listpage.js +++ b/gsa/src/web/pages/overrides/listpage.js @@ -100,7 +100,12 @@ const Page = ({ }) => ( ( + + )} filterEditDialog={FilterDialog} + filtersFilter={OVERRIDES_FILTER_FILTER} sectionIcon="override.svg" table={OverridesTable} title={_('Overrides')} @@ -126,12 +131,6 @@ Page.propTypes = { }; export default withEntitiesContainer('override', { - dashboard2: OverridesDashboard, - dashboardControls: () => ( - - ), - extraLoadParams: {details: 1}, - filtersFilter: OVERRIDES_FILTER_FILTER, })(Page); // vim: set ts=2 sw=2 tw=80: From b8ade25cc79ea02c11df9bb8d3d53937b06b3057 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 16:20:17 +0200 Subject: [PATCH 33/71] Use withCapabilities for override list page ToolBarIcons --- gsa/src/web/pages/overrides/listpage.js | 40 +++++++++++-------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/gsa/src/web/pages/overrides/listpage.js b/gsa/src/web/pages/overrides/listpage.js index 222698a6be..5f9e2489bf 100644 --- a/gsa/src/web/pages/overrides/listpage.js +++ b/gsa/src/web/pages/overrides/listpage.js @@ -28,6 +28,7 @@ import _ from 'gmp/locale'; import {OVERRIDES_FILTER_FILTER} from 'gmp/models/filter'; import PropTypes from 'web/utils/proptypes'; +import withCapabilities from 'web/utils/withCapabilities'; import EntitiesPage from 'web/entities/page'; import withEntitiesContainer from 'web/entities/withEntitiesContainer'; @@ -45,30 +46,25 @@ import OverrideComponent from './component'; import OverridesDashboard, {OVERRIDES_DASHBOARD_ID} from './dashboard'; -const ToolBarIcons = ({ +const ToolBarIcons = withCapabilities(({ + capabilities, onOverrideCreateClick, -}, {capabilities}) => { - return ( - - ( + + + + {capabilities.mayCreate('override') && + - - {capabilities.mayCreate('override') && - - } - - ); -}; - -ToolBarIcons.contextTypes = { - capabilities: PropTypes.capabilities.isRequired, -}; + } + +)); ToolBarIcons.propTypes = { onOverrideCreateClick: PropTypes.func.isRequired, From b1cbdfbc4512ac2e0a6e94223de8deeff5d1ac17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 16:22:15 +0200 Subject: [PATCH 34/71] Adjust imports at permissions list page --- gsa/src/web/pages/permissions/listpage.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/gsa/src/web/pages/permissions/listpage.js b/gsa/src/web/pages/permissions/listpage.js index 37778d1fd4..5c7935f916 100644 --- a/gsa/src/web/pages/permissions/listpage.js +++ b/gsa/src/web/pages/permissions/listpage.js @@ -24,22 +24,22 @@ import React from 'react'; import _ from 'gmp/locale'; -import PropTypes from '../../utils/proptypes.js'; -import withCapabilities from '../../utils/withCapabilities.js'; +import PropTypes from 'web/utils/proptypes'; +import withCapabilities from 'web/utils/withCapabilities'; -import EntitiesPage from '../../entities/page.js'; -import withEntitiesContainer from '../../entities/withEntitiesContainer.js'; +import EntitiesPage from 'web/entities/page'; +import withEntitiesContainer from 'web/entities/withEntitiesContainer'; -import ManualIcon from '../../components/icon/manualicon.js'; -import NewIcon from '../../components/icon/newicon.js'; +import ManualIcon from 'web/components/icon/manualicon'; +import NewIcon from 'web/components/icon/newicon'; -import IconDivider from '../../components/layout/icondivider.js'; +import IconDivider from 'web/components/layout/icondivider'; -import {createFilterDialog} from '../../components/powerfilter/dialog.js'; +import {createFilterDialog} from 'web/components/powerfilter/dialog'; -import Table, {SORT_FIELDS} from './table.js'; +import Table, {SORT_FIELDS} from './table'; -import PermissionComponent from './component.js'; +import PermissionComponent from './component'; const ToolBarIcons = withCapabilities(({ capabilities, From b816ef51708eb515ed1f556d7e786aec9e7c9e9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 16:23:28 +0200 Subject: [PATCH 35/71] Load entities from redux store for permissions list page --- gsa/src/web/pages/permissions/listpage.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gsa/src/web/pages/permissions/listpage.js b/gsa/src/web/pages/permissions/listpage.js index 5c7935f916..b02630e9e2 100644 --- a/gsa/src/web/pages/permissions/listpage.js +++ b/gsa/src/web/pages/permissions/listpage.js @@ -28,7 +28,7 @@ import PropTypes from 'web/utils/proptypes'; import withCapabilities from 'web/utils/withCapabilities'; import EntitiesPage from 'web/entities/page'; -import withEntitiesContainer from 'web/entities/withEntitiesContainer'; +import withEntitiesContainer from 'web/entities/withEntitiesContainer2'; import ManualIcon from 'web/components/icon/manualicon'; import NewIcon from 'web/components/icon/newicon'; @@ -37,6 +37,11 @@ import IconDivider from 'web/components/layout/icondivider'; import {createFilterDialog} from 'web/components/powerfilter/dialog'; +import { + loadEntities, + selector as entitiesSelector, +} from 'web/store/entities/permissions'; + import Table, {SORT_FIELDS} from './table'; import PermissionComponent from './component'; @@ -116,6 +121,9 @@ Page.propTypes = { onError: PropTypes.func.isRequired, }; -export default withEntitiesContainer('permission')(Page); +export default withEntitiesContainer('permission', { + entitiesSelector, + loadEntities, +})(Page); // vim: set ts=2 sw=2 tw=80: From 6df69f869e789c708e02e2932523833504afaee2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 16:36:21 +0200 Subject: [PATCH 36/71] Load overrides into redux store --- gsa/CMakeLists.txt | 1 + .../web/store/entities/__tests__/overrides.js | 29 +++++++++++++ gsa/src/web/store/entities/overrides.js | 43 +++++++++++++++++++ gsa/src/web/store/entities/reducers.js | 2 + 4 files changed, 75 insertions(+) create mode 100644 gsa/src/web/store/entities/__tests__/overrides.js create mode 100644 gsa/src/web/store/entities/overrides.js diff --git a/gsa/CMakeLists.txt b/gsa/CMakeLists.txt index 30deb0d580..035620fbc8 100644 --- a/gsa/CMakeLists.txt +++ b/gsa/CMakeLists.txt @@ -787,6 +787,7 @@ set (GSA_JS_SRC_FILES ${GSA_SRC_DIR}/src/web/store/entities/nvts.js ${GSA_SRC_DIR}/src/web/store/entities/operatingsystems.js ${GSA_SRC_DIR}/src/web/store/entities/ovaldefs.js + ${GSA_SRC_DIR}/src/web/store/entities/overrides.js ${GSA_SRC_DIR}/src/web/store/entities/permissions.js ${GSA_SRC_DIR}/src/web/store/entities/portlists.js ${GSA_SRC_DIR}/src/web/store/entities/reducers.js diff --git a/gsa/src/web/store/entities/__tests__/overrides.js b/gsa/src/web/store/entities/__tests__/overrides.js new file mode 100644 index 0000000000..89a7cf7f68 --- /dev/null +++ b/gsa/src/web/store/entities/__tests__/overrides.js @@ -0,0 +1,29 @@ +/* Greenbone Security Assistant + * + * Authors: + * Björn Ricks + * + * Copyright: + * Copyright (C) 2018 Greenbone Networks GmbH + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + */ +import {testAll} from '../utils/testing'; + +import * as funcs from '../overrides'; + +testAll('override', funcs); + +// vim: set ts=2 sw=2 tw=80: diff --git a/gsa/src/web/store/entities/overrides.js b/gsa/src/web/store/entities/overrides.js new file mode 100644 index 0000000000..7c549bf557 --- /dev/null +++ b/gsa/src/web/store/entities/overrides.js @@ -0,0 +1,43 @@ +/* Greenbone Security Assistant + * + * Authors: + * Björn Ricks + * + * Copyright: + * Copyright (C) 2018 Greenbone Networks GmbH + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + */ +import {createAll} from './utils/main'; + +const { + loadEntities, + loadEntity, + reducer, + selector, + entitiesActions, + entityActions, +} = createAll('override'); + +export { + loadEntities, + loadEntity, + reducer, + selector, + entitiesActions, + entityActions, +}; + +// vim: set ts=2 sw=2 tw=80: diff --git a/gsa/src/web/store/entities/reducers.js b/gsa/src/web/store/entities/reducers.js index 3c829baf30..3d9c5bb2b3 100644 --- a/gsa/src/web/store/entities/reducers.js +++ b/gsa/src/web/store/entities/reducers.js @@ -37,6 +37,7 @@ import {reducer as note} from './notes'; import {reducer as nvt} from './nvts'; import {reducer as operatingsystem} from './operatingsystems'; import {reducer as ovaldef} from './ovaldefs'; +import {reducer as override} from './overrides'; import {reducer as permission} from './permissions'; import {reducer as portlist} from './portlists'; import {reducer as reportformat} from './reportformats'; @@ -68,6 +69,7 @@ const entitiesReducer = combineReducers({ nvt, operatingsystem, ovaldef, + override, permission, portlist, reportformat, From e07cb14fcad7e17a6377997153d3a3f586ac44c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 16:36:43 +0200 Subject: [PATCH 37/71] Load entities from redux store at overrides list page --- gsa/src/web/pages/overrides/listpage.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gsa/src/web/pages/overrides/listpage.js b/gsa/src/web/pages/overrides/listpage.js index 5f9e2489bf..e9f51b823d 100644 --- a/gsa/src/web/pages/overrides/listpage.js +++ b/gsa/src/web/pages/overrides/listpage.js @@ -31,7 +31,7 @@ import PropTypes from 'web/utils/proptypes'; import withCapabilities from 'web/utils/withCapabilities'; import EntitiesPage from 'web/entities/page'; -import withEntitiesContainer from 'web/entities/withEntitiesContainer'; +import withEntitiesContainer from 'web/entities/withEntitiesContainer2'; import DashboardControls from 'web/components/dashboard/controls'; @@ -40,6 +40,11 @@ import NewIcon from 'web/components/icon/newicon'; import IconDivider from 'web/components/layout/icondivider'; +import { + loadEntities, + selector as entitiesSelector, +} from 'web/store/entities/overrides'; + import FilterDialog from './filterdialog'; import OverridesTable from './table'; import OverrideComponent from './component'; @@ -127,6 +132,8 @@ Page.propTypes = { }; export default withEntitiesContainer('override', { + entitiesSelector, + loadEntities, })(Page); // vim: set ts=2 sw=2 tw=80: From 6b97a33e57ab3411f8e585da992151e370a5dc94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 16:38:19 +0200 Subject: [PATCH 38/71] Adjust imports at results list page --- gsa/src/web/pages/results/listpage.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/gsa/src/web/pages/results/listpage.js b/gsa/src/web/pages/results/listpage.js index 2386930b7a..8e110781b9 100644 --- a/gsa/src/web/pages/results/listpage.js +++ b/gsa/src/web/pages/results/listpage.js @@ -25,23 +25,21 @@ import React from 'react'; import _ from 'gmp/locale'; -import Layout from '../../components/layout/layout.js'; +import {RESULTS_FILTER_FILTER} from 'gmp/models/filter'; -import EntitiesPage from '../../entities/page.js'; -import withEntitiesContainer from '../../entities/withEntitiesContainer.js'; +import Layout from 'web/components/layout/layout'; -import DashboardControls from '../../components/dashboard/controls'; +import EntitiesPage from 'web/entities/page'; +import withEntitiesContainer from 'web/entities/withEntitiesContainer'; -import ManualIcon from '../../components/icon/manualicon.js'; +import DashboardControls from 'web/components/dashboard/controls'; -import ResultsFilterDialog from './filterdialog.js'; - -import ResultsTable from './table.js'; +import ManualIcon from 'web/components/icon/manualicon'; +import ResultsFilterDialog from './filterdialog'; +import ResultsTable from './table'; import ResultsDashboard, {RESULTS_DASHBOARD_ID} from './dashboard'; -import {RESULTS_FILTER_FILTER} from 'gmp/models/filter.js'; - const ToolBarIcons = props => { return ( From 16fa16b89c9012c2be478952a3bd0146b9c54f3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 16:40:48 +0200 Subject: [PATCH 39/71] Don't pass EntitiesPage props through withEntitisContainer HOC --- gsa/src/web/pages/results/listpage.js | 48 +++++++++++++++------------ 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/gsa/src/web/pages/results/listpage.js b/gsa/src/web/pages/results/listpage.js index 8e110781b9..01911a143a 100644 --- a/gsa/src/web/pages/results/listpage.js +++ b/gsa/src/web/pages/results/listpage.js @@ -40,30 +40,34 @@ import ResultsFilterDialog from './filterdialog'; import ResultsTable from './table'; import ResultsDashboard, {RESULTS_DASHBOARD_ID} from './dashboard'; -const ToolBarIcons = props => { - return ( - - - - ); -}; +const ToolBarIcons = () => ( + + + +); + +const Page = props => ( + ( + + )} + title={_('Results')} + sectionIcon="result.svg" + toolBarIcons={ToolBarIcons} + table={ResultsTable} + filterEditDialog={ResultsFilterDialog} + /> +); export default withEntitiesContainer('result', { - filtersFilter: RESULTS_FILTER_FILTER, - dashboard2: ResultsDashboard, - dashboardControls: () => ( - - ), - title: _('Results'), - sectionIcon: 'result.svg', - toolBarIcons: ToolBarIcons, - table: ResultsTable, - filterEditDialog: ResultsFilterDialog, -})(EntitiesPage); +})(Page); // export default ResultsPage; From 76344b19aa7e01ef3a4bb9b5f00eb1ede8c66e1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 16:42:34 +0200 Subject: [PATCH 40/71] Load entities from redux store for results list page --- gsa/src/web/pages/results/listpage.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gsa/src/web/pages/results/listpage.js b/gsa/src/web/pages/results/listpage.js index 01911a143a..f29bbea36a 100644 --- a/gsa/src/web/pages/results/listpage.js +++ b/gsa/src/web/pages/results/listpage.js @@ -30,12 +30,17 @@ import {RESULTS_FILTER_FILTER} from 'gmp/models/filter'; import Layout from 'web/components/layout/layout'; import EntitiesPage from 'web/entities/page'; -import withEntitiesContainer from 'web/entities/withEntitiesContainer'; +import withEntitiesContainer from 'web/entities/withEntitiesContainer2'; import DashboardControls from 'web/components/dashboard/controls'; import ManualIcon from 'web/components/icon/manualicon'; +import { + loadEntities, + selector as entitiesSelector, +} from 'web/store/entities/results'; + import ResultsFilterDialog from './filterdialog'; import ResultsTable from './table'; import ResultsDashboard, {RESULTS_DASHBOARD_ID} from './dashboard'; @@ -67,6 +72,8 @@ const Page = props => ( ); export default withEntitiesContainer('result', { + entitiesSelector, + loadEntities, })(Page); // export default ResultsPage; From 8ba39b214ebf4ab3d71bc66d24a1c86ef0b94a60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 16:44:11 +0200 Subject: [PATCH 41/71] Adjust imports at roles list page --- gsa/src/web/pages/roles/listpage.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/gsa/src/web/pages/roles/listpage.js b/gsa/src/web/pages/roles/listpage.js index e84c4406b0..f79e8bc073 100644 --- a/gsa/src/web/pages/roles/listpage.js +++ b/gsa/src/web/pages/roles/listpage.js @@ -24,22 +24,22 @@ import React from 'react'; import _ from 'gmp/locale'; -import PropTypes from '../../utils/proptypes.js'; +import {ROLES_FILTER_FILTER} from 'gmp/models/filter'; -import EntitiesPage from '../../entities/page.js'; -import withEntitiesContainer from '../../entities/withEntitiesContainer.js'; +import PropTypes from 'web/utils/proptypes'; -import ManualIcon from '../../components/icon/manualicon.js'; -import NewIcon from '../../components/icon/newicon.js'; +import EntitiesPage from 'web/entities/page'; +import withEntitiesContainer from 'web/entities/withEntitiesContainer'; -import IconDivider from '../../components/layout/icondivider.js'; +import ManualIcon from 'web/components/icon/manualicon'; +import NewIcon from 'web/components/icon/newicon'; -import {createFilterDialog} from '../../components/powerfilter/dialog.js'; +import IconDivider from 'web/components/layout/icondivider'; -import {ROLES_FILTER_FILTER} from 'gmp/models/filter.js'; +import {createFilterDialog} from 'web/components/powerfilter/dialog'; -import RoleComponent from './component.js'; -import Table, {SORT_FIELDS} from './table.js'; +import RoleComponent from './component'; +import Table, {SORT_FIELDS} from './table'; const ToolBarIcons = ({ onRoleCreateClick, From 238b5c2be311b7561269d94bc75cbf319d59f150 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 16:44:48 +0200 Subject: [PATCH 42/71] Pass filterFilter prop to EntitiesPage directly --- gsa/src/web/pages/roles/listpage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gsa/src/web/pages/roles/listpage.js b/gsa/src/web/pages/roles/listpage.js index f79e8bc073..6c38397f2d 100644 --- a/gsa/src/web/pages/roles/listpage.js +++ b/gsa/src/web/pages/roles/listpage.js @@ -97,6 +97,7 @@ const RolesPage = ({ Date: Thu, 26 Jul 2018 16:45:50 +0200 Subject: [PATCH 43/71] Use withCapabilities HOC for roles list page ToolBarIcons --- gsa/src/web/pages/roles/listpage.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/gsa/src/web/pages/roles/listpage.js b/gsa/src/web/pages/roles/listpage.js index 6c38397f2d..4fe969cac4 100644 --- a/gsa/src/web/pages/roles/listpage.js +++ b/gsa/src/web/pages/roles/listpage.js @@ -27,6 +27,7 @@ import _ from 'gmp/locale'; import {ROLES_FILTER_FILTER} from 'gmp/models/filter'; import PropTypes from 'web/utils/proptypes'; +import withCapabilities from 'web/utils/withCapabilities'; import EntitiesPage from 'web/entities/page'; import withEntitiesContainer from 'web/entities/withEntitiesContainer'; @@ -41,9 +42,10 @@ import {createFilterDialog} from 'web/components/powerfilter/dialog'; import RoleComponent from './component'; import Table, {SORT_FIELDS} from './table'; -const ToolBarIcons = ({ +const ToolBarIcons = withCapabilities(({ + capabilities, onRoleCreateClick, -}, {capabilities}) => ( +}) => ( } -); +)); ToolBarIcons.propTypes = { onRoleCreateClick: PropTypes.func.isRequired, }; -ToolBarIcons.contextTypes = { - capabilities: PropTypes.capabilities.isRequired, -}; - const RolesFilterDialog = createFilterDialog({ sortFields: SORT_FIELDS, }); From 5ae7f634bdee4ab7c6406f2129f562e2c9faf086 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 26 Jul 2018 16:46:52 +0200 Subject: [PATCH 44/71] Load entities from redux store for roles list page --- gsa/src/web/pages/roles/listpage.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gsa/src/web/pages/roles/listpage.js b/gsa/src/web/pages/roles/listpage.js index 4fe969cac4..405955a59f 100644 --- a/gsa/src/web/pages/roles/listpage.js +++ b/gsa/src/web/pages/roles/listpage.js @@ -30,7 +30,7 @@ import PropTypes from 'web/utils/proptypes'; import withCapabilities from 'web/utils/withCapabilities'; import EntitiesPage from 'web/entities/page'; -import withEntitiesContainer from 'web/entities/withEntitiesContainer'; +import withEntitiesContainer from 'web/entities/withEntitiesContainer2'; import ManualIcon from 'web/components/icon/manualicon'; import NewIcon from 'web/components/icon/newicon'; @@ -39,6 +39,11 @@ import IconDivider from 'web/components/layout/icondivider'; import {createFilterDialog} from 'web/components/powerfilter/dialog'; +import { + loadEntities, + selector as entitiesSelector, +} from 'web/store/entities/roles'; + import RoleComponent from './component'; import Table, {SORT_FIELDS} from './table'; @@ -121,6 +126,8 @@ RolesPage.propTypes = { }; export default withEntitiesContainer('role', { + entitiesSelector, + loadEntities, })(RolesPage); // vim: set ts=2 sw=2 tw=80: From b2d74268937cfa1851412f58cac5244ebeebba9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Fri, 27 Jul 2018 08:13:39 +0200 Subject: [PATCH 45/71] Adjust imports at secinfo list page --- gsa/src/web/pages/secinfo/listpage.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gsa/src/web/pages/secinfo/listpage.js b/gsa/src/web/pages/secinfo/listpage.js index a519e88ab6..a57b0e85a6 100644 --- a/gsa/src/web/pages/secinfo/listpage.js +++ b/gsa/src/web/pages/secinfo/listpage.js @@ -27,20 +27,20 @@ import _ from 'gmp/locale'; import {SECINFO_FILTER_FILTER} from 'gmp/models/filter'; -import EntitiesPage from '../../entities/page.js'; -import withEntitiesContainer from '../../entities/withEntitiesContainer.js'; +import EntitiesPage from 'web/entities/page'; +import withEntitiesContainer from 'web/entities/withEntitiesContainer'; -import DashboardControls from '../../components/dashboard/controls'; +import DashboardControls from 'web/components/dashboard/controls'; -import ManualIcon from '../../components/icon/manualicon.js'; +import ManualIcon from 'web/components/icon/manualicon'; -import SecInfoFilterDialog from './filterdialog.js'; -import SecInfosTable from './table.js'; +import SecInfoFilterDialog from './filterdialog'; +import SecInfosTable from './table'; import { SecInfoDashboard, SECINFO_DASHBOARD_ID, -} from './dashboard/index.js'; +} from './dashboard'; const ToolBarIcons = props => { return ( From 088b183cf84853ac530d7d0eee2647a817cabf77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Fri, 27 Jul 2018 08:16:07 +0200 Subject: [PATCH 46/71] Don't pass EntitiesPage prop through withEntitiesContainer --- gsa/src/web/pages/secinfo/listpage.js | 46 +++++++++++++++------------ 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/gsa/src/web/pages/secinfo/listpage.js b/gsa/src/web/pages/secinfo/listpage.js index a57b0e85a6..15c0aee7ac 100644 --- a/gsa/src/web/pages/secinfo/listpage.js +++ b/gsa/src/web/pages/secinfo/listpage.js @@ -42,28 +42,32 @@ import { SECINFO_DASHBOARD_ID, } from './dashboard'; -const ToolBarIcons = props => { - return ( - - ); -}; +const ToolBarIcons = () => ( + +); + +const Page = props => ( + ( + + )} + filterEditDialog={SecInfoFilterDialog} + filtersFilter={SECINFO_FILTER_FILTER} + sectionIcon="allinfo.svg" + table={SecInfosTable} + title={_('All SecInfo Information')} + toolBarIcons={ToolBarIcons} + /> +); export default withEntitiesContainer('secinfo', { - createFilterType: 'info', - dashboard2: SecInfoDashboard, - dashboardControls: () => ( - - ), - filterEditDialog: SecInfoFilterDialog, - filtersFilter: SECINFO_FILTER_FILTER, - sectionIcon: 'allinfo.svg', - table: SecInfosTable, - title: _('All SecInfo Information'), - toolBarIcons: ToolBarIcons, -})(EntitiesPage); +})(Page); // vim: set ts=2 sw=2 tw=80: From 40bfe31976099352fa789844f01fb7f185d3dc92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Fri, 27 Jul 2018 08:19:42 +0200 Subject: [PATCH 47/71] Use redux store to load secinfo entities --- gsa/src/web/pages/secinfo/listpage.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gsa/src/web/pages/secinfo/listpage.js b/gsa/src/web/pages/secinfo/listpage.js index 15c0aee7ac..978a046ac7 100644 --- a/gsa/src/web/pages/secinfo/listpage.js +++ b/gsa/src/web/pages/secinfo/listpage.js @@ -28,12 +28,17 @@ import _ from 'gmp/locale'; import {SECINFO_FILTER_FILTER} from 'gmp/models/filter'; import EntitiesPage from 'web/entities/page'; -import withEntitiesContainer from 'web/entities/withEntitiesContainer'; +import withEntitiesContainer from 'web/entities/withEntitiesContainer2'; import DashboardControls from 'web/components/dashboard/controls'; import ManualIcon from 'web/components/icon/manualicon'; +import { + loadEntities, + selector as entitiesSelector, +} from 'web/store/entities/secinfo'; + import SecInfoFilterDialog from './filterdialog'; import SecInfosTable from './table'; @@ -68,6 +73,8 @@ const Page = props => ( ); export default withEntitiesContainer('secinfo', { + entitiesSelector, + loadEntities, })(Page); // vim: set ts=2 sw=2 tw=80: From 13960172f70591c042bb1fb0403cebc24c302551 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Fri, 27 Jul 2018 08:21:05 +0200 Subject: [PATCH 48/71] Adjust imports at tags list page --- gsa/src/web/pages/tags/listpage.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/gsa/src/web/pages/tags/listpage.js b/gsa/src/web/pages/tags/listpage.js index a3f7bcf94f..bbb0eb1542 100644 --- a/gsa/src/web/pages/tags/listpage.js +++ b/gsa/src/web/pages/tags/listpage.js @@ -26,21 +26,21 @@ import _ from 'gmp/locale'; import {TAGS_FILTER_FILTER} from 'gmp/models/filter'; -import PropTypes from '../../utils/proptypes.js'; -import withCapabilties from '../../utils/withCapabilities.js'; +import PropTypes from 'web/utils/proptypes'; +import withCapabilties from 'web/utils/withCapabilities'; -import EntitiesPage from '../../entities/page.js'; -import withEntitiesContainer from '../../entities/withEntitiesContainer.js'; +import EntitiesPage from 'web/entities/page'; +import withEntitiesContainer from 'web/entities/withEntitiesContainer'; -import ManualIcon from '../../components/icon/manualicon.js'; -import NewIcon from '../../components/icon/newicon.js'; +import ManualIcon from 'web/components/icon/manualicon'; +import NewIcon from 'web/components/icon/newicon'; -import IconDivider from '../../components/layout/icondivider.js'; +import IconDivider from 'web/components/layout/icondivider'; -import {createFilterDialog} from '../../components/powerfilter/dialog.js'; +import {createFilterDialog} from 'web/components/powerfilter/dialog'; -import TagComponent from './component.js'; -import TagsTable from './table.js'; +import TagComponent from './component'; +import TagsTable from './table'; export const SORT_FIELDS = [ ['name', _('Name'), '30%'], From 4a5f11fa9a26bc69daa43053395549af4cba88ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Fri, 27 Jul 2018 08:23:00 +0200 Subject: [PATCH 49/71] Load entities from redux store at tags list page --- gsa/src/web/pages/tags/listpage.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gsa/src/web/pages/tags/listpage.js b/gsa/src/web/pages/tags/listpage.js index bbb0eb1542..08aaa0381a 100644 --- a/gsa/src/web/pages/tags/listpage.js +++ b/gsa/src/web/pages/tags/listpage.js @@ -30,7 +30,7 @@ import PropTypes from 'web/utils/proptypes'; import withCapabilties from 'web/utils/withCapabilities'; import EntitiesPage from 'web/entities/page'; -import withEntitiesContainer from 'web/entities/withEntitiesContainer'; +import withEntitiesContainer from 'web/entities/withEntitiesContainer2'; import ManualIcon from 'web/components/icon/manualicon'; import NewIcon from 'web/components/icon/newicon'; @@ -39,6 +39,11 @@ import IconDivider from 'web/components/layout/icondivider'; import {createFilterDialog} from 'web/components/powerfilter/dialog'; +import { + loadEntities, + selector as entitiesSelector, +} from 'web/store/entities/tags'; + import TagComponent from './component'; import TagsTable from './table'; @@ -138,6 +143,8 @@ TagsPage.propTypes = { }; export default withEntitiesContainer('tag', { + entitiesSelector, + loadEntities, })(TagsPage); // vim: set ts=2 sw=2 tw=80: From 41fec98c907b969585a3ae73c2765cd2dadfe896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Fri, 27 Jul 2018 08:26:15 +0200 Subject: [PATCH 50/71] Adjust imports at users list page --- gsa/src/web/pages/users/listpage.js | 34 ++++++++++++++--------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/gsa/src/web/pages/users/listpage.js b/gsa/src/web/pages/users/listpage.js index 27525260ac..f344d68616 100644 --- a/gsa/src/web/pages/users/listpage.js +++ b/gsa/src/web/pages/users/listpage.js @@ -26,31 +26,31 @@ import React from 'react'; import _ from 'gmp/locale'; -import {isDefined} from 'gmp/utils/identity'; +import {USERS_FILTER_FILTER} from 'gmp/models/filter'; -import PropTypes from '../../utils/proptypes.js'; -import compose from '../../utils/compose.js'; -import withCapabilities from '../../utils/withCapabilities.js'; -import withGmp from '../../utils/withGmp.js'; +import {isDefined} from 'gmp/utils/identity'; -import SelectionType from '../../utils/selectiontype.js'; +import PropTypes from 'web/utils/proptypes'; +import compose from 'web/utils/compose'; +import withCapabilities from 'web/utils/withCapabilities'; +import withGmp from 'web/utils/withGmp'; -import EntitiesPage from '../../entities/page.js'; -import withEntitiesContainer from '../../entities/withEntitiesContainer.js'; +import SelectionType from 'web/utils/selectiontype'; -import ManualIcon from '../../components/icon/manualicon.js'; -import NewIcon from '../../components/icon/newicon.js'; +import EntitiesPage from 'web/entities/page'; +import withEntitiesContainer from 'web/entities/withEntitiesContainer'; -import IconDivider from '../../components/layout/icondivider.js'; -import Wrapper from '../../components/layout/wrapper.js'; +import ManualIcon from 'web/components/icon/manualicon'; +import NewIcon from 'web/components/icon/newicon'; -import {createFilterDialog} from '../../components/powerfilter/dialog.js'; +import IconDivider from 'web/components/layout/icondivider'; +import Wrapper from 'web/components/layout/wrapper'; -import {USERS_FILTER_FILTER} from 'gmp/models/filter.js'; +import {createFilterDialog} from 'web/components/powerfilter/dialog'; -import ConfirmDeleteDialog from './confirmdeletedialog.js'; -import UserComponent from './component.js'; -import UsersTable, {SORT_FIELDS} from './table.js'; +import ConfirmDeleteDialog from './confirmdeletedialog'; +import UserComponent from './component'; +import UsersTable, {SORT_FIELDS} from './table'; const ToolBarIcons = withCapabilities(({ capabilities, From 8066940793fc74333ab9f4c104475256a7481f6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Fri, 27 Jul 2018 08:26:41 +0200 Subject: [PATCH 51/71] Adjust formatting for users list ToolBarIcons --- gsa/src/web/pages/users/listpage.js | 30 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/gsa/src/web/pages/users/listpage.js b/gsa/src/web/pages/users/listpage.js index f344d68616..ef4024ed16 100644 --- a/gsa/src/web/pages/users/listpage.js +++ b/gsa/src/web/pages/users/listpage.js @@ -55,23 +55,21 @@ import UsersTable, {SORT_FIELDS} from './table'; const ToolBarIcons = withCapabilities(({ capabilities, onUserCreateClick, -}) => { - return ( - - ( + + + {capabilities.mayCreate('user') && + - {capabilities.mayCreate('user') && - - } - - ); -}); + } + +)); ToolBarIcons.propTypes = { onUserCreateClick: PropTypes.func.isRequired, From f00a8fa0278fb93fa29ef09f463fcee190cde42a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Fri, 27 Jul 2018 08:28:26 +0200 Subject: [PATCH 52/71] Pass filtersFilter prop to EntitiesPage directly --- gsa/src/web/pages/users/listpage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gsa/src/web/pages/users/listpage.js b/gsa/src/web/pages/users/listpage.js index ef4024ed16..d7c5ebea9c 100644 --- a/gsa/src/web/pages/users/listpage.js +++ b/gsa/src/web/pages/users/listpage.js @@ -201,6 +201,7 @@ class UsersPage extends React.Component { Date: Fri, 27 Jul 2018 08:33:54 +0200 Subject: [PATCH 53/71] Use redux store to load entities at users list --- gsa/src/web/pages/users/listpage.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gsa/src/web/pages/users/listpage.js b/gsa/src/web/pages/users/listpage.js index d7c5ebea9c..d1ac2c1506 100644 --- a/gsa/src/web/pages/users/listpage.js +++ b/gsa/src/web/pages/users/listpage.js @@ -38,7 +38,7 @@ import withGmp from 'web/utils/withGmp'; import SelectionType from 'web/utils/selectiontype'; import EntitiesPage from 'web/entities/page'; -import withEntitiesContainer from 'web/entities/withEntitiesContainer'; +import withEntitiesContainer from 'web/entities/withEntitiesContainer2'; import ManualIcon from 'web/components/icon/manualicon'; import NewIcon from 'web/components/icon/newicon'; @@ -48,6 +48,11 @@ import Wrapper from 'web/components/layout/wrapper'; import {createFilterDialog} from 'web/components/powerfilter/dialog'; +import { + loadEntities, + selector as entitiesSelector, +} from 'web/store/entities/users'; + import ConfirmDeleteDialog from './confirmdeletedialog'; import UserComponent from './component'; import UsersTable, {SORT_FIELDS} from './table'; @@ -249,6 +254,8 @@ UsersPage.propTypes = { export default compose( withGmp, withEntitiesContainer('user', { + entitiesSelector, + loadEntities, }), )(UsersPage); From 3953faed0b719c2aba3c6c75086b51b4782f544f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Fri, 27 Jul 2018 08:34:16 +0200 Subject: [PATCH 54/71] Get rid of wrapper element --- gsa/src/web/pages/users/listpage.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gsa/src/web/pages/users/listpage.js b/gsa/src/web/pages/users/listpage.js index d1ac2c1506..892aa6d29e 100644 --- a/gsa/src/web/pages/users/listpage.js +++ b/gsa/src/web/pages/users/listpage.js @@ -44,7 +44,6 @@ import ManualIcon from 'web/components/icon/manualicon'; import NewIcon from 'web/components/icon/newicon'; import IconDivider from 'web/components/layout/icondivider'; -import Wrapper from 'web/components/layout/wrapper'; import {createFilterDialog} from 'web/components/powerfilter/dialog'; @@ -186,7 +185,7 @@ class UsersPage extends React.Component { } = this.state; return ( - + } - + ); } } From 3d68a0c0fa2ed11c2181c7b2dced62c9ff7fb5d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Fri, 27 Jul 2018 09:22:20 +0200 Subject: [PATCH 55/71] Remove obsolete visible prop from user ConfirmDeleteDialog --- gsa/src/web/pages/users/confirmdeletedialog.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/gsa/src/web/pages/users/confirmdeletedialog.js b/gsa/src/web/pages/users/confirmdeletedialog.js index e4b24b3afa..9f4801f661 100644 --- a/gsa/src/web/pages/users/confirmdeletedialog.js +++ b/gsa/src/web/pages/users/confirmdeletedialog.js @@ -45,7 +45,6 @@ const ConfirmDeleteDialog = ({ title, username, users, - visible, onClose, onSave, }) => { @@ -85,7 +84,6 @@ const ConfirmDeleteDialog = ({ return ( Date: Fri, 27 Jul 2018 09:35:39 +0200 Subject: [PATCH 56/71] Update ConfirmDeleteDialog to current SaveDialog api --- gsa/src/web/pages/users/confirmdeletedialog.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gsa/src/web/pages/users/confirmdeletedialog.js b/gsa/src/web/pages/users/confirmdeletedialog.js index 9f4801f661..bf34cac12d 100644 --- a/gsa/src/web/pages/users/confirmdeletedialog.js +++ b/gsa/src/web/pages/users/confirmdeletedialog.js @@ -87,10 +87,10 @@ const ConfirmDeleteDialog = ({ title={title} onClose={onClose} onSave={onSave} - initialData={data} + defaultValues={data} > {({ - data: state, + values: state, onValueChange, }) => { return ( From 02d9f12929e7772b53a4a2bd8fbbd98bc5c9cffb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Fri, 27 Jul 2018 09:36:10 +0200 Subject: [PATCH 57/71] Simplify user ConfirmDeleteDialog * Always set default value for inheritor selection. * Use camelCase for inheritorId. * Adjust imports * Rename users prop to inheritorUsers * Only use deleteUsers array instead of special props for single user deletion * Use renderSelectItems to render list of inheritor users. --- .../web/pages/users/confirmdeletedialog.js | 74 ++++++++----------- 1 file changed, 31 insertions(+), 43 deletions(-) diff --git a/gsa/src/web/pages/users/confirmdeletedialog.js b/gsa/src/web/pages/users/confirmdeletedialog.js index bf34cac12d..3c14152bfe 100644 --- a/gsa/src/web/pages/users/confirmdeletedialog.js +++ b/gsa/src/web/pages/users/confirmdeletedialog.js @@ -26,33 +26,27 @@ import React from 'react'; import _ from 'gmp/locale'; -import {isDefined} from 'gmp/utils/identity'; -import {map} from 'gmp/utils/array'; +import PropTypes from 'web/utils/proptypes'; +import {renderSelectItems} from 'web/utils/render'; -import PropTypes from '../../utils/proptypes.js'; +import SaveDialog from 'web/components/dialog/savedialog'; -import SaveDialog from '../../components/dialog/savedialog.js'; +import FormGroup from 'web/components/form/formgroup'; +import Select from 'web/components/form/select'; -import FormGroup from '../../components/form/formgroup.js'; -import Select from '../../components/form/select.js'; - -import Layout from '../../components/layout/layout.js'; +import Layout from 'web/components/layout/layout'; const ConfirmDeleteDialog = ({ - deleteUsers, - id, - inheritor_id, - title, - username, - users, - onClose, - onSave, - }) => { - - let headline = ''; - - if (isDefined(username)) { - headline = _('User {{username}} will be deleted.', {username}); + deleteUsers = [], + inheritorId = '--', + title, + inheritorUsers, + onClose, + onSave, +}) => { + let headline; + if (deleteUsers.length === 1) { + headline = _('User {{name}} will be deleted.', {name: deleteUsers[0].name}); } else if (deleteUsers.length > 1) { headline = _('{{count}} users will be deleted', @@ -64,22 +58,18 @@ const ConfirmDeleteDialog = ({ const data = { deleteUsers, - id, - inheritor_id, - username, + inheritorId, }; - const inheritingUserOptions = map(users, user => ({ - label: user.name, - value: user.id, - })); - inheritingUserOptions.unshift({ - label: '--', - value: '--', + const inheritingUserItems = [{ + label: '--', + value: '--', }, { - label: _('Current User'), - value: 'self,', - }); + label: _('Current User'), + value: 'self,', + }, + ...renderSelectItems(inheritorUsers), + ]; return (