|
@@ -3,35 +3,44 @@ import isEqual from 'lodash/isEqual';
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
|
import {Client} from 'app/api';
|
|
|
+import {Organization, ProcessingIssue} from 'app/types';
|
|
|
import {fetchProcessingIssues} from 'app/actionCreators/processingIssues';
|
|
|
import ProcessingIssueHint from 'app/components/stream/processingIssueHint';
|
|
|
import SentryTypes from 'app/sentryTypes';
|
|
|
|
|
|
-class ProcessingIssueList extends React.Component {
|
|
|
+const defaultProps = {
|
|
|
+ showProject: false,
|
|
|
+};
|
|
|
+
|
|
|
+type Props = {
|
|
|
+ organization: Organization;
|
|
|
+ projectIds: string[];
|
|
|
+} & typeof defaultProps;
|
|
|
+
|
|
|
+type State = {
|
|
|
+ issues: ProcessingIssue[];
|
|
|
+ loading: boolean;
|
|
|
+};
|
|
|
+
|
|
|
+class ProcessingIssueList extends React.Component<Props, State> {
|
|
|
static propTypes = {
|
|
|
organization: SentryTypes.Organization.isRequired,
|
|
|
projectIds: PropTypes.array,
|
|
|
showProject: PropTypes.bool,
|
|
|
};
|
|
|
|
|
|
- static defaultProps = {
|
|
|
- showProject: false,
|
|
|
- };
|
|
|
+ static defaultProps = defaultProps;
|
|
|
|
|
|
- constructor(props) {
|
|
|
- super(props);
|
|
|
- this.api = new Client();
|
|
|
- this.state = {
|
|
|
- loading: true,
|
|
|
- issues: [],
|
|
|
- };
|
|
|
- }
|
|
|
+ state: State = {
|
|
|
+ loading: true,
|
|
|
+ issues: [],
|
|
|
+ };
|
|
|
|
|
|
componentDidMount() {
|
|
|
this.fetchIssues();
|
|
|
}
|
|
|
|
|
|
- componentDidUpdate(prevProps) {
|
|
|
+ componentDidUpdate(prevProps: Props) {
|
|
|
if (!isEqual(prevProps.projectIds, this.props.projectIds)) {
|
|
|
this.fetchIssues();
|
|
|
}
|
|
@@ -41,12 +50,14 @@ class ProcessingIssueList extends React.Component {
|
|
|
this.api.clear();
|
|
|
}
|
|
|
|
|
|
+ api = new Client();
|
|
|
+
|
|
|
fetchIssues() {
|
|
|
const {organization, projectIds} = this.props;
|
|
|
const promise = fetchProcessingIssues(this.api, organization.slug, projectIds);
|
|
|
|
|
|
promise.then(
|
|
|
- data => {
|
|
|
+ (data: ProcessingIssue[]) => {
|
|
|
const hasIssues = data.some(
|
|
|
p => p.hasIssues || p.resolveableIssues > 0 || p.issuesProcessing > 0
|
|
|
);
|