-
Notifications
You must be signed in to change notification settings - Fork 900
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(netflix): allow user to pick commit for git trigger
- Loading branch information
1 parent
4f1ddc8
commit a6c7c51
Showing
14 changed files
with
362 additions
and
8 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
Empty file.
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
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
62 changes: 62 additions & 0 deletions
62
app/scripts/modules/netflix/ci/services/scm.read.service.ts
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,62 @@ | ||
import {IPromise, module} from 'angular'; | ||
|
||
import {Api, API_SERVICE} from 'core/api/api.service'; | ||
|
||
export interface IOrganization { | ||
id: string; | ||
displayName: string; | ||
} | ||
|
||
export interface IRepository { | ||
name: string; | ||
} | ||
|
||
export interface ICommit { | ||
id: string; | ||
displayId: string; | ||
message: string; | ||
author: {username: string, email: string}; | ||
authoredTs: number; | ||
} | ||
|
||
export interface IBranch { | ||
id: string; | ||
displayId: string; | ||
latestCommitId: string; | ||
'default': boolean; | ||
} | ||
|
||
export interface ITag { | ||
id: string; | ||
displayId: string; | ||
commitId: string; | ||
} | ||
|
||
export class ScmReadService { | ||
|
||
static get $inject() { return ['API']; } | ||
constructor(private API: Api) {} | ||
|
||
public getOrganizations(type = 'stash', limit = 1000): IPromise<IOrganization[]> { | ||
return this.API.all('scm', type).withParams({limit}).getList().then((r: any) => r.data); | ||
} | ||
|
||
public getRepositories(org: string, type = 'stash', limit = 1000): IPromise<IRepository[]> { | ||
return this.API.all('scm', type, 'orgs', org, 'repos').withParams({limit}).getList().then((r: any) => r.data); | ||
} | ||
|
||
public getCommits(org: string, repository: string, type = 'stash', limit = 250): IPromise<ICommit[]> { | ||
return this.API.all('scm', type, 'orgs', org, 'repos', repository, 'commits').withParams({limit}).getList().then((r: any) => r.data); | ||
} | ||
|
||
public getBranches(org: string, repository: string, type = 'stash', limit = 100): IPromise<IBranch[]> { | ||
return this.API.all('scm', type, 'orgs', org, 'repos', repository, 'branches').withParams({limit}).getList().then((r: any) => r.data); | ||
} | ||
|
||
public getTags(org: string, repository: string, type = 'stash', limit = 200): IPromise<ITag[]> { | ||
return this.API.all('scm', type, 'orgs', org, 'repos', repository, 'tags').withParams({limit}).getList().then((r: any) => r.data); | ||
} | ||
} | ||
|
||
export const SCM_SERVICE = 'spinnaker.netflix.ci.scm.read.service'; | ||
module(SCM_SERVICE, [API_SERVICE]).service('scmReader', ScmReadService); |
101 changes: 101 additions & 0 deletions
101
app/scripts/modules/netflix/ci/trigger/ci.trigger.handler.component.html
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,101 @@ | ||
<div ng-if="$ctrl.showOptions"> | ||
<div class="form-group"> | ||
<label class="col-md-4 sm-label-right">Build from</label> | ||
<div class="col-md-6"> | ||
<select class="form-control input-sm" | ||
ng-model="$ctrl.viewState.buildSource" | ||
ng-change="$ctrl.buildSourceChanged()" | ||
ng-options="option for option in $ctrl.buildSources"></select> | ||
</div> | ||
</div> | ||
<div class="form-group" ng-if="$ctrl.viewState.buildSource === 'branch'"> | ||
<label class="col-md-4 sm-label-right">Branch</label> | ||
<div class="col-md-6" ng-if="$ctrl.viewState.branches.loading"> | ||
<p class="form-control-static text-center"> | ||
<span class="glyphicon glyphicon-asterisk glyphicon-spinning"></span> | ||
</p> | ||
</div> | ||
<div class="col-md-6" ng-if="$ctrl.viewState.branches.loadError">Error loading branches!</div> | ||
<div class="col-md-6" ng-if="!$ctrl.viewState.branches.loadError"> | ||
<ui-select class="form-control input-sm" | ||
ng-model="$ctrl.command.trigger.branch" | ||
on-select="$ctrl.branchSelected($item)" | ||
ng-if="$ctrl.branches.length"> | ||
<ui-select-match placeholder="Select..."> | ||
<span> | ||
<strong>{{$select.selected.displayId}}</strong> | ||
<span ng-if="$select.selected.default">(default branch)</span> | ||
</span> | ||
</ui-select-match> | ||
<ui-select-choices repeat="branch.displayId as branch in $ctrl.branches | filter: $select.search"> | ||
<div> | ||
<strong>{{branch.displayId}}</strong> | ||
<span ng-if="branch.default">(default branch)</span> | ||
<div> | ||
Latest commit: {{branch.latestCommitId}} | ||
</div> | ||
</div> | ||
</ui-select-choices> | ||
</ui-select> | ||
</div> | ||
</div> | ||
|
||
<div class="form-group" ng-if="$ctrl.viewState.buildSource === 'commit'"> | ||
<label class="col-md-4 sm-label-right">Commit</label> | ||
<div class="col-md-6" ng-if="$ctrl.viewState.commits.loading"> | ||
<p class="form-control-static text-center"> | ||
<span class="glyphicon glyphicon-asterisk glyphicon-spinning"></span> | ||
</p> | ||
</div> | ||
<div class="col-md-6" ng-if="$ctrl.viewState.commits.loadError">Error loading commits!</div> | ||
<div class="col-md-6" ng-if="!$ctrl.viewState.commits.loadError"> | ||
<ui-select class="form-control input-sm" | ||
ng-model="$ctrl.command.trigger.hash" | ||
ng-if="$ctrl.commits.length"> | ||
<ui-select-match placeholder="Select..."> | ||
<span> | ||
<strong>{{$select.selected.displayId}}</strong> | ||
({{$select.selected.author.username}}) | ||
<span ng-bind="$select.selected.message"></span> | ||
</span> | ||
</ui-select-match> | ||
<ui-select-choices repeat="commit.id as commit in $ctrl.commits | filter: $select.search"> | ||
<div> | ||
<strong>{{commit.displayId}}</strong> ({{commit.author.username}}) | ||
<div> | ||
<span ng-bind="commit.message"></span> | ||
<div class="text-right">{{commit.authoredTs | timestamp}}</div> | ||
</div> | ||
</div> | ||
</ui-select-choices> | ||
</ui-select> | ||
</div> | ||
</div> | ||
|
||
<div class="form-group" ng-if="$ctrl.viewState.buildSource === 'tag'"> | ||
<label class="col-md-4 sm-label-right">Tag</label> | ||
<div class="col-md-6" ng-if="$ctrl.viewState.tags.loading"> | ||
<p class="form-control-static text-center"> | ||
<span class="glyphicon glyphicon-asterisk glyphicon-spinning"></span> | ||
</p> | ||
</div> | ||
<div class="col-md-6" ng-if="$ctrl.viewState.tags.loadError">Error loading tags!</div> | ||
<div class="col-md-6" ng-if="!$ctrl.viewState.tags.loadError"> | ||
<ui-select class="form-control input-sm" | ||
ng-model="$ctrl.command.trigger.hash" | ||
ng-if="$ctrl.tags.length"> | ||
<ui-select-match placeholder="Select..."> | ||
<span> | ||
<strong>{{$select.selected.displayId}}</strong> | ||
<span ng-if="$select.selected.default">(default branch)</span> | ||
</span> | ||
</ui-select-match> | ||
<ui-select-choices repeat="tag.commitId as tag in $ctrl.tags | filter: $select.search"> | ||
<div> | ||
<strong>{{tag.displayId}}</strong> | ||
</div> | ||
</ui-select-choices> | ||
</ui-select> | ||
</div> | ||
</div> | ||
</div> |
Oops, something went wrong.