Skip to content

Commit

Permalink
fix(ui): hide diff when audit is too big (#4834)
Browse files Browse the repository at this point in the history
  • Loading branch information
richardlt authored and yesnault committed Dec 20, 2019
1 parent f53d196 commit 9dd31c2
Show file tree
Hide file tree
Showing 4 changed files with 1,432 additions and 1,427 deletions.
6 changes: 4 additions & 2 deletions ui/src/app/shared/diff/item/diff.item.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ export class DiffItemComponent implements OnInit, OnChanges {
if (this.original || this.updated) {
this.refresh();
}
this.codeMirrorConfig.mode = this.type;
if (this.codeMirrorConfig) {
this.codeMirrorConfig.mode = this.type;
}
}

refresh() {
Expand All @@ -126,7 +128,7 @@ export class DiffItemComponent implements OnInit, OnChanges {
} catch (e) { }
}

let diff = JsDiff.diffLines(original, updated);
let diff = JsDiff.diffLines(original + '', updated + '');

if (!Array.isArray(diff)) {
return;
Expand Down
5 changes: 3 additions & 2 deletions ui/src/app/shared/diff/list/diff.list.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
<button class="ui button" (click)="setSplit()" [class.active]="mode === 'split'">{{'common_split'
| translate}}</button>
</div>
<ng-container *ngFor="let i of items">
<ng-container *ngFor="let i of items;let idx = index">
<h4 class="ui top attached header">
<ng-container *ngIf="i.name">{{i.name}}</ng-container>
<ng-container *ngIf="i.translate">{{i.translate | translate: i.translateData}}</ng-container>
</h4>
<div class="ui attached segment">
<app-diff-item [mode]="mode" [type]="i.type" [original]="i.before" [updated]="i.after"></app-diff-item>
<app-diff-item *ngIf="idx < 10" [mode]="mode" [type]="i.type" [original]="i.before" [updated]="i.after"></app-diff-item>
<ng-container *ngIf="idx >= 10">{{'common_diff_to_much_item' | translate}}</ng-container>
</div>
</ng-container>
Loading

0 comments on commit 9dd31c2

Please sign in to comment.