Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
static.console-fe.src.pages.ServiceManagement.SubscriberList.SubscriberList.js Maven / Gradle / Ivy
/*
* Copyright 1999-2018 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import PropTypes from 'prop-types';
import {
Button,
Field,
Form,
Grid,
Input,
Loading,
Pagination,
Table,
Dialog,
Message,
ConfigProvider,
} from '@alifd/next';
import { connect } from 'react-redux';
import { getSubscribers, removeSubscribers } from '../../../reducers/subscribers';
import { request } from '../../../globalLib';
import RegionGroup from '../../../components/RegionGroup';
import './SubscriberList.scss';
const FormItem = Form.Item;
const { Row, Col } = Grid;
const { Column } = Table;
@connect(state => ({ subscriberData: state.subscribers }), { getSubscribers, removeSubscribers })
@ConfigProvider.config
class SubscriberList extends React.Component {
static displayName = 'SubscriberList';
static propTypes = {
locale: PropTypes.object,
getSubscribers: PropTypes.func,
removeSubscribers: PropTypes.func,
subscriberData: PropTypes.object,
};
constructor(props) {
super(props);
this.state = {
loading: false,
total: 0,
pageSize: 10,
pageNo: 1,
search: {
serviceName: '',
groupName: '',
},
};
this.field = new Field(this);
}
openLoading() {
this.setState({ loading: true });
}
closeLoading() {
this.setState({ loading: false });
}
querySubscriberList() {
const { searchServiceNamePrompt } = this.props.locale;
const { search, pageSize, pageNo, nowNamespaceId = '' } = this.state;
if (!search.serviceName) {
Message.error(searchServiceNamePrompt);
return;
}
this.props.getSubscribers({
...search,
pageSize,
pageNo,
namespaceId: nowNamespaceId,
});
}
switchNamespace = () => {
this.setState({ search: { serviceName: '', groupName: '' } });
this.props.removeSubscribers();
};
setNowNameSpace = (nowNamespaceName, nowNamespaceId) =>
this.setState({
nowNamespaceName,
nowNamespaceId,
});
render() {
const { locale = {}, subscriberData = {} } = this.props;
const { count = 0, subscribers = [] } = subscriberData;
const {
pubNoData,
subscriberList,
serviceName,
serviceNamePlaceholder,
groupName,
groupNamePlaceholder,
query,
} = locale;
const { search, nowNamespaceName, nowNamespaceId } = this.state;
const { init, getValue } = this.field;
this.init = init;
this.getValue = getValue;
return (
{subscriberList}
|
{nowNamespaceName}
{nowNamespaceId}
{count > this.state.pageSize && (
this.setState({ pageNo }, () => this.querySubscriberList())}
/>
)}
);
}
}
export default SubscriberList;