diff --git a/src/IPA.Bcfier.Navisworks/Services/NavisworksViewpointCreationService.cs b/src/IPA.Bcfier.Navisworks/Services/NavisworksViewpointCreationService.cs index b7bfe9e..0714f55 100644 --- a/src/IPA.Bcfier.Navisworks/Services/NavisworksViewpointCreationService.cs +++ b/src/IPA.Bcfier.Navisworks/Services/NavisworksViewpointCreationService.cs @@ -217,14 +217,18 @@ public List CreateClashIssues(NavisworksClashCreationData clashCreatio { if (t.SavedItem is ClashResult result) { - return clashCreationData.ExcludedClashIds == null - || !clashCreationData.ExcludedClashIds.Contains(result.Guid); + return (clashCreationData.ExcludedClashIds == null + || !clashCreationData.ExcludedClashIds.Contains(result.Guid)) + && (clashCreationData.Status == null + || clashCreationData.Status == result.Status.ToString()); } if (t.SavedItem is ClashResultGroup resultGroup) { - return clashCreationData.ExcludedClashIds == null - || !clashCreationData.ExcludedClashIds.Contains(resultGroup.Guid); + return (clashCreationData.ExcludedClashIds == null + || !clashCreationData.ExcludedClashIds.Contains(resultGroup.Guid)) + && (clashCreationData.Status == null + || clashCreationData.Status == resultGroup.Status.ToString()); } return false; diff --git a/src/IPA.Bcfier/Models/Clashes/NavisworksClashCreationData.cs b/src/IPA.Bcfier/Models/Clashes/NavisworksClashCreationData.cs index 34486d0..3b59cb4 100644 --- a/src/IPA.Bcfier/Models/Clashes/NavisworksClashCreationData.cs +++ b/src/IPA.Bcfier/Models/Clashes/NavisworksClashCreationData.cs @@ -7,6 +7,11 @@ public class NavisworksClashCreationData { public Guid ClashId { get; set; } + /// + /// This is used to filter for only a specific status of clashes + /// + public string? Status { get; set; } + public List ExcludedClashIds { get; set; } = new List(); } } diff --git a/src/ipa-bcfier-ui/src/app/components/bcf-file/bcf-file.component.ts b/src/ipa-bcfier-ui/src/app/components/bcf-file/bcf-file.component.ts index fb5e86e..f2ce5d4 100644 --- a/src/ipa-bcfier-ui/src/app/components/bcf-file/bcf-file.component.ts +++ b/src/ipa-bcfier-ui/src/app/components/bcf-file/bcf-file.component.ts @@ -211,86 +211,93 @@ export class BcfFileComponent { this.dialog .open(NavisworksClashSelectionComponent) .afterClosed() - .subscribe((selection?: { clashId: string; onlyImportNew: boolean }) => { - if (!selection) { - return; - } - this.notificationsService.info( - 'If there are many clashes, generation of the data could take a few minutes.' - ); - this.navisworksClashesLoadingService.showLoadingScreen(); - - const existingIds = selection.onlyImportNew - ? this.bcfFile.topics - .filter( - (topic) => - !!topic.serverAssignedId && - // We only want to take Guids, as other server assigned ids might not originate from Navisworks - /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test( - topic.serverAssignedId - ) - ) - .map((topic) => topic.serverAssignedId!) - : []; - - const cancellationSubscription = - this.navisworksClashProgressMessengerService.cancelGeneration.subscribe( - () => { - this.viewpointsClient - .cancelNavisworksClashDetection(selection.clashId) - .subscribe(() => { - /* Not doing anything with the response, that's handled later */ - }); - } + .subscribe( + (selection?: { + clashId: string; + onlyImportNew: boolean; + statusType: string | null; + }) => { + if (!selection) { + return; + } + this.notificationsService.info( + 'If there are many clashes, generation of the data could take a few minutes.' ); + this.navisworksClashesLoadingService.showLoadingScreen(); - this.viewpointsClient - .createNavisworksClashDetectionResultIssues({ - clashId: selection.clashId, - excludedClashIds: existingIds, - }) - .subscribe({ - next: (createdTopics) => { - this.navisworksClashesLoadingService.hideLoadingScreen(); - cancellationSubscription.unsubscribe(); - this.settingsMessengerService.settings - .pipe(take(1)) - .subscribe((s) => { - createdTopics.forEach((topic) => { - topic.creationAuthor = s.username; + const existingIds = selection.onlyImportNew + ? this.bcfFile.topics + .filter( + (topic) => + !!topic.serverAssignedId && + // We only want to take Guids, as other server assigned ids might not originate from Navisworks + /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test( + topic.serverAssignedId + ) + ) + .map((topic) => topic.serverAssignedId!) + : []; + + const cancellationSubscription = + this.navisworksClashProgressMessengerService.cancelGeneration.subscribe( + () => { + this.viewpointsClient + .cancelNavisworksClashDetection(selection.clashId) + .subscribe(() => { + /* Not doing anything with the response, that's handled later */ }); + } + ); - if (selection.onlyImportNew) { - // In that case, we're filtering out those topics that already exist in the - createdTopics = createdTopics.filter( - (topic) => - !this.bcfFile.topics.some( - (existingTopic) => - existingTopic.serverAssignedId === - topic.serverAssignedId - ) - ); - } + this.viewpointsClient + .createNavisworksClashDetectionResultIssues({ + clashId: selection.clashId, + excludedClashIds: existingIds, + status: selection.statusType, + }) + .subscribe({ + next: (createdTopics) => { + this.navisworksClashesLoadingService.hideLoadingScreen(); + cancellationSubscription.unsubscribe(); + this.settingsMessengerService.settings + .pipe(take(1)) + .subscribe((s) => { + createdTopics.forEach((topic) => { + topic.creationAuthor = s.username; + }); - this.bcfFile.topics.push(...createdTopics); - this.filteredTopics = [...this.bcfFile.topics]; - this.bcfFileAutomaticallySaveService.saveCurrentActiveBcfFileAutomatically(); + if (selection.onlyImportNew) { + // In that case, we're filtering out those topics that already exist in the + createdTopics = createdTopics.filter( + (topic) => + !this.bcfFile.topics.some( + (existingTopic) => + existingTopic.serverAssignedId === + topic.serverAssignedId + ) + ); + } - this.teamsMessengerService.sendMessageToTeams( - MessageType.AddNavisworksClashes - ); - }); - }, - error: (error) => { - this.navisworksClashesLoadingService.hideLoadingScreen(); - cancellationSubscription.unsubscribe(); - console.error(error); - this.notificationsService.error( - 'Failed to generate the clash data from Navisworks, this is probably a timeout issue' - ); - }, - }); - }); + this.bcfFile.topics.push(...createdTopics); + this.filteredTopics = [...this.bcfFile.topics]; + this.bcfFileAutomaticallySaveService.saveCurrentActiveBcfFileAutomatically(); + + this.teamsMessengerService.sendMessageToTeams( + MessageType.AddNavisworksClashes + ); + }); + }, + error: (error) => { + this.navisworksClashesLoadingService.hideLoadingScreen(); + cancellationSubscription.unsubscribe(); + console.error(error); + this.notificationsService.error( + 'Failed to generate the clash data from Navisworks, this is probably a timeout issue' + ); + }, + }); + } + ); } setResponsibleForAll(): void { diff --git a/src/ipa-bcfier-ui/src/app/components/navisworks-clash-selection/navisworks-clash-selection.component.html b/src/ipa-bcfier-ui/src/app/components/navisworks-clash-selection/navisworks-clash-selection.component.html index 96fd3ef..2b7e899 100644 --- a/src/ipa-bcfier-ui/src/app/components/navisworks-clash-selection/navisworks-clash-selection.component.html +++ b/src/ipa-bcfier-ui/src/app/components/navisworks-clash-selection/navisworks-clash-selection.component.html @@ -13,7 +13,22 @@

Select Clash Test

} - Only Import New + + Status + + All / No Filter + New + Active + Reviewed + Approved + Resolved + + + Only Import New Clashes