routes.ts 2.76 KB
Newer Older
1
import Loadable from 'utilities/CustomReactLoadable';
2

3
4
import steps from 'datasets/ui/dashboard/dataset-stepper/steps';

Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
5
import {ROLE_ADMINISTRATOR, ROLE_VETTEDUSER} from 'constants/userRoles';
6
7
8
9

const publicRoutes = [
  {
    path: '/datasets/suggest',
10
11
12
    component: Loadable({
      loader: () => import(/* webpackMode:"lazy", webpackChunkName: "datasets" */'datasets/ui/search/SuggestionsPage'),
    }),
13
14
15
16
17
18
    exact: true,
    extraProps: {
      title: 'datasets.common.modelName_plural',
      subtitle: 'datasets.common.subtitle',
    },
  },
19
20
21
22
23
24
25
  {
    path: '/datasets/overview/:filterCode(v.+)?',
    component: Loadable({
      loader: () => import(/* webpackMode:"lazy", webpackChunkName: "datasets" */'datasets/ui/OverviewPage'),
    }),
    exact: true,
  },
26
27
  {
    path: '/datasets/:filterCode(v.+)?',
28
29
30
    component: Loadable({
      loader: () => import(/* webpackMode:"lazy", webpackChunkName: "datasets" */'datasets/ui/BrowsePage'),
    }),
31
32
33
34
35
36
37
38
    exact: true,
    extraProps: {
      title: 'datasets.common.modelName_plural',
      subtitle: 'datasets.common.subtitle',
    },
  },
  {
    path: '/datasets/:uuid([a-z\\-0-9]+)',
39
40
41
    component: Loadable({
      loader: () => import(/* webpackMode:"lazy", webpackChunkName: "datasets" */'datasets/ui/DisplayPage'),
    }),
42
43
44
45
46
47
48
49
50
51
52
53
    exact: true,
    extraProps: {
      title: 'datasets.common.modelName_plural',
      subtitle: 'datasets.common.subtitle',
    },
  },
];

const dashboardRoutes = [

  {
    path: '/datasets/:filterCode(v.+)?',
54
55
56
    component: Loadable({
      loader: () => import(/* webpackMode:"lazy", webpackChunkName: "datasets" */'datasets/ui/dashboard/DashboardPage'),
    }),
57
    exact: true,
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
58
    auth: [ROLE_VETTEDUSER, ROLE_ADMINISTRATOR],
59
60
61
62
63
64
    extraProps: {
      title: 'My Dashboard',
    },
  },
  {
    path: '/datasets/edit',
65
66
67
    component: Loadable({
      loader: () => import(/* webpackMode:"lazy", webpackChunkName: "datasets" */'datasets/ui/dashboard/StepperPage'),
    }),
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
68
    auth: [ROLE_VETTEDUSER, ROLE_ADMINISTRATOR],
69
70
71
72
73
74
    extraProps: {
      title: 'datasets.dashboard.p.stepper.publisher',
    },
    routes: [
      {
        path: '/',
75
76
77
        component: Loadable({
          loader: () => import(/* webpackMode:"lazy", webpackChunkName: "datasets" */'datasets/ui/dashboard/dataset-stepper/steps/basic-info'),
        }),
78
79
80
81
82
83
        exact: true,
      },
    ],
  },
  {
    path: '/datasets/:uuid([a-z\\-0-9]+)/',
84
85
86
    component: Loadable({
      loader: () => import(/* webpackMode:"lazy", webpackChunkName: "datasets" */'datasets/ui/dashboard/StepperPage'),
    }),
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
87
    auth: [ROLE_VETTEDUSER, ROLE_ADMINISTRATOR],
88
89
90
91
    extraProps: {
      title: 'datasets.dashboard.p.stepper.publisher',
    },
    routes: [
92
      ...steps,
93
94
95
96
97
98
    ],
  },
];


export { publicRoutes as datasetPublicRoutes, dashboardRoutes as datasetDashboardRoutes };