File tree Expand file tree Collapse file tree 4 files changed +58
-5
lines changed Expand file tree Collapse file tree 4 files changed +58
-5
lines changed Original file line number Diff line number Diff line change 11
11
},
12
12
"dependencies" : {
13
13
"antd" : " 2.13.6" ,
14
+ "axios" : " ^0.17.0" ,
14
15
"babel-polyfill" : " ^6.26.0" ,
15
16
"moment" : " ^2.19.1" ,
16
17
"prop-types" : " ^15.6.0" ,
Original file line number Diff line number Diff line change
1
+ import axios from 'axios' ;
2
+ import { server } from "./config" ;
3
+
4
+ class CatalogApi {
5
+
6
+ static getAllCatalogs ( ) {
7
+ return axios (
8
+ {
9
+ method : 'get' ,
10
+ url : `${ server } /form/info` ,
11
+ params : {
12
+ size : 5000
13
+ }
14
+ }
15
+ ) ;
16
+ }
17
+
18
+ static getCatalogInfo ( catalogClass ) {
19
+ return axios . get ( `${ server } /form/info/${ catalogClass } ` ) ;
20
+ }
21
+
22
+ static getCatalogExtent ( catalogClass ) {
23
+ return axios . get ( `${ server } /form/objects/${ catalogClass } /info?size=500` ) ;
24
+ }
25
+
26
+ static getCatalogExtendWithClass ( catalogClass ) {
27
+ return axios . get ( `${ server } /form/objects/${ catalogClass } /infoclass?size=500&orderby=name` ) ;
28
+ }
29
+
30
+ static getFormObjectById ( catalogClass , id ) {
31
+ return axios . get ( `${ server } /form/object/${ catalogClass } /${ id } ` ) ;
32
+ }
33
+
34
+ static saveCatalog ( catalogClass , id , catalog ) {
35
+ return axios . put ( `${ server } /form/object/${ catalogClass } /${ id } ` , catalog ) ;
36
+ }
37
+ }
38
+
39
+ export default CatalogApi ;
Original file line number Diff line number Diff line change
1
+ export const server = 'http://localhost:57773/sah/rest' ;
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
- import { Breadcrumb , Table } from 'antd' ;
2
+ import { Breadcrumb , Table , notification } from 'antd' ;
3
+ import CatalogApi from '../api/catalogApi' ;
3
4
4
5
class CatalogListPage extends React . Component {
5
6
6
7
constructor ( props , context ) {
7
8
super ( props , context ) ;
8
9
10
+ this . state = {
11
+ catalogs : [ ]
12
+ } ;
13
+
9
14
this . columns = [
10
15
{
11
16
title : 'Catalog' ,
@@ -21,13 +26,20 @@ class CatalogListPage extends React.Component {
21
26
}
22
27
23
28
componentDidMount ( ) {
24
- this . setState ( { catalog : [ ] } ) ;
29
+ CatalogApi . getAllCatalogs ( )
30
+ . then ( ( catalogs ) => {
31
+ this . setState ( { catalogs : catalogs . data } ) ;
32
+ } )
33
+ . catch ( ( err ) => {
34
+ notification . error ( {
35
+ message : 'Unable to load Catalog list' ,
36
+ description : err . summary || '' ,
37
+ } ) ;
38
+ } ) ;
25
39
}
26
40
27
41
28
42
render ( ) {
29
- const { catalogs } = this . props ;
30
-
31
43
return (
32
44
< div >
33
45
< Breadcrumb style = { { margin : '12px 0' } } >
@@ -36,7 +48,7 @@ class CatalogListPage extends React.Component {
36
48
37
49
< div style = { { background : '#fff' , padding : 24 , minHeight : 280 } } >
38
50
< Table
39
- dataSource = { catalogs }
51
+ dataSource = { this . state . catalogs }
40
52
columns = { this . columns }
41
53
rowKey = "class"
42
54
bordered
You can’t perform that action at this time.
0 commit comments