Skip to content

Commit

Permalink
Fix things
Browse files Browse the repository at this point in the history
- Change statusTime to startTime in table
- Handle _replicatorDB not found
- Fix replication reducer
- Fix polling refresh
  • Loading branch information
popojargo committed Jun 13, 2020
1 parent 4753053 commit a35a657
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
3 changes: 2 additions & 1 deletion app/addons/replication/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,8 @@ export const fetchReplicationDocs = ({docsPerPage, page}) => {
const url = Helpers.getServerUrl('/_replicator/_find');
const docsPromise = post(url, mangoPayload)
.then((res) => {
return parseReplicationDocs(res.docs);
const docs = res.error ? [] : res.docs;
return parseReplicationDocs(docs);
});

if (!newApi) {
Expand Down
4 changes: 2 additions & 2 deletions app/addons/replication/components/common-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,9 @@ export class ReplicationTable extends React.Component {
Target
<span className={`replication__table-header-icon ${this.iconDirection('target')} ${this.isSelected('target')}`} />
</th>
<th className="replication__table-header-time" onClick={this.onSort('statusTime')}>
<th className="replication__table-header-time" onClick={this.onSort('startTime')}>
Start Time
<span className={`replication__table-header-icon ${this.iconDirection('statusTime')} ${this.isSelected('statusTime')}`} />
<span className={`replication__table-header-icon ${this.iconDirection('startTime')} ${this.isSelected('startTime')}`} />
</th>
<th className="replication__table-header-type" onClick={this.onSort('continuous')}>
Type
Expand Down
13 changes: 11 additions & 2 deletions app/addons/replication/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ const {LoadLines, Polling, RefreshBtn} = Components;

export default class ReplicationController extends React.Component {

constructor(props) {
super(props);
this.onRefresh = this.onRefresh.bind(this);
}

loadReplicationInfo (props, oldProps) {
this.props.initReplicator(props.routeLocalSource, props.localSource);
this.getAllActivity(props.pagination);
Expand All @@ -42,6 +47,10 @@ export default class ReplicationController extends React.Component {
this.props.getReplicateActivity();
}

onRefresh() {
this.getAllActivity(this.props.pagination);
}

componentDidMount () {
this.props.checkForNewApi();
this.props.getDatabasesList();
Expand Down Expand Up @@ -173,10 +182,10 @@ export default class ReplicationController extends React.Component {
max={600}
startValue={300}
stepSize={60}
onPoll={this.getAllActivity.bind(this, this.props.pagination)}
onPoll={this.onRefresh}
/>
<RefreshBtn
refresh={this.getAllActivity.bind(this, this.props.pagination)}
refresh={this.onRefresh}
/>
</div>
);
Expand Down
2 changes: 2 additions & 0 deletions app/addons/replication/reducers.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ const replication = (state = initialState, {type, options}) => {
return {
...state,
pagination: {
...state.pagination,
docsPerPage: state.pagination.docsPerPage,
page: state.pagination.page + 1
}
Expand All @@ -398,6 +399,7 @@ const replication = (state = initialState, {type, options}) => {
return {
...state,
pagination: {
...state.pagination,
docsPerPage: state.pagination.docsPerPage,
page: state.pagination.page - 1
}
Expand Down

0 comments on commit a35a657

Please sign in to comment.