Author: timopollmeier
Date: 2017-08-11 15:50:35 +0200 (Fri, 11 Aug 2017)
New Revision: 29336

Added:
   trunk/gsa/src/html/classic/ng/src/web/pages/apps/
   trunk/gsa/src/html/classic/ng/src/web/pages/apps/row.js
   trunk/gsa/src/html/classic/ng/src/web/pages/apps/table.js
Modified:
   trunk/gsa/ChangeLog
   trunk/gsa/src/html/classic/ng/src/web/pages/vulns/row.js
   trunk/gsa/src/html/classic/ng/src/web/pages/vulns/table.js
Log:
        Add ng component class for basic Apps table and allow hiding columns
        in the Vulnerabilities table not needed in the report section.

        * src/html/classic/ng/src/web/pages/apps/row.js: New JS file for an
        Apps table row.

        * src/html/classic/ng/src/web/pages/apps/table.js: New JS file for an
        Apps table.

        * src/html/classic/ng/src/web/pages/vulns/row.js: Add hideColumns
        prop to allow hiding the "Oldest Result" and "Newest Result" columns.

        * src/html/classic/ng/src/web/pages/vulns/table.js: Add hideColumns
        prop to allow hiding the "Oldest Result" and "Newest Result" columns.

Modified: trunk/gsa/ChangeLog
===================================================================
--- trunk/gsa/ChangeLog 2017-08-10 12:12:47 UTC (rev 29335)
+++ trunk/gsa/ChangeLog 2017-08-11 13:50:35 UTC (rev 29336)
@@ -1,3 +1,20 @@
+2017-08-11  Timo Pollmeier <timo.pollme...@greenbone.net>
+
+       Add ng component class for basic Apps table and allow hiding columns
+       in the Vulnerabilities table not needed in the report section.
+
+       * src/html/classic/ng/src/web/pages/apps/row.js: New JS file for an
+       Apps table row.
+
+       * src/html/classic/ng/src/web/pages/apps/table.js: New JS file for an
+       Apps table.
+
+       * src/html/classic/ng/src/web/pages/vulns/row.js: Add hideColumns
+       prop to allow hiding the "Oldest Result" and "Newest Result" columns.
+
+       * src/html/classic/ng/src/web/pages/vulns/table.js: Add hideColumns
+       prop to allow hiding the "Oldest Result" and "Newest Result" columns.
+
 2017-08-04  Michael Wiegand <michael.wieg...@greenbone.net>
 
        Switch to NEW behavior for CMake policy CMP0005. The policy was

Added: trunk/gsa/src/html/classic/ng/src/web/pages/apps/row.js
===================================================================
--- trunk/gsa/src/html/classic/ng/src/web/pages/apps/row.js                     
        (rev 0)
+++ trunk/gsa/src/html/classic/ng/src/web/pages/apps/row.js     2017-08-11 
13:50:35 UTC (rev 29336)
@@ -0,0 +1,130 @@
+/* Greenbone Security Assistant
+ *
+ * Authors:
+ * Björn Ricks <bjoern.ri...@greenbone.net>
+ * Timo Pollmeier <timo.pollme...@greenbone.net>
+ *
+ * Copyright:
+ * Copyright (C) 2017 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 React from 'react';
+
+import _, {datetime} from 'gmp/locale.js';
+import {is_defined} from 'gmp/utils.js';
+
+import PropTypes from '../../utils/proptypes.js';
+import {render_component} from '../../utils/render.js';
+
+import EditIcon from '../../entity/icon/editicon.js';
+import DeleteIcon from '../../entity/icon/deleteicon.js';
+import {withEntityActions} from '../../entities/actions.js';
+import {withEntityRow, RowDetailsToggle} from '../../entities/row.js';
+
+import SeverityBar from '../../components/bar/severitybar.js';
+
+import Comment from '../../components/comment/comment.js';
+
+import ExportIcon from '../../components/icon/exporticon.js';
+import NewIcon from '../../components/icon/newicon.js';
+import OsIcon from '../../components/icon/osicon.js';
+
+import IconDivider from '../../components/layout/icondivider.js';
+
+import TableData from '../../components/table/data.js';
+import TableRow from '../../components/table/row.js';
+
+/*
+const Actions = ({
+    entity,
+    onAppEditClick,
+    onAppDeleteClick,
+    onAppDownloadClick,
+  }, {capabilities}) => {
+
+  return (
+    <IconDivider>
+      <DeleteIcon
+        entity={entity}
+        name="asset"
+        displayName={_('App')}
+        onClick={onAppDeleteClick}/>
+      <EditIcon
+        entity={entity}
+        name="asset"
+        displayName={_('App')}
+        onClick={onAppEditClick}/>
+      <ExportIcon
+        value={entity}
+        title={_('Export App')}
+        onClick={onAppDownloadClick}
+      />
+    </IconDivider>
+  );
+};
+
+Actions.propTypes = {
+  entity: PropTypes.model,
+  onAppDeleteClick: PropTypes.func,
+  onAppDownloadClick: PropTypes.func,
+  onAppEditClick: PropTypes.func,
+};
+
+Actions.contextTypes = {
+  capabilities: PropTypes.capabilities.isRequired,
+};
+*/
+
+const Row = ({
+  entity,
+  links = true,
+  actions,
+  onToggleDetailsClick,
+  ...props,
+}) => {
+  return (
+    <TableRow>
+      <TableData>
+        {entity.name}
+      </TableData>
+      <TableData>
+        {entity.hosts.count}
+      </TableData>
+      <TableData>
+        {entity.occurrences.total}
+      </TableData>
+      <TableData flex align="center">
+        <SeverityBar severity={entity.severity}/>
+      </TableData>
+      {render_component(actions, {...props, entity})}
+    </TableRow>
+  );
+};
+
+Row.propTypes = {
+  actions: PropTypes.componentOrFalse,
+  entity: PropTypes.model.isRequired,
+  links: PropTypes.bool,
+  onToggleDetailsClick: PropTypes.func.isRequired,
+};
+
+// FIXME
+// export default withEntityRow(withEntityActions(Actions))(Row);
+
+export default withEntityRow()(Row);
+
+// vim: set ts=2 sw=2 tw=80:

Added: trunk/gsa/src/html/classic/ng/src/web/pages/apps/table.js
===================================================================
--- trunk/gsa/src/html/classic/ng/src/web/pages/apps/table.js                   
        (rev 0)
+++ trunk/gsa/src/html/classic/ng/src/web/pages/apps/table.js   2017-08-11 
13:50:35 UTC (rev 29336)
@@ -0,0 +1,117 @@
+/* Greenbone Security Assistant
+ *
+ * Authors:
+ * Björn Ricks <bjoern.ri...@greenbone.net>
+ * Timo Pollmeier <timo.pollme...@greenbone.net>
+ *
+ * Copyright:
+ * Copyright (C) 2017 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 React from 'react';
+
+import _ from 'gmp/locale.js';
+
+import PropTypes from '../../utils/proptypes.js';
+
+import SelectionType from '../../utils/selectiontype.js';
+
+import EntitiesFooter, {withEntitiesFooter} from '../../entities/footer.js';
+import {withEntitiesHeader} from '../../entities/header.js';
+import {createEntitiesTable} from '../../entities/table.js';
+// import withRowDetails from '../../entities/withRowDetails.js';
+
+import NewIcon from '../../components/icon/newicon.js';
+
+import TableHead from '../../components/table/head.js';
+import TableHeader from '../../components/table/header.js';
+import TableRow from '../../components/table/row.js';
+
+// import AppDetails from './details.js';
+import AppRow from './row.js';
+
+const Header = ({onSortChange, links = true, sort = true, actions = true,
+                 hideColumns = {}}) => {
+  return (
+    <TableHeader>
+      <TableRow>
+        <TableHead
+          sortby={sort ? 'name' : false}
+          onSortChange={onSortChange}>
+          {_('Application CPE')}
+        </TableHead>
+        <TableHead
+          sortby={sort ? 'hosts' : false}
+          onSortChange={onSortChange}>
+          {_('Hosts')}
+        </TableHead>
+        <TableHead
+          sortby={sort ? 'occurrences' : false}
+          onSortChange={onSortChange}>
+          {_('Occurrences')}
+        </TableHead>
+        <TableHead
+          width="10em"
+          sortby={sort ? 'severity' : false}
+          onSortChange={onSortChange}>
+          {_('Severity')}
+        </TableHead>
+        {actions ? actions : null}
+      </TableRow>
+    </TableHeader>
+  );
+};
+
+Header.propTypes = {
+  actions: PropTypes.element,
+  links: PropTypes.bool,
+  sort: PropTypes.bool,
+  onSortChange: PropTypes.func,
+};
+
+const AppsHeader = withEntitiesHeader()(Header);
+
+const Footer = ({onTargetCreateFromSelection, selectionType, ...props}) => {
+  return (
+    <EntitiesFooter {...props} selectionType={selectionType}>
+    </EntitiesFooter>
+  );
+};
+
+Footer.propTypes = {
+  selectionType: PropTypes.string,
+  onTargetCreateFromSelection: PropTypes.func.isRequired,
+};
+
+
+const AppsFooter = withEntitiesFooter({
+  span: 7,
+  delete: true,
+  download: 'hosts.xml',
+})(Footer);
+
+export const AppsTable = createEntitiesTable({
+  emptyTitle: _('No apps available'),
+  row: AppRow,
+/*  rowDetails: withRowDetails('app', 10)(AppDetails), */
+  header: AppsHeader,
+  footer: AppsFooter,
+});
+
+export default AppsTable;
+
+// vim: set ts=2 sw=2 tw=80:

Modified: trunk/gsa/src/html/classic/ng/src/web/pages/vulns/row.js
===================================================================
--- trunk/gsa/src/html/classic/ng/src/web/pages/vulns/row.js    2017-08-10 
12:12:47 UTC (rev 29335)
+++ trunk/gsa/src/html/classic/ng/src/web/pages/vulns/row.js    2017-08-11 
13:50:35 UTC (rev 29336)
@@ -38,7 +38,7 @@
 import TableRow from '../../components/table/row.js';
 import TableData from '../../components/table/data.js';
 
-const Row = ({entity, links = true, actions, ...other}) => {
+const Row = ({entity, links = true, actions, hideColumns = {}, ...other}) => {
   return (
     <TableRow>
       <TableData>
@@ -49,12 +49,14 @@
           {entity.name}
         </DetailsLink>
       </TableData>
-      <TableData>
-        {datetime(entity.results.oldest)}
-      </TableData>
-      <TableData>
-        {datetime(entity.results.newest)}
-      </TableData>
+      {hideColumns['oldest'] ? null :
+        <TableData>
+          {datetime(entity.results.oldest)}
+        </TableData>}
+      {hideColumns['newest'] ? null :
+        <TableData>
+          {datetime(entity.results.newest)}
+        </TableData>}
       <TableData flex align="center">
         <SeverityBar severity={entity.severity}/>
       </TableData>

Modified: trunk/gsa/src/html/classic/ng/src/web/pages/vulns/table.js
===================================================================
--- trunk/gsa/src/html/classic/ng/src/web/pages/vulns/table.js  2017-08-10 
12:12:47 UTC (rev 29335)
+++ trunk/gsa/src/html/classic/ng/src/web/pages/vulns/table.js  2017-08-11 
13:50:35 UTC (rev 29336)
@@ -37,7 +37,8 @@
 
 import VulnsRow from './row.js';
 
-const Header = ({onSortChange, links = true, sort = true, actions}) => {
+const Header = ({onSortChange, links = true, sort = true, actions,
+                 hideColumns = {}}) => {
   return (
     <TableHeader>
       <TableRow>
@@ -46,16 +47,18 @@
           onSortChange={onSortChange}>
           {_('Name')}
         </TableHead>
-        <TableHead
-          sortby={sort ? 'oldest' : false}
-          onSortChange={onSortChange}>
-          {_('Oldest Result')}
-        </TableHead>
-        <TableHead
-          sortby={sort ? 'newest' : false}
-          onSortChange={onSortChange}>
-          {_('Newest Result')}
-        </TableHead>
+        {hideColumns['oldest'] ? null :
+          <TableHead
+            sortby={sort ? 'oldest' : false}
+            onSortChange={onSortChange}>
+            {_('Oldest Result')}
+          </TableHead>}
+        {hideColumns['oldest'] ? null :
+          <TableHead
+            sortby={sort ? 'newest' : false}
+            onSortChange={onSortChange}>
+            {_('Newest Result')}
+          </TableHead>}
         <TableHead width="10em"
           sortby={sort ? 'severity' : false}
           onSortChange={onSortChange}>

_______________________________________________
Openvas-commits mailing list
Openvas-commits@wald.intevation.org
https://lists.wald.intevation.org/cgi-bin/mailman/listinfo/openvas-commits

Reply via email to