|
@@ -1,6 +1,5 @@
|
|
|
import Reflux from 'reflux';
|
|
|
|
|
|
-import NavigationActions from 'sentry/actions/navigationActions';
|
|
|
import OrganizationActions from 'sentry/actions/organizationActions';
|
|
|
import OrganizationsActions from 'sentry/actions/organizationsActions';
|
|
|
import ProjectActions from 'sentry/actions/projectActions';
|
|
@@ -13,14 +12,12 @@ type State = {
|
|
|
lastProject: Project | null;
|
|
|
organization: OrgTypes;
|
|
|
environment: string | string[] | null;
|
|
|
- lastRoute: string | null;
|
|
|
};
|
|
|
|
|
|
type LatestContextStoreInterface = {
|
|
|
state: State;
|
|
|
reset(): void;
|
|
|
get(): State;
|
|
|
- onSetLastRoute(route: string): void;
|
|
|
onUpdateOrganization(organization: OrgTypes): void;
|
|
|
onSetActiveOrganization(organization: OrgTypes): void;
|
|
|
onSetActiveProject(project: Project | null): void;
|
|
@@ -41,7 +38,6 @@ const storeConfig: Reflux.StoreDefinition & LatestContextStoreInterface = {
|
|
|
lastProject: null,
|
|
|
organization: null,
|
|
|
environment: null,
|
|
|
- lastRoute: null,
|
|
|
},
|
|
|
|
|
|
get() {
|
|
@@ -55,7 +51,6 @@ const storeConfig: Reflux.StoreDefinition & LatestContextStoreInterface = {
|
|
|
this.listenTo(OrganizationsActions.setActive, this.onSetActiveOrganization);
|
|
|
this.listenTo(OrganizationsActions.update, this.onUpdateOrganization);
|
|
|
this.listenTo(OrganizationActions.update, this.onUpdateOrganization);
|
|
|
- this.listenTo(NavigationActions.setLastRoute, this.onSetLastRoute);
|
|
|
},
|
|
|
|
|
|
reset() {
|
|
@@ -64,20 +59,10 @@ const storeConfig: Reflux.StoreDefinition & LatestContextStoreInterface = {
|
|
|
lastProject: null,
|
|
|
organization: null,
|
|
|
environment: null,
|
|
|
- lastRoute: null,
|
|
|
};
|
|
|
return this.state;
|
|
|
},
|
|
|
|
|
|
- onSetLastRoute(route) {
|
|
|
- this.state = {
|
|
|
- ...this.state,
|
|
|
- lastRoute: route,
|
|
|
- };
|
|
|
-
|
|
|
- this.trigger(this.state);
|
|
|
- },
|
|
|
-
|
|
|
onUpdateOrganization(org) {
|
|
|
// Don't do anything if base/target orgs are falsey
|
|
|
if (!this.state.organization) {
|