[CORD-2277] Two stage delete for models
Change-Id: Ic1b1d59a9f1d6d963d10951e694cf963f41d84d5
(cherry picked from commit e9cdf9ab429f1899b88552d8b0fd177c7cde9c94)
diff --git a/src/app/datasources/websocket/global.ts b/src/app/datasources/websocket/global.ts
index e86282a..8774173 100644
--- a/src/app/datasources/websocket/global.ts
+++ b/src/app/datasources/websocket/global.ts
@@ -24,6 +24,7 @@
export interface IWSEvent {
model: string;
skip_notification?: boolean;
+ deleted?: boolean;
msg: {
changed_fields: string[],
object?: any,
@@ -53,7 +54,15 @@
const ignoredFields: string[] = ['created', 'updated', 'backend_register'];
this.socket = io(this.AppConfig.websocketClient);
- this.socket.on('event', (data: IWSEvent): void => {
+
+ this.socket.on('remove', (data: IWSEvent): void => {
+ this.$log.info(`[WebSocket] Received Remove Event for: ${data.model} [${data.msg.pk}]`, data);
+ this._events.next(data);
+
+ // TODO update observers of parent classes
+ });
+
+ this.socket.on('update', (data: IWSEvent): void => {
if (data.msg.changed_fields.length === 0 || _.intersection(data.msg.changed_fields, ignoredFields).length === data.msg.changed_fields.length) {
// NOTE means that the only updated fields does not change anything in the UI, so don't send events around