diff options
author | Yaron Yogev <yaronyogev@gmail.com> | 2017-10-03 10:14:14 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-10-03 10:14:14 +0000 |
commit | 9e9c95952ca2a7efeafd316fff107b95fdd0f0b5 (patch) | |
tree | 6ad620ebc1f9adf6bf9fc671d88ea0adf8e7fe07 /ui/imports/ui/components/scheduled-scans-list | |
parent | 929a33a1cf8854e06d13e5ef352a48759c9ba2d5 (diff) | |
parent | 1fff14f0a5e25adaa851537c71c7bd8381c1bbb1 (diff) |
Merge "ui move to docker" into stable/euphrates
Diffstat (limited to 'ui/imports/ui/components/scheduled-scans-list')
3 files changed, 0 insertions, 303 deletions
diff --git a/ui/imports/ui/components/scheduled-scans-list/scheduled-scans-list.html b/ui/imports/ui/components/scheduled-scans-list/scheduled-scans-list.html deleted file mode 100644 index a796562..0000000 --- a/ui/imports/ui/components/scheduled-scans-list/scheduled-scans-list.html +++ /dev/null @@ -1,72 +0,0 @@ -<!-- -######################################################################################## -# Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others # -# # -# All rights reserved. This program and the accompanying materials # -# are made available under the terms of the Apache License, Version 2.0 # -# which accompanies this distribution, and is available at # -# http://www.apache.org/licenses/LICENSE-2.0 # -######################################################################################## - --> -<template name="ScheduledScansList"> -<div class="os-scheduled-scans-list cards white"> - <div class="sm-table-section"> - <h3>Scheduled Scans</h3> - <table class="sm-scheduled-scans-table table"> - <thead> - <tr> - <th>Log Level</th> - <th>Clear</th> - <th>Scan Only Iventory</th> - <th>Scan Only Links</th> - <th>Scan Only Cliques</th> - <th>Environment</th> - <th>Inventory</th> - <th>Object ID</th> - <th>Frequency</th> - <th> - <a class="sm-table-header" - data-is-sortable="true" - data-sort-field="submit_timestamp" - >Submit Timestamp<span><i class="{{ fieldSortClass 'submit_timestamp' }}"></i></span> - </a> - </th> - <th>Action</th> - </tr> </thead> - <tbody> - {{#each scan in scheduledScans }} - <tr> - <td>{{ scan.log_level }}</td> - <td>{{ scan.clear }}</td> - <td>{{ scan.scan_only_inventory }}</td> - <td>{{ scan.scan_only_links }}</td> - <td>{{ scan.scan_only_cliques }}</td> - <td>{{ scan.environment }}</td> - <td>{{ scan.inventory }}</td> - <td>{{ scan.object_id }}</td> - <td>{{ scan.freq }}</td> - <td>{{ scan.submit_timestamp }}</td> - <td> - <a href="{{pathFor route='scheduled-scan' - query=(asHash _id=(idToStr scan._id) action='view') }}" - ><i class="cl-action-icon fa fa-eye" area-hidden="true"></i></a> - <a href="{{pathFor route='scheduled-scan' - query=(asHash _id=(idToStr scan._id) action='update') }}" - ><i class="cl-action-icon fa fa-pencil" area-hidden="true"></i></a> - - <a href="{{pathFor route='scheduled-scan' - query=(asHash _id=(idToStr scan._id) action='remove') }}" - ><i class="cl-action-icon fa fa-trash-o" area-hidden="true"></i></a> - </td> - </tr> - {{/each }} - </tbody> - </table> - </div> - - <div class="sm-pager-section"> - {{> Pager (argsPager currentPage amountPerPage totalItems) }} - </div> - -</div> -</template> diff --git a/ui/imports/ui/components/scheduled-scans-list/scheduled-scans-list.js b/ui/imports/ui/components/scheduled-scans-list/scheduled-scans-list.js deleted file mode 100644 index bbdcfe7..0000000 --- a/ui/imports/ui/components/scheduled-scans-list/scheduled-scans-list.js +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Template Component: ScheduledScansList - */ - -//import { Meteor } from 'meteor/meteor'; -import * as R from 'ramda'; -import { Counts } from 'meteor/tmeasday:publish-counts'; -import { Template } from 'meteor/templating'; -import { ReactiveDict } from 'meteor/reactive-dict'; -import { SimpleSchema } from 'meteor/aldeed:simple-schema'; -import { ScheduledScans, - subsScheduledScansPageAmountSorted, - subsScheduledScansPageAmountSortedCounter, -} from '/imports/api/scheduled-scans/scheduled-scans'; - -import '/imports/ui/components/pager/pager'; - -import './scheduled-scans-list.html'; - -/* - * Lifecycles - */ - -Template.ScheduledScansList.onCreated(function() { - var instance = this; - - instance.state = new ReactiveDict(); - instance.state.setDefault({ - env: null, - page: 1, - amountPerPage: 10, - sortField: 'submit_timestamp', - sortDirection: -1, - }); - - instance.autorun(function () { - let data = Template.currentData(); - - new SimpleSchema({ - }).validate(data); - }); - - instance.autorun(function () { - let amountPerPage = instance.state.get('amountPerPage'); - let page = instance.state.get('page'); - let sortField = instance.state.get('sortField'); - let sortDirection = instance.state.get('sortDirection'); - - instance.subscribe(subsScheduledScansPageAmountSorted, - page, amountPerPage, sortField, sortDirection); - }); -}); - -/* -Template.ScheduledScansList.rendered = function() { -}; -*/ - -/* - * Events - */ - -Template.ScheduledScansList.events({ - 'click .sm-table-header': function (event, instance) { - event.preventDefault(); - let isSortable = event.target.dataset.isSortable; - if (! isSortable ) { return; } - - let sortField = event.target.dataset.sortField; - let currentSortField = instance.state.get('sortField'); - let currentSortDirection = instance.state.get('sortDirection'); - - if (sortField === currentSortField) { - let sortDirection = null; - if (currentSortDirection === null) { - sortDirection = -1; - } else if (currentSortDirection === -1) { - sortDirection = 1; - } else if (currentSortDirection === 1) { - sortField = null; - sortDirection = null; - } else { - sortField = null; - sortDirection = null; - } - - instance.state.set('sortField', sortField); - instance.state.set('sortDirection', sortDirection); - - } else { - instance.state.set('sortField', sortField); - instance.state.set('sortDirection', -1); - } - }, -}); - -/* - * Helpers - */ - -Template.ScheduledScansList.helpers({ - scheduledScans: function () { - let instance = Template.instance(); - let page = instance.state.get('page'); - let amountPerPage = instance.state.get('amountPerPage'); - let sortField = instance.state.get('sortField'); - let sortDirection = instance.state.get('sortDirection'); - - let skip = (page - 1) * amountPerPage; - let sortParams = {}; - sortParams = R.ifElse(R.isNil, R.always(sortParams), - R.assoc(R.__, sortDirection, sortParams))(sortField); - - let qParams = { - limit: amountPerPage, - skip: skip, - sort: sortParams, - }; - - return ScheduledScans.find({}, qParams); - }, - - currentPage: function () { - let instance = Template.instance(); - return instance.state.get('page'); - }, - - amountPerPage: function () { - let instance = Template.instance(); - return instance.state.get('amountPerPage'); - }, - - totalItems: function () { - let counterName = subsScheduledScansPageAmountSortedCounter; - - return Counts.get(counterName); - }, - - argsPager: function (currentPage, amountPerPage, totalItems) { - let instance = Template.instance(); - let totalPages = Math.ceil(totalItems / amountPerPage); - - return { - disableNext: currentPage * amountPerPage > totalItems, - disablePrev: currentPage == 1, - totalPages: totalPages, - currentPage: currentPage, - onReqNext: function () { - console.log('next'); - let page = (currentPage * amountPerPage > totalItems) ? currentPage : currentPage + 1; - instance.state.set('page', page); - }, - onReqPrev: function () { - console.log('prev'); - let page = (currentPage == 1) ? currentPage : currentPage - 1; - instance.state.set('page', page); - }, - onReqFirst: function () { - console.log('req first'); - instance.state.set('page', 1); - }, - onReqLast: function () { - console.log('req last'); - instance.state.set('page', totalPages); - }, - onReqPage: function (pageNumber) { - console.log('req page'); - let page; - if (pageNumber <= 1) { - page = 1; - } else if (pageNumber > Math.ceil(totalItems / amountPerPage)) { - page = totalPages; - } else { - page = pageNumber; - } - - instance.state.set('page', page); - }, - }; - }, - - fieldSortClass: function (fieldName) { - let instance = Template.instance(); - let classes = 'fa fa-sort'; - if (fieldName === instance.state.get('sortField')) { - let sortDirection = instance.state.get('sortDirection'); - if (sortDirection === -1) { - classes = 'fa fa-sort-desc'; - } else if (sortDirection === 1) { - classes = 'fa fa-sort-asc'; - } - } - - return classes; - }, -}); // end: helpers - - diff --git a/ui/imports/ui/components/scheduled-scans-list/scheduled-scans-list.styl b/ui/imports/ui/components/scheduled-scans-list/scheduled-scans-list.styl deleted file mode 100644 index bd2f7c0..0000000 --- a/ui/imports/ui/components/scheduled-scans-list/scheduled-scans-list.styl +++ /dev/null @@ -1,33 +0,0 @@ -.os-scheduled-scans-list - display: flex; - flex-flow: column nowrap; - margin: 20px; - - .cl-action-icon, - .card.fa.cl-action-icon - font-size: 16px !important; - - .sm-scheduled-scans-table - th - color: spark-blue - - a - color: spark-blue; - cursor: pointer; - i.fa - padding: 0px 3px; - font-size: small; - - .sm-action-bar - display: flex; - - a - margin: 0px 5px; - - .cl-action-icon - color: gray - - .sm-pager-section - display: flex; - justify-content: center; - |