Skip to content

Commit

Permalink
Fix external links
Browse files Browse the repository at this point in the history
  • Loading branch information
martinboulais committed Dec 9, 2024
1 parent abc0770 commit d9a1405
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const aliEcsEnvironmentLinkComponent = (environmentId) => {
const aliEcsEnvironmentUrl = getAliEcsUrl(environmentId);
return aliEcsEnvironmentUrl
? h(
'a',
'a.external-link',
{ target: '_blank', href: aliEcsEnvironmentUrl },
'ECS',
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { h } from '/js/src/index.js';
* @param {string} label The label for the link.
* @return {Component} The infologger link component
*/
const infoLoggerLink = (url, label) => h('a', { href: url, target: '_blank' }, label);
const infoLoggerLink = (url, label) => h('a.external-link', { href: url, target: '_blank' }, label);

Check warning on line 24 in lib/public/components/common/externalLinks/infologgerLinksComponents.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/externalLinks/infologgerLinksComponents.js#L24

Added line #L24 was not covered by tests

/**
* Returns an FLP infologger link component for the given infologger filter and label.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ export const qcGuiLinkComponent = (run) => {
return null;
}

return h('a', { href: qcGuiLinkUrl, target: '_blank' }, 'QCG');
return h('a.external-link', { href: qcGuiLinkUrl, target: '_blank' }, 'QCG');

Check warning on line 30 in lib/public/components/common/externalLinks/qcGuiLinkComponent.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/externalLinks/qcGuiLinkComponent.js#L30

Added line #L30 was not covered by tests
};
22 changes: 12 additions & 10 deletions lib/public/views/Runs/Details/runDetailsComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,16 +140,18 @@ export const runDetailsComponent = (runDetailsModel, router) => runDetailsModel.
]),
),
]),
h('h3.flex-row.w-100.g2.items-baseline.mb3', [
environmentLink && [h('', 'Environment: '), environmentLink],
(flpInfologgerLink || epnInfologgerLink) && [
h('', 'Infologger: '),
flpInfologgerLink && h('.external-links', flpInfologgerLink),
epnInfologgerLink && h('.external-links', epnInfologgerLink),
],
[h('.external-links', qcGuiLinkComponent(run))],
isRunConsideredRunning(run) && aliEcsEnvironmentLink && [h('.external-links', aliEcsEnvironmentLink)],
].filter((elements) => elements).flatMap((elements) => ['-', ...elements]).slice(1)),
h(
'h3.flex-row.w-100.g2.items-baseline.mb3',
[
environmentLink && [h('', 'Environment: '), environmentLink],
(flpInfologgerLink || epnInfologgerLink) && [h('', 'Infologger: '), flpInfologgerLink, epnInfologgerLink],

Check warning on line 147 in lib/public/views/Runs/Details/runDetailsComponent.js

View check run for this annotation

Codecov / codecov/patch

lib/public/views/Runs/Details/runDetailsComponent.js#L146-L147

Added lines #L146 - L147 were not covered by tests
[qcGuiLinkComponent(run)],
isRunConsideredRunning(run) && aliEcsEnvironmentLink && [aliEcsEnvironmentLink],

Check warning on line 149 in lib/public/views/Runs/Details/runDetailsComponent.js

View check run for this annotation

Codecov / codecov/patch

lib/public/views/Runs/Details/runDetailsComponent.js#L149

Added line #L149 was not covered by tests
]
.filter((elements) => elements && elements.filter((item) => item).length)
.flatMap((elements) => ['-', ...elements])

Check warning on line 152 in lib/public/views/Runs/Details/runDetailsComponent.js

View check run for this annotation

Codecov / codecov/patch

lib/public/views/Runs/Details/runDetailsComponent.js#L151-L152

Added lines #L151 - L152 were not covered by tests
.slice(1),
),
errorAlert(runDetailsModel.updateErrors),
h('.flex-column.g2', [
h(PanelComponent, [
Expand Down
9 changes: 4 additions & 5 deletions test/public/runs/detail.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -478,12 +478,11 @@ module.exports = () => {
await waitForNavigation(page, () => pressElement(page, 'a#run-overview'));
await waitForNavigation(page, () => pressElement(page, '#row108 a'));

await page.waitForSelector('.external-links');
await expectLink(page, '.external-links a', {
await expectLink(page, 'a.external-link', {
innerText: 'FLP',
href: 'http://localhost:8081/?q={%22run%22:{%22match%22:%22108%22},%22severity%22:{%22in%22:%22W%20E%20F%22}}',
});
await expectLink(page, '.external-links:nth-of-type(3) a', {
await expectLink(page, 'a.external-link:nth-of-type(2)', {
innerText: 'QCG',
href: 'http://localhost:8082/?page=layoutShow&runNumber=108&definition=PHYSICS&pdpBeamType=pp&runType=PHYSICS',
});
Expand All @@ -492,7 +491,7 @@ module.exports = () => {
it('should display links to environment in ECS if run is running', async () => {
await goToRunDetails(page, 104);

await page.waitForSelector('.external-links:nth-of-type(3) a', { hidden: true, timeout: 250 });
await page.waitForSelector('a.external-link:nth-of-type(3)', { hidden: true, timeout: 250 });

// Create running run
await goToRunDetails(page, '1010');
Expand All @@ -501,7 +500,7 @@ module.exports = () => {
await page.waitForSelector('.alert.alert-danger', { hidden: true, timeout: 300 });
await expectInnerText(page, '#runDurationValue', 'RUNNING');

await expectLink(page, '.external-links:nth-of-type(5) a', {
await expectLink(page, 'a.external-link:nth-of-type(4)', {
href: 'http://localhost:8080/?page=environment&id=CmCvjNbg',
innerText: 'ECS',
});
Expand Down

0 comments on commit d9a1405

Please sign in to comment.