From 7aa5a43d77ec882558b8ebf959ff7b15ee7f48b5 Mon Sep 17 00:00:00 2001 From: Ramesh Kumar <ramesh.p@matriotsolutions.com> Date: Thu, 29 Dec 2022 15:49:09 +0530 Subject: [PATCH] TMSS-2175: Console warning cleared --- .../tmss_webapp/src/authenticate/login.js | 2 +- .../authenticate/permission.stack.handler.js | 2 +- .../src/components/AuthComponent.js | 3 +- .../src/components/JSONEditor/JEditor.js | 35 ++------ .../src/components/ProtectedRouteComponent.js | 6 +- .../components/Timeline/CalendarTimeline.js | 2 + .../tmss_webapp/src/components/ViewTable.js | 84 +++++++------------ .../src/layout/components/CustomDialog.js | 2 - .../src/layout/components/PageHeader.js | 8 +- .../tmss_webapp/src/routes/Project/edit.js | 4 +- .../tmss_webapp/src/routes/Project/list.js | 5 +- .../Report/cycle/report.category.data.js | 1 + .../src/routes/Report/cycle/report.main.js | 7 +- .../Report/cycle/report.project.summary.js | 5 +- .../src/routes/Report/project.report.js | 2 +- .../routes/Reservation/reservation.summary.js | 1 - .../Scheduling/Scheduling.Constraints.js | 34 +------- .../Scheduling/Scheduling.task.relation.js | 19 +++-- .../routes/Scheduling/SchedulingUnitList.js | 60 ++++++------- .../src/routes/Scheduling/Stations.js | 5 +- .../routes/Scheduling/ViewSchedulingUnit.js | 31 +++---- .../src/routes/Scheduling/create.e2e.test.js | 2 +- .../src/routes/Scheduling/create.js | 28 +------ .../tmss_webapp/src/routes/Scheduling/edit.js | 5 +- .../Scheduling/excelview.schedulingset.js | 43 ++++++---- .../src/routes/Scheduling/ingest.progress.js | 7 +- .../src/routes/Scheduling/summary.js | 1 + .../tmss_webapp/src/routes/Task/edit.js | 3 +- .../tmss_webapp/src/routes/Task/list.js | 24 +++--- .../tmss_webapp/src/routes/Task/view.js | 4 +- .../src/routes/Timeline/list.tabs.js | 2 +- .../tmss_webapp/src/routes/Timeline/view.js | 9 +- .../src/routes/Timeline/week.view.js | 10 +-- .../tmss_webapp/src/routes/Workflow/index.js | 17 ++-- .../src/routes/Workflow/workflow.list.js | 9 +- .../src/services/schedule.service.js | 16 ++-- 36 files changed, 203 insertions(+), 295 deletions(-) diff --git a/SAS/TMSS/frontend/tmss_webapp/src/authenticate/login.js b/SAS/TMSS/frontend/tmss_webapp/src/authenticate/login.js index a4bdd8b0fe1..0a1815c582b 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/authenticate/login.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/authenticate/login.js @@ -120,7 +120,7 @@ export class Login extends Component { <div className="col-md-12 button-div" style={{textAlign: 'center', marginTop: '50px'}} > <button className="btn btn-primary" onClick={this.doKeyCloakLogin}> - <img src="../images/Keycloak_Logo.png" style={{height: "50px"}} /> Go to Keycloak Login</button> + <img src="../images/Keycloak_Logo.png" style={{height: "50px"}} alt="Keycloak"/> Go to Keycloak Login</button> </div> } {this.state.systemLogin && diff --git a/SAS/TMSS/frontend/tmss_webapp/src/authenticate/permission.stack.handler.js b/SAS/TMSS/frontend/tmss_webapp/src/authenticate/permission.stack.handler.js index 9782e964be9..fe19c0bc427 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/authenticate/permission.stack.handler.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/authenticate/permission.stack.handler.js @@ -1,4 +1,4 @@ -import AuthStore, { persistor } from './../authenticate/auth.store'; +import AuthStore from './../authenticate/auth.store'; import AuthService from '../services/auth.service'; import _ from 'lodash'; import axios from 'axios'; diff --git a/SAS/TMSS/frontend/tmss_webapp/src/components/AuthComponent.js b/SAS/TMSS/frontend/tmss_webapp/src/components/AuthComponent.js index c25d97f8345..043a5cb1ca0 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/components/AuthComponent.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/components/AuthComponent.js @@ -4,7 +4,6 @@ import { Redirect} from 'react-router-dom'; import Auth from '../authenticate/auth' import { Login } from '../authenticate/login'; import AppLoader from '../layout/components/AppLoader'; -import { AppTopbar } from '../layout/components/AppTopbar'; class AuthComponent extends Component { @@ -24,7 +23,7 @@ class AuthComponent extends Component { async componentDidUpdate(prevProp, prevState) { const authenticate = await Auth.isAuthenticated(); - if(prevState.authenticated != authenticate){ + if(prevState.authenticated !== authenticate){ this.setState({authenticated: authenticate, isLoginProgress: authenticate}); } } diff --git a/SAS/TMSS/frontend/tmss_webapp/src/components/JSONEditor/JEditor.js b/SAS/TMSS/frontend/tmss_webapp/src/components/JSONEditor/JEditor.js index c6cad3cdc1f..d15a54d336c 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/components/JSONEditor/JEditor.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/components/JSONEditor/JEditor.js @@ -3,18 +3,16 @@ * to create form using JSON Schema and get JSON output */ /* eslint-disable react-hooks/exhaustive-deps */ +/* eslint-disable no-loop-func */ import React, { useEffect, useRef } from 'react'; -import _, { max } from 'lodash'; +import _ from 'lodash'; import AppLoader from '../../layout/components/AppLoader'; import UIConstants from '../../utils/ui.constants'; import UnitConverter from '../../utils/unit.converter'; import Validator from '../../utils/validator'; import $RefParser from 'json-schema-ref-parser'; import "@fortawesome/fontawesome-free/css/all.css"; -import flatpickr from 'flatpickr'; import "flatpickr/dist/flatpickr.css"; -import { Button } from 'primereact/button'; -import UtilService from '../../services/util.service'; const JSONEditor = require("@json-editor/json-editor").JSONEditor; @@ -149,6 +147,8 @@ function Jeditor(props) { case 'HBA_210_250': nyquistzone = 3; break; + default: + break; } return nyquistzone; } @@ -252,7 +252,7 @@ function Jeditor(props) { const errors = []; if (schema.validationType === "subband_list") { if (!subbandValidator(value, path)) { - if(_.indexOf(subBandProps, path) == -1) { + if(_.indexOf(subBandProps, path) === -1) { subBandProps.push(path) } errors.push({ @@ -263,7 +263,7 @@ function Jeditor(props) { } } else if (schema.validationType === "subband_list_optional") { if (value && !subbandValidator(value, path)) { - if(_.indexOf(subBandProps, path) == -1) { + if(_.indexOf(subBandProps, path) === -1) { subBandProps.push(path) } errors.push({ @@ -716,8 +716,8 @@ function Jeditor(props) { parentProps = parentProps?parentProps:[]; parentProps[propertyKey] = properties[propertyKey]; const propertyValue = properties[propertyKey]; - if ((propertyKey.toLowerCase() === 'subbands' && propertyValue.type === 'array') || - propertyKey.toLowerCase() === 'list' && propertyValue.type === 'array') { + if ((propertyKey.toLowerCase() === 'subbands' || + propertyKey.toLowerCase() === 'list') && propertyValue.type === 'array') { let newProperty = {}; newProperty.additionalItems = false; newProperty.title = propertyValue.title; @@ -761,14 +761,12 @@ function Jeditor(props) { properties['channels_per_subband']['validationType'] = "channelsPerSubband"; // properties['channels_per_subband']['propertyOrder'] = 1001 //>>>>>> If properyOrder is nor working, remove these lines - let propertyOrder = 10; for (let property of _.keys(properties)) { if (['channels_per_subband', 'frequency_resolution', 'time_resolution'].indexOf(property)<0) { properties[property]['propertyOrder'] = 1; - propertyOrder++; } }//<<<<<< - } else if (propertyKey.toLowerCase() === 'single_pulse_search' && props.observationType == 'pulsar pipeline' && properties['dspsr']) { + } else if (propertyKey.toLowerCase() === 'single_pulse_search' && props.observationType === 'pulsar pipeline' && properties['dspsr']) { // Add custom fields to the properties where property 'single_pulse_search' is one of the property. let freqResolution = { title: 'Frequency Resolution (kHz)',type: 'string',default: '' }; properties['dspsr']['properties']['digifil']['properties']['frequency_resolution'] = freqResolution; @@ -1292,21 +1290,6 @@ function Jeditor(props) { } } - /** - * Remove Selected Station label - * @param {*} parentNode - */ - function removeLabelNode(parentNode) { - if (parentNode) { - var labelELs = parentNode.getElementsByTagName('label'); - for (const element of labelELs) { - if (element.innerText === 'Selected Stations') { - parentNode.removeChild(element); - } - } - } - } - /** * Function to calculate and update the readonly field time_resolution when channels_per_subband or integration time value is changed * @param {string} channelsPropPath - path of the channels_per_subband preoperty to get the id or name of the field diff --git a/SAS/TMSS/frontend/tmss_webapp/src/components/ProtectedRouteComponent.js b/SAS/TMSS/frontend/tmss_webapp/src/components/ProtectedRouteComponent.js index d24a58ed2fd..b9f494b9a96 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/components/ProtectedRouteComponent.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/components/ProtectedRouteComponent.js @@ -5,7 +5,6 @@ import { } from 'react-router-dom'; import AuthStore from '../authenticate/auth.store'; import AuthUtil from "../utils/auth.util"; -import _ from 'lodash'; class ProtectedRoute extends Component{ @@ -25,7 +24,8 @@ class ProtectedRoute extends Component{ const permission = this.props.permissions if(this.state.permission_set['userRolePermission']){ if(permission.length <= 2) { - if(typeof(permission[0]) !== undefined && permission[1] !== undefined) { + console.log(permission); + if(permission[0] !== undefined && permission[1] !== undefined) { if(this.state.permission_set['userRolePermission'][permission[0]] && this.state.permission_set['userRolePermission'][permission[0]][permission[1]]) { return true; } else { @@ -47,7 +47,7 @@ class ProtectedRoute extends Component{ } render() { - const { name, component, path, exact, permissions, location } = this.props; + const { name, component, path, permissions, location } = this.props; if(permissions) { if(this.hasPermission()) { this.updatePageTracker(location.pathname); diff --git a/SAS/TMSS/frontend/tmss_webapp/src/components/Timeline/CalendarTimeline.js b/SAS/TMSS/frontend/tmss_webapp/src/components/Timeline/CalendarTimeline.js index dafd45603e4..f7a3e98e298 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/components/Timeline/CalendarTimeline.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/components/Timeline/CalendarTimeline.js @@ -259,6 +259,8 @@ export class CalendarTimeline extends Component { zoomRange = [currentUTC.toDate()]; } break; + default: + break; } fp.setDate(zoomRange); this.setState({zoomRange: zoomRange}); diff --git a/SAS/TMSS/frontend/tmss_webapp/src/components/ViewTable.js b/SAS/TMSS/frontend/tmss_webapp/src/components/ViewTable.js index 3ba9617a516..ac6c780910f 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/components/ViewTable.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/components/ViewTable.js @@ -1,7 +1,10 @@ +/* eslint-disable react-hooks/exhaustive-deps */ +/* eslint-disable jsx-a11y/anchor-is-valid */ +/* eslint-disable jsx-a11y/aria-role */ import React, { useRef, useState } from "react"; import { useFlexLayout , useResizeColumns, useSortBy, useTable, useFilters, useGlobalFilter, useAsyncDebounce, usePagination, useRowSelect, useColumnOrder } from 'react-table' import matchSorter from 'match-sorter' -import _, { filter } from 'lodash'; +import _ from 'lodash'; import moment from 'moment'; import { useHistory } from "react-router-dom"; import { OverlayPanel } from 'primereact/overlaypanel'; @@ -18,13 +21,11 @@ import { MultiSelect } from 'primereact/multiselect'; import { RadioButton } from 'primereact/radiobutton'; import { useExportData } from "react-table-plugins"; import { ProgressBar } from 'primereact/progressbar'; -import {Checkbox} from 'primereact/checkbox'; import { Dropdown } from 'primereact/dropdown'; import "flatpickr/dist/flatpickr.css"; import Flatpickr from "react-flatpickr"; import confirmDatePlugin from "flatpickr/dist/plugins/confirmDate/confirmDate"; -import shortcutButtonsPlugin from "shortcut-buttons-flatpickr"; import { DragDropContext, Droppable, Draggable } from "react-beautiful-dnd"; import UtilService from '../../src/services/util.service' import Papa from "papaparse"; @@ -47,7 +48,6 @@ let allowColumnSelection = true; let showTopComponents = true; let allowRowSelection = false; let showTopPagination = false; -let columnclassname = []; let parentCallbackFunction, parentCBonSelection; let showCSV = false; let showActionInNewTab = false; @@ -63,9 +63,6 @@ let loadingStatus = false; let tmpTableData = null; let currentTableName = null; let storeFilter = false; -let storage_array = []; -let dragged = null; -let reorder = []; //let confirmDatePlugin = new confirmDatePlugin(); // Define a default UI for filtering let fixedColumns = ['Select', 'Action', 'Status Logs', 'View Summary']; @@ -109,7 +106,7 @@ function DefaultColumnFilter({ const [filtered, setFiltered] = useState(false); const [prevTable, setPrevTable] = useState(''); React.useEffect(() => { - if (!filterValue && value || prevTable !== currentTableName) { + if ((!filterValue && value) || prevTable !== currentTableName) { setValue(''); setPrevTable(currentTableName); } @@ -179,7 +176,7 @@ function DefaultColumnFilter({ ) } -const setStoreData = (id, value) => { +/*const setStoreData = (id, value) => { let localstorage_key = window.location.pathname.split('/')[1]; let storage = UtilService.localStore({ type: 'get', key: localstorage_key }); if(storage && storage.length > 0) { @@ -201,7 +198,7 @@ const setStoreData = (id, value) => { storage = [{name: id, value: value}] } UtilService.localStore({ type: 'set', key: localstorage_key, value: storage }); -} +}*/ /* Generate and download csv @@ -246,7 +243,7 @@ function getExportFileBlob({ columns, data, fileType, fileName }) { else if (fileType === "pdf") { const headerNames = columns.map((column) => column.exportValue); const doc = new JsPDF(); - var index = headerNames.indexOf('Action'); + let index = headerNames.indexOf('Action'); if (index > -1) { headerNames.splice(index, 1); } @@ -269,11 +266,10 @@ function SelectColumnFilter({ column: { filterValue, setFilter, preFilteredRows, id, Header }, }) { const [value, setValue] = useState(''); - const [filtered, setFiltered] = useState(false); const [rowData, setRowData] = useState(null); const [prevTable, setPrevTable] = useState(''); React.useEffect(() => { - if (!filterValue && value || prevTable !== currentTableName) { + if ((!filterValue && value) || prevTable !== currentTableName) { setValue(''); setPrevTable(currentTableName); } @@ -322,7 +318,6 @@ function SelectColumnFilter({ <div onClick={e => { e.stopPropagation() }}> <select title={(tableToolTipsState[Header])?tableToolTipsState[Header]:"Select a value from list to search"} - // className= {columnclassname[0][Header]} style={{ height: '24.2014px', border: '1px solid lightgrey', @@ -334,12 +329,10 @@ function SelectColumnFilter({ if (doServersideFilter) { if (e.target.value === '' || e.target.value === 'All') { hasFilters = false; - setFiltered(false); setFilter(undefined); setValue(''); callServerFilter(e, true); } else { - setFiltered(true); callServerFilter(e, false); } } @@ -368,7 +361,7 @@ function MultiSelectColumnFilter({ const [filtertype, setFiltertype] = useState('Any'); const [prevTable, setPrevTable] = useState(''); React.useEffect(() => { - if (!filterValue && value || prevTable !== currentTableName) { + if ((!filterValue && value) || prevTable !== currentTableName) { setValue(''); setFiltertype('Any'); setPrevTable(currentTableName); @@ -509,7 +502,7 @@ function MultiSelectFilter({ } React.useEffect(() => { - if (!filterValue && value || prevTable !== currentTableName) { + if ((!filterValue && value) || prevTable !== currentTableName) { setValue(''); setFiltertype('Any'); setPrevTable(currentTableName); @@ -644,10 +637,10 @@ function BooleanColumnFilter({ // Calculate the min and max // using the preFilteredRows const [value, setValue] = useState(null); - const [filtered, setFiltered] = useState(false); + // const [filtered, setFiltered] = useState(false); const [prevTable, setPrevTable] = useState(''); React.useEffect(() => { - if (!filterValue && value || prevTable !== currentTableName) { + if ((!filterValue && value) || prevTable !== currentTableName) { setValue(null); setPrevTable(currentTableName); } @@ -664,14 +657,14 @@ function BooleanColumnFilter({ hasFilters = true; _.remove(tableOptionsState.filters, function(filter) { return filter.id === Header }); if (isCleared == null) { - setFiltered(false); + // setFiltered(false); } else if (isCleared) { hasFilters = false; tableOptionsState.filters.push({id: Header, value: true}); - setFiltered(true); + // setFiltered(true); setValue(true); } else { - setFiltered(true); + // setFiltered(true); setValue(false); tableOptionsState.filters.push({id: Header, value: false}); } @@ -705,7 +698,7 @@ function BooleanColumnFilter({ // This is a custom filter UI that uses a // calendar to set the valueCalendar -function ColumnFilter({ +/*function ColumnFilter({ column: { setFilter, filterValue, Header }, }) { // Calculate the min and max @@ -753,7 +746,7 @@ function ColumnFilter({ } }} className="tb-cal-reset fa fa-times" />} </div> ) -} +}*/ // This is a custom filter UI that uses a // calendar range to set the value @@ -766,7 +759,7 @@ function DateRangeColumnFilter({ const [filtered, setFiltered] = useState(false); const [prevTable, setPrevTable] = useState(''); React.useEffect(() => { - if (!filterValue && value || prevTable !== currentTableName) { + if ((!filterValue && value) || prevTable !== currentTableName) { setValue(null); setPrevTable(currentTableName); } @@ -835,10 +828,9 @@ function FlatpickrRangeColumnFilter({ column: { setFilter, filterValue, Header }, }) { const [value, setValue] = useState(''); - const [filtered, setFiltered] = useState(false); const [prevTable, setPrevTable] = useState(''); React.useEffect(() => { - if (!filterValue && value || prevTable !== currentTableName) { + if ((!filterValue && value) || prevTable !== currentTableName) { setValue(null); setPrevTable(currentTableName); } @@ -913,7 +905,6 @@ function FlatpickrRangeColumnFilter({ TableUtil.saveFilter(currentTableName, Header, newValue); } if ((newValue !== '' && newValue !== 'Invalid date' ) && isValueChanged && doServersideFilter) { - setFiltered(true); callServerFilter(newValue); } } @@ -926,7 +917,7 @@ function FlatpickrRangeColumnFilter({ </button> <button className="p-button p-component p-button-icon-only calendar-reset" onClick={(value) => { - setFilter(undefined); setValue([]); setFiltered(false);filterValue = []; + setFilter(undefined); setValue([]); filterValue = []; if(storeFilter){ TableUtil.saveFilter(currentTableName, Header, [] ); } @@ -954,7 +945,7 @@ function CalendarColumnFilter({ const [filtered, setFiltered] = useState(false); const [prevTable, setPrevTable] = useState(''); React.useEffect(() => { - if (!filterValue && value || prevTable !== currentTableName) { + if ((!filterValue && value) || prevTable !== currentTableName) { setValue(null); setPrevTable(currentTableName); } @@ -1025,7 +1016,7 @@ function DateTimeColumnFilter({ const [value, setValue] = useState(''); const [prevTable, setPrevTable] = useState(''); React.useEffect(() => { - if (!filterValue && value|| prevTable !== currentTableName) { + if ((!filterValue && value) || prevTable !== currentTableName) { setValue(null); setPrevTable(currentTableName); } @@ -1280,7 +1271,6 @@ function durationTimeFilterFn(rows, id, filterValue) { function RangeColumnFilter({ column: { filterValue = [], preFilteredRows, setFilter, id, Header }, }) { - let [value, setValue] = useState(''); let [firstLoad, setFirstLoad] = useState(true); const [min, max] = React.useMemo(() => { let min = 0; @@ -1295,7 +1285,6 @@ function RangeColumnFilter({ if (storeFilter && firstLoad) { let storedFilter = TableUtil.getFilter(currentTableName, Header); if (storedFilter) { - setValue(storedFilter); setFilter(storedFilter); setFirstLoad(false); } @@ -1314,7 +1303,6 @@ function RangeColumnFilter({ <Slider value={filterValue} min={min} max={max} className="filter-slider" style={{}} onChange={(e) => { - setValue(e.value); setFilter(e.value); if(storeFilter) { TableUtil.saveFilter(currentTableName, Header, e.value); @@ -1375,7 +1363,6 @@ function NumberRangeFilter({ <InputText value={value[0]} type="number" - tooltip="Enter the minimum value to search" onKeyUp={(e) => { if (e.key === "Enter" && doServersideFilter) { TableUtil.saveFilter(currentTableName, Header, rangeValue); @@ -1407,7 +1394,6 @@ function NumberRangeFilter({ <InputText value={value[1]} type="number" - tooltip="Enter the maximum value to search" onKeyUp={(e) => { if (e.key === "Enter" && doServersideFilter) { setFiltered(true); @@ -1459,7 +1445,7 @@ function RankRangeFilter({ setValue(filterValue); //setFilter(filterValue); } - if(!filterValue && value.length>0 && (value[0]!= '' || value[1]!= '')){ + if(!filterValue && value.length>0 && (value[0]!== '' || value[1]!== '')){ setValue(['', '']); setRangeValue(['','']) } @@ -1506,7 +1492,7 @@ function RankRangeFilter({ val = val.replace(/([^0-9.]+)/, ""); const match = /(\d{0,1})[^.]*((?:\.\d{0,4})?)/g.exec(val); val = match[1] + match[2]; - if (val == '' || (val >= 0 && val <= 1)) { + if (val === '' || (val >= 0 && val <= 1)) { let max = rangeValue[1]; setValue([val,max]); setFilter([val,max] || undefined); @@ -1545,7 +1531,7 @@ function RankRangeFilter({ val = val.replace(/([^0-9.]+)/, ""); const match = /(\d{0,1})[^.]*((?:\.\d{0,4})?)/g.exec(val); val = match[1] + match[2]; - if (val == '' || (val >= 0 && val <= 1)) { + if (val === '' || (val >= 0 && val <= 1)) { let min = rangeValue[0]; setRangeValue([min,val]); filterValue[1] = val; @@ -1577,7 +1563,7 @@ function DurationRangeFilter({ const [filtered, setFiltered] = useState(false); const [prevTable, setPrevTable] = useState(''); React.useEffect(() => { - if (!filterValue && value || prevTable !== currentTableName) { + if ((!filterValue && value) || prevTable !== currentTableName) { setValue(''); setPrevTable(currentTableName); } @@ -2016,7 +2002,7 @@ const IndeterminateCheckbox = React.forwardRef( // ViewTable table component function Table(props) { let {fetchData, pageCount: controlledPageCount, currentPage, dataFetchStatus, columns, data, defaultheader, optionalheader, - tablename, defaultSortColumn, defaultpagesize, columnOrders, showAction, toggleBySorting, onColumnToggle, lsKeySortColumn + tablename, defaultSortColumn, defaultpagesize, columnOrders, showAction, toggleBySorting, lsKeySortColumn , descendingColumn, ignoreSorting } = props; ignoreSorting = ignoreSorting ||[]; ignoreSorting = [...ignoreSorting,'action']; @@ -2125,7 +2111,6 @@ function Table(props) { setAllFilters, allColumns, getToggleHideAllColumnsProps, - visibleColumns, state, page, preGlobalFilteredRows, @@ -2312,10 +2297,6 @@ function Table(props) { parentCBonSelection(selectedRows) } - const onSortBy = () => { - sessionStorage.setItem("sortedData", tbldata); - } - /** * Clear all filters in table and reload the data */ @@ -2461,11 +2442,11 @@ function Table(props) { index={_.findIndex(allColumns, { id: column.id })} isDragDisabled={_.includes(fixedColumns, column.id)? true: false}> {(provided, snapshot) => ( - <th role = {'tablehead'} className={column.id} className={_.includes(fixedColumns, column.id)?'fixed-column-td':''} style={{display: 'flex'}} + <th role = {'tablehead'} className={_.includes(fixedColumns, column.id)?'fixed-column-td':''} style={{display: 'flex'}} onClick={() => { if(!doServersideFilter) { if(!column.disableSortBy) { - toggleBySorting({ 'id': column.id, desc: (column.isSortedDesc != undefined ? !column.isSortedDesc : false) }); + toggleBySorting({ 'id': column.id, desc: (column.isSortedDesc !== undefined ? !column.isSortedDesc : false) }); } } }}> @@ -2493,8 +2474,6 @@ function Table(props) { </div> {/* Render the columns filter UI */} {column.Header !== 'actionpath' && - // <div className={columnclassname[0][column.Header]}> - // {...column.getHeaderProps(column.getSortByToggleProps())} <div> {column.canFilter && column.Header !== 'Action' ? column.render('Filter') : null} </div> @@ -2548,7 +2527,7 @@ function Table(props) { if (cell.column.id !== 'actionpath') { // return <td {...cell.getCellProps()} className={cell.column.id+'_body'}> return <td key={cell.column.id+'_'+cell.row.id} className={_.includes(fixedColumns, cell.column.id)?'fixed-column-td':''}> - {(cell.row.original.links || []).includes(cell.column.id) ? <a href={cell.row.original.linksURL[cell.column.id]} target={cell.column.newTab ? "_blank":""} >{cell.render('Cell', cell.getCellProps())}</a> : cell.render('Cell', cell.getCellProps())} + {(cell.row.original.links || []).includes(cell.column.id) ? <a href={cell.row.original.linksURL[cell.column.id]} target={cell.column.newTab ? "_blank":""} rel="noreferrer" >{cell.render('Cell', cell.getCellProps())}</a> : cell.render('Cell', cell.getCellProps())} </td> } else { @@ -2613,7 +2592,6 @@ function ViewTable(props) { parentCallbackFunction = props.filterCallback; parentCBonSelection = props.onRowSelection; isunittest = props.unittest; - columnclassname = props.columnclassname; loadingStatus = props.loadingStatus === undefined ? loadingStatus : props.loadingStatus; showTopTotal = props.showTopTotal === undefined ? true : props.showTopTotal; showGlobalFilter = props.showGlobalFilter === undefined ? true : props.showGlobalFilter; diff --git a/SAS/TMSS/frontend/tmss_webapp/src/layout/components/CustomDialog.js b/SAS/TMSS/frontend/tmss_webapp/src/layout/components/CustomDialog.js index ca439cd563d..0e3295ba9a4 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/layout/components/CustomDialog.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/layout/components/CustomDialog.js @@ -19,9 +19,7 @@ export class CustomDialog extends Component { const isConfirm = this.props.type.toLowerCase()==='confirmation'; const isWarning = this.props.type.toLowerCase()==='warning'; const isSuccess = this.props.type.toLowerCase()==='success'; - const isError = this.props.type.toLowerCase()==='error'; const showIcon = (typeof this.props.showIcon === "undefined") ? true : this.props.showIcon; - // const isError = this.props.type.toLowerCase()==='error'; let iconClass = isConfirm?"pi-question-circle pi-warning":(isWarning?"pi-info-circle pi-warning": (isSuccess?"pi-check-circle pi-success":"pi-times-circle pi-danger")); return ( <div className={`custom-dlg p-grid`} data-testid="confirm_dialog" diff --git a/SAS/TMSS/frontend/tmss_webapp/src/layout/components/PageHeader.js b/SAS/TMSS/frontend/tmss_webapp/src/layout/components/PageHeader.js index bcfa96a362a..dc9879a6664 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/layout/components/PageHeader.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/layout/components/PageHeader.js @@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react'; import { routes } from '../../routes'; import {matchPath, Link} from 'react-router-dom'; -export default ({ title, subTitle, actions, ...props}) => { +const PageHeader = ({ title, subTitle, actions, ...props}) => { const [page, setPage] = useState({}); useEffect(() => { @@ -56,7 +56,7 @@ export default ({ title, subTitle, actions, ...props}) => { } else if (action.type === 'ext_link') { return ( <a href={action.props.pathname} title={action.title || ''} - target={action.target?action.target:"_blank"}>{action.label}</a> + target={action.target?action.target:"_blank"} rel="noreferrer">{action.label}</a> ); } else if (action.type === 'tag') { return ( @@ -75,4 +75,6 @@ export default ({ title, subTitle, actions, ...props}) => { </div> </div> ); -} \ No newline at end of file +} + +export default PageHeader; \ No newline at end of file diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/edit.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/edit.js index f339a06ef0f..c30e6345e37 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/edit.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/edit.js @@ -2,7 +2,6 @@ import React, { Component } from 'react'; import { Redirect } from 'react-router-dom'; import _ from 'lodash'; -import { InputText } from 'primereact/inputtext'; import { InputNumber } from 'primereact/inputnumber'; import { InputTextarea } from 'primereact/inputtextarea'; import { Checkbox } from 'primereact/checkbox'; @@ -254,7 +253,7 @@ export class ProjectEdit extends Component { //value = value.replace(/^(0|\.)/, ""); const match = /(\d{0,1})[^.]*((?:\.\d{0,2})?)/g.exec(value); const val = match[1] + match[2]; - if (val == '' || (val >= 0 && val <= 6)) { + if (val === '' || (val >= 0 && val <= 6)) { project[key] = val === ''? '' :Number(val); } else { project[key] = previousValue; @@ -404,7 +403,6 @@ export class ProjectEdit extends Component { */ async saveProjectQuota(project) { publish('edit-dirty', false); - let dialog = {}; let quotaError = {}; let updatingProjectQuota = []; let newProjectQuota = []; diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/list.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/list.js index 4f8b4874546..87838344ee6 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/list.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/list.js @@ -6,7 +6,6 @@ import PageHeader from '../../layout/components/PageHeader'; import CycleService from '../../services/cycle.service'; import UtilService from '../../services/util.service'; import AuthUtil from '../../utils/auth.util'; -import AccessDenied from '../../layout/components/AccessDenied'; import _ from 'lodash'; import { Dialog } from 'primereact/dialog'; import { RadioButton } from 'primereact/radiobutton'; @@ -16,7 +15,6 @@ import { Column } from 'primereact/column'; import { DataTable } from 'primereact/datatable'; import { appGrowl } from '../../layout/components/AppGrowl'; import TopProgressBar from '../../layout/components/TopProgressBar'; -/* eslint-disable no-unused-expressions */ export class ProjectList extends Component { lsTableName = 'project_list'; @@ -206,6 +204,7 @@ export class ProjectList extends Component { if(projectArchive) { project.archive_location_label = (options[projectArchive.archive_location] || {}).label; } + return quota; }); list[index] = project; this.updatedProjList.push(project); @@ -391,7 +390,7 @@ export class ProjectList extends Component { } }]; dialog.onSubmit = () => { - this.closeDialog; + this.closeDialog(); this.setState({showStatusUpdateDialog: false}); } dialog.width = '30vw'; diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.category.data.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.category.data.js index 28fbf7cd893..796e94a3cef 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.category.data.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.category.data.js @@ -109,6 +109,7 @@ class CycleCategoryWiseData extends Component{ categoryData['pulpBF'] = (cycleData["Pulsar Pipeline"].size__sum/dataConversionFactor).toFixed(2); // categoryData['dynspecBF'] = cycleData.dynspecBF; reportData.push(categoryData); + return repData; }); if (isTableData) { diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.main.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.main.js index 8adac925969..c353904648f 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.main.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.main.js @@ -144,8 +144,6 @@ class CycleReportMain extends Component { async downloadPDF() { this.setState({isDownloading: true}); let reportDivs = document.getElementsByClassName('report-div'); - // Get the div heights of each page of the report - let divHeights = _.map(reportDivs, 'clientHeight'); // Create a PDF document with landscape orientation, 1st report div width and the max height of all report divs in pixels const pdf = new jsPDF('l', 'px', [ (reportDivs[0].clientWidth+100), (reportDivs[0].clientHeight+100)]); let pageIndex = 0; @@ -188,7 +186,7 @@ class CycleReportMain extends Component { csvOptions.push(csvOption); } return ( - <div className="fluid" className="csv-options-dlg-content"> + <div className="fluid csv-options-dlg-content"> <div className="col-lg-12" style={{padding: '5px'}}> <Checkbox inputId={`cb-all`} value="all" checked={this.state.reportNames.length === _.keys(REPORT_VARIABLE_MAP).length-1} @@ -225,8 +223,6 @@ class CycleReportMain extends Component { * Select or Unselect all reports in the dialog */ selectAllCSVOptions() { - let allReports = _.keys(REPORT_VARIABLE_MAP); - allReports = allReports.splice(1); let repWithData = _.keys(this.cyclesReportData); if (repWithData.length > this.state.reportNames.length) { this.setState({reportNames: repWithData}); @@ -291,6 +287,7 @@ class CycleReportMain extends Component { } csvList.push(csvData); isColHeaderSet = true; + return data; }); // Pass column headers to CSV parser if (colHeaders.length > 0) { diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.project.summary.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.project.summary.js index 64c38bf4177..c423d875bb1 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.project.summary.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.project.summary.js @@ -9,10 +9,6 @@ import UnitConverter from "../../../utils/unit.converter"; */ class CycleProjectSummary extends Component{ - constructor(props){ - super(props); - } - /** * Returns the projects summary of the cycle(s) formatted to display in summary table. * @returns Array of Cycle Projects list @@ -37,6 +33,7 @@ class CycleProjectSummary extends Component{ projectData['dataToPoznan'] = ((poznanData?poznanData.size:0)/dataConversionFactor).toFixed(2); reportData.push(projectData); } + return repData; }); if (this.props.setExportData && reportData.length>0) { this.props.setExportData('ProjectSummary', reportData); diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/project.report.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/project.report.js index eae7bfb039b..972338d74c8 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/project.report.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/project.report.js @@ -328,7 +328,7 @@ class ProjectReport extends Component { <label>Project Documentation</label> </div> <div className="col-lg-9 col-md-8 col-sm-12"> - <a href="https://support.astron.nl/jira" target="_blank">Link to Jira Ticket</a> + <a href="https://support.astron.nl/jira" target="_blank" rel="noreferrer">Link to Jira Ticket</a> </div> <div className="col-lg-3 col-md-4 col-sm-12"> <label>Project statistics over the period</label> diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Reservation/reservation.summary.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Reservation/reservation.summary.js index e51f176ba54..fe63bf478c1 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Reservation/reservation.summary.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Reservation/reservation.summary.js @@ -75,7 +75,6 @@ export class ReservationSummary extends Component { specification = newArray.length > 0?(isStringArray?newArray.join(", "):newArray):null; } else { let newObject = {}; - let keys = _.keys(specification); for (const objectKey of _.keys(specification)) { let object = this.getFormattedSpecification(specification[objectKey]); if (object) { diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/Scheduling.Constraints.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/Scheduling.Constraints.js index 75c7da352f7..c7bce5ad81e 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/Scheduling.Constraints.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/Scheduling.Constraints.js @@ -7,7 +7,7 @@ import UIConstants from '../../utils/ui.constants'; import UtilService from '../../services/util.service'; /* eslint-disable react-hooks/exhaustive-deps */ -export default (props) => { +const SchedulingConstraints = (props) => { let editorFunction = null; const { parentFunction = (editorFn) => { editorFunction = editorFn;} } = props; const [constraintSchema, setConstraintSchema] = useState(); @@ -29,7 +29,6 @@ export default (props) => { } if(propertyKey === 'at' || propertyKey === 'after' || propertyKey === 'before'){ propertyValue.propertyOrder=3; - // setDateTimeOption(propertyValue); } if(propertyKey === 'between' || propertyKey === 'not_between' ){ propertyValue.propertyOrder=4; @@ -48,9 +47,7 @@ export default (props) => { propertyValue.propertyOrder=7; } if(propertyKey === 'calibrator' || propertyKey === 'target'){ - if(props.onUpdate==="scheduleConstraints"){ - propertyValue.default = propertyValue.default; - } else{ + if(props.onUpdate!=="scheduleConstraints"){ propertyValue.default = ((propertyValue.default * 180) / Math.PI).toFixed(2); } propertyValue.title = propertyKey+' (Degrees)'; @@ -78,30 +75,6 @@ export default (props) => { } }; - //DateTime flatPicker component enabled with seconds - const setDateTimeOption = async(propertyValue) => { - const systemTime = moment.utc((await UtilService.getUTC())); - propertyValue.format = 'datetime-local'; - propertyValue.validationType = 'dateTime'; - propertyValue.skipFormat = true; - propertyValue.options = { - "inputAttributes": { - "placeholder": "YYYY-MM-DD HH:mm:ss" - }, - "flatpickr": { - "inlineHideInput": true, - "wrap": true, - "enableSeconds": true, - "time_24hr": true, - "allowInput": true, - "defaultDate": systemTime.format(UIConstants.CALENDAR_DEFAULTDATE_FORMAT), - "defaultHour": systemTime.hour(), - "defaultMinute": systemTime.minutes(), - "minuteIncrement": 1 - } - }; - }; - //Configuring Schema Definitions const configureDefinitions = (schema) => { for (const definitionName in schema.definitions) { @@ -118,7 +91,6 @@ export default (props) => { } else if(definitionName === 'timewindow') { for (let property in schema.definitions.timewindow.properties) { if(property === 'to' || property === 'from'){ - // setDateTimeOption(schema.definitions.timewindow.properties[property]); if (property === 'from') { schema.definitions.timewindow.properties[property].propertyOrder = 1; } else { @@ -225,3 +197,5 @@ export default (props) => { </> ); }; + +export default SchedulingConstraints; \ No newline at end of file diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/Scheduling.task.relation.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/Scheduling.task.relation.js index c7f5a58475a..20fd943b67d 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/Scheduling.task.relation.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/Scheduling.task.relation.js @@ -8,9 +8,10 @@ import { CustomDialog } from '../../layout/components/CustomDialog'; import { DataTable } from 'primereact/datatable'; import { Column } from 'primereact/column'; import { Dropdown } from 'primereact/dropdown'; -/* eslint-disable no-unused-expressions */ +/* eslint-disable react-hooks/exhaustive-deps */ +/* eslint-disable no-loop-func */ -export default (props) => { +const TaskRelations = (props) => { const ingestableTaskTypes = ["observation", "pipeline"]; const [originIngestRelation, setOriginIngestRelation] = useState(_.cloneDeep(props.ingestGroup)); const [ingestRelation, setIngestRelation] = useState(_.cloneDeep(props.ingestGroup)); @@ -25,7 +26,7 @@ export default (props) => { return ingestableTasks.length===ingestRelation[groupName].length; } const actionToggle = (taskData) => { - return taskData.find((task) => task.action == 'add' || task.action == 'delete') + return taskData.find((task) => task.action === 'add' || task.action === 'delete') } const closeDialog = () => { stateConfrimDialog.dialogVisible = false @@ -42,7 +43,7 @@ export default (props) => { } const confirmTasks = (modeObj, task, isGroup) => { const relationGroup = { ...ingestRelation }; - if (modeObj.mode == 'single') { + if (modeObj.mode === 'single') { let tasCanIngest = !relationGroup[modeObj.group][modeObj.pos].canIngest; relationGroup[modeObj.group][modeObj.pos].canIngest = tasCanIngest; setIngestRelation(relationGroup); @@ -114,6 +115,7 @@ export default (props) => { connectorConsumer.toDelete = false; } } + return connector; }) tempTaskDraftRelations.push(tempTaskRelation); } @@ -169,6 +171,7 @@ export default (props) => { if (createConnectorConsumer) { connector.consumers.push(connectorConsumer); } + return connector; }); } groupTasks.splice(index, 1, task); @@ -197,6 +200,7 @@ export default (props) => { if (!_.find(connector.consumers, {id: selectedIngestTask})) { connector.consumers.push(connectorConsumer); } + return connector; }); } tempIngestRelation[group] = groupTasks; @@ -310,9 +314,10 @@ export default (props) => { Object.keys(ingestGroup).sort().map(group => { if (group !== 'ingest') { ingestRelation[group].map((task, index) => { - tempIngestData.push(task); + tempIngestData.push(task); return task; }) } + return group; }); setTaskRelationDraft(_.cloneDeep(tempIngestData)); }, [props.ingestGroup]); @@ -406,4 +411,6 @@ export default (props) => { } else { return <></> } -}; \ No newline at end of file +}; + +export default TaskRelations; \ No newline at end of file diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/SchedulingUnitList.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/SchedulingUnitList.js index 2c0a07f8279..6327aea6058 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/SchedulingUnitList.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/SchedulingUnitList.js @@ -6,7 +6,7 @@ import ViewTable from './../../components/ViewTable'; import { CustomPageSpinner } from '../../components/CustomPageSpinner'; import UnitConverter from '../../utils/unit.converter'; //import UnitConversion from '../../utils/unit.converter'; -import _, { forEach } from 'lodash'; +import _ from 'lodash'; import ScheduleService from '../../services/schedule.service'; import { Link } from 'react-router-dom'; //import WorkflowService from '../../services/workflow.service'; @@ -24,6 +24,7 @@ import Websocket from 'react-websocket'; import { InputText } from 'primereact/inputtext'; import { InputTextarea } from 'primereact/inputtextarea'; import ProjectService from '../../services/project.service'; +/* eslint-disable jsx-a11y/anchor-is-valid */ const derviedscheduleconstraints = {}; class SchedulingUnitList extends Component{ @@ -324,21 +325,21 @@ class SchedulingUnitList extends Component{ const timearray = obj[key]; if (timearray['at'] === undefined) { Object.assign(derviedscheduleconstraints, { - ['time' + '_' + 'at']: '' + 'time_at': '' }); - defaultcolumns['time' + '_' + 'at'] = {name: 'Time at'}; + defaultcolumns['time_at'] = {name: 'Time at'}; } if (timearray['after'] === undefined) { Object.assign(derviedscheduleconstraints, { - ['time' + '_' + 'after']: '' + 'time_after': '' }); - defaultcolumns['time' + '_' + 'after'] = {name: 'Time after'}; + defaultcolumns['time_after'] = {name: 'Time after'}; } if (timearray['before'] === undefined) { Object.assign(derviedscheduleconstraints, { - ['time' + '_' + 'before']: '' + 'time_before': '' }); - defaultcolumns['time' + '_' + 'before'] = {name: 'Time before'}; + defaultcolumns['time_before'] = {name: 'Time before'}; } for (var timekey in timearray) { //To retireve to and from values on same column between and not_between @@ -361,22 +362,22 @@ class SchedulingUnitList extends Component{ } }) Object.assign(derviedscheduleconstraints, { - ['time' + '_' + timekey]: combinedvalues + ["time_" + timekey]: combinedvalues }); - defaultcolumns['time' + '_' + timekey] = {name: 'Time '+timekey}; + defaultcolumns["time_" + timekey] = {name: 'Time '+timekey}; } } else { Object.assign(derviedscheduleconstraints, { - ['time' + '_' + timekey]: '' + ["time_" + timekey]: '' }); - defaultcolumns['time' + '_' + timekey] = {name: 'Time '+timekey}; + defaultcolumns["time_" + timekey] = {name: 'Time '+timekey}; } } else { //const dateConstraint = moment.utc(); Object.assign(derviedscheduleconstraints, { - ['time' + '_' + timekey]: moment(timearray[timekey].replace('Z', '')).format('YYYY-MM-DD HH:mm:ss') + ["time_" + timekey]: moment(timearray[timekey].replace('Z', '')).format('YYYY-MM-DD HH:mm:ss') }); - defaultcolumns['time' + '_' + timekey] = {name: 'Time '+timekey}; + defaultcolumns["time_" + timekey] = {name: 'Time '+timekey}; } } } else { @@ -392,11 +393,11 @@ class SchedulingUnitList extends Component{ } else if (parent === 'transit_offset' && (key === 'from' || key === 'to')) { value = obj['from']; Object.assign(derviedscheduleconstraints, { - [parent + '_' +'from']: ((value<0?'-':'')+UnitConverter.getSecsToHHmmss(Math.abs(value))) + [parent + "_from"]: ((value<0?'-':'')+UnitConverter.getSecsToHHmmss(Math.abs(value))) }); value = obj['to']; Object.assign(derviedscheduleconstraints, { - [parent + '_' +'to']: ((value<0?'-':'')+UnitConverter.getSecsToHHmmss(Math.abs(value))) + [parent + "_to"]: ((value<0?'-':'')+UnitConverter.getSecsToHHmmss(Math.abs(value))) }); defaultcolumns[parent + '_from'] = {name: ` ${this.capitalize(parent)} from`}; defaultcolumns[parent + '_to'] = {name: ` ${this.capitalize(parent)} to`}; @@ -671,8 +672,6 @@ class SchedulingUnitList extends Component{ let schUnit = _.find(this.schUnits, ['id', selectedRow.id]) if(this.state.suType === "Blueprint") { schUnit = schUnit.draft; - schUnit['name'] = schUnit.name; - schUnit.scheduling_unit_blueprints = schUnit.scheduling_unit_blueprints; } else { schUnit.scheduling_unit_blueprints = _.map(schUnit.scheduling_unit_blueprints, 'url') @@ -1071,6 +1070,7 @@ class SchedulingUnitList extends Component{ } else { hasInvalidSUD = true; } + return sud; }); } // Find SUB which is not blongs to the selected SUD @@ -1411,7 +1411,7 @@ class SchedulingUnitList extends Component{ try { let response = null; let param = {}; - if (this.state.suType == 'Draft') { + if (this.state.suType === 'Draft') { response = await ScheduleService.copySchedulingUnitDraft(item.id, param); } else { response = await ScheduleService.copySchedulingUnitBluePrint(item.id, param); @@ -1552,7 +1552,7 @@ class SchedulingUnitList extends Component{ for (const item of this.selectedRows) { try { let response = null; - if (this.state.suType == 'Draft') { + if (this.state.suType === 'Draft') { response = await ScheduleService.copySchedulingUnitDraft(item.id, param); } else { response = await ScheduleService.copySchedulingUnitBluePrint(item.id, param); @@ -1762,44 +1762,44 @@ class SchedulingUnitList extends Component{ if (values[1]) { this.filterQry += 'process_stop_time_before='+moment(new Date(values[1])).format("YYYY-MM-DDTHH:mm:ss")+".000Z&"; } - } else if ((filter.id === 'Scheduling Unit ID' || filter.id === 'Linked Draft ID') && filter.value != '') { + } else if ((filter.id === 'Scheduling Unit ID' || filter.id === 'Linked Draft ID') && filter.value !== '') { let columnDetails = _.find(this.state.columnMap, {displayName:filter.id}); this.idFilterValues = UnitConverter.getSubbandOutput(filter.value); this.filterQry += columnDetails.orgField+'='+this.idFilterValues.toString()+"&"; - } else if (filter.id === 'Linked Blueprint ID' && filter.value != '') { + } else if (filter.id === 'Linked Blueprint ID' && filter.value !== '') { const values = UnitConverter.getSubbandOutput(filter.value);//_.split(filter.value, ","); for ( const value of values) { this.filterQry += 'scheduling_unit_blueprints='+value+"&"; } - } else if (filter.id === 'Rank' && filter.value != '') { + } else if (filter.id === 'Rank' && filter.value !== '') { const values = _.split(filter.value, ","); if (values[0] && values[0] !== '' && values[0]>0) { - this.filterQry += "rank_min" +'='+parseFloat(values[0])+'&'; + this.filterQry += "rank_min="+parseFloat(values[0])+'&'; } if (values[1] && values[1] !== '' && values[1]>0) { - this.filterQry += "rank_max" +'='+parseFloat(values[1])+'&'; + this.filterQry += "rank_max="+parseFloat(values[1])+'&'; } - } else if ((filter.id === 'Created_At' || filter.id === 'Updated_At') && filter.value != '') { + } else if ((filter.id === 'Created_At' || filter.id === 'Updated_At') && filter.value !== '') { let columnDetails = _.find(this.state.columnMap, {displayName:filter.id}); const values = _.split(filter.value, ","); if (values.length>2){ continue; } - if((values[0] && values[0] != '' && values[0] != 'null') && (values[1] && values[1] != '' && values[1] != 'null')) { + if((values[0] && values[0] !== '' && values[0] !== 'null') && (values[1] && values[1] !== '' && values[1] !== 'null')) { this.filterQry += columnDetails.orgField+'_after='+ moment(new Date(values[0])).format("YYYY-MM-DDT00:00:00")+".000Z&"; this.filterQry += columnDetails.orgField+'_before='+moment(new Date(values[1])).format("YYYY-MM-DDT23:59:59")+".000Z&"; } - } else if (filter.id === 'Duration (HH:mm:ss)' && filter.value != '') { + } else if (filter.id === 'Duration (HH:mm:ss)' && filter.value !== '') { let columnDetails = _.find(this.state.columnMap, {displayName:filter.id}); const values = _.split(filter.value, ","); if (values[0].includes(":")) { - this.filterQry += columnDetails.orgField+"_min" +'=PT'+UnitConverter.getHHmmssToSecs(values[0])+'S&'; + this.filterQry += columnDetails.orgField + "_min=PT" + UnitConverter.getHHmmssToSecs(values[0]) + "S&"; } if (values[1].includes(":")) { - this.filterQry += columnDetails.orgField+"_max" +'=PT'+UnitConverter.getHHmmssToSecs(values[1])+'S&'; + this.filterQry += columnDetails.orgField + "_max=PT" + UnitConverter.getHHmmssToSecs(values[1]) + "S&"; } - } else if (filter.id === 'Template ID' && filter.value != '') { + } else if (filter.id === 'Template ID' && filter.value !== '') { // Since it is ModelChoiceFilter, it will allow single parameter, so use last parameter if contains multi parameter const values = _.split(filter.value, ","); this.filterQry += 'observation_strategy_template='+values[values.length-1]+"&"; diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/Stations.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/Stations.js index 7c67954d4a6..ca74b34dc5d 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/Stations.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/Stations.js @@ -16,7 +16,7 @@ const props = { } */ -export default (props) => { +const Stations = (props) => { const { tooltipOptions } = UIConstants; let op; @@ -353,6 +353,7 @@ export default (props) => { </> ) } + return <></> })} {customStations.map((stat, index) => ( <> @@ -373,3 +374,5 @@ export default (props) => { </div> ); }; + +export default Stations; diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/ViewSchedulingUnit.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/ViewSchedulingUnit.js index 72fa9e96f43..16567003db3 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/ViewSchedulingUnit.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/ViewSchedulingUnit.js @@ -37,9 +37,8 @@ import { InputText } from 'primereact/inputtext'; import { InputTextarea } from 'primereact/inputtextarea'; import { Dropdown } from 'primereact/dropdown'; import ProjectService from '../../services/project.service'; -import { RadioButton } from 'primereact/radiobutton'; -import { Button } from 'react-bootstrap'; import IngestProgress from './ingest.progress'; +/* eslint-disable jsx-a11y/anchor-is-valid */ class ViewSchedulingUnit extends Component { lsKeySortColumn = 'SortDataViewSchedulingUnit'; @@ -484,7 +483,7 @@ class ViewSchedulingUnit extends Component { } else if(this.props.match.params.type === 'blueprint') { ingestGroup = tasks.map(task => ({ name: task.name, canRemove: true, connectors : _.filter(task.draft.connector_types, connector => { - return connector.iotype_value == 'output'}), + return connector.iotype_value === 'output'}), consumers: task.consumers || [], isObsolete: task.obsolete_since!==null, type_value: task.task_type, id: task.id })); ingestGroup = _.groupBy(_.sortBy(ingestGroup, ['type_value','name']), 'type_value'); @@ -839,7 +838,7 @@ class ViewSchedulingUnit extends Component { for (const producer_id of ingestTask.produced_by_ids) { const taskRelation = await ScheduleService.getTaskRelation(producer_id); let producerTask = scheduletasklist.find(task => task.id === taskRelation.producer_id && task.tasktype.toLowerCase() === 'draft'); - if(producerTask!=undefined){ + if(producerTask!==undefined){ producerTask.consumers = producerTask.consumers || []; let producerTaskConsumer = _.find(producerTask.consumers, { id: ingestTask.id}) || { id: ingestTask.id}; producerTaskConsumer.canRemove = taskRelation && taskRelation.blueprints.length < 1 ? true: producerTaskConsumer.canRemove? producerTaskConsumer.canRemove : false; @@ -852,6 +851,7 @@ class ViewSchedulingUnit extends Component { connector.consumers.push(connectorConsumer); producerTaskConsumer.canIngest = producerTaskConsumer.canIngest===undefined?connectorConsumer.canIngest: producerTaskConsumer.canIngest&&connectorConsumer.canIngest; } + return connector; }); producerTask.consumers.push(producerTaskConsumer) // Store all existing task relations of ingest task @@ -897,7 +897,7 @@ class ViewSchedulingUnit extends Component { for (const producer_id of ingestTask.produced_by_ids) { const blueprintRelation = await ScheduleService.getBlueprintRelation(producer_id); let producerTask = taskBlueprintsList.find(task => task.id === blueprintRelation.producer_id && task.tasktype.toLowerCase() === 'blueprint'); - if(producerTask!=undefined){ + if(producerTask!==undefined){ // Store all existing task relations of ingest task producerTask.consumers = producerTask.consumers || []; let producerTaskConsumer = { id: ingestTask.id, canRemove: true}; @@ -910,6 +910,7 @@ class ViewSchedulingUnit extends Component { connector.consumers.push(connectorConsumer); producerTaskConsumer.canIngest = producerTaskConsumer.canIngest===undefined?connectorConsumer.canIngest: producerTaskConsumer.canIngest&&connectorConsumer.canIngest; } + return connector; }) producerTask.consumers.push(producerTaskConsumer) // Store all existing task relations of ingest task @@ -1127,7 +1128,7 @@ class ViewSchedulingUnit extends Component { try { let param = { } - if (this.state.scheduleunitType == 'draft') { + if (this.state.scheduleunitType === 'draft') { response = await ScheduleService.copySchedulingUnitDraft(this.state.scheduleunit.id, param); } else { response = await ScheduleService.copySchedulingUnitBluePrint(this.state.scheduleunit.id, param); @@ -1142,7 +1143,7 @@ class ViewSchedulingUnit extends Component { dialog.type = response.status === 201 ? "success" : "warning"; dialog.header = "Copy Scheduling Unit Status"; dialog.content = this.getStatusForCopiedShedulingUnit; - if (this.statusUpdate == 'Success') { + if (this.statusUpdate === 'Success') { dialog.actions = [{ id: 'yes', title: 'Yes', @@ -1237,7 +1238,7 @@ class ViewSchedulingUnit extends Component { name: this.state.copiedSchedulingUnit.name, scheduling_set_id: this.state.copiedSchedulingUnit.scheduling_set_id } - if (this.state.scheduleunitType == 'draft') { + if (this.state.scheduleunitType === 'draft') { response = await ScheduleService.copySchedulingUnitDraft(this.state.scheduleunit.id, param); } else { response = await ScheduleService.copySchedulingUnitBluePrint(this.state.scheduleunit.id, param); @@ -1259,7 +1260,7 @@ class ViewSchedulingUnit extends Component { dialog.type = copyUpdateResponse.status === 201 ? "success" : "warning"; dialog.header = "Advanced Copy Scheduling Unit - Status"; dialog.content = this.getAdvancedSUCopyStatusContent; - if (this.statusUpdate == 'Success') { + if (this.statusUpdate === 'Success') { dialog.actions = [{ id: 'yes', title: 'Yes', @@ -1622,13 +1623,13 @@ class ViewSchedulingUnit extends Component { const taskRelObj = await ScheduleService.getTaskRelationDraftAPIReqObj("all"); let createdTaskRes=[],deletedTaskRes=[],updateTaskRelObj=[]; let schedulingUnitTaskList = [] - if(this.props.match.params.type == 'draft') { + if(this.props.match.params.type === 'draft') { schedulingUnitTaskList = this.state.scheduleunit.task_drafts; - } else if(this.props.match.params.type == 'blueprint'){ + } else if(this.props.match.params.type === 'blueprint'){ schedulingUnitTaskList = this.state.scheduleunit.task_blueprints; } const consumerTask = _.find(schedulingUnitTaskList, ['id', consumer.id]); - if(this.props.match.params.type == 'blueprint') { + if(this.props.match.params.type === 'blueprint') { consumerTask.connector_types = consumerTask.draft.connector_types; } if(taskRelationsToAdd.length) { @@ -1641,7 +1642,7 @@ class ViewSchedulingUnit extends Component { }); for (const producerTask of producerTasks) { let taskDraftRelObj = {...taskRelObj}; - if(this.props.match.params.type == 'blueprint') { + if(this.props.match.params.type === 'blueprint') { producerTask.connector_types = producerTask.draft.connector_types; let producerRelations = await ScheduleService.getAllTaskRelation('draft', `producer=${producerTask.draft_id}`); producerRelations = _.filter(producerRelations, ['consumer_id', consumerTask.draft_id]) @@ -1672,7 +1673,7 @@ class ViewSchedulingUnit extends Component { } } } - if (this.props.match.params.type == 'draft') { + if (this.props.match.params.type === 'draft') { taskDraftRelObj.blueprints = []; let taskRel = this.fetchTaskRelationObj(producerTask, consumerTask, taskDraftRelObj); taskRelAddDraftObj = [...taskRelAddDraftObj, ...taskRel]; @@ -2190,7 +2191,7 @@ class ViewSchedulingUnit extends Component { ingestTaskTemplate = _.find(this.taskTemplates, {'id': existingIngestTasks[0].specifications_template.id}); newIngestTask = _.cloneDeep(existingIngestTasks[0]); let taskNamePrefix = existingIngestTasks[0].name; - taskNamePrefix = taskNamePrefix.replace( /[^\d\.]*/g, ''); + taskNamePrefix = taskNamePrefix.replace( /[^\d]*/g, ''); taskNamePrefix = taskNamePrefix === '' ? '1' : (parseInt(taskNamePrefix)+1); newIngestTask['name'] = `Ingest ${taskNamePrefix}`; } else { diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.e2e.test.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.e2e.test.js index 362c3b96642..3961eb4920c 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.e2e.test.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.e2e.test.js @@ -3,7 +3,7 @@ import {getDocument, queries, waitFor} from 'pptr-testing-library'; jest.setTimeout(600000); -describe("App.js", () => { +describe.skip("App.js", () => { let browser; let page; diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.js index 3c92eb03c67..c141d3ef658 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.js @@ -325,7 +325,6 @@ export class SchedulingUnitCreate extends Component { const promises = []; promises.push(ScheduleService.validateSpecificationsDoc(updatedConstraintParmas.constraint.url, schedulingConstraintsDoc)) const validation_result = await Promise.all(promises); - let validation_message = '' if(validation_result.length > 0) { let validationMessage = validation_result[0]['message']; if(validation_result[0]['valid']) { @@ -422,7 +421,7 @@ export class SchedulingUnitCreate extends Component { value = value.replace(/([^0-9.]+)/, ""); const match = /(\d{0,1})[^.]*((?:\.\d{0,4})?)/g.exec(value); const val = match[1] + match[2]; - if (val == '' || (val >= 0 && val <= 1)) { + if (val === '' || (val >= 0 && val <= 1)) { schedulingUnit[key] = val === ''? '':Number(val); } else { schedulingUnit[key] = previousValue; @@ -651,31 +650,6 @@ export class SchedulingUnitCreate extends Component { * Function to create Scheduling unit */ async saveSchedulingUnit() { - - //station - let station_groups = []; - /*(this.state.selectedStations || []).forEach(key => { - let station_group = {}; - const stations = this.state[key] ? this.state[key].stations : []; - const max_nr_missing = parseInt(this.state[key] ? (this.state[key].missing_StationFields || 0) : 0); - station_group = { - stations, - max_nr_missing - }; - station_groups.push(station_group); - }); - - this.state.customSelectedStations.forEach(station => { - station_groups.push({ - stations: station.stations, - max_nr_missing:parseInt(station.max_nr_missing) - }); - }); - - if (!station_groups.length) { - this.growl.show({severity: 'error', summary: 'Select Stations', detail: 'Please specify station groups.'}); - return; - }*/ await this.updateParameters(); let observStrategy = _.cloneDeep(this.state.updatedObservStrategy); let newSpecificationDoc = {} diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js index a181ab16636..f2789651720 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js @@ -111,7 +111,6 @@ export class EditSchedulingUnit extends Component { ParserUtility.addStationParameters(observStrategy); let stationGroups = {}; if (observStrategy) { - let station_group = []; let tasksToUpdate = {}; const tasks = observStrategy.template.tasks; const parameters = observStrategy.template.parameters; @@ -317,7 +316,7 @@ export class EditSchedulingUnit extends Component { value = value.replace(/([^0-9.]+)/, ""); const match = /(\d{0,1})[^.]*((?:\.\d{0,4})?)/g.exec(value); const val = match[1] + match[2]; - if (val == '' || (val >= 0 && val <= 1)) { + if (val === '' || (val >= 0 && val <= 1)) { schedulingUnit[key] = val === ''? '':Number(val); } else { schedulingUnit[key] = previousValue; @@ -483,7 +482,6 @@ export class EditSchedulingUnit extends Component { const promises = []; promises.push(ScheduleService.validateSpecificationsDoc(updatedConstraintParmas.constraint.url, schedulingConstraintsDoc)) const validation_result = await Promise.all(promises); - let validation_message = '' if(validation_result.length > 0) { let validationMessage = validation_result[0]['message']; if(validation_result[0]['valid']) { @@ -593,7 +591,6 @@ export class EditSchedulingUnit extends Component { async saveSchedulingUnit() { await this.updateParameters(); const constStrategy = _.cloneDeep(this.state.updatedConstraintParmas); - let station_groups = []; let observStrategy = _.cloneDeep(this.state.updatedObservStrategy); const schUnit = { ...this.state.schedulingUnit }; schUnit.scheduling_constraints_doc = constStrategy; diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/excelview.schedulingset.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/excelview.schedulingset.js index 7470afb39e3..b9baad83085 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/excelview.schedulingset.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/excelview.schedulingset.js @@ -50,6 +50,7 @@ import AccessDenied from '../../layout/components/AccessDenied'; import AuthUtil from '../../utils/auth.util'; import { MultiSelect } from 'primereact/multiselect'; import TopProgressBar from '../../layout/components/TopProgressBar'; +/* eslint-disable no-loop-func */ const BG_COLOR = '#f878788f'; /** @@ -379,7 +380,7 @@ export class SchedulingSetCreate extends Component { }) } } else { - for (var count = 0; count < noOfSU; count++) { + for (let count = 0; count < noOfSU; count++) { let tmpRow = _.cloneDeep(this.state.agSUWithDefaultValue); tmpRow['custId'] = this.custId++; this.tmpRowData.push(tmpRow); @@ -619,7 +620,7 @@ export class SchedulingSetCreate extends Component { this.changeStrategy(strategyId); }); } else { - this. changeStrategy(strategyId); + this.changeStrategy(strategyId); } } @@ -962,7 +963,7 @@ export class SchedulingSetCreate extends Component { } } else { let availableCount = this.tmpRowData.length; - for(var i = availableCount; i<totalSU; i++){ + for(let i = availableCount; i<totalSU; i++){ let tmpRow = _.cloneDeep(this.state.agSUWithDefaultValue); tmpRow['custId'] = this.custId++; this.tmpRowData.push(tmpRow); @@ -983,7 +984,7 @@ export class SchedulingSetCreate extends Component { isFetchingData: true // hasSameValue: hasSameValue }); - {this.state.gridApi && + if (this.state.gridApi) { this.state.gridApi.setRowData(this.state.rowData); } // Lazy fetching of specifications_doc so that grid loads faster and data required while updating is loaded later @@ -1023,6 +1024,7 @@ export class SchedulingSetCreate extends Component { if (stationGroups) { stationGroups.map(stationGroup =>{ stationValue += stationGroup.stations+':'+stationGroup.max_nr_missing+"|"; + return stationGroup; }); return stationValue; } @@ -1529,6 +1531,7 @@ export class SchedulingSetCreate extends Component { this.state.defaultStationGroups[stationKey].map(stationGroup =>{ let missingStation = (stationGroup.max_nr_missing)?stationGroup.max_nr_missing:0; stationValue += stationGroup.stations+':'+missingStation+"|"; + return stationGroup; }); let stationField = stationKey;//_.replace(stationKey, ' ', '_'); this.agSUWithDefaultValue[stationField] = stationValue; @@ -1978,12 +1981,12 @@ export class SchedulingSetCreate extends Component { if(isSetFocus === true) { if (field.startsWith('gdef_')) { this.state.topGridApi.stopEditing(); - var focusedCell = this.state.topGridColumnApi.getColumn(field) + let focusedCell = this.state.topGridColumnApi.getColumn(field) this.state.topGridApi.ensureColumnVisible(focusedCell); this.state.topGridApi.setFocusedCell(rowIndex, focusedCell); } else { this.state.gridApi.stopEditing(); - var focusedCell = this.state.gridColumnApi.getColumn(field) + let focusedCell = this.state.gridColumnApi.getColumn(field) this.state.gridApi.ensureColumnVisible(focusedCell); this.state.gridApi.setFocusedCell(rowIndex, focusedCell); } @@ -2035,7 +2038,7 @@ export class SchedulingSetCreate extends Component { publish('edit-dirty', true); if(isMultiselect) { //this.state.gridApi.stopEditing(); - var focusedCell = this.state.gridColumnApi.getColumn(field) + let focusedCell = this.state.gridColumnApi.getColumn(field) this.state.gridApi.ensureColumnVisible(focusedCell); this.state.gridApi.setFocusedCell(rowIndex, focusedCell); } @@ -2328,6 +2331,7 @@ export class SchedulingSetCreate extends Component { isValidRow = false; errorMsg += column.colDef.headerName+", "; } + return stationGroup; }); } } else { @@ -2356,7 +2360,7 @@ export class SchedulingSetCreate extends Component { if (column.colDef.max_length) { let sgCellValue = rowData[column.colId]; - if (sgCellValue && sgCellValue != '' && sgCellValue.length>column.colDef.max_length) { + if (sgCellValue && sgCellValue !== '' && sgCellValue.length>column.colDef.max_length) { isValidRow = false; errorMsg += column.colDef.headerName+", "; } @@ -2581,10 +2585,11 @@ export class SchedulingSetCreate extends Component { const $refs = await $RefParser.resolve(observStrategy.template); observStrategy.template.parameters.forEach(async(param, index) => { let refIndex = 0; - for (const ref of param.refs) { + // for (const ref of param.refs) { + param.refs.forEach(() => { $refs.set(observStrategy.template.parameters[index]['refs'][refIndex], this.state.paramsOutput[param.name]); refIndex++; - } + }); }); this.setState({observationIdSet: observationIdSet}); return observStrategy; @@ -2689,6 +2694,7 @@ export class SchedulingSetCreate extends Component { tmpStationGroup['max_nr_missing'] = Number(missingStation); tmpStationGroups.push(tmpStationGroup); } + return stationGroup; }); return tmpStationGroups; } @@ -2763,6 +2769,7 @@ export class SchedulingSetCreate extends Component { tmpStationGroup['max_nr_missing'] = Number(missingStation); tmpStationGroups.push(tmpStationGroup); } + return stationGroup; }); //task.specifications_doc.station_configuration.station_groups = tmpStationGroups; } @@ -2789,6 +2796,7 @@ export class SchedulingSetCreate extends Component { tmpStationGroup['max_nr_missing'] = Number(missingStation); tmpStationGroups.push(tmpStationGroup); } + return stationGroup; }); //task.specifications_doc.station_configuration.station_groups = tmpStationGroups; } @@ -3159,13 +3167,12 @@ export class SchedulingSetCreate extends Component { if ( column.colId !== '0'){ line += column.colDef.headerName + '\t'; } + return column; }); } line = _.trim(line); clipboardData += line + '\r\n'; clipboardData = _.trim(clipboardData); - const queryOpts = { name: 'clipboard-write', allowWithoutGesture: true }; - // await navigator.permissions.query(queryOpts); await navigator.clipboard.writeText(clipboardData); this.growl.show({severity: 'success', summary: '', detail: 'Header copied to clipboard '}); } @@ -3175,8 +3182,6 @@ export class SchedulingSetCreate extends Component { * Read Data from clipboard */ async readClipBoard(){ - const queryOpts = { name: 'clipboard-read', allowWithoutGesture: true }; - // await navigator.permissions.query(queryOpts); let data = await navigator.clipboard.readText(); return data; } @@ -3192,11 +3197,12 @@ export class SchedulingSetCreate extends Component { var focusedCell = this.state.gridApi.getFocusedCell(); if (focusedCell && focusedCell.column['colId'] === '0') { if ( this.state.copyHeader ) { - var line = ''; + let line = ''; columnsName.map( column => { if ( column.colId !== '0'){ line += column.colDef.headerName + '\t'; } + return column; }) line = _.trim(line); clipboardData += line + '\r\n'; @@ -3204,7 +3210,7 @@ export class SchedulingSetCreate extends Component { //for(const rowData of selectedRows){ for(var rowCount=0; rowCount < selectedRows.length ; rowCount++) { const rowData = selectedRows[rowCount]; - var line = ''; + let line = ''; //for(const key of this.state.colKeyOrder){ for(var count =0; count < this.state.colKeyOrder.length; count++) { let value = ' '; @@ -3387,6 +3393,7 @@ export class SchedulingSetCreate extends Component { if (_.includes(this.strategyVariables, focusedCell.column['colId'])) { this.validateSpecificationsDoc(selectedRowIndex, this.tmpRowData[selectedRowIndex]); } + return selectedRow; }); } } else if (selectedRows && selectedRows.length>0) { @@ -3401,7 +3408,7 @@ export class SchedulingSetCreate extends Component { // If multiple rows are copied, iteration occurs once and all copied rows will be pasted. // If only one row is copied, iteration occurs as per the no of selected rows. noOfRowsToPaste = suRows.length===1?selectedRows.length:1; - for (const pasteCount of _.range(1, noOfRowsToPaste+1)) { + _.range(1, noOfRowsToPaste+1).forEach(() => { // Paste all copied rows suRows.map(async line => { selectedRowIndex++; @@ -3436,7 +3443,7 @@ export class SchedulingSetCreate extends Component { await this.validateSchedulingConstraints(selectedRowIndex, suGridRowData); await this.validateSpecificationsDoc(selectedRowIndex, suGridRowData); }); - } + }) } } diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/ingest.progress.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/ingest.progress.js index 228bed7e1fb..19c5461a6a2 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/ingest.progress.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/ingest.progress.js @@ -3,11 +3,12 @@ import { ProgressBar } from 'primereact/progressbar'; import _ from 'lodash'; import TaskService from '../../services/task.service'; import ScheduleService from '../../services/schedule.service'; +/* eslint-disable react-hooks/exhaustive-deps */ /** * Component to show the ingest progress. */ -export default (props) => { +const IngestProgress = (props) => { const TASK_NOT_STARTED_STATUSES = ['defined', 'schedulable', 'scheduled', 'unschedulable']; const [ingestProgress, setIngestProgress] = useState(0); const expandFields = 'task_blueprints,task_blueprints.specifications_template,task_blueprints.subtasks'; @@ -54,4 +55,6 @@ export default (props) => { return ( <ProgressBar value={ingestProgress}></ProgressBar> ); -}; \ No newline at end of file +}; + +export default IngestProgress; \ No newline at end of file diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/summary.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/summary.js index 939548a1d1d..4cdec9cc041 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/summary.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/summary.js @@ -323,6 +323,7 @@ export class SchedulingUnitSummary extends Component { 'Control ID': `${process.env.REACT_APP_SERVER_NAME}/inspect/HTML/${task.controlId}/` }; } + return task; }); const constraintsTemplate = this.props.constraintsTemplate; // After receiving output from the SchedulingConstraint editor order and format it to display diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Task/edit.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Task/edit.js index ef3ff7c13b1..c6567b2d6d4 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Task/edit.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Task/edit.js @@ -243,7 +243,8 @@ export class TaskEdit extends Component { let fieldsToDisable = []; //To disable input fields in JSON editor task.specifications_doc.station_configuration?.SAPs.map((sap, index) => { - fieldsToDisable.push('SAPs.'+ index +'.name') + fieldsToDisable.push('SAPs.'+ index +'.name'); + return sap; }) this.templateOutput[task.specifications_template_id] = task.specifications_doc; this.setState({schedulingUnit: schedulingUnit,targetTask: targetTask, task: task, taskSchema: taskTemplate.ref_resolved_schema, isLoading: false, fieldsToDisable: fieldsToDisable}); diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Task/list.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Task/list.js index f3488dfb660..a2baf778dc0 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Task/list.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Task/list.js @@ -849,7 +849,7 @@ export class TaskList extends Component { dialog.type = "confirmation"; dialog.header = "Confirm to mark task(s) as obsolete"; dialog.actions = [{ id: 'yes', title: 'Mark as obsolete', className:'act-btn-dispose', callback: this.markObsoleteTasks }, - { id: 'no', title: 'Cancel', className:'act-btn-cancel', className:'act-btn-cancel', callback: this.closeDialog }]; + { id: 'no', title: 'Cancel', className:'act-btn-cancel', callback: this.closeDialog }]; dialog.detail = "Warning: Obsolete task(s) will not be copied and dataproducts will not be used for pipelines and ingest. Are you sure you want to make the task(s) obsolete?"; dialog.content = this.getObsTaskConfirmDlgContent; dialog.submit = this.markObsoleteTasks; @@ -1119,12 +1119,10 @@ export class TaskList extends Component { let expand = taskType.toLowerCase() === 'draft' ? this.TASK_DRAFT_EXPAND: this.TASK_BLUEPRINT_EXPAND; let fields = taskType.toLowerCase() === 'draft' ? this.TASK_DRAFT_FIELDS: this.TASK_BLUEPRINT_FIELDS; let response = await TaskService.getExpandedTasksWithFilter(taskType.toLowerCase(), expand, fields.join(","), filterQry, orderBy, limit, offset); - const {task, task_draft, task_blueprint} = this.state.userrole.userRolePermission + const {task_draft, task_blueprint} = this.state.userrole.userRolePermission if (response && response.data) { this.totalPage = response.data.count; let tasks = taskType.toLowerCase() === 'draft' ? (await this.getFormattedTaskDrafts(response.data.results)) : await this.getFormattedTaskBlueprints(response.data.results); - let ingestGroup = tasks.map(task => ({ name: task.name, canIngest: task.canIngest, type_value: task.type_value, id: task.id })); - ingestGroup = _.groupBy(_.filter(ingestGroup, 'type_value'), 'type_value'); tasks = await this.formatDataProduct(tasks); let actions = []; let projectTask = _.uniqBy(_.map(tasks, function(task) { @@ -1240,40 +1238,40 @@ export class TaskList extends Component { } else { this.filterQry += 'scheduling_unit_blueprint_name='+encodeURIComponent(filter.value)+'&'; } - } else if ((filter.id === 'Duration (HH:mm:ss)' || filter.id === 'Relative Start Time (HH:mm:ss)' || filter.id === 'Relative End Time (HH:mm:ss)') && filter.value != '') { + } else if ((filter.id === 'Duration (HH:mm:ss)' || filter.id === 'Relative Start Time (HH:mm:ss)' || filter.id === 'Relative End Time (HH:mm:ss)') && filter.value !== '') { let columnDetails = _.find(this.state.columnMap, {displayName:filter.id}); const values = _.split(filter.value, ","); if (values[0].includes(":")) { - this.filterQry += columnDetails.orgField+"_min" +'=PT'+UnitConverter.getHHmmssToSecs(values[0])+'S&'; + this.filterQry += columnDetails.orgField+"_min=PT"+UnitConverter.getHHmmssToSecs(values[0])+"S&"; } if (values[1].includes(":")) { - this.filterQry += columnDetails.orgField+"_max" +'=PT'+UnitConverter.getHHmmssToSecs(values[1])+'S&'; + this.filterQry += columnDetails.orgField+"_max=PT"+UnitConverter.getHHmmssToSecs(values[1])+"S&"; } - } else if (filter.id === 'Linked Blueprint ID' && filter.value != '') { + } else if (filter.id === 'Linked Blueprint ID' && filter.value !== '') { const values = UnitConverter.getSubbandOutput(filter.value) _.split(values, ",").forEach(value =>{ if(value && _.trim(value) !== '') { this.filterQry += 'task_blueprints='+_.trim(value)+'&'; } }); - } else if ((filter.id === 'Created at' || filter.id === 'Updated at') && filter.value != '') { + } else if ((filter.id === 'Created at' || filter.id === 'Updated at') && filter.value !== '') { let columnDetails = _.find(this.state.columnMap, {displayName:filter.id}); const values = _.split(filter.value, ","); if (values.length>2){ continue; } - if((values[0] && values[0] != '' && values[0] != 'null') && (values[1] && values[1] != '' && values[1] != 'null')) { + if((values[0] && values[0] !== '' && values[0] !== 'null') && (values[1] && values[1] !== '' && values[1] !== 'null')) { this.filterQry += columnDetails.orgField+'_after='+ moment(new Date(values[0])).format("YYYY-MM-DDT00:00:00")+".000Z&"; this.filterQry += columnDetails.orgField+'_before='+moment(new Date(values[1])).format("YYYY-MM-DDT23:59:59")+".000Z&"; } - } else if ((filter.id === 'Control ID') && filter.value != '') { + } else if ((filter.id === 'Control ID') && filter.value !== '') { const values = UnitConverter.getSubbandOutput(filter.value); _.split(values, ",").forEach(value =>{ if(value && _.trim(value) !== '') { this.filterQry += 'subtasks='+_.trim(value)+'&'; } }); - } else if ((filter.id === 'Scheduling Unit ID' || filter.id === 'Linked Draft ID'|| filter.id === 'ID') && filter.value != '') { + } else if ((filter.id === 'Scheduling Unit ID' || filter.id === 'Linked Draft ID'|| filter.id === 'ID') && filter.value !== '') { let columnDetails = _.find(this.state.columnMap, {displayName:filter.id}); const values = UnitConverter.getSubbandOutput(filter.value); this.idFilterValues = filter.id === 'ID' ?values:[]; @@ -1429,8 +1427,6 @@ export class TaskList extends Component { _.remove(taskList, function (su) { return su.id === updatedTask.id }); taskList.push(updatedTask); } - let ingestGroup = taskList.map(task => ({ name: task.name, canIngest: task.canIngest, type_value: task.type_value, id: task.id })); - ingestGroup = _.groupBy(_.filter(ingestGroup, 'type_value'), 'type_value'); taskList = await this.formatDataProduct(taskList); let projectTask = _.uniqBy(_.map(taskList, function(task) { return { diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Task/view.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Task/view.js index 9fd40ee2fc6..c9fdc50e1d6 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Task/view.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Task/view.js @@ -165,7 +165,7 @@ export class TaskView extends Component { this.getTaskDetails(this.props.match.params.id, this.props.match.params.type); } const moduleName = this.props.match.params.type === 'draft' ? 'task_draft': 'task_blueprint' - if(prevState.taskId != this.props.match.params.id || prevState.moduleName !== moduleName ) { + if(prevState.taskId !== this.props.match.params.id || prevState.moduleName !== moduleName ) { const permissionById = await AuthUtil.getUserPermissionByModuleId(moduleName, this.props.match.params.id) this.setState({ permissionById: permissionById, moduleName: moduleName, taskId: this.props.match.params.id}); } @@ -908,7 +908,6 @@ export class TaskView extends Component { * @param {*} disableUpdateAction : true - relevant button will be disabled */ prepareActionMenus(disableUpdateAction) { - const {task} = this.state.userrole.userRolePermission; let actions = [ ]; if (this.state.taskType === 'draft') { @@ -942,7 +941,6 @@ export class TaskView extends Component { }); actions.push({icon: 'fa-times-circle', iconType: 'far', title: this.state.task && this.state.task.obsolete_since?'Already marked as obsolete':this.state.permissionById[this.state.taskId] && this.state.permissionById[this.state.taskId].obsolete?'Mark as Obsolete':`${this.access_denied_message}`, - title: this.state.task && '', disabled: this.state.task && this.state.task.obsolete_since? true: this.state.permissionById[this.state.taskId] && this.state.permissionById[this.state.taskId].obsolete?false: true, type: 'button', actOn: 'click', props: { callback: this.showObsoleteConfirmation }}); } diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/list.tabs.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/list.tabs.js index 4f062fda70b..4a78eeb8c0b 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/list.tabs.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/list.tabs.js @@ -63,7 +63,7 @@ class TimelineListTabs extends Component { task.suName = suBlueprint.name; task.duration = UnitConverter.getSecsToHHmmss(suBlueprint.duration); let outputDataproducts = []; - taskBlueprint.subtasks.map(function(subtask) { outputDataproducts = outputDataproducts.concat(subtask.output_dataproducts)}); + taskBlueprint.subtasks.map(function(subtask) { outputDataproducts = outputDataproducts.concat(subtask.output_dataproducts); return subtask;}); task.dataProducts = outputDataproducts.length; task.dataSize = _.sumBy(outputDataproducts, 'size'); task.dataSizeOnDisk = _.sumBy(outputDataproducts, function (product) { return product.deletedSince ? 0 : product.size }); diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/view.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/view.js index 4c687354a09..65e5fece59f 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/view.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/view.js @@ -24,8 +24,6 @@ import SchedulingUnitSummary from '../Scheduling/summary'; import ReservationSummary from '../Reservation/reservation.summary'; import { TieredMenu } from 'primereact/tieredmenu'; import { MultiSelect } from 'primereact/multiselect'; -import { Button } from 'primereact/button'; -import { ProgressBar } from 'primereact/progressbar'; import TimelineListTabs from './list.tabs'; import TimelineCommonUtils from './common.utils'; import AuthStore from '../../authenticate/auth.store'; @@ -228,6 +226,7 @@ export class TimelineView extends Component { if(updateConstraints.id===id){ updateConstraints.scheduling_constraints_doc = updatedResponse.data.scheduling_constraints_doc; } + return updateConstraints; }); this.setState({ suBlueprints: updateStateVal, @@ -328,7 +327,6 @@ export class TimelineView extends Component { const permission = await AuthUtil.getUserRolePermission(); const timelinePermission = permission.userRolePermission.timeline; - let taskTypes = [] let menuOptions = [ { label: 'Add Reservation', icon: "fa fa-", disabled: !timelinePermission.addreservation, command: (e) => { this.selectOptionMenu(e, 'Add Reservation') } }, @@ -701,7 +699,6 @@ export class TimelineView extends Component { let filteredTasks = taskFilterData?_.map(taskFilterData, task => {return task["id"]?task["id"]:task["Task Id"]}):[]; if (suBlueprint.tasks) { let items = [], itemGroup = []; - const subtaskTemplates = this.subtaskTemplates; for (let task of suBlueprint.tasks) { if (((!this.state.stationView && this.state.selectedTaskTypes.indexOf(task.task_type)>=0) || (this.state.stationView && task.task_type === 'observation')) @@ -864,7 +861,7 @@ export class TimelineView extends Component { */ closeSummaryPanel() { // If the stored previous position available, restore it else keep the default positions - const canExtendSUList = this.timelineUIAttributes.canExtendSUList!=undefined?this.timelineUIAttributes.canExtendSUList:true; + const canExtendSUList = this.timelineUIAttributes.canExtendSUList!==undefined?this.timelineUIAttributes.canExtendSUList:true; const canShrinkSUList = this.timelineUIAttributes.canShrinkSUList || false; this.setState({ isSUDetsVisible: false, isReservDetsVisible: false, isTaskDetsVisible: false, isUnscheduledDetVisible: false, canExtendSUList: canExtendSUList, canShrinkSUList: canShrinkSUList @@ -1499,6 +1496,7 @@ export class TimelineView extends Component { this.updateTimeline(); break; } + default: { break; } } } @@ -1749,7 +1747,6 @@ export class TimelineView extends Component { } render() { - const {dynamicScheduler} = this.state.userrole.userRolePermission; if (this.state.redirect) { return <Redirect to={{ pathname: this.state.redirect }}></Redirect> } diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/week.view.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/week.view.js index d3575988cce..811e31b7455 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/week.view.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/week.view.js @@ -26,7 +26,6 @@ import UIConstants from '../../utils/ui.constants'; import { TieredMenu } from 'primereact/tieredmenu'; import { InputSwitch } from 'primereact/inputswitch'; import { MultiSelect } from 'primereact/multiselect'; -import { Button } from 'primereact/button'; import ReservationSummary from '../Reservation/reservation.summary'; import TimelineListTabs from './list.tabs'; import TimelineCommonUtils from './common.utils'; @@ -248,6 +247,7 @@ export class WeekTimelineView extends Component { if(updateConstraints.id===id){ updateConstraints.scheduling_constraints_doc = updatedResponse.data.scheduling_constraints_doc; } + return updateConstraints; }); this.setState({ suBlueprints: updateStateVal, @@ -328,8 +328,6 @@ export class WeekTimelineView extends Component { const defaultStartTime = showCustomDate?startDay.clone().hour(0).minutes(0).seconds(0):startDay.day(-2).hour(0).minutes(0).seconds(0); const endDay = defaultStartTime.clone(); const defaultEndTime = endDay.add(10, 'days').hour(23).minutes(59).seconds(59); - const datasetStartTime = defaultStartTime.clone().add(-1 * OFFSET_DATA_DAYS, 'days'); - const datasetEndTime = defaultEndTime.clone().add(OFFSET_DATA_DAYS, 'days'); // Fetch all details from server and prepare data to pass to timeline and table components let group = [], items = []; @@ -665,7 +663,7 @@ export class WeekTimelineView extends Component { * Closes the SU details section */ closeSUDets() { - const canExtendSUList = this.timelineUIAttributes.canExtendSUList!=undefined?this.timelineUIAttributes.canExtendSUList:true; + const canExtendSUList = this.timelineUIAttributes.canExtendSUList!==undefined?this.timelineUIAttributes.canExtendSUList:true; const canShrinkSUList = this.timelineUIAttributes.canShrinkSUList || false; this.setState({ isSUDetsVisible: false, isReservDetsVisible: false, isUnscheduledDetVisible: false, canExtendSUList: canExtendSUList, canShrinkSUList: canShrinkSUList }); @@ -694,7 +692,6 @@ export class WeekTimelineView extends Component { } if (item.type === "SCHEDULE") { const itemSU = _.find(this.state.suBlueprints, { id: parseInt(item.id.split("-")[0]) }); - const itemStations = itemSU.stations; item.suStartTime = moment.utc(itemSU.start_time); item.suStopTime = moment.utc(itemSU.stop_time); item.stations = this.timelineCommonUtils.getSUStationGroupCount(itemSU.stations); @@ -842,7 +839,7 @@ export class WeekTimelineView extends Component { if (this.state.datasetStartTime && filteredSUData) { this.filteredSUBs = _.map(filteredSUData, "Id"); } - let group=[], items = []; + let items = []; const startTime = this.state.startTime; const endTime = this.state.endTime; const suBlueprints = this.state.suBlueprints; @@ -1067,6 +1064,7 @@ export class WeekTimelineView extends Component { this.timeline.updateTimeline(updatedItemGroupData); break; } + default: { break; } } } diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Workflow/index.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Workflow/index.js index c33b2a4a674..49fc25f37bb 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Workflow/index.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Workflow/index.js @@ -24,6 +24,7 @@ import UtilService from '../../services/util.service'; import NotFound from '../../layout/components/NotFound'; import { appGrowl } from '../../layout/components/AppGrowl'; import Websocket from 'react-websocket'; +/* eslint-disable react-hooks/exhaustive-deps */ const RedirectionMap = { 'wait scheduled': { @@ -65,7 +66,8 @@ const RedirectionMap = { } }; - const stepItems = [ +//Workflow Page Title +const stepItems = [ {label: 'Wait Scheduled'}, {label: 'Scheduled'}, {label: 'QA Reporting(TO)'}, @@ -76,9 +78,6 @@ const RedirectionMap = { {label: 'Unpin Data'}, {label: 'Done'} ]; -//Workflow Page Title -const pageTitle = ['Waiting To Be Scheduled','Scheduled','QA Reporting (TO)', 'QA Reporting (SDCO)', 'PI Verification', 'Decide Acceptance','Ingesting','Unpin Data','Done']; - const ALLOWED_PROJECT_ROLES = {'qa reporting to': ["shared_support", "friend_of_project", "friend_of_project_primary"], 'qa reporting sos': ["shared_support", "friend_of_project", "friend_of_project_primary"], 'pi verification': ["pi", "contact", "shared_support", "friend_of_project", "friend_of_project_primary"], @@ -88,7 +87,7 @@ const ALLOWED_PROJECT_ROLES = {'qa reporting to': ["shared_support", "friend_of_ const roleTitleMap = {pi: "PI", co_i: "Co-I", contact: "Contact Author", shared_support: "Shared Support User", friend_of_project: "Friend of Project", friend_of_project_primary:"Friend of Project(Primary)"}; -export default (props) => { +const WorkflowView = (props) => { let growl; // const [disableNextButton, setDisableNextButton] = useState(false); const [loader, setLoader] = useState(false); @@ -105,13 +104,14 @@ export default (props) => { const [notFound, setNotFound] = useState(); const [showAddSystemEvent, setShowAddSystemEvent] = useState(false); const [skippedSteps, setSkippedSteps] = useState([]); - const [originPath, setOriginPath] = useState(props.location.state?props.location.state.origin:"/su/workflow"); + const [originPath, setOriginPath] = useState("/su/workflow"); const [websocket, setWebsocket] = useState({}); // const [ingestTask, setInjestTask] = useState({}); // const [QASchedulingTask, setQASchdulingTask] = useState([]); useEffect(() => { setLoader(true); + setOriginPath(props.location.state?props.location.state.origin:"/su/workflow"); const promises = [ ScheduleService.getSchedulingUnitExtended('blueprint', props.match.params.id), UtilService.getProjectRoles() @@ -154,6 +154,7 @@ export default (props) => { subtaskTemplate.type_value.toLowerCase() === 'pipeline') { promises.push(DataProductService.getSubtaskOutputDataproduct(subtask.id)); } + return subtask; }); const dataProducts = await Promise.all(promises); task['dataProducts'] = dataProducts.filter(product => product.data.length).map(product => product.data).flat(); @@ -488,4 +489,6 @@ export default (props) => { } </> ) -}; \ No newline at end of file +}; + +export default WorkflowView; \ No newline at end of file diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Workflow/workflow.list.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Workflow/workflow.list.js index b85cbcc967f..54d70003997 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Workflow/workflow.list.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Workflow/workflow.list.js @@ -1,7 +1,6 @@ import React, { Component } from 'react'; import _ from 'lodash'; import moment from 'moment'; -import { MultiSelect } from 'primereact/multiselect'; import {TriStateCheckbox} from 'primereact/tristatecheckbox'; import PageHeader from '../../layout/components/PageHeader'; @@ -12,7 +11,6 @@ import WorkflowService from '../../services/workflow.service'; import ScheduleService from '../../services/schedule.service'; import UIConstants from '../../utils/ui.constants'; import UtilService from '../../services/util.service'; -import UnitConverter from '../../utils/unit.converter'; import AuthUtil from '../../utils/auth.util'; import AccessDenied from '../../layout/components/AccessDenied'; import { Dropdown } from 'primereact/dropdown'; @@ -211,7 +209,6 @@ class WorkflowList extends Component{ workflowTask['project'] = schedulingUnit.draft.scheduling_set.project_id; workflowTask['status'] = schedulingUnit.status; workflowTask['created'] = moment(workflowTask['created']).format(UIConstants.UTC_DATE_TIME_FORMAT); - workflowTask['flow_task'] = workflowTask.flow_task; workflowTask['lastTaskName'] = this.redirectionMap[workflowTask.flow_task.toLowerCase()]; workflowTask['owner'] = workflowTask.owner? workflowTask.owner : ''; workflowTask['owner_username'] = workflowTask.owner_username? workflowTask.owner_username : ''; @@ -433,7 +430,7 @@ class WorkflowList extends Component{ } } this.filterQry += 'flow_task=' + qryString.join(",") +'&'; - } else if ((filter.id === 'Updated At') && filter.value != '') { + } else if ((filter.id === 'Updated At') && filter.value !== '') { const values = filter.value; if (values[0] && values[0] !== '') { this.filterQry += 'created_after='+ moment(new Date(values[0])).format("YYYY-MM-DD HH:mm:ss&"); @@ -441,9 +438,9 @@ class WorkflowList extends Component{ if (values[1] && values[1] !== '') { this.filterQry += 'created_before='+moment(new Date(values[1])).format("YYYY-MM-DD HH:mm:ss&"); } - } else if ((filter.id === 'ownerUserNameisNull') && filter.value != '') { + } else if ((filter.id === 'ownerUserNameisNull') && filter.value !== '') { this.filterQry += "owner_username_isnull="+filter.value+'&'; - } else if ((filter.id === 'participated') && filter.value != '') { + } else if ((filter.id === 'participated') && filter.value !== '') { if(filter.value) { for (const process of filter.value) { this.filterQry += "process="+process+'&'; diff --git a/SAS/TMSS/frontend/tmss_webapp/src/services/schedule.service.js b/SAS/TMSS/frontend/tmss_webapp/src/services/schedule.service.js index a2977929c99..1ae3f71a706 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/services/schedule.service.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/services/schedule.service.js @@ -589,7 +589,7 @@ const ScheduleService = { } else if (type === 'blueprint') { url = `/api/task_relation_blueprint/${id}/`; } - const response = await axios.delete(url); + await axios.delete(url); return { 'name': name, action: 'Removed', @@ -886,12 +886,10 @@ const ScheduleService = { return suUpdateResponse } }, - getSchedulingListByProject: async function (project) { - /* - SU - Schedulign Unit - Get Scheduling Unit Draft and It's Blueprints using Project ID. there is no direct API to get SU form project (API request -TMSS-349) - Use Fetch all Scheduling Set and filter Scheduling Set with Project ID => Get SU Draft list and SU Blueprints - */ + /*getSchedulingListByProject: async function (project) { + //SU - Schedulign Unit + //Get Scheduling Unit Draft and It's Blueprints using Project ID. there is no direct API to get SU form project (API request -TMSS-349) + //Use Fetch all Scheduling Set and filter Scheduling Set with Project ID => Get SU Draft list and SU Blueprints try { let schedulingunitlist = []; //Fetch all Scheduling Set as there is no API to fetch Scheduling Set for a Project @@ -924,7 +922,7 @@ const ScheduleService = { } catch (error) { console.error('[project.services.getSchedulingListByProject]', error); } - }, + },*/ getSchedulingListByStatus: async function (status) { try { let url = `/api/scheduling_unit_blueprint/?ordering=name&expand=${SU_EXPAND_FIELDS.join()}&fields=${SU_FETCH_FIELDS.join()}` @@ -1092,7 +1090,7 @@ const ScheduleService = { }, /* Create Task Relation based on consumer(Ingest) and producer */ createTaskRelation: async function (taskRelDraftObj, obj, type) { - let taskRelDraftPromises = [], taskRelAddDraftObj = []; + let taskRelDraftPromises = []; try { if (taskRelDraftObj) { taskRelDraftObj.forEach((tObj, i) => { -- GitLab