From d11fb7cc35cbda73cb01d7a51fa659e356d861ab Mon Sep 17 00:00:00 2001
From: NithyaSanthanam <nithya.s@matriotsolutions.com>
Date: Fri, 22 Oct 2021 19:34:33 +0530
Subject: [PATCH] TMSS-886: Updated column names and added Process time in task
 view

---
 .../tmss_webapp/src/components/ViewTable.js   |  2 +-
 .../routes/Scheduling/ViewSchedulingUnit.js   | 23 ++++++++++---------
 .../tmss_webapp/src/routes/Task/list.js       | 16 ++++++-------
 .../tmss_webapp/src/routes/Task/view.js       | 21 +++++++++++++----
 4 files changed, 37 insertions(+), 25 deletions(-)

diff --git a/SAS/TMSS/frontend/tmss_webapp/src/components/ViewTable.js b/SAS/TMSS/frontend/tmss_webapp/src/components/ViewTable.js
index a9bd822854a..f097978c05f 100644
--- a/SAS/TMSS/frontend/tmss_webapp/src/components/ViewTable.js
+++ b/SAS/TMSS/frontend/tmss_webapp/src/components/ViewTable.js
@@ -1158,7 +1158,7 @@ function dateFilterFn(rows, id, filterValue) {
   const filteredRows = _.filter(rows, function (row) {
     // If cell value is null or empty
     if (!row.values[id]) {
-      return false;
+      return true;
     }
     //Remove microsecond if value passed is UTC string in format "YYYY-MM-DDTHH:mm:ss.sssss"
     let rowValue = moment.utc(row.values[id].split('.')[0]);
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 45f48da3c61..28dd1e2bce4 100644
--- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/ViewSchedulingUnit.js
+++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/ViewSchedulingUnit.js
@@ -61,8 +61,8 @@ class ViewSchedulingUnit extends Component {
                 "Control ID",
                 "Name",
                 "Description",
-                "Start Time",
-                "End Time",
+                "Observation Start Time",
+                "Observation End Time",
                 "Process Start Time",
                 "Process End Time",
                 "Duration (HH:mm:ss)",
@@ -97,12 +97,12 @@ class ViewSchedulingUnit extends Component {
                 name: "Name",
                 description: "Description",
                 on_sky_start_time: {
-                    name: "Start Time",
+                    name: "Observation Start Time",
                     filter:"flatpickrDateRange",
                     format:UIConstants.CALENDAR_DATETIME_FORMAT
                 },
                 on_sky_stop_time: {
-                    name: "End Time",
+                    name: "Observation End Time",
                     filter:"flatpickrDateRange",
                     format:UIConstants.CALENDAR_DATETIME_FORMAT
                 },
@@ -155,8 +155,8 @@ class ViewSchedulingUnit extends Component {
                 "Cancelled": "filter-input-50",
                 "Duration (HH:mm:ss)": "filter-input-75",
                 "Template ID": "filter-input-50",
-                "Start Time":"filter-input-150",
-                "End Time":"filter-input-150",
+                "Observation Start Time":"filter-input-150",
+                "Observation End Time":"filter-input-150",
                 "Process Start Time":"filter-input-150",
                 "Process End Time":"filter-input-150",
                 // "BluePrint / Task Draft link": "filter-input-100",
@@ -392,7 +392,7 @@ class ViewSchedulingUnit extends Component {
     }
 
     async getFilterColumns(type) {
-        const columnOrderToRemove = type === 'blueprint' ?[] :['Status', 'Status Logs', 'Start Time', 'End Time', 'Process Start Time', 'Process End Time', 'Control ID','#Dataproducts', 'Data Size', 'Data Size on Disk', 'Subtask Content'];
+        const columnOrderToRemove = type === 'blueprint' ?[] :['Status', 'Status Logs', 'Observation Start Time', 'Observation End Time', 'Process Start Time', 'Process End Time', 'Control ID','#Dataproducts', 'Data Size', 'Data Size on Disk', 'Subtask Content'];
         const columnDefinitionToRemove = type === 'blueprint' ?['scheduling_unit_draft']:['scheduling_unit_blueprint', 'status', 'status_logs', 'on_sky_start_time', 'on_sky_stop_time', 'process_start_time', 'process_stop_time', 'subTaskID','noOfOutputProducts','size','dataSizeOnDisk','subtaskContent'];
         let tmpDefaulColumns = _.cloneDeep(this.state.defaultcolumns[0]);
         let tmpOptionalColumns = _.cloneDeep(this.state.optionalcolumns[0]);
@@ -1333,12 +1333,13 @@ class ViewSchedulingUnit extends Component {
                                 <label className="col-lg-2 col-md-2 col-sm-12">Updated At</label>
                                 <span className="col-lg-4 col-md-4 col-sm-12">{this.state.scheduleunit.created_at && moment(this.state.scheduleunit.updated_at, moment.ISO_8601).format(UIConstants.CALENDAR_DATETIME_FORMAT)}</span>
                             </div>
+                            {this.props.match.params.type === 'blueprint' &&
                             <div className="p-grid">
-                                <label className="col-lg-2 col-md-2 col-sm-12">Start Time</label>
+                                <label className="col-lg-2 col-md-2 col-sm-12">Observation Start Time</label>
                                 <span className="col-lg-4 col-md-4 col-sm-12">{this.state.scheduleunit.on_sky_start_time && moment(this.state.scheduleunit.on_sky_start_time).format(UIConstants.CALENDAR_DATETIME_FORMAT)}</span>
-                                <label className="col-lg-2 col-md-2 col-sm-12">End Time</label>
+                                <label className="col-lg-2 col-md-2 col-sm-12">Observation End Time</label>
                                 <span className="col-lg-4 col-md-4 col-sm-12">{this.state.scheduleunit.on_sky_stop_time && moment(this.state.scheduleunit.on_sky_stop_time).format(UIConstants.CALENDAR_DATETIME_FORMAT)}</span>
-                            </div>
+                            </div>}
                             <div className="p-grid">
                                 <label className="col-lg-2 col-md-2 col-sm-12" >Duration (HH:mm:ss)</label>
                                 <span className="col-lg-4 col-md-4 col-sm-12">{moment.utc((this.state.scheduleunit.duration ? this.state.scheduleunit.duration : 0) * 1000).format(UIConstants.CALENDAR_TIME_FORMAT)}</span>
@@ -1442,7 +1443,7 @@ class ViewSchedulingUnit extends Component {
                         </span>
                     </div>
                 </div>
-
+                {console.log(this.state.schedulingUnitTasks)}
                 {this.state.isLoading ? <AppLoader /> : (this.state.schedulingUnitTasks.length > 0) ?
                     <ViewTable
                         data={this.state.schedulingUnitTasks}
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 a97de1b647e..bbd138a3be6 100644
--- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Task/list.js
+++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Task/list.js
@@ -53,8 +53,8 @@ export class TaskList extends Component {
                 "Control ID",
                 "Name",
                 "Description",
-                "Start Time",
-                "End Time",
+                "Observation Start Time",
+                "Observation End Time",
                 "Process Start Time",
                 "Process End Time",
                 "Duration (HH:mm:ss)",
@@ -109,12 +109,12 @@ export class TaskList extends Component {
                     name:"Description"
                 },
                 on_sky_start_time: {
-                    name: "Start Time",
+                    name: "Observation Start Time",
                     filter: "flatpickrDateRange",
                     format: UIConstants.CALENDAR_DATETIME_FORMAT
                 },
                 on_sky_stop_time: {
-                    name: "End Time",
+                    name: "Observation End Time",
                     filter: "flatpickrDateRange",
                     format: UIConstants.CALENDAR_DATETIME_FORMAT
                 },
@@ -194,8 +194,8 @@ export class TaskList extends Component {
                 "Linked Draft ID": "filter-input-75",
                 "Relative Start Time (HH:mm:ss)": "filter-input-75",
                 "Relative End Time (HH:mm:ss)": "filter-input-75",
-                "Start Time": "filter-input-150",
-                "End Time": "filter-input-150",
+                "Observation Start Time": "filter-input-150",
+                "Observation End Time": "filter-input-150",
                 "Process Start Time": "filter-input-150",
                 "Process End Time": "filter-input-150",
                 "Status": "filter-input-125",
@@ -629,7 +629,7 @@ export class TaskList extends Component {
      */
     async getFilterColumns(type) {
         const taskFilters = await TaskService.getTaskFilterDefinition(type);
-        const columnOrderToRemove = this.state.taskType === 'Blueprint' ?[] :['Status', 'Status Logs', 'Start Time', 'End Time', 'Process Start Time', 'Process End Time', 'Control ID','#Dataproducts', 'Data Size', 'Data Size on Disk', 'Subtask Content'];
+        const columnOrderToRemove = this.state.taskType === 'Blueprint' ?[] :['Status', 'Status Logs', 'Observation Start Time', 'Observation End Time', 'Process Start Time', 'Process End Time', 'Control ID','#Dataproducts', 'Data Size', 'Data Size on Disk', 'Subtask Content'];
         const columnDefinitionToRemove = this.state.taskType === 'Blueprint' ?['scheduling_unit_draft']:['scheduling_unit_blueprint', 'status', 'status_logs', 'on_sky_start_time', 'on_sky_stop_time', 'process_start_time', 'process_stop_time','subTaskID','noOfOutputProducts','size','dataSizeOnDisk','subtaskContent'];
         this.columnMap = [];
         let tmpDefaulColumns = _.cloneDeep(this.state.defaultcolumns[0]);
@@ -798,7 +798,7 @@ export class TaskList extends Component {
         let filters = UtilService.localStore({ type: 'get', key: "su_task_list_"+this.state.taskType });
         if(filters.length > 0 ) {
             for( const filter of filters) {
-            if (filter.id === 'Start Time') {
+            if (filter.id === 'Observation Start Time') {
                 const values = filter.value;
                 if (values[0]) {
                     this.filterQry += 'on_sky_start_time_after='+ moment(new Date(values[0])).format("YYYY-MM-DDTHH:mm:ss")+".000Z&";
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 3cf15c2c262..9ea825cd069 100644
--- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Task/view.js
+++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Task/view.js
@@ -485,17 +485,28 @@ export class TaskView extends Component {
                                             <label className="col-lg-2 col-md-2 col-sm-12">Updated At</label>
                                             <span className="col-lg-4 col-md-4 col-sm-12">{moment.utc(this.state.task.updated_at).format(UIConstants.CALENDAR_DATETIME_FORMAT)}</span>
                                         </div>
+                                        {this.state.taskType === 'blueprint' && this.state.task.task_type === 'observation' &&
                                         <div className="p-grid">
-                                            <label className="col-lg-2 col-md-2 col-sm-12">Start Time</label>
+                                            <label className="col-lg-2 col-md-2 col-sm-12">Observation Start Time</label>
                                             <span className="col-lg-4 col-md-4 col-sm-12">{this.state.task.on_sky_start_time?moment(this.state.task.on_sky_start_time,moment.ISO_8601).format(UIConstants.CALENDAR_DATETIME_FORMAT):""}</span>
-                                            <label className="col-lg-2 col-md-2 col-sm-12">End Time</label>
+                                            <label className="col-lg-2 col-md-2 col-sm-12">Observation End Time</label>
                                             <span className="col-lg-4 col-md-4 col-sm-12">{this.state.task.on_sky_stop_time?moment(this.state.task.on_sky_stop_time,moment.ISO_8601).format(UIConstants.CALENDAR_DATETIME_FORMAT):""}</span>
-                                        </div>
+                                        </div>}
+                                        {this.state.taskType === 'blueprint' &&
+                                        <div className="p-grid">
+                                            <label className="col-lg-2 col-md-2 col-sm-12">Process Start Time</label>
+                                            <span className="col-lg-4 col-md-4 col-sm-12">{this.state.task.process_start_time?moment(this.state.task.on_sky_start_time,moment.ISO_8601).format(UIConstants.CALENDAR_DATETIME_FORMAT):""}</span>
+                                            <label className="col-lg-2 col-md-2 col-sm-12">Process End Time</label>
+                                            <span className="col-lg-4 col-md-4 col-sm-12">{this.state.task.process_stop_time?moment(this.state.task.on_sky_stop_time,moment.ISO_8601).format(UIConstants.CALENDAR_DATETIME_FORMAT):""}</span>
+                                        </div>}
                                         <div className="p-grid">
                                             {/* <label className="col-lg-2 col-md-2 col-sm-12">Tags</label>
                                             <Chips className="col-lg-4 col-md-4 col-sm-12 chips-readonly" disabled value={this.state.task.tags}></Chips> */}
-                                            <label className="col-lg-2 col-md-2 col-sm-12">Status</label>
-                                            <span className="col-lg-4 col-md-4 col-sm-12">{this.state.task.status}</span>
+                                            {this.state.taskType === 'blueprint' && 
+                                            <>
+                                                <label className="col-lg-2 col-md-2 col-sm-12">Status</label>
+                                                <span className="col-lg-4 col-md-4 col-sm-12">{this.state.task.status}</span>
+                                            </>}
                                             {this.state.schedulingUnit &&
                                             <>
                                                 <label className="col-lg-2 col-md-2 col-sm-12">Scheduling Unit</label>
-- 
GitLab