From 7530c56d393b5975637c533375c86c420abdd2b2 Mon Sep 17 00:00:00 2001 From: Mathieu Guindon Date: Mon, 2 Jun 2025 20:41:40 -0400 Subject: [PATCH] fix quickfixes and annotations, modal sizes --- rubberduckvba.Server/Services/CacheService.cs | 25 +----------- .../annotation-item-box.component.html | 2 +- .../annotation-item-box.component.ts | 2 +- .../inspection-item-box.component.html | 39 +++++++++---------- .../inspection-item-box.component.ts | 2 +- .../quickfix-item-box.component.html | 2 +- .../quickfix-item-box.component.ts | 2 +- 7 files changed, 26 insertions(+), 48 deletions(-) diff --git a/rubberduckvba.Server/Services/CacheService.cs b/rubberduckvba.Server/Services/CacheService.cs index 6c56254..1e97775 100644 --- a/rubberduckvba.Server/Services/CacheService.cs +++ b/rubberduckvba.Server/Services/CacheService.cs @@ -120,7 +120,7 @@ public void Invalidate(InspectionsFeatureViewModel newContent) public void Invalidate(QuickFixesFeatureViewModel newContent) { GetCurrentJobState(); - if (XmldocJobState?.StateName == JobStateSucceeded) + if (!TryReadXmldocCache("quickfixes", out _) || XmldocJobState?.StateName == JobStateSucceeded) { Write("quickfixes", newContent); foreach (var item in newContent.QuickFixes) @@ -136,7 +136,7 @@ public void Invalidate(QuickFixesFeatureViewModel newContent) public void Invalidate(AnnotationsFeatureViewModel newContent) { GetCurrentJobState(); - if (XmldocJobState?.StateName == JobStateSucceeded) + if (!TryReadXmldocCache("annotations", out _) || XmldocJobState?.StateName == JobStateSucceeded) { Write("annotations", newContent); foreach (var item in newContent.Annotations) @@ -156,27 +156,6 @@ public void Clear() _logger.LogInformation("Cache was cleared."); } - private bool IsTagsCacheValid() => IsCacheValid(TagsJobState, () => TagsJobState); - - private bool IsXmldocCacheValid() => IsCacheValid(XmldocJobState, () => XmldocJobState); - - /// - /// Side-effecting: - /// - /// The initial state before the check - /// The current state after the check - /// - private bool IsCacheValid(HangfireJobState? initial, Func getCurrent) - { - GetCurrentJobState(); - var current = getCurrent.Invoke(); - - return current is null - || (current.StateName == JobStateSucceeded // last executed job must have succeeded - && current.LastJobId == initial?.LastJobId // last executed job must be the same job ID we know about - && current.StateTimestamp == initial?.StateTimestamp); // same execution -> cache was not invalidated - } - private void Write(string key, T value) { _cache.Set(key, value, _options); diff --git a/rubberduckvba.client/src/app/components/feature-item-box/annotation-item-box/annotation-item-box.component.html b/rubberduckvba.client/src/app/components/feature-item-box/annotation-item-box/annotation-item-box.component.html index 702ee3b..6bff154 100644 --- a/rubberduckvba.client/src/app/components/feature-item-box/annotation-item-box/annotation-item-box.component.html +++ b/rubberduckvba.client/src/app/components/feature-item-box/annotation-item-box/annotation-item-box.component.html @@ -101,7 +101,7 @@
Parameters
View | Edit this content on  GitHub
- +  View page diff --git a/rubberduckvba.client/src/app/components/feature-item-box/annotation-item-box/annotation-item-box.component.ts b/rubberduckvba.client/src/app/components/feature-item-box/annotation-item-box/annotation-item-box.component.ts index 83e3518..d40356a 100644 --- a/rubberduckvba.client/src/app/components/feature-item-box/annotation-item-box/annotation-item-box.component.ts +++ b/rubberduckvba.client/src/app/components/feature-item-box/annotation-item-box/annotation-item-box.component.ts @@ -44,7 +44,7 @@ export class AnnotationItemBoxComponent implements OnInit, OnChanges { public showDetailsModal(): void { console.log(`Showing details for annotation: ${this.annotationInfo.name}`); - this.modal.open(this.annotationDetails); + this.modal.open(this.annotationDetails, { modalDialogClass: this.annotationInfo.parameters.length > 0 || this.annotationInfo.examples.length > 0 ? 'modal-xl' : 'modal-l' }); } public get annotationInfo(): AnnotationViewModel { diff --git a/rubberduckvba.client/src/app/components/feature-item-box/inspection-item-box/inspection-item-box.component.html b/rubberduckvba.client/src/app/components/feature-item-box/inspection-item-box/inspection-item-box.component.html index 961f67d..b9abb1e 100644 --- a/rubberduckvba.client/src/app/components/feature-item-box/inspection-item-box/inspection-item-box.component.html +++ b/rubberduckvba.client/src/app/components/feature-item-box/inspection-item-box/inspection-item-box.component.html @@ -28,35 +28,35 @@
 {{inspectionInfo.title}}
- + -