Make app.navigate accept options
Option {replace: true} is used now in app.navigate to replace existing history record with the new route. Implements blueprint react-router Change-Id: I8f8fc62073194d45e2c35368e613d8e24fcf24b4
This commit is contained in:
parent
c2b3ffdaad
commit
e17a428545
@ -243,8 +243,8 @@ class App {
|
||||
this.page = this.rootComponent.setPage(Page, options);
|
||||
}
|
||||
|
||||
navigate(url, options) {
|
||||
return this.router.navigate(url.replace(/^\//, '#'), options);
|
||||
navigate(url, {replace} = {replace: false}) {
|
||||
return this.router.navigate(url.replace(/^\//, '#'), {trigger: true, replace: !!replace});
|
||||
}
|
||||
|
||||
logout() {
|
||||
|
@ -62,7 +62,7 @@ export var unsavedChangesMixin = {
|
||||
applyChanges: this.applyChanges,
|
||||
revertChanges: this.revertChanges
|
||||
}).then(() => {
|
||||
app.navigate(href, {trigger: true});
|
||||
app.navigate(href);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ HistoryTab = React.createClass({
|
||||
if (!transactionId || !_.includes(subtabs, transactionId)) {
|
||||
app.navigate(
|
||||
'/cluster/' + cluster.id + '/history' + (defaultSubtab ? '/' + defaultSubtab : ''),
|
||||
{trigger: true, replace: true}
|
||||
{replace: true}
|
||||
);
|
||||
}
|
||||
return {activeTransactionId: transactionId || null};
|
||||
@ -70,7 +70,7 @@ HistoryTab = React.createClass({
|
||||
() => {
|
||||
app.navigate(
|
||||
'/cluster/' + this.props.cluster.id + '/history',
|
||||
{trigger: true, replace: true}
|
||||
{replace: true}
|
||||
);
|
||||
}
|
||||
);
|
||||
@ -83,7 +83,7 @@ HistoryTab = React.createClass({
|
||||
if (_.isNull(this.props.activeTransactionId) && transaction) {
|
||||
app.navigate(
|
||||
'/cluster/' + cluster.id + '/history/' + transaction.id,
|
||||
{trigger: true, replace: true}
|
||||
{replace: true}
|
||||
);
|
||||
}
|
||||
if (this.props.activeTransactionId !== activeTransactionId) {
|
||||
|
@ -92,7 +92,7 @@ var LogsTab = React.createClass({
|
||||
_.extend({}, this.props.selectedLogs) : _.omit(this.props.selectedLogs, 'node');
|
||||
logOptions.level = logOptions.level.toLowerCase();
|
||||
app.navigate('/cluster/' + this.props.cluster.id + '/logs/' +
|
||||
utils.serializeTabOptions(logOptions), {trigger: false, replace: true});
|
||||
utils.serializeTabOptions(logOptions), {replace: true});
|
||||
params = params || {};
|
||||
this.fetchLogs(params)
|
||||
.then((data) => {
|
||||
|
@ -532,10 +532,7 @@ var NetworkTab = React.createClass({
|
||||
|
||||
// check if current subroute is valid
|
||||
if (!subroute || !_.includes(subtabs, subroute)) {
|
||||
app.navigate(
|
||||
'/cluster/' + cluster.id + '/network/' + subtabs[0],
|
||||
{trigger: true, replace: true}
|
||||
);
|
||||
app.navigate('/cluster/' + cluster.id + '/network/' + subtabs[0], {replace: true});
|
||||
}
|
||||
return {activeNetworkSectionName: subroute, showAllNetworks};
|
||||
}
|
||||
@ -890,8 +887,7 @@ var NetworkTab = React.createClass({
|
||||
this.updateInitialConfiguration();
|
||||
var defaultSubtab = this.constructor.getSubtabs(this.props)[0];
|
||||
app.navigate(
|
||||
'/cluster/' + this.props.cluster.id + '/network/' + defaultSubtab,
|
||||
{trigger: true, replace: true}
|
||||
'/cluster/' + this.props.cluster.id + '/network/' + defaultSubtab, {replace: true}
|
||||
);
|
||||
});
|
||||
});
|
||||
@ -927,7 +923,7 @@ var NetworkTab = React.createClass({
|
||||
if (!this.props.showAllNetworks) {
|
||||
app.navigate(
|
||||
'/cluster/' + this.props.cluster.id + '/network/group/' + newNodeNetworkGroupId,
|
||||
{trigger: true, replace: true}
|
||||
{replace: true}
|
||||
);
|
||||
}
|
||||
});
|
||||
@ -940,10 +936,7 @@ var NetworkTab = React.createClass({
|
||||
:
|
||||
this.props.cluster.get('nodeNetworkGroups').find({is_default: true}).id
|
||||
);
|
||||
app.navigate(
|
||||
navigationUrl,
|
||||
{trigger: true, replace: true}
|
||||
);
|
||||
app.navigate(navigationUrl, {replace: true});
|
||||
},
|
||||
render() {
|
||||
var isLocked = this.isLocked();
|
||||
|
@ -69,7 +69,7 @@ var NodesTab = React.createClass({
|
||||
},
|
||||
checkScreenExists(screen) {
|
||||
if (!this.getScreenConstructor(screen || this.state.screen)) {
|
||||
app.navigate('/cluster/' + this.props.cluster.id + '/nodes', {trigger: true, replace: true});
|
||||
app.navigate('/cluster/' + this.props.cluster.id + '/nodes', {replace: true});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -88,10 +88,7 @@ var NodesTab = React.createClass({
|
||||
});
|
||||
},
|
||||
() => {
|
||||
app.navigate(
|
||||
'/cluster/' + this.props.cluster.id + '/nodes',
|
||||
{trigger: true, replace: true}
|
||||
);
|
||||
app.navigate('/cluster/' + this.props.cluster.id + '/nodes', {replace: true});
|
||||
}
|
||||
);
|
||||
},
|
||||
|
@ -722,7 +722,7 @@ ManagementPanel = React.createClass({
|
||||
changeScreen(url, passNodeIds) {
|
||||
url = url ? '/' + url : '';
|
||||
if (passNodeIds) url += '/' + utils.serializeTabOptions({nodes: this.props.nodes.map('id')});
|
||||
app.navigate('/cluster/' + this.props.cluster.id + '/nodes' + url, {trigger: true});
|
||||
app.navigate('/cluster/' + this.props.cluster.id + '/nodes' + url);
|
||||
},
|
||||
goToConfigurationScreen(action, conflict) {
|
||||
if (conflict) {
|
||||
|
@ -61,10 +61,7 @@ var SettingsTab = React.createClass({
|
||||
if (activeTab === 'settings') {
|
||||
var subroute = tabOptions[0];
|
||||
if (!subroute || !_.includes(subtabs, subroute)) {
|
||||
app.navigate(
|
||||
'/cluster/' + cluster.id + '/settings/' + subtabs[0],
|
||||
{trigger: true, replace: true}
|
||||
);
|
||||
app.navigate('/cluster/' + cluster.id + '/settings/' + subtabs[0], {replace: true});
|
||||
}
|
||||
return {activeSettingsSectionName: subroute};
|
||||
}
|
||||
|
@ -861,7 +861,7 @@ export var RemoveClusterDialog = React.createClass({
|
||||
() => {
|
||||
this.close();
|
||||
dispatcher.trigger('updateNodeStats updateNotifications');
|
||||
app.navigate('/clusters', {trigger: true});
|
||||
app.navigate('/clusters');
|
||||
},
|
||||
this.showError
|
||||
);
|
||||
@ -1037,11 +1037,14 @@ export var ShowNodeInfoDialog = React.createClass({
|
||||
},
|
||||
goToConfigurationScreen(url) {
|
||||
this.close();
|
||||
app.navigate(
|
||||
'/cluster/' + this.props.node.get('cluster') + '/nodes/' + url + '/' +
|
||||
utils.serializeTabOptions({nodes: this.props.node.id}),
|
||||
{trigger: true}
|
||||
);
|
||||
app.navigate([
|
||||
'/cluster/',
|
||||
this.props.node.get('cluster'),
|
||||
'/nodes/',
|
||||
url,
|
||||
'/',
|
||||
utils.serializeTabOptions({nodes: this.props.node.id})
|
||||
].join(''));
|
||||
},
|
||||
showSummary(group) {
|
||||
var meta = this.props.node.get('meta');
|
||||
|
@ -84,7 +84,7 @@ var LoginForm = React.createClass({
|
||||
nextUrl = app.router.returnUrl;
|
||||
delete app.router.returnUrl;
|
||||
}
|
||||
app.navigate(nextUrl, {trigger: true});
|
||||
app.navigate(nextUrl);
|
||||
});
|
||||
},
|
||||
componentDidMount() {
|
||||
|
@ -40,7 +40,7 @@ var WelcomePage = React.createClass({
|
||||
});
|
||||
this.saveSettings(this.getStatisticsSettingsToSave())
|
||||
.then(
|
||||
() => app.navigate('/', {trigger: true}),
|
||||
() => app.navigate('/'),
|
||||
(response) => {
|
||||
this.setState({actionInProgress: false});
|
||||
utils.showErrorDialog({response});
|
||||
|
@ -693,7 +693,7 @@ var CreateClusterWizard = React.createClass({
|
||||
() => {
|
||||
this.props.clusters.add(cluster);
|
||||
this.close();
|
||||
app.navigate('/cluster/' + this.cluster.id, {trigger: true});
|
||||
app.navigate('/cluster/' + this.cluster.id);
|
||||
},
|
||||
(response) => {
|
||||
this.stopHandlingKeys = false;
|
||||
|
Loading…
Reference in New Issue
Block a user