Skip to content

Commit

Permalink
fix(core): Display latest template in pipeline template list (#7145)
Browse files Browse the repository at this point in the history
  • Loading branch information
louisjimenez committed Jun 25, 2019
1 parent 456172b commit 745f0a1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/scripts/modules/core/src/domain/IPipelineTemplateV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface IPipelineTemplateV2 {
version?: string;
updateTs?: string;
digest?: string;
tag?: string;
}

interface IPipelineTemplateMetadataV2 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,10 @@ export class PipelineTemplateReader {
return API.one('pipelineTemplates')
.get()
.then((templates: IPipelineTemplateV2[]) => {
return templates.filter(({ schema }) => schema === 'v2');
return templates.filter(
({ digest, schema, tag }) =>
schema === 'v2' && tag === PipelineTemplateV2Service.defaultTag && typeof digest === 'undefined',
);
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export class PipelineTemplateV2Service {
}

private static schema = 'v2';
public static defaultTag = 'latest';

public static inheritedKeys: Set<InheritedItem> = new Set([
InheritedItem.Triggers,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,9 @@ export class CreatePipelineModal extends React.Component<ICreatePipelineModalPro
const config = {
...pipelineConfig,
...(preselectedTemplate
? PipelineTemplateV2Service.getPipelineTemplateConfigV2(preselectedTemplate.id)
? PipelineTemplateV2Service.getPipelineTemplateConfigV2(
`${preselectedTemplate.id}:${PipelineTemplateV2Service.defaultTag}`,
)
: PipelineTemplateReader.getPipelineTemplateConfig({
name: command.name,
application: application.name,
Expand Down

0 comments on commit 745f0a1

Please sign in to comment.