File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111 },
1212 "dependencies" : {
1313 "antd" : " 2.13.6" ,
14+ "axios" : " ^0.17.0" ,
1415 "babel-polyfill" : " ^6.26.0" ,
1516 "moment" : " ^2.19.1" ,
1617 "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 11import React from 'react' ;
2- import { Breadcrumb , Table } from 'antd' ;
2+ import { Breadcrumb , Table , notification } from 'antd' ;
3+ import CatalogApi from '../api/catalogApi' ;
34
45class CatalogListPage extends React . Component {
56
67 constructor ( props , context ) {
78 super ( props , context ) ;
89
10+ this . state = {
11+ catalogs : [ ]
12+ } ;
13+
914 this . columns = [
1015 {
1116 title : 'Catalog' ,
@@ -21,13 +26,20 @@ class CatalogListPage extends React.Component {
2126 }
2227
2328 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+ } ) ;
2539 }
2640
2741
2842 render ( ) {
29- const { catalogs } = this . props ;
30-
3143 return (
3244 < div >
3345 < Breadcrumb style = { { margin : '12px 0' } } >
@@ -36,7 +48,7 @@ class CatalogListPage extends React.Component {
3648
3749 < div style = { { background : '#fff' , padding : 24 , minHeight : 280 } } >
3850 < Table
39- dataSource = { catalogs }
51+ dataSource = { this . state . catalogs }
4052 columns = { this . columns }
4153 rowKey = "class"
4254 bordered
You can’t perform that action at this time.
0 commit comments