From a69b7fd3f09e1673157e79a2b5a13732376d0ac4 Mon Sep 17 00:00:00 2001
From: Reinder Kraaij <kraaij@astron.nl>
Date: Fri, 24 Nov 2023 12:00:23 +0100
Subject: [PATCH] Add Exterl URls Calls

---
 .../tmss_webapp/src/utils/externalurls.js     | 29 +++++++++++++++++++
 .../src/utils/externalurls.test.js            | 16 ++++++++++
 2 files changed, 45 insertions(+)
 create mode 100644 SAS/TMSS/frontend/tmss_webapp/src/utils/externalurls.js
 create mode 100644 SAS/TMSS/frontend/tmss_webapp/src/utils/externalurls.test.js

diff --git a/SAS/TMSS/frontend/tmss_webapp/src/utils/externalurls.js b/SAS/TMSS/frontend/tmss_webapp/src/utils/externalurls.js
new file mode 100644
index 00000000000..f36ccd799e7
--- /dev/null
+++ b/SAS/TMSS/frontend/tmss_webapp/src/utils/externalurls.js
@@ -0,0 +1,29 @@
+const ExternalUrlsUtils = {
+
+
+
+      BaseLofarMonitorUrl : "https://proxy.lofar.eu/lofmonitor/station_overview?station=",
+
+        /**
+     * Function to give back a scheduling constraint url
+     * @param {string} Station - The Station
+     * @param {string} schedulingUnit - the Unit we are looking at
+     * @param {string} onDate - 2023-02-14 formatedf formated of the date
+     * @returns string  with the url
+     */
+    getUserRolePermissionForStationAndSchedulingUnitOnDate(station,schedulingUnit,onDate) {
+        return  "/api/scheduling_unit_blueprint/" + schedulingUnit + "/scheduling_constraints_plot/" + station + "/" + onDate
+    },
+    
+    /**
+     * Function to give back the Lofar Monitoring Url
+     * @param {string} Station - The Station
+     * @returns string  with the url
+     */
+
+    getLofarMontitorUrlForStation(station) {
+        return this.BaseLofarMonitorUrl + station 
+    }
+};
+
+export default ExternalUrlsUtils;
\ No newline at end of file
diff --git a/SAS/TMSS/frontend/tmss_webapp/src/utils/externalurls.test.js b/SAS/TMSS/frontend/tmss_webapp/src/utils/externalurls.test.js
new file mode 100644
index 00000000000..356d6d89fe3
--- /dev/null
+++ b/SAS/TMSS/frontend/tmss_webapp/src/utils/externalurls.test.js
@@ -0,0 +1,16 @@
+import externalUrls from "./externalurls";
+
+describe('getLofarMontitorUrlForStation', () => {
+    it('should return the correct url', () => {
+        const subbandString = externalUrls.getLofarMontitorUrlForStation("CS002")
+        expect(subbandString).toEqual("https://proxy.lofar.eu/lofmonitor/station_overview?station=CS002")
+    })
+});
+
+describe('getUserRolePermissionForStationAndSchedulingUnitOnDate', () => {
+    it('should return the correct url', () => {
+        const subbandString = externalUrls.getUserRolePermissionForStationAndSchedulingUnitOnDate("CS003", 21, "1976-08-06")
+        expect(subbandString).toEqual("/api/scheduling_unit_blueprint/21/scheduling_constraints_plot/CS003/1976-08-06")
+
+    })
+});
\ No newline at end of file
-- 
GitLab