Skip to content

Commit

Permalink
signalR updates
Browse files Browse the repository at this point in the history
- updated package version
- make casing consistent with api updates
  • Loading branch information
sei-aschlackman committed Oct 9, 2024
1 parent e5e91e9 commit e38fbed
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 10 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
32 changes: 30 additions & 2 deletions src/app/shared/signalr/signalr.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,17 +188,30 @@ 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);
});
}

private addDirectoryHandlers() {
this.hubConnection.on('DirectoryCreated', (directory: Directory) => {
this.directoryService.updated(directory);
});

this.hubConnection.on('DirectoryUpdated', (directory: Directory) => {
this.directoryService.updated(directory);
});
Expand All @@ -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);
});
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit e38fbed

Please sign in to comment.