Skip to content

Commit 17aeb11

Browse files
authored
Merge pull request #76 from rubberduck-vba/webhook
fix quickfixes and annotations, modal sizes
2 parents 7d0bcde + 7530c56 commit 17aeb11

File tree

7 files changed

+26
-48
lines changed

7 files changed

+26
-48
lines changed

rubberduckvba.Server/Services/CacheService.cs

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public void Invalidate(InspectionsFeatureViewModel newContent)
120120
public void Invalidate(QuickFixesFeatureViewModel newContent)
121121
{
122122
GetCurrentJobState();
123-
if (XmldocJobState?.StateName == JobStateSucceeded)
123+
if (!TryReadXmldocCache<QuickFixesFeatureViewModel>("quickfixes", out _) || XmldocJobState?.StateName == JobStateSucceeded)
124124
{
125125
Write("quickfixes", newContent);
126126
foreach (var item in newContent.QuickFixes)
@@ -136,7 +136,7 @@ public void Invalidate(QuickFixesFeatureViewModel newContent)
136136
public void Invalidate(AnnotationsFeatureViewModel newContent)
137137
{
138138
GetCurrentJobState();
139-
if (XmldocJobState?.StateName == JobStateSucceeded)
139+
if (!TryReadXmldocCache<AnnotationsFeatureViewModel>("annotations", out _) || XmldocJobState?.StateName == JobStateSucceeded)
140140
{
141141
Write("annotations", newContent);
142142
foreach (var item in newContent.Annotations)
@@ -156,27 +156,6 @@ public void Clear()
156156
_logger.LogInformation("Cache was cleared.");
157157
}
158158

159-
private bool IsTagsCacheValid() => IsCacheValid(TagsJobState, () => TagsJobState);
160-
161-
private bool IsXmldocCacheValid() => IsCacheValid(XmldocJobState, () => XmldocJobState);
162-
163-
/// <summary>
164-
/// Side-effecting:
165-
/// </summary>
166-
/// <param name="initial">The initial state before the check</param>
167-
/// <param name="getCurrent">The current state after the check</param>
168-
/// <returns></returns>
169-
private bool IsCacheValid(HangfireJobState? initial, Func<HangfireJobState?> getCurrent)
170-
{
171-
GetCurrentJobState();
172-
var current = getCurrent.Invoke();
173-
174-
return current is null
175-
|| (current.StateName == JobStateSucceeded // last executed job must have succeeded
176-
&& current.LastJobId == initial?.LastJobId // last executed job must be the same job ID we know about
177-
&& current.StateTimestamp == initial?.StateTimestamp); // same execution -> cache was not invalidated
178-
}
179-
180159
private void Write<T>(string key, T value)
181160
{
182161
_cache.Set(key, value, _options);

rubberduckvba.client/src/app/components/feature-item-box/annotation-item-box/annotation-item-box.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ <h5>Parameters</h5>
101101
<div class="small text-muted text-center">
102102
<a href="{{annotationInfo.getGitHubViewLink()}}">View</a> | <a href="{{annotationInfo.getGitHubEditLink()}}">Edit</a> this content on <fa-icon [icon]="['fab', 'github']"></fa-icon>&nbsp;GitHub
103103
</div>
104-
<a href="/annotations/{{annotationInfo.name}}" class="btn btn-expand" title="Expand to page"><fa-icon [icon]="['fas', 'expand']"></fa-icon></a>
104+
<a href="/annotations/{{annotationInfo.name}}" class="btn btn-expand" title="Expand to page"><fa-icon [icon]="['fas', 'expand']"></fa-icon>&nbsp;View page</a>
105105
</div>
106106
</div>
107107
</div>

rubberduckvba.client/src/app/components/feature-item-box/annotation-item-box/annotation-item-box.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export class AnnotationItemBoxComponent implements OnInit, OnChanges {
4444

4545
public showDetailsModal(): void {
4646
console.log(`Showing details for annotation: ${this.annotationInfo.name}`);
47-
this.modal.open(this.annotationDetails);
47+
this.modal.open(this.annotationDetails, { modalDialogClass: this.annotationInfo.parameters.length > 0 || this.annotationInfo.examples.length > 0 ? 'modal-xl' : 'modal-l' });
4848
}
4949

5050
public get annotationInfo(): AnnotationViewModel {

rubberduckvba.client/src/app/components/feature-item-box/inspection-item-box/inspection-item-box.component.html

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,35 +28,35 @@ <h6 class="d-inline text-wrap">&nbsp;{{inspectionInfo.title}}</h6>
2828
</div>
2929
</div>
3030

31-
<ng-template #inspectionDetails let-modal class="modal-xl">
31+
<ng-template #inspectionDetails let-modal>
3232
<div class="modal-header align-content-center">
3333
<h4><img src="../../assets/vector-ducky-540.png" height="32">&nbsp;{{inspectionInfo.title}}</h4>
3434
<button type="button" class="btn-close" aria-label="close" (click)="modal.dismiss('x')"></button>
3535
</div>
36-
<div class="modal-body">
37-
<div class="row">
38-
<div class="text-start">
39-
<div class="row">
36+
<div class="modal-body my-2 mx-4">
37+
<div class="row text-start">
38+
<div class="col-6">
39+
<div class="">
40+
<strong class="fw-medium" [innerHtml]="inspectionInfo.summary"></strong>
41+
<h6>Reasoning</h6>
42+
<p [innerHtml]="inspectionInfo.reasoning"></p>
43+
</div>
44+
</div>
45+
<div class="col-6">
4046
<div>
41-
<h6>
47+
<h6>Inspection Type</h6>
48+
<strong>
4249
<fa-icon [icon]="'lightbulb'"></fa-icon>&nbsp;{{inspectionInfo.inspectionType}}
43-
</h6>
50+
</strong>
4451
<p class="small text-black-50">{{inspectionTypeTitle}}</p>
4552
</div>
46-
</div>
47-
<div class="row">
53+
<hr />
4854
<div>
49-
Default Severity: <strong>{{inspectionInfo.defaultSeverity}}</strong>&nbsp;<span ngClass="{{severityIconClass}}"></span>
55+
<h6>Default Severity</h6>
56+
<span ngClass="{{severityIconClass}}"></span>&nbsp;<strong>{{inspectionInfo.defaultSeverity}}</strong>
5057
<p class="small text-black-50">{{severityTitle}}</p>
5158
</div>
52-
</div>
53-
<div class="row">
54-
<div class="col-11 ms-2">
55-
<div class="bg-light rounded-4 px-3 pt-2 pb-1">
56-
<p class="fw-medium" [innerHtml]="inspectionInfo.summary"></p>
57-
</div>
58-
<p [innerHtml]="inspectionInfo.reasoning"></p>
59-
</div>
59+
<hr />
6060
</div>
6161
<div *ngIf="(inspectionInfo.hostApp?.length ?? 0) > 0" class="row">
6262
<div>
@@ -101,7 +101,6 @@ <h6><fa-icon [icon]="'circle-check'"></fa-icon>&nbsp;{{fix.name}}</h6>
101101
</ul>
102102
</div>
103103
</div>
104-
</div>
105104
</div>
106105

107106
<div *ngIf="inspectionInfo.examples && inspectionInfo.examples.length > 0"
@@ -134,6 +133,6 @@ <h6><fa-icon [icon]="'circle-check'"></fa-icon>&nbsp;{{fix.name}}</h6>
134133
<div class="small text-muted text-center">
135134
<a href="{{inspectionInfo.getGitHubViewLink()}}">View</a> | <a href="{{inspectionInfo.getGitHubEditLink()}}">Edit</a> this content on <fa-icon [icon]="['fab', 'github']"></fa-icon>&nbsp;GitHub
136135
</div>
137-
<a href="/inspections/{{inspectionInfo.name}}" class="btn btn-expand" title="Expand to page"><fa-icon [icon]="['fas', 'expand']"></fa-icon></a>
136+
<a href="/inspections/{{inspectionInfo.name}}" class="btn btn-expand" title="Expand to page"><fa-icon [icon]="['fas', 'expand']"></fa-icon>&nbsp;View page</a>
138137
</div>
139138
</ng-template>

rubberduckvba.client/src/app/components/feature-item-box/inspection-item-box/inspection-item-box.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export class InspectionItemBoxComponent implements OnInit, OnChanges {
4747
public showDetailsModal(): void {
4848
this.api.getInspection(this.inspectionInfo.name).subscribe((inspection: InspectionViewModel) => {
4949
this._inspectionInfo.next(inspection);
50-
this.modal.open(this.inspectionDetails);
50+
this.modal.open(this.inspectionDetails, { modalDialogClass: 'modal-xl'});
5151
});
5252
}
5353

rubberduckvba.client/src/app/components/feature-item-box/quickfix-item-box/quickfix-item-box.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ <h6><span [ngClass]="inspection.getSeverityIconClass"></span>&nbsp;{{inspection.
137137
<div class="small text-muted text-center">
138138
<a href="{{quickFixInfo.getGitHubViewLink()}}">View</a> | <a href="{{quickFixInfo.getGitHubEditLink()}}">Edit</a> this content on <fa-icon [icon]="['fab', 'github']"></fa-icon>&nbsp;GitHub
139139
</div>
140-
<a href="/quickfixes/{{quickFixInfo.name}}" class="btn btn-expand" title="Expand to page"><fa-icon [icon]="['fas', 'expand']"></fa-icon></a>
140+
<a href="/quickfixes/{{quickFixInfo.name}}" class="btn btn-expand" title="Expand to page"><fa-icon [icon]="['fas', 'expand']"></fa-icon>&nbsp;View page</a>
141141
</div>
142142
</div>
143143
</div>

rubberduckvba.client/src/app/components/feature-item-box/quickfix-item-box/quickfix-item-box.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export class QuickFixItemBoxComponent implements OnInit, OnChanges {
4444

4545
public showDetailsModal(): void {
4646
console.log(`Showing details for QuickFix: ${this.quickFixInfo.name}`);
47-
this.modal.open(this.QuickFixDetails);
47+
this.modal.open(this.QuickFixDetails, { modalDialogClass: 'modal-xl' });
4848
}
4949

5050
public get quickFixInfo(): QuickFixViewModelClass {

0 commit comments

Comments
 (0)