From 2e60b6bf9e32e4f76036b1deb1461f94702955d2 Mon Sep 17 00:00:00 2001
From: Nico Vermaas <vermaas@astron.nl>
Date: Thu, 21 Jul 2022 14:33:40 +0200
Subject: [PATCH] fixed the background surveys by adding named surveys (also a
 change in esap-api)

---
 package.json                                  |  2 +-
 src/components/LoadingSpinner.js              |  9 ++++++++
 src/components/StaticConfig.js                |  8 +++----
 .../pages/skyViews/AladinSkyView.js           | 22 +++++++++++--------
 .../pages/skyViews/SkyViewController.js       |  2 +-
 src/contexts/GlobalContext.js                 |  2 +-
 src/contexts/UIContext.js                     |  2 +-
 src/views/page/QueryResultsTable.js           |  6 +++--
 8 files changed, 34 insertions(+), 19 deletions(-)
 create mode 100644 src/components/LoadingSpinner.js

diff --git a/package.json b/package.json
index e9c4edc..011363d 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "adex-gui",
-  "version": "0.5.0",
+  "version": "0.5.0 - 21 jul 2022",
   "private": true,
   "dependencies": {
     "@fortawesome/fontawesome-svg-core": "^1.2.36",
diff --git a/src/components/LoadingSpinner.js b/src/components/LoadingSpinner.js
new file mode 100644
index 0000000..1fa8f0f
--- /dev/null
+++ b/src/components/LoadingSpinner.js
@@ -0,0 +1,9 @@
+import React from 'react';
+
+const LoadingSpinner = () => (
+  <div>
+    <i className="fa fa-spinner fa-spin" /> Fetching data...
+  </div>
+);
+
+export default LoadingSpinner;
diff --git a/src/components/StaticConfig.js b/src/components/StaticConfig.js
index 9bd2366..b4e0c51 100644
--- a/src/components/StaticConfig.js
+++ b/src/components/StaticConfig.js
@@ -14,16 +14,16 @@ import {MultiRow} from "../models/menuOptions/MultiRow";
 // configuration for SkyView plugin
 
 export const SkyViewHeader = new Header("SkyView", undefined, "Query", "Show selection(s) in the skyview. It refreshes the data and performs a new query", "search");
-export const Survey = new Dropdown("Survey", "the background surveys that are created by ASTRON", "h4", "right");
+export const Survey = new Dropdown("Survey", "Background HiPS survey.", "h4", "right");
 export const ColorMap = new Dropdown("Color Map", "Change the color scheme of the background survey", "h4");
 export const AladinConfig = new MultiRow("Sky settings", undefined, [Survey, ColorMap])
 export const Ra = new InputField("RA", undefined, typeStylingDict.number);
 export const Dec = new InputField("Dec", undefined, typeStylingDict.number);
 export const FoV = new InputField("FoV", undefined, typeStylingDict.number);
-export const Coordinates = new MultiRow("Coordinates", "In degrees", [Ra, Dec, FoV])
+export const Coordinates = new MultiRow("Coordinates", "In decimal degrees", [Ra, Dec, FoV])
 export const FrequencySlider = new RangeSlider("Frequency", "In megahertz (MHz)")
-export const CalibrationLevel = new Checkbox("Calibration Level", "The calibration level gives information if any calibration models have been applied.")
-export const DataProductType = new Checkbox("DataProduct Type", "The way the data has been processed or stored and in what dimensions.");
+export const CalibrationLevel = new Checkbox("Calibration Level", "Level of calibration and processing. Raw (0), Calibrated (1) or Processed (2).")
+export const DataProductType = new Checkbox("DataProduct Type", "Like images, cubes, (radio) visibilities or time domain data");
 export const ArchiveSelection = new Checkbox("Archives", "Go to the archive page to find out more about our archives/telescopes.");
 export const Collection = new Checkbox("Collections", "The group to which the data belongs too.")
 
diff --git a/src/components/pages/skyViews/AladinSkyView.js b/src/components/pages/skyViews/AladinSkyView.js
index 0ac38b9..af3ac6a 100644
--- a/src/components/pages/skyViews/AladinSkyView.js
+++ b/src/components/pages/skyViews/AladinSkyView.js
@@ -19,7 +19,7 @@ const AladinSkyView = (props) => {
 
             const aladinWindowConfig = {
                 showFrame: false,
-                showLayersControl: false,
+                showLayersControl: true,
                 showGotoControl: false,
                 showZoomControl: false,
                 reticleColor: '#00adee',
@@ -27,6 +27,7 @@ const AladinSkyView = (props) => {
             };
             let aladin = window.A.aladin('#aladin-lite-div', aladinWindowConfig)
             aladin.setImageSurvey(skyView.selectedSurvey)
+
             aladin.getBaseImageLayer().getColorMap().update(skyView.selectedColorMap);
 
             aladin.gotoRaDec(skyView.ra, skyView.dec)
@@ -36,14 +37,17 @@ const AladinSkyView = (props) => {
 
             if (skyView.surveys) {
                 skyView.surveys.forEach((survey_config) => {
-                    aladin.createImageSurvey(
-                        survey_config['hips_name'],
-                        survey_config['hips_name'],
-                        survey_config['hips_url'],
-                        "equatorial",
-                        13,
-                        {imgFormat: survey_config['format']}
-                    )
+                    // only create survey layers for hips files
+                    if (survey_config['hips_name']) {
+                        aladin.createImageSurvey(
+                            survey_config['hips_name'],
+                            survey_config['hips_name'],
+                            survey_config['hips_url'],
+                            "equatorial",
+                            13,
+                            {imgFormat: survey_config['format']}
+                        )
+                    }
                 });
             }
 
diff --git a/src/components/pages/skyViews/SkyViewController.js b/src/components/pages/skyViews/SkyViewController.js
index 5514df5..7bf6478 100644
--- a/src/components/pages/skyViews/SkyViewController.js
+++ b/src/components/pages/skyViews/SkyViewController.js
@@ -87,7 +87,7 @@ export function SkyViewController() {
             {"function": getGroupedSetterFunction(setSkyView, 'refreshAladin'), "value": skyView.refreshAladin}]);
     }
 
-    const surveyNames = skyView.surveys.map(survey => survey.hips_name);
+    const surveyNames = skyView.surveys.map(survey => survey.name);
     Survey.bindDropdown(getGroupedSetterFunction(setSkyView, 'selectedSurvey'), surveyNames, skyView.selectedSurvey);
     ColorMap.bindDropdown(getGroupedSetterFunction(setSkyView, 'selectedColorMap'), skyView.colorMaps, skyView.selectedColorMap);
     Ra.bindInputField(getGroupedSetterFunction(setSkyView, 'ra'), skyView.ra);
diff --git a/src/contexts/GlobalContext.js b/src/contexts/GlobalContext.js
index bd8d63d..8092322 100644
--- a/src/contexts/GlobalContext.js
+++ b/src/contexts/GlobalContext.js
@@ -43,7 +43,7 @@ export function GlobalContextProvider({ children }) {
 
     const api_host =
     process.env.NODE_ENV === "development"
-      //? "http://localhost:5555/esap-api/"
+      //  "http://localhost:5555/esap-api/"
       ? "https://sdc-dev.astron.nl:5557/esap-api/"
       : "https://sdc-dev.astron.nl:5557/esap-api/";
 
diff --git a/src/contexts/UIContext.js b/src/contexts/UIContext.js
index c8bd1aa..0488e4c 100644
--- a/src/contexts/UIContext.js
+++ b/src/contexts/UIContext.js
@@ -21,7 +21,7 @@ export function UIContextProvider({children}) {
         colorMaps: [],
         datasets: [],
         selectedDatasets: [],
-        selectedSurvey: undefined,
+        selectedSurvey: "P/DSS2/color",
         selectedColorMap: undefined,
         archives: [],
         selectedArchives: [],
diff --git a/src/views/page/QueryResultsTable.js b/src/views/page/QueryResultsTable.js
index 2ed4844..51d0021 100644
--- a/src/views/page/QueryResultsTable.js
+++ b/src/views/page/QueryResultsTable.js
@@ -1,5 +1,6 @@
 import React, {useContext} from "react";
-import Spinner from "../basics/Spinner";
+//import Spinner from "../basics/Spinner";
+import LoadingSpinner from '../../components/LoadingSpinner';
 import Bar from "../basics/Bar";
 import {SkyViewContext} from "../../contexts/SkyViewContext";
 import Icon from "../basics/Icon";
@@ -89,7 +90,8 @@ export default function QueryResultsTable(props) {
     }
 
     if (isLoading) {
-        return <Spinner message={"Loading Query"} size={"h3"}/>;
+        return <LoadingSpinner/>
+        //return <Spinner message={"Loading Query"} size={"h3"}/>;
     }
 
     if (data.length === 0) {
-- 
GitLab