/
App.js
93 lines (88 loc) · 2.41 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import React, { Component } from "react";
import N2O from "n2o-framework/lib/N2o";
import { authProvider } from "n2o-auth";
import createFactoryConfig from "n2o-framework/lib/core/factory/createFactoryConfig";
import functions from "n2o-framework/lib/utils/functions";
import Route from "n2o-framework/lib/components/core/Route";
import Page from "n2o-framework/lib/components/core/Page";
import DashboardV2 from "./pages/DashboardV2";
import Select from "./pages/Select";
import DataGrid from "./components/widgets/DataGrid/DataGrid";
import AvatarCell from "./components/cells/Avatar/AvatarCell";
import CollapsedCardFieldset from "./components/fieldset/CollapsedCard/CollapsedCardFieldset";
import { EcpButton } from "n2o-ecp-plugin";
const config = {
widgets: {
DataGrid: DataGrid
},
controls: {
InputText: () => (
<EcpButton
fileRequestService={{
url: "http://localhost:9000/sign/get",
type: "GET",
data: {
userId: 1
}
}}
fileSaveService={{
url: "http://localhost:9000/sign/set",
type: "POST",
data: {
userId: 1
}
}}
/>
)
},
cells: {
AvatarCell: AvatarCell
},
fieldsets: {
CollapsedCardFieldset: CollapsedCardFieldset
},
messages: {
timeout: {
error: 0,
success: 5000,
warning: 0,
info: 0
}
},
security: {
authProvider,
externalLoginUrl: "/"
},
evalContext: functions,
realTimeConfig: true,
embeddedRouting: true
};
class App extends Component {
render() {
return (
<N2O {...createFactoryConfig(config)}>
{/* 1 полный кастом */}
<Route path="/custom/v1" exact component={DashboardV2} />
{/* 2 обертка, без метаданных */}
<Route
path="/custom/v2"
exact
render={routeProps => {
return <Page {...routeProps} page={Select} rootPage />;
}}
/>
{/* 3 обертка, метаданные */}
<Route
path="/custom/v3"
exact
render={routeProps => (
<Page {...routeProps} page={Select} needMetadata rootPage />
)}
/>
{/* 5 */}
{/*<Route path="custom/:id" component={Page} render={Page} page={"DefaultPage" || "MyPage"} needMetadata={true || false} />*/}
</N2O>
);
}
}
export default App;