index.ts 4.0 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',
28
    x2paddle = 'x2paddle',
29
    HighDimensional = 'high-dimensional',
P
Peter Pan 已提交
30
    PRCurve = 'pr-curve',
P
Peter Pan 已提交
31
    ROCCurve = 'roc-curve',
R
RotPublic 已提交
32
    Profiler = 'profiler',
R
RotPublic 已提交
33 34 35
    HyperParameter = 'hyper-parameter',
    fastdeploy_server = 'fastdeploy_server',
    fastdeploy_client = 'fastdeploy_client'
36 37 38 39 40 41 42
}

export interface Route {
    id: Pages | string;
    default?: boolean;
    visible?: boolean;
    path?: string;
R
RotPublic 已提交
43 44
    // component?: LazyExoticComponent<FunctionComponent>;
    component?: any;
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 71 72
    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 已提交
73 74 75 76 77
            },
            {
                id: Pages.Text,
                path: '/sample/text',
                component: React.lazy(() => import('~/pages/sample/text'))
78 79 80 81 82
            }
        ]
    },
    {
        id: Pages.Graph,
R
RotPublic 已提交
83 84
        children: [
            {
R
RotPublic 已提交
85 86
                id: 'dynamic_graph',
                path: '/graph/dynamic_graph',
R
RotPublic 已提交
87 88 89
                component: React.lazy(() => import('~/pages/graphDynamic'))
            },
            {
R
RotPublic 已提交
90 91
                id: 'static_graph',
                path: '/graph/static_graph',
R
RotPublic 已提交
92 93 94
                component: React.lazy(() => import('~/pages/graphStatic'))
            }
        ]
95
    },
R
RotPublic 已提交
96
    {
97
        id: Pages.x2paddle,
R
RotPublic 已提交
98 99 100
        path: '/x2paddle',
        component: React.lazy(() => import('~/pages/x2paddle'))
    },
101 102 103 104 105 106 107 108 109 110
    {
        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 已提交
111 112 113 114 115
    {
        id: Pages.Profiler,
        path: '/profiler',
        component: React.lazy(() => import('~/pages/profiler'))
    },
116 117 118 119 120 121 122 123
    {
        id: Pages.HighDimensional,
        path: '/high-dimensional',
        component: React.lazy(() => import('~/pages/high-dimensional'))
    },
    {
        id: Pages.PRCurve,
        path: '/pr-curve',
P
Peter Pan 已提交
124 125 126 127 128 129
        component: React.lazy(() => import('~/pages/curves/pr'))
    },
    {
        id: Pages.ROCCurve,
        path: '/roc-curve',
        component: React.lazy(() => import('~/pages/curves/roc'))
R
RotPublic 已提交
130 131 132 133 134 135 136 137 138 139
    },
    {
        id: Pages.fastdeploy_server,
        path: '/fastdeploy_server',
        component: React.lazy(() => import('~/pages/Fastdeploy'))
    },
    {
        id: Pages.fastdeploy_client,
        path: '/fastdeploy_client',
        component: React.lazy(() => import('~/pages/FastdeployClient'))
140 141 142 143
    }
];

export default routes;