Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3484 from icfantv/commit_diffs
feat(aws/netflix): add diff view to ASG details
- Loading branch information
Showing
13 changed files
with
359 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<div modal-page> | ||
<modal-close (dismiss)="$ctrl.close()"></modal-close> | ||
<div class="modal-header has-sticky-headers"> | ||
<h3>Changes to {{$ctrl.nameItem.name}}</h3> | ||
</div> | ||
<div class="modal-body" style="max-height: 800px; overflow-y: scroll;" sticky-headers> | ||
<div ng-if="$ctrl.commits.length"> | ||
<div class="component-heading" sticky-header> | ||
<h4>Commits</h4> | ||
</div> | ||
<div class="component-body"> | ||
<commit-history commits="$ctrl.commits"></commit-history> | ||
</div> | ||
</div> | ||
<div ng-if="$ctrl.hasJarChanges"> | ||
<div class="component-heading" sticky-header> | ||
<h4>JAR Changes</h4> | ||
</div> | ||
<div class="component-body"> | ||
<jar-diff jar-diffs="$ctrl.jarDiffs"></jar-diff> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="modal-footer"> | ||
<button class="btn btn-primary" ng-click="$ctrl.close()">Close</button> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import {module} from 'angular'; | ||
|
||
import {IComponentOptions} from 'angular'; | ||
|
||
export interface ICommit { | ||
authorDisplayName: string; | ||
commitUrl: string; | ||
displayId: string; | ||
id: string; | ||
message: string; | ||
timestamp: number; | ||
} | ||
|
||
class CommitHistoryComponent implements IComponentOptions { | ||
public bindings: any = { | ||
commits: '<' | ||
}; | ||
public template = ` | ||
<div ng-if="$ctrl.commits && $ctrl.commits.length"> | ||
<table class="table table-condensed"> | ||
<tr><th>Date</th><th>Commit</th><th>Message</th><th>Author</th></tr> | ||
<tr ng-repeat="commit in $ctrl.commits"> | ||
<td>{{commit.timestamp | date:'MM/dd'}}</td> | ||
<td><a target="_blank" href="{{commit.commitUrl}}">{{commit.displayId}}</a></td> | ||
<td>{{commit.message | limitTo: 50}}</td> | ||
<td>{{commit.authorDisplayName || 'N/A'}}</td> | ||
</tr> | ||
</table> | ||
</div> | ||
`; | ||
} | ||
|
||
export const COMMIT_HISTORY_COMPONENT = 'spinnaker.diffs.commit.history.component'; | ||
module(COMMIT_HISTORY_COMPONENT, []).component('commitHistory', new CommitHistoryComponent()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import {module} from 'angular'; | ||
|
||
import {VIEW_CHANGES_LINK} from './viewChangesLink.component'; | ||
|
||
export const CORE_DIFF_MODULE = 'spinnaker.diff.module'; | ||
module(CORE_DIFF_MODULE, [VIEW_CHANGES_LINK]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import {IComponentController, IComponentOptions, module} from 'angular'; | ||
|
||
export interface IJarDiffItem { | ||
displayDiff: string; | ||
} | ||
|
||
export interface IJarDiff { | ||
[key: string]: IJarDiffItem[]; | ||
added: IJarDiffItem[]; | ||
downgraded: IJarDiffItem[]; | ||
duplicates: IJarDiffItem[]; | ||
removed: IJarDiffItem[]; | ||
unchanged: IJarDiffItem[]; | ||
unknown: IJarDiffItem[]; | ||
upgraded: IJarDiffItem[]; | ||
} | ||
|
||
class JarDiffComponentController implements IComponentController { | ||
|
||
public jarDiffs: IJarDiff; | ||
public hasJarDiffs = false; | ||
|
||
public $onInit() { | ||
this.hasJarDiffs = Object.keys(this.jarDiffs).some((key: string) => this.jarDiffs[key].length > 0); | ||
} | ||
|
||
public $onChanges() { | ||
this.$onInit(); | ||
} | ||
} | ||
|
||
class JarDiffComponent implements IComponentOptions { | ||
public bindings: any = { | ||
jarDiffs: '<' | ||
}; | ||
public controller: any = JarDiffComponentController; | ||
public template = ` | ||
<div ng-if="$ctrl.hasJarDiffs"> | ||
<table class="table table-condensed no-lines" ng-if="$ctrl.jarDiffs.added && $ctrl.jarDiffs.added.length"> | ||
<tr><th>Added</th></tr> | ||
<tr ng-repeat="jar in $ctrl.jarDiffs.added"> | ||
<td>{{jar.displayDiff}}</td> | ||
</tr> | ||
</table> | ||
<table class="table table-condensed no-lines" ng-if="$ctrl.jarDiffs.removed && $ctrl.jarDiffs.removed.length"> | ||
<tr><th>Removed</th></tr> | ||
<tr ng-repeat="jar in $ctrl.jarDiffs.removed"> | ||
<td>{{jar.displayDiff}}</td> | ||
</tr> | ||
</table> | ||
<table class="table table-condensed no-lines" ng-if="$ctrl.jarDiffs.upgraded && $ctrl.jarDiffs.upgraded.length"> | ||
<tr><th>Upgraded</th></tr> | ||
<tr ng-repeat="jar in $ctrl.jarDiffs.upgraded"> | ||
<td>{{jar.displayDiff}}</td> | ||
</tr> | ||
</table> | ||
<table class="table table-condensed no-lines" ng-if="$ctrl.jarDiffs.downgraded && $ctrl.jarDiffs.downgraded.length"> | ||
<tr><th>Downgraded</th></tr> | ||
<tr ng-repeat="jar in $ctrl.jarDiffs.downgraded"> | ||
<td>{{jar.displayDiff}}</td> | ||
</tr> | ||
</table> | ||
<table class="table table-condensed no-lines" ng-if="$ctrl.jarDiffs.duplicates && $ctrl.jarDiffs.duplicates.length"> | ||
<tr><th>Duplicates</th></tr> | ||
<tr ng-repeat="jar in $ctrl.jarDiffs.duplicates"> | ||
<td>{{jar.displayDiff}}</td> | ||
</tr> | ||
</table> | ||
<table class="table table-condensed no-lines" ng-if="$ctrl.jarDiffs.unknown && $ctrl.jarDiffs.unknown.length"> | ||
<tr><th>Unknown</th></tr> | ||
<tr ng-repeat="jar in $ctrl.jarDiffs.unknown"> | ||
<td>{{jar.displayDiff}}</td> | ||
</tr> | ||
</table> | ||
</div> | ||
`; | ||
} | ||
|
||
export const JAR_DIFF_COMPONENT = 'spinnaker.diffs.jar.diff.component'; | ||
module(JAR_DIFF_COMPONENT, []).component('jarDiff', new JarDiffComponent()); |
Oops, something went wrong.