forked from openshift-kni/rds-analyzer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhtml.go
More file actions
1731 lines (1512 loc) · 54.9 KB
/
html.go
File metadata and controls
1731 lines (1512 loc) · 54.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package report
import (
"html/template"
"io"
"path/filepath"
"sort"
"strings"
"time"
"github.com/openshift-kni/rds-analyzer/pkg/parser"
"github.com/openshift-kni/rds-analyzer/pkg/rules"
"github.com/openshift-kni/rds-analyzer/pkg/types"
)
// escapeHTML escapes characters that could break HTML structure.
// Returns template.HTML to prevent double-escaping by the template engine.
func escapeHTML(s string) template.HTML {
s = strings.ReplaceAll(s, "&", "&")
s = strings.ReplaceAll(s, "<", "<")
s = strings.ReplaceAll(s, ">", ">")
return template.HTML(s)
}
// HTMLReport contains all data needed to render the HTML report.
type HTMLReport struct {
GeneratedAt string
OCPVersion string
RDSVariant string
Summary SummaryData
MissingCRs []MissingCRGroup
Diffs []DiffData
CountViolations []CountViolationData
ImpactStats ImpactStats
}
// SummaryData contains validation summary statistics.
type SummaryData struct {
TotalMissing int
DiffCRs int
TotalCRs int
UnmatchedCRs int
PatchedCRs int
MetadataHash string
}
// MissingCRGroup represents a group of missing CRs.
type MissingCRGroup struct {
GroupName string
IsRequired bool
CRCount int
Deviations []DeviationData
}
// DeviationData represents a deviation within a group.
type DeviationData struct {
Name string
Message string
CRs []MissingCRData
IsOneOfRequired bool // True for "one of the following is required" deviations
HasSatisfiedCR bool // True if at least one CR in this deviation is satisfied
}
// MissingCRData represents a single missing CR.
type MissingCRData struct {
Path string
Impact string
ImpactCSS string
IsSatisfied bool // True if this CR was found in correlated templates
}
// DiffData represents a single difference with rule evaluation.
type DiffData struct {
Index int
Total int
CRName string
Template string
Description string
ExpectedNotFound []DiffLineData
FoundNotExpected []DiffLineData
ExpectedValues []template.HTML
FoundValues []DiffLineData
OverallImpact string
OverallImpactCSS string
MatchedRules []RuleMatchData
HasNeedsReview bool
NoRulesMatched bool
NoMatchComment string
}
// DiffLineData represents a single diff line with optional rule match.
type DiffLineData struct {
Line template.HTML
Rules []RuleTagData
HasRules bool
}
// RuleTagData represents a rule tag with tooltip info.
type RuleTagData struct {
ID string
Comment string
Impact string
ImpactCSS string
}
// RuleMatchData represents a matched rule.
type RuleMatchData struct {
RuleID string
Impact string
ImpactCSS string
Comment string
}
// CountViolationData represents a count rule violation.
type CountViolationData struct {
RuleID string
Description string
Count int
Impact string
ImpactCSS string
Comment string
MatchedCRs []string
}
// ImpactStats contains impact statistics.
type ImpactStats struct {
Impacting int
NotImpacting int
NotADeviation int
NeedsReview int
MissingImpacting int
MissingNotImpacting int
MissingNeedsReview int
RequiredCRCount int
OptionalCRCount int
}
// HTMLGenerator generates HTML reports.
type HTMLGenerator struct {
ruleEngine *rules.Engine
tmpl *template.Template
}
// NewHTMLGenerator creates a new HTML report generator.
func NewHTMLGenerator(ruleEngine *rules.Engine) *HTMLGenerator {
tmpl := template.Must(template.New("report").Parse(htmlTemplate))
return &HTMLGenerator{
ruleEngine: ruleEngine,
tmpl: tmpl,
}
}
// Generate creates an HTML report from the validation report.
func (g *HTMLGenerator) Generate(w io.Writer, report types.ValidationReport) error {
htmlReport := g.buildHTMLReport(report)
return g.tmpl.Execute(w, htmlReport)
}
func (g *HTMLGenerator) buildHTMLReport(report types.ValidationReport) HTMLReport {
htmlReport := HTMLReport{
GeneratedAt: time.Now().Format("2006-01-02 15:04:05 MST"),
Summary: SummaryData{
TotalMissing: report.Summary.NumMissing,
DiffCRs: report.Summary.NumDiffCRs,
TotalCRs: report.Summary.TotalCRs,
UnmatchedCRs: len(report.Summary.UnmatchedCRS),
PatchedCRs: report.Summary.PatchedCRs,
MetadataHash: report.Summary.MetadataHash,
},
}
if targetVersion := g.ruleEngine.GetTargetVersion(); !targetVersion.IsZero() {
htmlReport.OCPVersion = targetVersion.String()
}
htmlReport.RDSVariant = g.ruleEngine.GetRDSVariant()
htmlReport.MissingCRs, htmlReport.ImpactStats = g.processMissingCRs(report.Summary.ValidationIssues, report.Diffs)
htmlReport.Summary.TotalMissing = htmlReport.ImpactStats.RequiredCRCount + htmlReport.ImpactStats.OptionalCRCount
htmlReport.Diffs, htmlReport.CountViolations = g.processDiffs(report.Diffs, &htmlReport.ImpactStats)
return htmlReport
}
func (g *HTMLGenerator) processMissingCRs(issues types.ValidationIssues, diffs []types.Diff) ([]MissingCRGroup, ImpactStats) {
stats := ImpactStats{}
var groups []MissingCRGroup
if len(issues) == 0 {
return groups, stats
}
// Extract correlated templates from diffs to determine satisfied CRs.
correlatedTemplates := rules.ExtractCorrelatedTemplates(diffs)
missingCRResults := g.ruleEngine.EvaluateMissingCRs(issues, correlatedTemplates)
groupKeys := make([]string, 0, len(issues))
for k := range issues {
groupKeys = append(groupKeys, k)
}
sort.Strings(groupKeys)
for _, groupName := range groupKeys {
group := MissingCRGroup{
GroupName: groupName,
IsRequired: false, // Will be set based on CR impacts below.
}
deviations := issues[groupName]
deviationKeys := make([]string, 0, len(deviations))
for k := range deviations {
deviationKeys = append(deviationKeys, k)
}
sort.Strings(deviationKeys)
// Track if any CR in this group is impacting.
hasImpactingCR := false
for _, deviationName := range deviationKeys {
deviation := deviations[deviationName]
devData := DeviationData{
Name: deviationName,
Message: deviation.Msg,
IsOneOfRequired: strings.Contains(deviation.Msg, "One of the following is required"),
HasSatisfiedCR: false,
}
for _, cr := range deviation.CRs {
result := missingCRResults[cr]
// Determine impact CSS - override to green for satisfied CRs.
impactCSS := getImpactCSS(result.Impact)
if result.IsSatisfied {
impactCSS = "impact-satisfied"
devData.HasSatisfiedCR = true
}
crData := MissingCRData{
Path: cr,
Impact: result.Impact,
ImpactCSS: impactCSS,
IsSatisfied: result.IsSatisfied,
}
devData.CRs = append(devData.CRs, crData)
if !result.IsSatisfied {
switch result.Impact {
case "Impacting":
stats.MissingImpacting++
hasImpactingCR = true
case "NotImpacting":
stats.MissingNotImpacting++
default:
stats.MissingNeedsReview++
}
}
}
group.Deviations = append(group.Deviations, devData)
}
// Group is required if any unsatisfied CR in it has Impacting impact.
group.IsRequired = hasImpactingCR
group.CRCount = countUnsatisfiedGroupCRs(group)
if hasImpactingCR {
stats.RequiredCRCount += group.CRCount
} else {
stats.OptionalCRCount += group.CRCount
}
groups = append(groups, group)
}
return groups, stats
}
// countUnsatisfiedGroupCRs counts the number of unsatisfied CRs in a MissingCRGroup.
func countUnsatisfiedGroupCRs(group MissingCRGroup) int {
count := 0
for _, dev := range group.Deviations {
for _, cr := range dev.CRs {
if !cr.IsSatisfied {
count++
}
}
}
return count
}
// getImpactPriority returns the sort priority for an impact (lower = first).
func getImpactPriority(impact string) int {
switch impact {
case "Impacting":
return 0
case "NotImpacting":
return 1
case "NeedsReview":
return 2
case "NotADeviation":
return 3
default:
return 4
}
}
func (g *HTMLGenerator) processDiffs(diffs []types.Diff, stats *ImpactStats) ([]DiffData, []CountViolationData) {
var diffDataList []DiffData
var allDiffChecks []types.DiffCheck
for _, d := range diffs {
// Handle empty diffs - add minimal DiffCheck for count rules only.
if d.DiffOutput == "" {
allDiffChecks = append(allDiffChecks, types.DiffCheck{
CRName: d.CRName,
TemplateFileName: filepath.Base(d.CorrelatedTemplate),
})
continue
}
diffData := DiffData{
CRName: d.CRName,
Template: d.CorrelatedTemplate,
Description: d.Description,
}
formattedDiff, err := parser.ParseExpectedAndFound(d.DiffOutput, d.CRName, filepath.Base(d.CorrelatedTemplate))
if err != nil {
continue
}
allDiffChecks = append(allDiffChecks, formattedDiff)
ruleResult := g.ruleEngine.Evaluate(formattedDiff)
for _, line := range formattedDiff.ExpectedNotFound {
rules := getMatchingRulesHTML(line, "ExpectedNotFound", ruleResult)
diffData.ExpectedNotFound = append(diffData.ExpectedNotFound, DiffLineData{
Line: escapeHTML(line),
Rules: rules,
HasRules: len(rules) > 0,
})
if len(rules) == 0 {
diffData.HasNeedsReview = true
}
}
for _, line := range formattedDiff.FoundNotExpected {
rules := getMatchingRulesHTML(line, "FoundNotExpected", ruleResult)
diffData.FoundNotExpected = append(diffData.FoundNotExpected, DiffLineData{
Line: escapeHTML(line),
Rules: rules,
HasRules: len(rules) > 0,
})
if len(rules) == 0 {
diffData.HasNeedsReview = true
}
}
for _, line := range formattedDiff.ExpectedValue {
diffData.ExpectedValues = append(diffData.ExpectedValues, escapeHTML(line))
}
for _, line := range formattedDiff.FoundValue {
rules := getMatchingRulesHTML(line, "ExpectedFound", ruleResult)
diffData.FoundValues = append(diffData.FoundValues, DiffLineData{
Line: escapeHTML(line),
Rules: rules,
HasRules: len(rules) > 0,
})
if len(rules) == 0 {
diffData.HasNeedsReview = true
}
}
finalImpact := ruleResult.Impact
if !ruleResult.Matched {
finalImpact = "NeedsReview"
diffData.NoRulesMatched = true
diffData.NoMatchComment = ruleResult.Comment
} else if diffData.HasNeedsReview && finalImpact != "Impacting" {
finalImpact = "NeedsReview"
}
diffData.OverallImpact = finalImpact
diffData.OverallImpactCSS = getImpactCSS(finalImpact)
for _, condResult := range ruleResult.Conditions {
if condResult.Matched {
diffData.MatchedRules = append(diffData.MatchedRules, RuleMatchData{
RuleID: condResult.RuleID,
Impact: condResult.Impact,
ImpactCSS: getImpactCSS(condResult.Impact),
Comment: condResult.Comment,
})
}
}
switch finalImpact {
case "Impacting":
stats.Impacting++
case "NotImpacting":
stats.NotImpacting++
case "NotADeviation":
stats.NotADeviation++
default:
stats.NeedsReview++
}
diffDataList = append(diffDataList, diffData)
}
// Sort diffs by impact priority: Impacting -> NotImpacting -> NeedsReview -> NotADeviation.
sort.SliceStable(diffDataList, func(i, j int) bool {
return getImpactPriority(diffDataList[i].OverallImpact) < getImpactPriority(diffDataList[j].OverallImpact)
})
// Update Index and Total after sorting.
for i := range diffDataList {
diffDataList[i].Index = i + 1
diffDataList[i].Total = len(diffDataList)
}
var countViolations []CountViolationData
countResults := g.ruleEngine.EvaluateCountRules(allDiffChecks)
for _, result := range countResults {
countViolations = append(countViolations, CountViolationData{
RuleID: result.RuleID,
Description: result.Description,
Count: result.Count,
Impact: result.Impact,
ImpactCSS: getImpactCSS(result.Impact),
Comment: result.Comment,
MatchedCRs: result.MatchedCRs,
})
switch result.Impact {
case "Impacting":
stats.Impacting++
case "NotImpacting":
stats.NotImpacting++
case "NotADeviation":
stats.NotADeviation++
default:
stats.NeedsReview++
}
}
return diffDataList, countViolations
}
func getMatchingRulesHTML(line, diffType string, ruleResult rules.EvaluationResult) []RuleTagData {
trimmedLine := strings.TrimSpace(line)
var ruleTags []RuleTagData
seen := make(map[string]bool)
for _, condResult := range ruleResult.Conditions {
if condResult.ConditionType == diffType && condResult.Matched {
trimmedMatched := strings.TrimSpace(condResult.MatchedText)
if strings.Contains(trimmedLine, trimmedMatched) || strings.Contains(trimmedMatched, trimmedLine) {
if !seen[condResult.RuleID] {
seen[condResult.RuleID] = true
ruleTags = append(ruleTags, RuleTagData{
ID: condResult.RuleID,
Comment: condResult.Comment,
Impact: condResult.Impact,
ImpactCSS: getImpactCSS(condResult.Impact),
})
}
}
}
}
return ruleTags
}
func getImpactCSS(impact string) string {
switch impact {
case "Impacting":
return "impact-impacting"
case "NotImpacting":
return "impact-not-impacting"
case "NotADeviation":
return "impact-not-deviation"
default:
return "impact-needs-review"
}
}
const htmlTemplate = `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>RDS Validation Report</title>
<style>
:root {
--color-impacting: #dc3545;
--color-not-impacting: #e6a817;
--color-not-deviation: #28a745;
--color-needs-review: #6c757d;
--color-bg: #f5f5f5;
--color-card-bg: #ffffff;
--color-border: #dee2e6;
--color-text: #212529;
--color-text-muted: #6c757d;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
background-color: var(--color-bg);
color: var(--color-text);
line-height: 1.6;
padding: 20px;
}
.container {
max-width: 1200px;
margin: 0 auto;
}
header {
background: #343a40;
color: white;
padding: 30px;
border-radius: 10px;
margin-bottom: 30px;
}
header h1 {
font-size: 2rem;
margin-bottom: 10px;
}
header .meta {
font-size: 0.9rem;
opacity: 0.9;
}
.section {
background: var(--color-card-bg);
border-radius: 10px;
padding: 25px;
margin-bottom: 25px;
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
border: 1px solid var(--color-border);
}
.section h2 {
font-size: 1.4rem;
margin-bottom: 20px;
padding-bottom: 10px;
border-bottom: 2px solid var(--color-border);
display: flex;
align-items: center;
gap: 10px;
}
.section h2 .badge {
font-size: 0.8rem;
padding: 4px 10px;
border-radius: 20px;
font-weight: normal;
}
.summary-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 20px;
}
.stat-card {
background: #5b7188;
color: white;
padding: 20px;
border-radius: 10px;
text-align: center;
}
.stat-card .value {
font-size: 2.5rem;
font-weight: bold;
}
.stat-card .label {
font-size: 0.9rem;
opacity: 0.9;
margin-top: 5px;
}
.tooltip-container {
position: relative;
display: inline-flex;
align-items: center;
gap: 8px;
}
.tooltip-icon {
display: inline-flex;
align-items: center;
justify-content: center;
width: 18px;
height: 18px;
border-radius: 50%;
background: rgba(255, 255, 255, 0.3);
font-size: 0.75rem;
font-weight: bold;
cursor: help;
}
.tooltip-icon:hover + .tooltip-text,
.tooltip-text:hover {
visibility: visible;
opacity: 1;
}
.tooltip-text {
visibility: hidden;
opacity: 0;
position: absolute;
bottom: 125%;
left: 50%;
transform: translateX(-50%);
background: #212529;
color: white;
padding: 8px 12px;
border-radius: 6px;
font-size: 0.8rem;
white-space: nowrap;
z-index: 100;
transition: opacity 0.2s;
}
.tooltip-text::after {
content: "";
position: absolute;
top: 100%;
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: #212529 transparent transparent transparent;
}
.impact-badge {
display: inline-flex;
align-items: center;
gap: 5px;
padding: 4px 12px;
border-radius: 20px;
font-size: 0.85rem;
font-weight: 500;
}
.impact-impacting {
background-color: rgba(220, 53, 69, 0.15);
color: var(--color-impacting);
border: 1px solid var(--color-impacting);
}
.impact-not-impacting {
background-color: rgba(230, 168, 23, 0.15);
color: #a37c00;
border: 1px solid var(--color-not-impacting);
}
.impact-not-deviation {
background-color: rgba(40, 167, 69, 0.15);
color: var(--color-not-deviation);
border: 1px solid var(--color-not-deviation);
}
.impact-needs-review {
background-color: rgba(108, 117, 125, 0.15);
color: var(--color-needs-review);
border: 1px solid var(--color-needs-review);
}
.impact-satisfied {
background-color: rgba(40, 167, 69, 0.15);
color: var(--color-not-deviation);
border: 1px solid var(--color-not-deviation);
}
.none-found-box {
border: 2px solid #fd7e14;
background-color: rgba(253, 126, 20, 0.1);
border-radius: 8px;
padding: 15px;
margin: 10px 0;
}
.none-found-header {
color: #d63300;
font-weight: 600;
margin-bottom: 10px;
}
.group-card {
border: 1px solid var(--color-border);
border-radius: 8px;
margin-bottom: 15px;
overflow: hidden;
}
.group-header {
background: #f1f3f4;
padding: 12px 15px;
font-weight: 600;
display: flex;
justify-content: space-between;
align-items: center;
}
.deviation-item {
padding: 12px 15px;
border-bottom: 1px solid var(--color-border);
}
.deviation-item:last-child {
border-bottom: none;
}
.deviation-name {
font-weight: 500;
color: #495057;
}
.deviation-msg {
font-size: 0.9rem;
color: var(--color-text-muted);
margin-bottom: 8px;
}
.cr-list {
list-style: none;
margin-top: 10px;
}
.cr-list li {
padding: 6px 0;
font-family: 'SF Mono', 'Consolas', monospace;
font-size: 0.85rem;
display: flex;
align-items: center;
gap: 8px;
}
.diff-card {
border: 1px solid var(--color-border);
border-radius: 8px;
margin-bottom: 20px;
overflow: hidden;
}
.diff-header {
background: #f1f3f4;
padding: 15px;
border-bottom: 1px solid var(--color-border);
}
.diff-header h3 {
font-size: 1.1rem;
margin-bottom: 8px;
}
.diff-meta {
font-size: 0.85rem;
color: var(--color-text-muted);
}
.diff-meta span {
display: block;
margin-bottom: 3px;
}
.diff-content {
padding: 15px;
}
.diff-section {
margin-bottom: 15px;
}
.diff-section h4 {
font-size: 0.9rem;
color: var(--color-text-muted);
margin-bottom: 8px;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.diff-lines {
font-family: 'SF Mono', 'Consolas', monospace;
font-size: 0.85rem;
background: #f8f9fa;
border-radius: 4px;
padding: 10px;
overflow: visible;
}
.diff-line {
padding: 3px 5px;
display: flex;
justify-content: space-between;
align-items: flex-start;
position: relative;
}
.diff-line.expected {
background-color: rgba(40, 167, 69, 0.15);
color: #155724;
border-left: 3px solid var(--color-not-deviation);
}
.diff-line.found {
background-color: rgba(220, 53, 69, 0.15);
color: #721c24;
border-left: 3px solid var(--color-impacting);
}
.diff-line span {
white-space: pre-wrap;
word-break: break-word;
}
.rule-tags-container {
display: flex;
gap: 5px;
flex-wrap: wrap;
margin-left: 10px;
flex-shrink: 0;
}
.rule-tag {
font-size: 0.75rem;
padding: 2px 8px;
border-radius: 3px;
white-space: nowrap;
cursor: help;
position: relative;
display: inline-block;
border: 1px solid;
}
.rule-tag.impact-impacting {
background: rgba(220, 53, 69, 0.1);
border-color: var(--color-impacting);
color: var(--color-impacting);
}
.rule-tag.impact-not-impacting {
background: rgba(230, 168, 23, 0.1);
border-color: var(--color-not-impacting);
color: #a37c00;
}
.rule-tag.impact-not-deviation {
background: rgba(40, 167, 69, 0.1);
border-color: var(--color-not-deviation);
color: var(--color-not-deviation);
}
.rule-tag.impact-needs-review {
background: rgba(108, 117, 125, 0.1);
border-color: var(--color-needs-review);
color: var(--color-needs-review);
}
.rule-tag .tooltip {
visibility: hidden;
opacity: 0;
position: fixed;
background-color: #333;
color: white;
padding: 10px 14px;
border-radius: 6px;
font-size: 0.85rem;
white-space: normal;
width: max-content;
max-width: 350px;
z-index: 10000;
box-shadow: 0 4px 12px rgba(0,0,0,0.3);
text-align: left;
line-height: 1.5;
pointer-events: none;
}
.rule-tag:hover .tooltip {
visibility: visible;
opacity: 1;
}
.diff-result {
background: #f8f9fa;
padding: 15px;
border-top: 1px solid var(--color-border);
}
.diff-result h4 {
margin-bottom: 10px;
}
.rules-list {
list-style: none;
}
.rules-list li {
padding: 5px 0;
font-size: 0.9rem;
}
.violation-card {
border: 1px solid var(--color-border);
border-radius: 8px;
margin-bottom: 15px;
overflow: hidden;
}
.violation-card.impact-impacting {
border-color: var(--color-impacting);
}
.violation-card.impact-impacting .violation-header {
background: rgba(220, 53, 69, 0.12);
border-left: 4px solid var(--color-impacting);
}
.violation-card.impact-not-impacting {
border-color: var(--color-not-impacting);
}
.violation-card.impact-not-impacting .violation-header {
background: rgba(230, 168, 23, 0.12);
border-left: 4px solid var(--color-not-impacting);
}
.violation-card.impact-not-deviation {
border-color: var(--color-not-deviation);
}
.violation-card.impact-not-deviation .violation-header {
background: rgba(40, 167, 69, 0.12);
border-left: 4px solid var(--color-not-deviation);
}
.violation-card.impact-needs-review {
border-color: var(--color-needs-review);
}
.violation-card.impact-needs-review .violation-header {
background: rgba(108, 117, 125, 0.12);
border-left: 4px solid var(--color-needs-review);
}
.violation-header {
padding: 15px;
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid var(--color-border);
}
.violation-body {
padding: 15px;
}
.matched-crs {
margin-top: 10px;
padding: 10px;
background: #f8f9fa;
border-radius: 4px;
}
.matched-crs h5 {
font-size: 0.85rem;
margin-bottom: 8px;
}
.matched-crs ul {
list-style: none;
font-family: 'SF Mono', 'Consolas', monospace;
font-size: 0.8rem;
}
.impact-summary-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
gap: 15px;
}
.impact-stat {
text-align: center;
padding: 20px;
border-radius: 8px;
border: 2px solid;
}