update global cluster_id
This commit is contained in:
parent
338d0bd4d9
commit
28d1abc0ca
|
@ -71,6 +71,7 @@ export default {
|
|||
type: 'saveData',
|
||||
payload:{
|
||||
selectedCluster: data[0],
|
||||
selectedClusterID: (data[0] || {}).id
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -14,7 +14,8 @@ export default {
|
|||
},
|
||||
|
||||
effects: {
|
||||
*fetchList({ payload }, { call, put }) {
|
||||
*fetchList({ payload }, { call, put , select }) {
|
||||
payload.cluster_id = yield select(state => state.global.selectedClusterID);
|
||||
const res = yield call(getTemplateList, payload);
|
||||
console.log("fetchList response:",res);
|
||||
if (res.hits) {
|
||||
|
@ -39,7 +40,8 @@ export default {
|
|||
message.warning(res.msg);
|
||||
}
|
||||
},
|
||||
*add({ payload, callback }, { call, put }) {
|
||||
*add({ payload, callback }, { call, put , select }) {
|
||||
payload.cluster_id =yield select(state => state.global.selectedClusterID);
|
||||
const res = yield call(addTemplate, payload);
|
||||
console.log("add res:",res);
|
||||
//业务数据格式化处理
|
||||
|
@ -59,7 +61,8 @@ export default {
|
|||
|
||||
if (callback) callback();
|
||||
},
|
||||
*update({ payload, callback }, { call, put }) {
|
||||
*update({ payload, callback }, { call, put , select }) {
|
||||
payload.cluster_id = yield select(state => state.global.selectedClusterID);
|
||||
const res = yield call(updateTemplate, payload);
|
||||
console.log("update res:",res);
|
||||
//业务数据格式化处理
|
||||
|
@ -69,7 +72,9 @@ export default {
|
|||
|
||||
if (callback) callback();
|
||||
},
|
||||
*delete({ payload, callback }, { call, put }) {
|
||||
*delete({ payload, callback }, { call, put, select }) {
|
||||
// payload.cluster_id =yield select(state => state.global.selectedClusterID);
|
||||
payload.cluster_id = yield select(state => state.global.selectedClusterID);
|
||||
const payloadNew = {...payload};
|
||||
if (Array.isArray(payload.id)) {
|
||||
payloadNew.id = payload.id.toString();
|
||||
|
|
|
@ -108,8 +108,8 @@ const UpdateForm = Form.create()(props => {
|
|||
loading: loading.effects['searchTemplate/fetchList'],
|
||||
list:searchTemplate.list,
|
||||
pagination: searchTemplate.pagination,
|
||||
clusterID:global.selectedCluster.id,
|
||||
}))
|
||||
|
||||
@Form.create()
|
||||
class SearchTemplate extends PureComponent {
|
||||
state = {
|
||||
|
@ -156,8 +156,8 @@ class SearchTemplate extends PureComponent {
|
|||
|
||||
//获取基本数据列表
|
||||
handleGetListData = () => {
|
||||
const {dispatch,clusterID} = this.props;
|
||||
let payload = {size: 10, from: 0,cluster_id:clusterID};
|
||||
const {dispatch} = this.props;
|
||||
let payload = {size: 10, from: 0};
|
||||
if (this.state.formValues.name) {
|
||||
payload.name = this.state.formValues.name;
|
||||
}
|
||||
|
@ -202,14 +202,13 @@ class SearchTemplate extends PureComponent {
|
|||
};
|
||||
|
||||
handleDeleteClick = e => {
|
||||
const { dispatch,clusterID } = this.props;
|
||||
const { dispatch} = this.props;
|
||||
const { selectedRows } = this.state;
|
||||
|
||||
if (!selectedRows) return message.warn("请选择需要删除的行");
|
||||
dispatch({
|
||||
type: 'searchTemplate/delete',
|
||||
payload: {
|
||||
cluster_id: clusterID,
|
||||
id: selectedRows.map(row => row.id),
|
||||
},
|
||||
callback: () => {
|
||||
|
@ -264,11 +263,10 @@ class SearchTemplate extends PureComponent {
|
|||
};
|
||||
|
||||
handleAdd = fields => {
|
||||
const { dispatch,clusterID } = this.props;
|
||||
const { dispatch} = this.props;
|
||||
dispatch({
|
||||
type: 'searchTemplate/add',
|
||||
payload: {
|
||||
cluster_id: clusterID,
|
||||
name: fields.name,
|
||||
source: fields.source,
|
||||
},
|
||||
|
@ -279,11 +277,10 @@ class SearchTemplate extends PureComponent {
|
|||
};
|
||||
|
||||
handleUpdate = fields => {
|
||||
const { dispatch,clusterID } = this.props;
|
||||
const { dispatch} = this.props;
|
||||
dispatch({
|
||||
type: 'searchTemplate/update',
|
||||
payload: {
|
||||
cluster_id: clusterID,
|
||||
id: fields.id,
|
||||
name: fields.name,
|
||||
source: fields.source,
|
||||
|
|
Loading…
Reference in New Issue