diff --git a/SAS/TMSS/frontend/tmss_webapp/package.json b/SAS/TMSS/frontend/tmss_webapp/package.json index 65b27b2d39e0df204b3c4f0735bf68472965aa7b..04b30047fed23fe43eed53f9c823c0c872016128 100644 --- a/SAS/TMSS/frontend/tmss_webapp/package.json +++ b/SAS/TMSS/frontend/tmss_webapp/package.json @@ -176,7 +176,8 @@ "html", "text", "text-summary", - "cobertura" + "cobertura", + "lcov" ], "testMatch": [ "**/*.test.js" diff --git a/SAS/TMSS/frontend/tmss_webapp/src/App.js b/SAS/TMSS/frontend/tmss_webapp/src/App.js index 798eae59e576581ecc3a08789ea52c8cd0fe26ef..197a4718ce76eaa0ea416b753d7d5270e8f1d510 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/App.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/App.js @@ -1,13 +1,12 @@ import React, {Component} from 'react'; -import { Redirect} from 'react-router-dom'; -import { BrowserRouter as Router } from 'react-router-dom'; +import { Redirect, BrowserRouter as Router} from 'react-router-dom'; + import classNames from 'classnames'; import { AppTopbar } from './layout/components/AppTopbar'; import AppMenu from './layout/components/AppMenu'; import {AppFooter } from './layout/components/AppFooter'; import {RoutedContent} from './routes'; import AppBreadcrumb from "./layout/components/AppBreadcrumb"; -import {withRouter } from 'react-router'; import handleResponse from "./response.handler" import 'primeicons/primeicons.css'; @@ -37,15 +36,14 @@ export { class App extends Component { constructor() { super(); - this.isBackButtonClicked = false; this.state = { layoutMode: 'static', currentMenu: '', currentPath: '/', PageTitle:'', - staticMenuInactive: localStorage.getItem('staticMenuInactive') === 'true' ? true : false, - overlayMenuActive: localStorage.getItem('overlayMenuActive') === 'true' ? true : false, - mobileMenuActive: localStorage.getItem('mobileMenuActive') === 'true' ? true : false, + staticMenuInactive: localStorage.getItem('staticMenuInactive') === 'true', + overlayMenuActive: localStorage.getItem('overlayMenuActive') === 'true', + mobileMenuActive: localStorage.getItem('mobileMenuActive') === 'true', authenticated: true, findObjectPlaceholder: 'Sub Task', redirect: window.location.pathname === '/'? '/su/timelineview/week': window.location.pathname, @@ -165,7 +163,6 @@ class App extends Component { this.setState({ isEditDirty: flag }, () => { if (flag) { window.addEventListener("beforeunload", reloadDirty); - // window.addEventListener('popstate', this.onBackButtonEvent); window.history.pushState(null, document.title, window.location.href); window.addEventListener('popstate', this.onBackButtonEvent); } else { @@ -174,11 +171,10 @@ class App extends Component { }); }); - var reloadDirty =function (e) { - var confirmationMessage = "\o/"; + let reloadDirty =function (e) { + let confirmationMessage = "\o/"; (e || window.event).returnValue = confirmationMessage; //Gecko + IE return confirmationMessage; - // this.toggleDirtyDialog(); }; } @@ -201,10 +197,6 @@ class App extends Component { } } - componentWillUnmount = () => { - //window.removeEventListener('popstate', this.onBackButtonEvent); - } - close = () => { this.setState({showDirtyDialog: false}); } diff --git a/SAS/TMSS/frontend/tmss_webapp/src/authenticate/login.js b/SAS/TMSS/frontend/tmss_webapp/src/authenticate/login.js index 0a1815c582b1e30e4a175bf62f1a825c4f0f6cfb..f2b8c6dbdb4b11934cf0f00cda9b93c6f6fb36e6 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/authenticate/login.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/authenticate/login.js @@ -101,7 +101,7 @@ export class Login extends Component { </div> {/* Right panel with login form */} <div className="col-md-7 logn-part" style={{'height': '402px'}}> - <div className="row"> + <div className="row login-part"> <div className="col-lg-10 col-md-12 mx-auto"> <div className="logo-cover"> {/* <img src="./logo.png" alt="" /> */} diff --git a/SAS/TMSS/frontend/tmss_webapp/src/components/ViewTable.js b/SAS/TMSS/frontend/tmss_webapp/src/components/ViewTable.js index 94d7cfbc6f4e645bc004436a2674b7f4adea576e..8879d005654946527892596592090c12452d6908 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/components/ViewTable.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/components/ViewTable.js @@ -2824,8 +2824,7 @@ function ViewTable(props) { loadingStatus = false; } }); - } else { - if(tbldata) { + } else if(tbldata) { const startRow = state.pageSize * state.pageIndex; const endRow = startRow + state.pageSize; //setData(tbldata.slice(startRow, endRow)); @@ -2835,7 +2834,7 @@ function ViewTable(props) { setLoading(false); loadingStatus = false; } - } + } // Set the filterCallback function to load on filter changes filterCallback = loadServerData; diff --git a/SAS/TMSS/frontend/tmss_webapp/src/layout/sass/_login.scss b/SAS/TMSS/frontend/tmss_webapp/src/layout/sass/_login.scss index d5680fc6c8cf0edc3b12f399c1eb07e0d2a655d5..88a494ffa81b3ceb5db794f1aef2a1409f363579 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/layout/sass/_login.scss +++ b/SAS/TMSS/frontend/tmss_webapp/src/layout/sass/_login.scss @@ -34,6 +34,17 @@ float: right; font-weight: 600; } +@media only screen and (max-width: 765px) { +.login-part{ + background-color: white; + min-width: 500px; +} +.login-form-link { + width:250px; + display: inline; +} +} + .logn-part{ padding: 5%; } diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/create.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/create.js index e13fb1f87938514b67219c791a6cf1900d3cf291..b288b2c4075991829b92f34c287af68da089b5f6 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/create.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/create.js @@ -40,7 +40,7 @@ export class ProjectCreate extends Component { name: '', description: '', trigger_priority: 1000, - rank: '', + rank: 6, quota: [], // Mandatory Field in the back end, so an empty array is passed can_trigger: false, auto_pin: false, @@ -49,7 +49,7 @@ export class ProjectCreate extends Component { piggyback_allowed_aartfaac: false }, projectQuota: {}, // Resource Allocations - validFields: {}, // For Validation + validFields: {rank:true}, // For Validation validForm: false, // To enable Save Button errors: {}, // Validation Errors periodCategories: [], @@ -216,7 +216,7 @@ export class ProjectCreate extends Component { value = value.replace(/([^0-9.]+)/, ""); 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; @@ -329,6 +329,7 @@ export class ProjectCreate extends Component { if (Object.keys(validFields).length === Object.keys(this.formRules).length) { validForm = true; } + return validForm; } @@ -569,7 +570,7 @@ export class ProjectCreate extends Component { data-for="reacttooltip" data-iscapture="true" data-tip="Priority of this project w.r.t. other projects. Projects can interrupt observations of lower-priority projects. Min-0.00, Max-6.00" - inputId="proj-rank" name="rank" data-testid="rank" id="proj-rank" + inputid="proj-rank" name="rank" data-testid="rank" id="proj-rank" className="p-inputtext p-component" value={this.state.project.rank} step="0.01" 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 c376cc051ed79dbd2b0ccc7604d7b1daec4032f7..cb5d1a1fe74cdbd351c95bd5d5c945180244c72e 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/edit.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/edit.js @@ -606,7 +606,7 @@ export class ProjectEdit extends Component { data-for="reacttooltip" data-iscapture="true" data-tip="Priority of this project w.r.t. other projects. Projects can interrupt observations of lower-priority projects. Min-0.00, Max-6.00" - inputId="proj-rank" name="rank" data-testid="proj-rank" id="proj-rank" + inputid="proj-rank" name="rank" data-testid="proj-rank" id="proj-rank" className="p-inputtext p-component" value={this.state.project.rank} step="0.01" diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.cycle.completion.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.cycle.completion.js index 3820203da41c9176186ee490131b57d16ccc3812..900eb91d6c6404a852b72f1db872bafa395bb94e 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.cycle.completion.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.cycle.completion.js @@ -66,12 +66,11 @@ class CycleCompletionLevel extends Component { label: 'Performed', borderColor: '#44a3ce', backgroundColor: '#44a3ce', - borderWidth: 2, barThickness: 50, // barPercentage: 0.3, data: _.map(this.state.reportData, 'performed'), borderColor: 'white', - borderWidth: 2, + borderWidth: 2 } ], }; diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/index.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/index.js index a0dd15636733c5d055a8066827fbadbfe94959eb..76602b79e0d3d7609297758f33e314960848d81d 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/index.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/index.js @@ -32,9 +32,6 @@ class ReportHome extends Component { <TabPanel header="Project"> <ProjectReportMain ></ProjectReportMain> </TabPanel> - <TabPanel header="Scheduling Unit"> - <h1>Scheduling Unit Report...</h1> - </TabPanel> </TabView> </React.Fragment> 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 f00f7a3c88a11d6d861db509d3ea1c8a47b34e24..a02a8f220eac0327e65292ba85b19eca1fd9a9a9 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 @@ -3,7 +3,7 @@ import { Link } from 'react-router-dom'; import moment from 'moment'; import _ from 'lodash'; import 'chart.js/auto'; -import { Bar ,CategoryScale,Chart} from 'react-chartjs-2'; +import { Bar } from 'react-chartjs-2'; import ProjectService from '../../services/project.service'; import ReportService from '../../services/report.service'; @@ -81,7 +81,7 @@ class ProjectReport extends Component { for (const reportSub of suStatsList) { if (reportSub.observed_duration) { reportSub.observingTime = (reportSub.observed_duration/timeFactor).toFixed(2); - if (reportSub.acceptance_status != 'failed'){ + if (reportSub.acceptance_status !== 'failed'){ totalSUBObsTime += reportSub.observed_duration; } reportSub.observingTimeInc = (totalSUBObsTime / timeFactor).toFixed(2); @@ -92,7 +92,7 @@ class ProjectReport extends Component { reportSub.processDuration = reportSub.observed_duration; if (reportSub.processDuration) { reportSub.processTime = (reportSub.processDuration/timeFactor).toFixed(2); - if (reportSub.acceptance_status != 'failed'){ + if (reportSub.acceptance_status !== 'failed'){ totalProcessTime += reportSub.processDuration; } reportSub.processTimeInc = (totalProcessTime / timeFactor).toFixed(2); @@ -100,7 +100,7 @@ class ProjectReport extends Component { reportSub.processTimeIncPercent = (totalProcessTime / projectProcessTime *100).toFixed(2); } reportSub.ingestDataSize = ((reportSub["ingested_data_size"] || 0)/dataSizeFactor).toFixed(2); - if (reportSub.acceptance_status != 'failed'){ + if (reportSub.acceptance_status !== 'failed'){ totalLTAStorage += reportSub["ingested_data_size"]; } reportSub.ingestDataIncPercent = (totalLTAStorage / projectLTAStorage * 100).toFixed(2); diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/project.report.main.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/project.report.main.js index 05a2882e732ace590f2146967ce208d317b2d911..0e512ff021ba0f739bc334b7a3916c02c4aef272 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/project.report.main.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/project.report.main.js @@ -141,8 +141,7 @@ class ProjectReportMain extends Component { async downloadPDF() { this.setState({isDownloading: true}); let reportDivs = document.getElementsByClassName('report-div'); - // Get the div heights of each project 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; @@ -229,10 +228,10 @@ class ProjectReportMain extends Component { const blob = new Blob([csvString], { type: "text/csv" }); // Add dummy link to click and download the created CSV - var a = document.createElement("a"); + let a = document.createElement("a"); document.body.appendChild(a); a.style = "display: none"; - var url = window.URL.createObjectURL(blob); + let url = window.URL.createObjectURL(blob); a.href = url; const reportPeriod = `${moment(this.state.reportPeriod[0]).format("DDMMMYYYY")}-${moment(this.state.reportPeriod[1]).format("DDMMMYYYY")}`; a.download = `Project_${reportPeriod}.csv`; diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Reservation/reservation.list.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Reservation/reservation.list.js index b19c79e75184b383d5dfed8d89018157dc8db90b..5f8043a6efc9f51ce957b34ee1f7961390465d2a 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Reservation/reservation.list.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Reservation/reservation.list.js @@ -615,7 +615,7 @@ export class ReservationList extends Component{ } } } - } else if (filter.id === 'Duration (Days HH:mm:ss)' && filter.value != '') { + } else if (filter.id === 'Duration (Days HH:mm:ss)' && filter.value !== '') { let columnDetails = _.find(this.state.columnMap, {displayName:filter.id}); const values = _.split(filter.value, ","); if ((values.length === 0) || (values[0] === '' || values[0] === '0') && (values[1] === '' || values[1] === '0')) { @@ -642,7 +642,6 @@ export class ReservationList extends Component{ let sortBy = state && state.sortBy?state.sortBy[0]:(sortByValue)?sortByValue:null; if (sortBy) { this.defaultSortColumn = sortBy; - //this.setState({defaultSortColumn: [sortBy]}); UtilService.localStore({ type: 'set', key: this.lsKeySortColumn ,value:sortBy}); let columnDetails = _.find(this.state.columnMap, {displayName:sortBy.id}); if(columnDetails) { 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 ea9e3e4f124d815fdbd51a2816164d07d9a9c184..608b0d7edb529f36a352407f81539dc2bd719df8 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js @@ -753,7 +753,7 @@ export class EditSchedulingUnit extends Component { data-for="reacttooltip" data-iscapture="true" data-tip="Priority of this scheduling unit w.r.t. other scheduling units within the same queue and project.. Min-0.0000, Max-1.0000" - inputId="proj-rank" name="rank" data-testid="rank" + inputid="proj-rank" name="rank" data-testid="rank" className="p-inputtext p-component p-filled" value={this.state.schedulingUnit.rank} step="0.0001" diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/helpers/week.view.helper.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/helpers/week.view.helper.js index 07fa8770e7b0e9fa096b90de632197baa6fbd1c8..4f5c4d292520f26c24675f6a0f493806bb3e550b 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/helpers/week.view.helper.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/helpers/week.view.helper.js @@ -129,13 +129,13 @@ export function getPageHeaderOptionsMenuItems(permissions) { //TODO factory meth { label: 'Add Reservation', icon: "fa fa-plus", - disabled: !permissions.weekView.addreservation, + disabled: permissions==null||permissions.weekView==null||!permissions.weekView.addreservation, command: () => window.open('/reservation/create', '_blank') }, { label: 'Reservation List', icon: "fa fa-bars", - disabled: !permissions.weekView.listreservation, + disabled: permissions==null||permissions.weekView==null||!permissions.weekView.listreservation, command: () => window.open('/reservation/list', '_blank') }, @@ -145,13 +145,13 @@ export function getPageHeaderOptionsMenuItems(permissions) { //TODO factory meth { label: 'System Issues', icon: "fa fa-bars", - disabled: !permissions.weekView.listsystemevent, + disabled: permissions==null||permissions.weekView==null||!permissions.weekView.listsystemevent, command: () => window.open('/systemevent/list', '_blank') }, { label: 'Add System Event', icon: "fa fa-plus", - disabled: !permissions.weekView.addsystemevent, + disabled: permissions==null||permissions.weekView==null||!permissions.weekView.addsystemevent, command: () => window.open('/systemevent/create', '_blank') }, @@ -161,7 +161,7 @@ export function getPageHeaderOptionsMenuItems(permissions) { //TODO factory meth { label: 'Add Scheduling Unit', icon: "fa fa-plus", - disabled: !permissions.schedulingUnit.create, + disabled: permissions==null||permissions.schedulingUnit==null||!permissions.schedulingUnit.create, command: () => window.open('/schedulingunit/create', '_blank') },