diff --git a/frontend/common/providers/FeatureListProvider.js b/frontend/common/providers/FeatureListProvider.js index 038c8f47d990..9d0edcce9782 100644 --- a/frontend/common/providers/FeatureListProvider.js +++ b/frontend/common/providers/FeatureListProvider.js @@ -30,6 +30,9 @@ const FeatureListProvider = class extends React.Component { usageData: FeatureListStore.getFeatureUsage(), }) }) + this.listenTo(FeatureListStore, 'removed', (data) => { + this.props.onRemove?.(data) + }) this.listenTo(FeatureListStore, 'saved', (data) => { this.props.onSave && this.props.onSave(data) diff --git a/frontend/common/providers/ProjectProvider.js b/frontend/common/providers/ProjectProvider.js index cf91d54a0c1a..48effb2c160a 100644 --- a/frontend/common/providers/ProjectProvider.js +++ b/frontend/common/providers/ProjectProvider.js @@ -32,8 +32,8 @@ const ProjectProvider = class extends React.Component { ), ) }) - this.listenTo(ProjectStore, 'removed', () => { - this.props.onRemoveEnvironment && this.props.onRemoveEnvironment() + this.listenTo(ProjectStore, 'removed', (data) => { + this.props.onRemoveEnvironment && this.props.onRemoveEnvironment(data) }) this.listenTo(OrganisationStore, 'removed', () => { this.props.onRemove && this.props.onRemove() diff --git a/frontend/common/stores/feature-list-store.ts b/frontend/common/stores/feature-list-store.ts index 22325753c37d..4e24d2a0322c 100644 --- a/frontend/common/stores/feature-list-store.ts +++ b/frontend/common/stores/feature-list-store.ts @@ -851,6 +851,7 @@ const controller = { ) store.model.lastSaved = new Date().valueOf() store.saved({}) + store.trigger('removed', flag) }) }, searchFeatures: _.throttle( diff --git a/frontend/common/stores/project-store.js b/frontend/common/stores/project-store.js index a174fd7a77eb..1747bc10de6c 100644 --- a/frontend/common/stores/project-store.js +++ b/frontend/common/stores/project-store.js @@ -76,7 +76,7 @@ const controller = { getStore().dispatch( environmentService.util.invalidateTags(['Environment']), ) - store.trigger('removed') + store.trigger('removed', env) store.saved() AppActions.refreshOrganisation() }) diff --git a/frontend/global.d.ts b/frontend/global.d.ts index fcbd2ee93343..9ca8cbfeb70d 100644 --- a/frontend/global.d.ts +++ b/frontend/global.d.ts @@ -27,7 +27,7 @@ declare global { ) => void const openConfirm: (data: OpenConfirm) => void const Row: typeof Component - const toast: (value: string, theme?: string, expiry?: number) => void + const toast: (value: ReactNode, theme?: string, expiry?: number) => void const Flex: typeof Component const isMobile: boolean const FormGroup: typeof Component diff --git a/frontend/web/components/pages/EnvironmentSettingsPage.js b/frontend/web/components/pages/EnvironmentSettingsPage.js index b7b009444bf9..582b586125aa 100644 --- a/frontend/web/components/pages/EnvironmentSettingsPage.js +++ b/frontend/web/components/pages/EnvironmentSettingsPage.js @@ -127,7 +127,7 @@ const EnvironmentSettingsPage = class extends Component { ) } - onRemoveEnvironment = () => { + onRemoveEnvironment = (environment) => { const envs = ProjectStore.getEnvs() if (envs && envs.length) { this.context.router.history.replace( @@ -139,6 +139,11 @@ const EnvironmentSettingsPage = class extends Component { `/project/${this.props.match.params.projectId}/environment/create`, ) } + toast( +