Skip to content

Commit

Permalink
fix(artifacts): Persist default artifact account in ExpectedArtifactM…
Browse files Browse the repository at this point in the history
…odal (spinnaker#6783)
  • Loading branch information
jkschneider authored and claymccoy committed Mar 29, 2019
1 parent 3519f6f commit ce12338
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions app/scripts/modules/core/src/artifact/react/ArtifactEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,21 @@ export class ArtifactEditor extends React.Component<IArtifactEditorProps> {
this.props.onArtifactEdit(artifact);
};

private defaultArtifactAccountIfNecessary(): void {
const { artifact, artifactAccounts } = this.props;
if (!artifact.artifactAccount && artifactAccounts.length > 0) {
this.onArtifactAccountChanged(artifactAccounts[0]);
}
}

public componentDidMount(): void {
this.defaultArtifactAccountIfNecessary();
}

public componentDidUpdate(): void {
this.defaultArtifactAccountIfNecessary();
}

public render(): React.ReactNode {
const { pipeline, artifact, artifactAccounts, onArtifactEdit, isDefault } = this.props;
const artifactAccount = artifactAccounts.find(acc => acc.name === artifact.artifactAccount) || artifactAccounts[0];
Expand Down

0 comments on commit ce12338

Please sign in to comment.