Skip to content

Commit

Permalink
fix: display of tags on job/pipeline template details page (#1288)
Browse files Browse the repository at this point in the history
  • Loading branch information
y-oksaku authored Dec 10, 2024
1 parent 9c3963f commit ff5b06d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 12 deletions.
18 changes: 7 additions & 11 deletions app/templates/job/detail/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,14 @@ export default Route.extend(AuthenticatedRouteMixin, {
this.router.transitionTo('/404');
}

templateTagData.forEach(tagObj => {
[templateData, templateDataFiltered].forEach(verPayload => {
const taggedVerObj = verPayload.find(
verObj => verObj.version === tagObj.version
);
[...templateData, ...templateDataFiltered].forEach(template => {
const tags = templateTagData.filter(
tag => template.version === tag.version
);

if (taggedVerObj) {
taggedVerObj.tag = taggedVerObj.tag
? `${taggedVerObj.tag} ${tagObj.tag}`
: tagObj.tag;
}
});
if (!template.tag) {
template.tag = tags.map(tag => tag.tag).join(' ');
}
});

this.setProperties({
Expand Down
13 changes: 12 additions & 1 deletion app/templates/pipeline/detail/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,12 @@ export default class TemplatesPipelineDetailController extends Controller {
}

get filteredTemplates() {
const { pipelineTemplateVersions, pipelineTemplateTags } = this.model;
const { startTime, endTime } = this;
const startTimeInDate = new Date(startTime);
const endTimeInDate = new Date(endTime);

let filteredVersions = this.model.pipelineTemplateVersions.filter(v => {
const filteredVersions = pipelineTemplateVersions.filter(v => {
// TODO: polyfill pipeline template metrics data
v.metrics = {
jobs: { count: '' },
Expand All @@ -156,6 +157,16 @@ export default class TemplatesPipelineDetailController extends Controller {
);
});

filteredVersions.forEach(template => {
const tags = pipelineTemplateTags.filter(
tag => template.version === tag.version
);

if (!template.tag) {
template.tag = tags.map(tag => tag.tag).join(' ');
}
});

return filteredVersions;
}

Expand Down
4 changes: 4 additions & 0 deletions tests/acceptance/pipeline-template-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -431,5 +431,9 @@ module('Acceptance | pipeline template', function (hooks) {
assert
.dom('div.parameters > span.value > ul > li > span.value')
.includesText('value1');

assert
.dom('table.table td div.version-cell')
.includesText('1.0.3 - latest');
});
});

0 comments on commit ff5b06d

Please sign in to comment.