Skip to content
Snippets Groups Projects
Select Git revision
  • b716fbb34bae66438fb6a336ab7156760eb8b948
  • MCCS-163 default
  • main
  • sar-277-update-docs-with-examples-for-lrc
  • st-946-automate
  • sar_302-log-fix
  • sar-287_subarray_commands_to_lrc
  • sar_302-POC_await_sub_device_state
  • sat_302_fix_pipelines
  • sar-286_lrc_one_subarry_command
  • sar-286_lrc_improvements
  • sar-288-async-controller
  • sar-276-combine-tango-queue
  • sar-255_remove_nexus_reference
  • sar-275-add-LRC
  • sar-273-add-lrc-attributes
  • sar-272
  • sp-1106-marvin-1230525148-ska-tango-base
  • sp-1106-marvin-813091765-ska-tango-base
  • sar-255/Publish-package-to-CAR
  • mccs-661-device-under-test-fixture
  • mccs-659-pep257-docstring-linting
  • 0.11.3
  • 0.11.2
  • 0.11.1
  • 0.11.0
  • 0.10.1
  • 0.10.0
  • 0.9.1
  • 0.9.0
  • 0.8.1
  • 0.8.0
  • 0.7.2
  • 0.7.1
  • 0.7.0
  • 0.6.6
  • 0.6.5
  • 0.6.4
  • 0.6.3
  • 0.6.2
  • 0.6.1
  • 0.6.0
42 results

CentralLogger.py

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    Main.js 3.07 KiB
    import React, {useState, useEffect }  from 'react';
    import '../App.css';
    
    import { get_backend_url } from '../utils/web'
    import { useGlobalReducer } from '../Store';
    import { useFetchArchives } from '../hooks/useFetchArchives';
    import { useFetchDataSets } from '../hooks/useFetchDataSets';
    
    import { NavigationBar } from './NavigationBar';
    import ArchivesPage from '../routes/archives/ArchivesPage';
    import DataSetsPage from '../routes/datasets/DataSetsPage';
    import TelescopesPage from '../routes/telescopes/TelescopesPage';
    import ArchiveDetails from '../routes/details/ArchiveDetails';
    import QueryPage from '../routes/query/QueryPage';
    
    import { About } from './About';
    
    import {
        BrowserRouter as Router,
        Switch,
        Route,
        useParams
    } from "react-router-dom";
    
    
    // This site has multiple pages, all of which are rendered
    // dynamically in the browser (not server rendered).
    //
    // Although the page does not ever refresh, notice how
    // React Router keeps the URL up to date as you navigate
    // through the site. This preserves the browser history,
    // making sure things like the back button and bookmarks
    // work properly.
    
    function Main () {
    
        // use global state
        const [ my_state , my_dispatch] = useGlobalReducer()
    
        // note that the resource 'archives-uri' is fetched instead of the more (human friendly) 'archives'
        useFetchArchives(get_backend_url("/esap-api/archives-uri"),{onMount:true})
        //useFetchDataSets(get_backend_url("/esap-api/datasets-uri"),{onMount:true})
    
        return (
            // basename defines which path is is added before the routing urls.
            <Router basename="esap-gui">
                <div>
                    <NavigationBar/>
    
                    {/*
                     A <Switch> looks through all its children <Route>
                     elements and renders the first one whose path
                     matches the current URL. Use a <Switch> any time
                     you have multiple routes, but you want only one
                     of them to render at a time
                     */}
    
                    <Switch>
                        <Route exact path="/">
                            <QueryPage />
                        </Route>
    
                        <Route path="/telescopes">
                            <TelescopesPage />
                        </Route>
    
                        <Route path="/archives">
                            <ArchivesPage />
                        </Route>
    
                        <Route path="/datasets">
                            <DataSetsPage />
                        </Route>
    
                        <Route path="/query">
                            <QueryPage />
                        </Route>
    
                        <Route path="/about">
                            <About />
                        </Route>
    
                        <Route path="/archive/:uri" children={<DetailsForward />} />
                    </Switch>
                </div>
    
                <footer><small>ASTRON - version 0.5.1 - 28 feb 2020</small></footer>
            </Router>
        );
    }
    
    // reroute to dataproduct details
    function DetailsForward() {
        let { uri } = useParams();
    
        return (
            <ArchiveDetails uri={uri}/>
        );
    }
    
    export default Main;