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 0000000000000000000000000000000000000000..f36ccd799e7ac500a687b1d8417713fb53b3c4f6 --- /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 0000000000000000000000000000000000000000..356d6d89fe33b739d40c50f3fac83fab1a049959 --- /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