-
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(core): Add support for an Artifactory Trigger (#6664)
Co-Authored-By: Ria Stein <eleftheria.kousathana@gmail.com>
- Loading branch information
1 parent
bc2bf43
commit 35e82ac
Showing
6 changed files
with
96 additions
and
1 deletion.
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
67 changes: 67 additions & 0 deletions
67
...cripts/modules/core/src/pipeline/config/triggers/artifactory/ArtifactoryTriggerConfig.tsx
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,67 @@ | ||
import * as React from 'react'; | ||
import Select, { Option } from 'react-select'; | ||
|
||
import { ITriggerConfigProps } from '@spinnaker/core'; | ||
import { IArtifactoryTrigger } from 'core/domain/ITrigger'; | ||
import { ArtifactoryReaderService } from './artifactoryReader.service'; | ||
|
||
export interface IArtifactoryTriggerConfigProps extends ITriggerConfigProps { | ||
trigger: IArtifactoryTrigger; | ||
} | ||
|
||
export interface IArtifactoryTriggerConfigState { | ||
artifactorySearchNames: string[]; | ||
} | ||
|
||
export class ArtifactoryTriggerConfig extends React.Component< | ||
IArtifactoryTriggerConfigProps, | ||
IArtifactoryTriggerConfigState | ||
> { | ||
constructor(props: IArtifactoryTriggerConfigProps) { | ||
super(props); | ||
this.state = { | ||
artifactorySearchNames: [], | ||
}; | ||
} | ||
|
||
public componentDidMount() { | ||
ArtifactoryReaderService.getArtifactoryNames().then((names: string[]) => { | ||
this.setState({ | ||
artifactorySearchNames: names, | ||
}); | ||
}); | ||
} | ||
|
||
private artifactorySearchNameChanged = (option: Option<string>) => { | ||
const searchName = option.value; | ||
Object.assign(this.props.trigger, { artifactorySearchName: searchName }); | ||
this.props.fieldUpdated(); | ||
this.setState({}); | ||
}; | ||
|
||
public render() { | ||
const { trigger } = this.props; | ||
const { artifactorySearchNames } = this.state; | ||
const { artifactorySearchName } = trigger; | ||
return ( | ||
<div className="sp-formItem"> | ||
<div className="sp-formItem__left"> | ||
<div className="sp-formLabel">Artifactory Name</div> | ||
</div> | ||
<div className="sp-formItem__right"> | ||
<div className="sp-form"> | ||
<span className="field"> | ||
<Select | ||
value={artifactorySearchName} | ||
placeholder="Select Artifactory name" | ||
onChange={this.artifactorySearchNameChanged} | ||
options={artifactorySearchNames.map((name: string) => ({ label: name, value: name }))} | ||
clearable={false} | ||
/> | ||
</span> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...cripts/modules/core/src/pipeline/config/triggers/artifactory/artifactoryReader.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,11 @@ | ||
import { IPromise } from 'angular'; | ||
|
||
import { API } from 'core/api/ApiService'; | ||
|
||
export class ArtifactoryReaderService { | ||
public static getArtifactoryNames(): IPromise<string[]> { | ||
return API.one('artifactory') | ||
.one('names') | ||
.get(); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
app/scripts/modules/core/src/pipeline/config/triggers/artifactory/artifactoryTrigger.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,10 @@ | ||
import { ArtifactoryTriggerConfig } from './ArtifactoryTriggerConfig'; | ||
import { Registry } from '@spinnaker/core'; | ||
|
||
Registry.pipeline.registerTrigger({ | ||
label: 'Artifactory', | ||
description: 'Executes the pipeline on an Artifactory repo update', | ||
key: 'artifactory', | ||
component: ArtifactoryTriggerConfig, | ||
validators: [], | ||
}); |
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