index.ts 3.6 KB
Newer Older
P
Peter Pan 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
/**
 * Copyright 2020 Baidu Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

P
Peter Pan 已提交
17 18 19
import type {FunctionComponent, LazyExoticComponent} from 'react';

import React from 'react';
20 21 22 23 24 25

export enum Pages {
    Scalar = 'scalar',
    Histogram = 'histogram',
    Image = 'image',
    Audio = 'audio',
P
Peter Pan 已提交
26
    Text = 'text',
27
    Graph = 'graph',
R
RotPublic 已提交
28
    ToggleGraph = 'ToggleGraph',
29
    HighDimensional = 'high-dimensional',
P
Peter Pan 已提交
30
    PRCurve = 'pr-curve',
P
Peter Pan 已提交
31
    ROCCurve = 'roc-curve',
R
RotPublic 已提交
32
    Profiler = 'profiler',
P
Peter Pan 已提交
33
    HyperParameter = 'hyper-parameter'
34 35 36 37 38 39 40
}

export interface Route {
    id: Pages | string;
    default?: boolean;
    visible?: boolean;
    path?: string;
R
RotPublic 已提交
41 42
    // component?: LazyExoticComponent<FunctionComponent>;
    component?: any;
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
    children?: Pick<Route, 'id' | 'path' | 'component'>[];
}

const routes: Route[] = [
    {
        id: 'index',
        default: true,
        visible: false,
        path: '/index',
        component: React.lazy(() => import('~/pages/index'))
    },
    {
        id: Pages.Scalar,
        path: '/scalar',
        component: React.lazy(() => import('~/pages/scalar'))
    },
    {
        id: 'sample',
        children: [
            {
                id: Pages.Image,
                path: '/sample/image',
                component: React.lazy(() => import('~/pages/sample/image'))
            },
            {
                id: Pages.Audio,
                path: '/sample/audio',
                component: React.lazy(() => import('~/pages/sample/audio'))
P
Peter Pan 已提交
71 72 73 74 75
            },
            {
                id: Pages.Text,
                path: '/sample/text',
                component: React.lazy(() => import('~/pages/sample/text'))
76 77 78 79 80
            }
        ]
    },
    {
        id: Pages.Graph,
R
RotPublic 已提交
81 82 83 84 85 86 87 88 89 90 91 92
        children: [
            {
                id: 'graphDynamic',
                path: '/graphDynamic',
                component: React.lazy(() => import('~/pages/graphDynamic'))
            },
            {
                id: 'graphStatic',
                path: '/graphStatic',
                component: React.lazy(() => import('~/pages/graphStatic'))
            }
        ]
93
    },
R
RotPublic 已提交
94 95 96 97 98
    {
        id: Pages.ToggleGraph,
        path: '/x2paddle',
        component: React.lazy(() => import('~/pages/x2paddle'))
    },
99 100 101 102 103 104 105 106 107 108
    {
        id: Pages.Histogram,
        path: '/histogram',
        component: React.lazy(() => import('~/pages/histogram'))
    },
    {
        id: Pages.HyperParameter,
        path: '/hyper-parameter',
        component: React.lazy(() => import('~/pages/hyper-parameter'))
    },
R
RotPublic 已提交
109 110 111 112 113
    {
        id: Pages.Profiler,
        path: '/profiler',
        component: React.lazy(() => import('~/pages/profiler'))
    },
114 115 116 117 118 119 120 121
    {
        id: Pages.HighDimensional,
        path: '/high-dimensional',
        component: React.lazy(() => import('~/pages/high-dimensional'))
    },
    {
        id: Pages.PRCurve,
        path: '/pr-curve',
P
Peter Pan 已提交
122 123 124 125 126 127
        component: React.lazy(() => import('~/pages/curves/pr'))
    },
    {
        id: Pages.ROCCurve,
        path: '/roc-curve',
        component: React.lazy(() => import('~/pages/curves/roc'))
128 129 130 131
    }
];

export default routes;