-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove recents and favorites when entities are deleted (#4431)
* Improve recent and favourites display * Remove debug logging * Remove debug logging/subscription leak * Unit test fix * Remove recents and favorites when entities are deleted * Fix merge issues * Fix merge issue * Tidy up and improve following PR feedback * Remove out of date comment * Fixed problem where clear was not working * Check favorite exists before deleting
- Loading branch information
Showing
5 changed files
with
92 additions
and
10 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
src/frontend/packages/store/src/actions/entity.delete.actions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { Action } from '@ngrx/store'; | ||
|
||
import { EntityRequestAction } from '../types/request.types'; | ||
import { IFavoriteMetadata, UserFavorite } from '../types/user-favorites.types'; | ||
|
||
export class EntityDeleteCompleteAction implements Action { | ||
|
||
public static ACTION_TYPE = '[Entity] Entity delete complete'; | ||
public type = EntityDeleteCompleteAction.ACTION_TYPE; | ||
|
||
constructor( | ||
public entityGuid: string, | ||
public entityType: string, | ||
public endpointGuid: string, | ||
public endpointType: string, | ||
public action: EntityRequestAction, | ||
) {} | ||
|
||
// Create an entity delete action if we have all of the properties we need | ||
public static parse(action: EntityRequestAction): EntityDeleteCompleteAction { | ||
if (action.guid && action.entityType && action.endpointType && action.endpointGuid) { | ||
return new EntityDeleteCompleteAction(action.guid, action.entityType, action.endpointGuid, action.endpointType, action); | ||
} | ||
return null; | ||
} | ||
|
||
public asFavorite(): UserFavorite<IFavoriteMetadata> { | ||
return new UserFavorite<IFavoriteMetadata>(this.endpointGuid, this.endpointType, this.entityType, this.entityGuid); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters