-
Notifications
You must be signed in to change notification settings - Fork 903
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(provider/appengine): enable artifacts as config files (#5888)
- Loading branch information
Scott
authored
Oct 24, 2018
1 parent
c6a5937
commit 0a6d3f9
Showing
14 changed files
with
250 additions
and
37 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
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
4 changes: 4 additions & 0 deletions
4
app/scripts/modules/core/src/artifact/IArtifactAccountPair.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,4 @@ | ||
export interface IArtifactAccountPair { | ||
id: string; | ||
account: string; | ||
} |
75 changes: 75 additions & 0 deletions
75
app/scripts/modules/core/src/artifact/NgAppengineConfigArtifactDelegate.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,75 @@ | ||
import { IScope } from 'angular'; | ||
import { get } from 'lodash'; | ||
import { | ||
ExpectedArtifactService, | ||
Registry, | ||
IExpectedArtifact, | ||
IArtifactAccount, | ||
IArtifactSource, | ||
IExpectedArtifactSelectorViewControllerDelegate, | ||
IStage, | ||
IPipeline, | ||
} from 'core'; | ||
import { ExpectedArtifactSelectorViewControllerAngularDelegate } from './ExpectedArtifactSelectorViewControllerAngularDelegate'; | ||
|
||
export class NgAppengineConfigArtifactDelegate | ||
extends ExpectedArtifactSelectorViewControllerAngularDelegate<IArtifactSource<IStage | IPipeline>> | ||
implements IExpectedArtifactSelectorViewControllerDelegate { | ||
public expectedArtifacts: IExpectedArtifact[]; | ||
public requestingNew = false; | ||
|
||
private getStage() { | ||
return get(this, 'artifact.$scope.command.viewState.stage', null); | ||
} | ||
|
||
private getPipeline() { | ||
return get(this, 'artifact.$scope.command.viewState.pipeline', null); | ||
} | ||
|
||
constructor(private artifact: { $scope: IScope; id: string; account: string }) { | ||
super(artifact.$scope); | ||
this.refreshExpectedArtifacts(); | ||
this.sources = ExpectedArtifactService.sourcesForPipelineStage(() => this.getPipeline(), this.getStage()); | ||
this.kinds = Registry.pipeline.getArtifactKinds().filter(a => a.isMatch); | ||
} | ||
|
||
public setAccounts = (accounts: any) => { | ||
this.accounts = [...accounts]; | ||
}; | ||
|
||
public getExpectedArtifacts(): IExpectedArtifact[] { | ||
return ExpectedArtifactService.getExpectedArtifactsAvailableToStage(this.getStage(), this.getPipeline()); | ||
} | ||
|
||
public getSelectedExpectedArtifact(): IExpectedArtifact { | ||
return this.expectedArtifacts.find(ea => ea.id === this.artifact.id); | ||
} | ||
|
||
public getSelectedAccount(): IArtifactAccount { | ||
return this.accounts.find(a => a.name === this.artifact.account); | ||
} | ||
|
||
public setSelectedExpectedArtifact(e: IExpectedArtifact): void { | ||
this.artifact.id = e.id; | ||
this.requestingNew = false; | ||
this.scopeApply(); | ||
} | ||
|
||
public setSelectedArtifactAccount(a: IArtifactAccount): void { | ||
if (a == null) { | ||
this.artifact.account = ''; | ||
} else { | ||
this.artifact.account = a.name; | ||
} | ||
this.scopeApply(); | ||
} | ||
|
||
public createArtifact(): void { | ||
this.requestingNew = true; | ||
this.scopeApply(); | ||
} | ||
|
||
public refreshExpectedArtifacts(): void { | ||
this.expectedArtifacts = this.getExpectedArtifacts(); | ||
} | ||
} |
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
Oops, something went wrong.