mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-17 18:51:10 +01:00
Added loading spinner to Changesets
This commit is contained in:
@@ -1,9 +1,10 @@
|
|||||||
import React from "react"
|
import React from "react"
|
||||||
import {connect} from "react-redux";
|
import {connect} from "react-redux";
|
||||||
|
import {Loading} from "@scm-manager/ui-components";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
fetchChangesetsByNamespaceAndName, fetchChangesetsByNamespaceNameAndBranch,
|
fetchChangesetsByNamespaceAndName, fetchChangesetsByNamespaceNameAndBranch,
|
||||||
getChangesets,
|
getChangesets, isFetchChangesetsPending,
|
||||||
} from "../modules/changesets";
|
} from "../modules/changesets";
|
||||||
import type { History } from "history";
|
import type { History } from "history";
|
||||||
import {fetchBranchesByNamespaceAndName, getBranchNames} from "../../repos/modules/branches";
|
import {fetchBranchesByNamespaceAndName, getBranchNames} from "../../repos/modules/branches";
|
||||||
@@ -39,10 +40,10 @@ class Changesets extends React.Component<State, Props> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {changesets, branchNames} = this.props;
|
const {changesets, branchNames, loading} = this.props;
|
||||||
const branch = this.props.match.params.branch;
|
const branch = this.props.match.params.branch;
|
||||||
if (changesets === null) {
|
if (loading || !changesets) {
|
||||||
return null
|
return <Loading />
|
||||||
}
|
}
|
||||||
if (branchNames) {
|
if (branchNames) {
|
||||||
return <div>
|
return <div>
|
||||||
@@ -65,7 +66,8 @@ class Changesets extends React.Component<State, Props> {
|
|||||||
const mapStateToProps = (state, ownProps: Props) => {
|
const mapStateToProps = (state, ownProps: Props) => {
|
||||||
const {namespace, name} = ownProps.repository;
|
const {namespace, name} = ownProps.repository;
|
||||||
return {
|
return {
|
||||||
changesets: getChangesets(namespace, name, ownProps.match.params.branch, state),
|
loading: isFetchChangesetsPending(namespace, name, state),
|
||||||
|
changesets: getChangesets(state, namespace, name, ownProps.match.params.branch),
|
||||||
branchNames: getBranchNames(namespace, name, state)
|
branchNames: getBranchNames(namespace, name, state)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user