diff --git a/package-lock.json b/package-lock.json index 77901fcf..7b9e3507 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,7 +27,7 @@ "@datorama/akita-ngdevtools": "^7.0.0", "@materia-ui/ngx-monaco-editor": "^6.0.0", "@mdi/font": "^7.0.96", - "@microsoft/signalr": "^7.0.0", + "@microsoft/signalr": "^8.0.7", "@ng-bootstrap/ng-bootstrap": "^13.1.0", "@ngneat/hotkeys": "^1.3.0", "angular-resizable-element": "^6.0.0", @@ -3077,9 +3077,9 @@ "integrity": "sha512-rzlxTfR64hqY8yiBzDjmANfcd8rv+T5C0Yedv/TWk2QyAQYdc66e0kaN1ipmnYU3RukHRTRcBARHzzm+tIhL7w==" }, "node_modules/@microsoft/signalr": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@microsoft/signalr/-/signalr-7.0.0.tgz", - "integrity": "sha512-9bHYqc0cjN0fL1KnK+MhlN0Qd/rp8Na4pzKYSV3wP8VC8p7188dvvmRTreYLXXh0srRLf9aMBj0ZbdZQwfnL/A==", + "version": "8.0.7", + "resolved": "https://registry.npmjs.org/@microsoft/signalr/-/signalr-8.0.7.tgz", + "integrity": "sha512-PHcdMv8v5hJlBkRHAuKG5trGViQEkPYee36LnJQx4xHOQ5LL4X0nEWIxOp5cCtZ7tu+30quz5V3k0b1YNuc6lw==", "dependencies": { "abort-controller": "^3.0.0", "eventsource": "^2.0.2", @@ -20135,9 +20135,9 @@ "integrity": "sha512-rzlxTfR64hqY8yiBzDjmANfcd8rv+T5C0Yedv/TWk2QyAQYdc66e0kaN1ipmnYU3RukHRTRcBARHzzm+tIhL7w==" }, "@microsoft/signalr": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@microsoft/signalr/-/signalr-7.0.0.tgz", - "integrity": "sha512-9bHYqc0cjN0fL1KnK+MhlN0Qd/rp8Na4pzKYSV3wP8VC8p7188dvvmRTreYLXXh0srRLf9aMBj0ZbdZQwfnL/A==", + "version": "8.0.7", + "resolved": "https://registry.npmjs.org/@microsoft/signalr/-/signalr-8.0.7.tgz", + "integrity": "sha512-PHcdMv8v5hJlBkRHAuKG5trGViQEkPYee36LnJQx4xHOQ5LL4X0nEWIxOp5cCtZ7tu+30quz5V3k0b1YNuc6lw==", "requires": { "abort-controller": "^3.0.0", "eventsource": "^2.0.2", diff --git a/package.json b/package.json index 543fe7ba..3512afef 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "@datorama/akita-ngdevtools": "^7.0.0", "@materia-ui/ngx-monaco-editor": "^6.0.0", "@mdi/font": "^7.0.96", - "@microsoft/signalr": "^7.0.0", + "@microsoft/signalr": "^8.0.7", "@ng-bootstrap/ng-bootstrap": "^13.1.0", "@ngneat/hotkeys": "^1.3.0", "angular-resizable-element": "^6.0.0", diff --git a/src/app/shared/signalr/signalr.service.ts b/src/app/shared/signalr/signalr.service.ts index af813b80..7c0c0b81 100644 --- a/src/app/shared/signalr/signalr.service.ts +++ b/src/app/shared/signalr/signalr.service.ts @@ -188,10 +188,19 @@ export class SignalRService { } private addFileHandlers() { - this.hubConnection.on('FileUpdated', (file: ModelFile) => { + this.hubConnection.on('FileCreated', (file: ModelFile) => { this.fileService.fileUpdated(file); }); + this.hubConnection.on('FileUpdated', (file: ModelFile) => { + if (file.isDeleted) { + this.projectService.closeTab(file.id); + this.fileService.fileDeleted(file.id); + } else { + this.fileService.fileUpdated(file); + } + }); + this.hubConnection.on('FileDeleted', (fileId: string) => { this.projectService.closeTab(fileId); this.fileService.fileDeleted(fileId); @@ -199,6 +208,10 @@ export class SignalRService { } private addDirectoryHandlers() { + this.hubConnection.on('DirectoryCreated', (directory: Directory) => { + this.directoryService.updated(directory); + }); + this.hubConnection.on('DirectoryUpdated', (directory: Directory) => { this.directoryService.updated(directory); }); @@ -209,6 +222,10 @@ export class SignalRService { } private addWorkspaceHandlers() { + this.hubConnection.on('WorkspaceCreated', (workspace: Workspace) => { + this.workspaceService.updated(workspace); + }); + this.hubConnection.on('WorkspaceUpdated', (workspace: Workspace) => { this.workspaceService.updated(workspace); }); @@ -361,11 +378,22 @@ export class SignalRService { const retVal = {}; modifiedProperties.forEach((x) => { - retVal[x] = entity[x]; + const prop = this.titleToCamelCase(x); + retVal[prop] = entity[prop]; }); return retVal; } + + private titleToCamelCase(str: string) { + let retVal = str; + + if (str && str.length > 1) { + retVal = str[0].toLocaleLowerCase() + str.substring(1); + } + + return retVal; + } } class RetryPolicy {