-
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(gce): Support new artifact model for deploy SG (#7178)
- Loading branch information
Jammy Louie
committed
Jul 4, 2019
1 parent
c93b4d0
commit ecb2dd1
Showing
9 changed files
with
183 additions
and
24 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
116 changes: 116 additions & 0 deletions
116
...ripts/modules/core/src/pipeline/config/triggers/artifacts/custom/CustomArtifactEditor.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,116 @@ | ||
import * as React from 'react'; | ||
import { cloneDeep, extend } from 'lodash'; | ||
|
||
import { ArtifactTypePatterns } from 'core/artifact'; | ||
import { IArtifactEditorProps, IArtifactKindConfig } from 'core/domain'; | ||
import { StageConfigField } from 'core/pipeline'; | ||
import { SpelText } from 'core/widgets'; | ||
|
||
import { ArtifactEditor } from '../ArtifactEditor'; | ||
import { singleFieldArtifactEditor } from '../singleFieldArtifactEditor'; | ||
|
||
const TYPE = 'custom/object'; | ||
|
||
export const CustomMatch: IArtifactKindConfig = { | ||
label: 'Custom', | ||
typePattern: ArtifactTypePatterns.CUSTOM_OBJECT, | ||
type: TYPE, | ||
description: 'A custom-defined artifact.', | ||
key: 'custom', | ||
isDefault: false, | ||
isMatch: true, | ||
editCmp: singleFieldArtifactEditor('name', TYPE, 'Reference', '', ''), | ||
}; | ||
|
||
export const CustomDefault: IArtifactKindConfig = { | ||
label: 'Custom', | ||
typePattern: ArtifactTypePatterns.CUSTOM_OBJECT, | ||
type: TYPE, | ||
description: 'A custom-defined artifact.', | ||
key: 'default.custom', | ||
isDefault: true, | ||
isMatch: false, | ||
editCmp: class extends ArtifactEditor { | ||
constructor(props: IArtifactEditorProps) { | ||
super(props, TYPE); | ||
} | ||
|
||
private onTypeChanged = (type: string) => { | ||
this.updateArtifact({ type }); | ||
}; | ||
|
||
private onNameChanged = (name: string) => { | ||
this.updateArtifact({ name }); | ||
}; | ||
|
||
private onVersionChanged = (version: string) => { | ||
this.updateArtifact({ version }); | ||
}; | ||
|
||
private onLocationChanged = (location: string) => { | ||
this.updateArtifact({ location }); | ||
}; | ||
|
||
private onReferenceChanged = (reference: string) => { | ||
this.updateArtifact({ reference }); | ||
}; | ||
|
||
private updateArtifact = (changes: any) => { | ||
const clonedArtifact = cloneDeep(this.props.artifact); | ||
extend(clonedArtifact, changes); | ||
this.props.onChange(clonedArtifact); | ||
}; | ||
|
||
public render() { | ||
return ( | ||
<> | ||
<StageConfigField label="Type"> | ||
<SpelText | ||
placeholder="" | ||
value={this.props.artifact.type} | ||
onChange={this.onTypeChanged} | ||
pipeline={this.props.pipeline} | ||
docLink={true} | ||
/> | ||
</StageConfigField> | ||
<StageConfigField label="Name"> | ||
<SpelText | ||
placeholder="" | ||
value={this.props.artifact.name} | ||
onChange={this.onNameChanged} | ||
pipeline={this.props.pipeline} | ||
docLink={true} | ||
/> | ||
</StageConfigField> | ||
<StageConfigField label="Version"> | ||
<SpelText | ||
placeholder="" | ||
value={this.props.artifact.version} | ||
onChange={this.onVersionChanged} | ||
pipeline={this.props.pipeline} | ||
docLink={true} | ||
/> | ||
</StageConfigField> | ||
<StageConfigField label="Location"> | ||
<SpelText | ||
placeholder="" | ||
value={this.props.artifact.location} | ||
onChange={this.onLocationChanged} | ||
pipeline={this.props.pipeline} | ||
docLink={true} | ||
/> | ||
</StageConfigField> | ||
<StageConfigField label="Reference"> | ||
<SpelText | ||
placeholder="" | ||
value={this.props.artifact.reference} | ||
onChange={this.onReferenceChanged} | ||
pipeline={this.props.pipeline} | ||
docLink={true} | ||
/> | ||
</StageConfigField> | ||
</> | ||
); | ||
} | ||
}, | ||
}; |
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