Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Branches page - show spinner while search is still ongoing #219

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class BranchesPage extends React.Component {
}}/>
</AltContainer>

<AltContainer stores={{ branchesStore: BranchesStore, branchTextUnitsStore: BranchTextUnitsStore}}>
<AltContainer stores={{ branchesSearchParamStore: BranchesSearchParamStore, branchesStore: BranchesStore, branchTextUnitsStore: BranchTextUnitsStore}}>
<BranchesSearchResults
onChangeSelectedBranchTextUnits={(selectedBranchTextUnitIds) => {
BranchesPageActions.changeSelectedBranchTextUnitIds(selectedBranchTextUnitIds);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import BranchesPageActions from "../../actions/branches/BranchesPageActions";
class BranchesSearchResults extends React.Component {

static propTypes = {
"branchesSearchParamStore": PropTypes.object.isRequired,
"branchesStore": PropTypes.object.isRequired,
"branchTextUnitsStore": PropTypes.object.isRequired,
"onChangeOpenBranchStatistic": PropTypes.func.isRequired,
Expand Down Expand Up @@ -63,7 +64,7 @@ class BranchesSearchResults extends React.Component {

renderGridHeader() {
return (
<Row className="bms" className="branches-branchstatistic-header">
<Row className="bms branches-branchstatistic-header">
<Col md={4} className="branches-branchstatistic-col1">
<FormattedMessage id="branches.header.branch"/>
</Col>
Expand Down Expand Up @@ -343,9 +344,15 @@ class BranchesSearchResults extends React.Component {
}

render() {
if (this.props.branchesSearchParamStore.isSpinnerShown) {
return <div class="branch-spinner mtl mbl">
<span className="glyphicon glyphicon-refresh spinning" />
</div>
}

return (
<div>
<div className="mll mrl" className="branches-branchstatistic">
<div className="mll mrl branches-branchstatistic">
<Grid fluid={true}>
{this.renderGridHeader()}
{this.props.branchesStore.branchStatistics.map(this.renderBranchStatistic.bind(this))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,22 @@ class ScreenshotsGrid extends React.Component {
</div>);
}

renderSpinner() {
return (
<div class="branch-spinner mtl mbl">
<span className="glyphicon glyphicon-refresh spinning" />
</div>
);
}

/**
* @return {JSX}
*/
render() {
var res;

if (this.props.searching) {
res = null;
res = this.renderSpinner();
} else if (this.props.screenshotsData.length > 0) {
res = this.renderWithResults();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,6 @@ let SearchResults = createReactClass({
}
}

return result;
},

/**
Expand All @@ -710,6 +709,13 @@ let SearchResults = createReactClass({
},

render() {
if (this.state.isSearching) {
return <div class="branch-spinner mtl mbl">
<span className="glyphicon glyphicon-refresh spinning" />
</div>
}


return (
<div onKeyUp={this.onKeyUpSearchResults} onClick={this.onChangeSearchResults}>
{this.getTextUnitToolbarUI()}
Expand Down
6 changes: 6 additions & 0 deletions webapp/src/main/resources/sass/mojito.scss
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,12 @@ label.current-pageNumber {
overflow-y: auto;
}

.branch-spinner {
display: flex;
justify-content: center;
align-items: center;
}

.textunit-toolbar-clear {
clear: both;
}
Expand Down
Loading