From f04d9b4c0ffe2dde71c2c37552678621d8f000ae Mon Sep 17 00:00:00 2001
From: Reinder Kraaij <kraaij@astron.nl>
Date: Fri, 19 Jan 2024 15:06:46 +0000
Subject: [PATCH] Resolve TMSS-2884 "Ui tweaks front end only"

---
 SAS/TMSS/frontend/tmss_webapp/package-lock.json        |  2 +-
 SAS/TMSS/frontend/tmss_webapp/package.json             |  2 +-
 .../tmss_webapp/src/components/ViewTable/ViewTable.js  |  6 +++---
 .../tmss_webapp/src/layout/sass/_timeline.scss         |  3 ++-
 .../tmss_webapp/src/layout/sass/_viewtable.scss        |  8 ++++++--
 .../src/routes/Reservation/reservation.list.js         |  9 +++++++--
 .../tmss_webapp/src/tests/reservation.list.test.js     | 10 +++++++++-
 7 files changed, 29 insertions(+), 11 deletions(-)

diff --git a/SAS/TMSS/frontend/tmss_webapp/package-lock.json b/SAS/TMSS/frontend/tmss_webapp/package-lock.json
index d2cbde2fa15..cdf8a683d77 100644
--- a/SAS/TMSS/frontend/tmss_webapp/package-lock.json
+++ b/SAS/TMSS/frontend/tmss_webapp/package-lock.json
@@ -1,6 +1,6 @@
 {
   "name": "tmss",
-  "version": "0.9.9",
+  "version": "1.0.0",
   "lockfileVersion": 3,
   "requires": true,
   "packages": {
diff --git a/SAS/TMSS/frontend/tmss_webapp/package.json b/SAS/TMSS/frontend/tmss_webapp/package.json
index 2a85980b790..05d58646b6b 100644
--- a/SAS/TMSS/frontend/tmss_webapp/package.json
+++ b/SAS/TMSS/frontend/tmss_webapp/package.json
@@ -1,6 +1,6 @@
 {
   "name": "tmss",
-  "version": "0.9.9",
+  "version": "1.0.0",
   "private": true,
   "dependencies": {
     "@ag-grid-community/all-modules": "^24.1.0",
diff --git a/SAS/TMSS/frontend/tmss_webapp/src/components/ViewTable/ViewTable.js b/SAS/TMSS/frontend/tmss_webapp/src/components/ViewTable/ViewTable.js
index d7411df43a7..037b21030c6 100644
--- a/SAS/TMSS/frontend/tmss_webapp/src/components/ViewTable/ViewTable.js
+++ b/SAS/TMSS/frontend/tmss_webapp/src/components/ViewTable/ViewTable.js
@@ -268,9 +268,9 @@ function SelectColumnFilter({
           preFilteredRows = preFilteredRows || rowData;
           setRowData(preFilteredRows);
           preFilteredRows.forEach(row => {
-            let value = String(row.values[id]);
-            if (!options.has(value)) {
-            options.add(value)
+            if(row.values[id]!==null && row.values[id]!==undefined) {
+              let value = String(row.values[id]);
+              options.add(value)
             }
           });
       }
diff --git a/SAS/TMSS/frontend/tmss_webapp/src/layout/sass/_timeline.scss b/SAS/TMSS/frontend/tmss_webapp/src/layout/sass/_timeline.scss
index 8e859ebc17b..8d75d894f08 100644
--- a/SAS/TMSS/frontend/tmss_webapp/src/layout/sass/_timeline.scss
+++ b/SAS/TMSS/frontend/tmss_webapp/src/layout/sass/_timeline.scss
@@ -119,7 +119,8 @@ $vh: 1vh;
   margin-top:5px;
   padding-right:5px;
   height: 30px;
-  width:230px;
+  width:240px;
+  text-wrap: nowrap;
   border-right: 1px solid var(--gray-200);
   border-left : 1px solid var(--gray-200);
   .dropdown-title {
diff --git a/SAS/TMSS/frontend/tmss_webapp/src/layout/sass/_viewtable.scss b/SAS/TMSS/frontend/tmss_webapp/src/layout/sass/_viewtable.scss
index c29e470cb40..37048f5cd9e 100644
--- a/SAS/TMSS/frontend/tmss_webapp/src/layout/sass/_viewtable.scss
+++ b/SAS/TMSS/frontend/tmss_webapp/src/layout/sass/_viewtable.scss
@@ -289,7 +289,11 @@ body .p-paginator {
 }
 
 
-.notfixed-column-td-Created, .notfixed-column-td-StartTime, .notfixed-column-td-EndTime {
+.notfixed-column-td-Created, .notfixed-column-td-StartTime, .notfixed-column-td-EndTime, .notfixed-column-td-StartDate, .notfixed-column-td-EndDate  {
   min-width: 237px;
-  
+  }
+
+.notfixed-column-td-CycleCode
+{
+  min-width: 200px;
 }
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 3a2a9c27909..d27f97ad2e8 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
@@ -239,6 +239,9 @@ export class ReservationList extends Component {
 
 
     prepareLoading = async () => {
+        if (this.cycleList.length==0) {
+            this.cycleList = await CycleService.getAllCycles();
+        }
         let setFromRedirection = await this.setFromRedirection();
 
         if (setFromRedirection) {
@@ -246,8 +249,10 @@ export class ReservationList extends Component {
             this.pageUpdated = true;
             return
         }
+
         this.setLocalFilters();
-        this.cycleList = await CycleService.getAllCycles();
+        
+        
     }
     /**
      * Set Top filters when the state changed or while init the page
@@ -722,7 +727,7 @@ export class ReservationList extends Component {
                 this.reservations.push(reservation);
             }
         }
-            this.cycleList.map(cycle => {
+            this.cycleList?.map(cycle => {
                 cycle['url'] = cycle.name;
             });
             this.pageUpdated = true;
diff --git a/SAS/TMSS/frontend/tmss_webapp/src/tests/reservation.list.test.js b/SAS/TMSS/frontend/tmss_webapp/src/tests/reservation.list.test.js
index 62350c42aa9..e18bd5a9455 100644
--- a/SAS/TMSS/frontend/tmss_webapp/src/tests/reservation.list.test.js
+++ b/SAS/TMSS/frontend/tmss_webapp/src/tests/reservation.list.test.js
@@ -2,7 +2,7 @@
 
 import axios from "axios";
 import MockAdapter from 'axios-mock-adapter';
-import { render, act } from '@testing-library/react';
+import { render, act, waitFor } from '@testing-library/react';
 import reservationList from '../__mocks__/reservation.list.json'
 import reservationListLimited from '../__mocks__/reservation.list.limit.json'
 
@@ -10,12 +10,14 @@ import { MockAxiosSecurity  } from './axiosmocks.'
 import { MemoryRouter } from "react-router-dom";
 import PermissionStackUtil from "../authenticate/permission.stack.handler";
 import { ReservationList } from "../routes/Reservation/reservation.list";
+import  cycles from "../__mocks__/cycle.json"
 
 
 function MakePrimaryMock() {
     let mock = new MockAdapter(axios);
     mock.onOptions("/api/reservation/").reply(200, reservationList);
     mock.onGet("/api/reservation/?limit=10&offset=0").reply(200, reservationListLimited);
+    mock.onGet("/api/cycle").reply(200, cycles);
     mock.onGet("/api/reservation/?ordering=name&limit=10&offset=0").reply(200, reservationListLimited);
     return mock
 }
@@ -35,6 +37,12 @@ describe('Reservation List ', () => {
     it('Reservation List  correctly with data', async () => {
         let {  component } = await RenderReservationist();
         const componentSnapshot = component.asFragment();
+       
+        await waitFor(() => {
+            const anchorElement = component.container.querySelector('.fa-search');
+            expect(anchorElement).toBeInTheDocument();
+          });
+
         expect(componentSnapshot).toMatchSnapshot();
         component.unmount();
 
-- 
GitLab