Browse Source

部分action命名调整

zhuth 7 years ago
parent
commit
563093822c

+ 1 - 1
app/components/datasource/dataConnectBox.jsx

@@ -18,7 +18,7 @@ const DataConnectBox = ({operation, dispatch, dataConnect, visibleBox, hideBox,
 
     const okHandler = () => {
         if(operation == 'create') {
-            dispatch({ type: 'dataConnect/fetchAdd' });
+            dispatch({ type: 'dataConnect/remoteAdd' });
         }else if(operation == 'modify') {
             dispatch({ type: 'dataConnect/modify' });
         }

+ 2 - 2
app/components/datasource/datasource.jsx

@@ -229,7 +229,7 @@ class DataSource extends React.Component {
                     <div className='operation'><Divider type="vertical" /></div>
                     <div className='operation' onClick={() => {
                         let selectedModel = dataConnect.list.find((i) => { return i.code == record.code });
-                        dispatch({ type: 'dataConnect/fetchDelete', model: selectedModel });
+                        dispatch({ type: 'dataConnect/remoteDelete', model: selectedModel });
                     }}><Icon type="delete"/>删除</div>
                 </div>
             ),
@@ -244,7 +244,7 @@ class DataSource extends React.Component {
                 tabBarExtraContent={
                     <div className='datasource-tabs-tools'>
                         <Button onClick={()=>{
-                            dispatch({type: activeTab=='dataConnect'?'dataConnect/fetchList':'dataSource/testData'});
+                            dispatch({type: activeTab=='dataConnect'?'dataConnect/remoteList':'dataSource/testData'});
                         }}>测试数据</Button>
                         <Search
                             placeholder="请输入关键字"

+ 5 - 5
app/models/dataConnect.js

@@ -77,7 +77,7 @@ export default {
         }
     },
     effects: {
-        *fetchList(action, { select, call, put, takeEvery, takeLatest }) {
+        *remoteList(action, { select, call, put, takeEvery, takeLatest }) {
             try {
                 const res = yield call(service.fetch, {
                     url: URLS.DATACONNECT_LIST,
@@ -104,7 +104,7 @@ export default {
                 //yield takeLatest({ type: 'loadList', data: [] });
             }
         },
-        *fetchAdd(action, { select, call, put, takeEvery, takeLatest }) {
+        *remoteAdd(action, { select, call, put, takeEvery, takeLatest }) {
             const dataConnect = yield select(state => state.present.dataConnect);
             const model = dataConnect.newOne;
             try {
@@ -128,11 +128,11 @@ export default {
                 //yield takeLatest({ type: 'loadList', data: [] });
             }
         },
-        *fetchDelete(action, { select, call, put, takeEvery, takeLatest }) {
+        *remoteDelete(action, { select, call, put, takeEvery, takeLatest }) {
             const model = action.model;
             try {
                 const res = yield call(service.fetch, {
-                    url: URLS.DATACONNECT_ADD,
+                    url: URLS.DATACONNECT_DELETE,
                     body: {
                     }
                 });
@@ -147,7 +147,7 @@ export default {
         setup({ dispatch, history }) {
             return history.listen(({ pathname, query }) => {
                 if (pathname.startsWith('/datasource')) {
-                    dispatch({ type: 'fetchList' })
+                    dispatch({ type: 'remoteList' })
                 }
             })
         }

+ 5 - 4
app/models/dataSource.js

@@ -101,7 +101,7 @@ export default {
         }
     },
     effects: {
-        *fetchList(action, { select, call, put, takeEvery, takeLatest }) {
+        *remoteList(action, { select, call, put, takeEvery, takeLatest }) {
             try {
                 const res = yield call(service.fetch, {
                     url: URLS.DATASOURCE_LIST,
@@ -111,8 +111,9 @@ export default {
                     // r.dbConfig = JSON.parse(r.dbConfig);
                     return {
                         key: i,
+                        code: r.dataId,
                         name: r.dataName,
-                        type: r.type || 'unknown',
+                        type: r.type || 'database',
                         dbType: 'oracle',
                         creator: r.createBy,
                         createTime: new Date(r.createDate),
@@ -178,8 +179,8 @@ export default {
     subscriptions: {
         setup({ dispatch, history }) {
             return history.listen(({ pathname, query }) => {
-                if (pathname.startsWith('/datasource')) {
-                    dispatch({ type: 'fetchList' })
+                if(pathname.startsWith('/datasource')) {
+                    dispatch({ type: 'remoteList' })
                 }
             })
         }

+ 2 - 2
app/routes/mainLayout.js

@@ -19,8 +19,8 @@ const MainLayout = (history) => {
             <Content className='main-content'>
                 <Switch>
                     <Route exact path='/' component={Welcome}/>
-                    <Route exact path='/datasource' component={DataSource}/>
-                    <Route path='/datasource/:type/:code' component={DataSourceDetail}/>
+                    <Route exact sensitive path='/datasource' component={DataSource}/>
+                    <Route sensitive path='/datasource/:type/:code' component={DataSourceDetail}/>
                 </Switch>
             </Content>
         </Layout>

+ 1 - 1
app/routes/router.js

@@ -11,7 +11,7 @@ function RouterConfig({ history }) {
     <LocaleProvider locale={zhCN}>
       <Router history={history}>
         <Switch>
-          <Route path='/chartdesigner' component={ChartDesigner}/>
+          <Route sensitive path='/chartdesigner' component={ChartDesigner}/>
           <Route path='/' component={MainLayout}/>
         </Switch>
       </Router>