-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[O2B-913] Add infologger links (#1196)
* [O2B-913] Add infologger links * Fix linter * Simplify configuration controller
- Loading branch information
1 parent
03e08cf
commit 1a09b57
Showing
20 changed files
with
360 additions
and
109 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
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 |
---|---|---|
@@ -1,9 +1,26 @@ | ||
const { origin } = require('./httpConfig.js'); | ||
|
||
/** | ||
* Return the given origin with a different port | ||
* | ||
* @param {string} origin the origin to change port from | ||
* @param {number} port the new port to apply | ||
* @return {string} the new URL | ||
*/ | ||
const changeOriginPort = (origin, port) => origin.replace(/(\/\/[a-zA-Z0-9-.]+:)\d+/, (_, match) => `${match}${port}`); | ||
|
||
exports.services = { | ||
enableHousekeeping: process.env?.ENABLE_HOUSEKEEPING ?? false, | ||
aliEcsGUI: { | ||
url: process.env?.ALI_ECS_GUI_URL || origin.replace(/(\/\/[a-zA-Z0-9-.]+:)\d+/, (_, match) => `${match}8080`), | ||
url: process.env?.ALI_ECS_GUI_URL || changeOriginPort(origin, 8080), | ||
token: process.env?.ALI_ECS_GUI_TOKEN, | ||
}, | ||
infologger: { | ||
flp: { | ||
url: process.env?.FLP_INFOLOGGER_URL || changeOriginPort(origin, 8081), | ||
}, | ||
epn: { | ||
url: process.env?.EPN_INFOLOGGER_URL || null, | ||
}, | ||
}, | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* @license | ||
* Copyright CERN and copyright holders of ALICE O2. This software is | ||
* distributed under the terms of the GNU General Public License v3 (GPL | ||
* Version 3), copied verbatim in the file "COPYING". | ||
* | ||
* See http://alice-o2.web.cern.ch/license for full licensing information. | ||
* | ||
* In applying this license CERN does not waive the privileges and immunities | ||
* granted to it by virtue of its status as an Intergovernmental Organization | ||
* or submit itself to any jurisdiction. | ||
*/ | ||
|
||
const { CONFIGURATION: { FLP_INFOLOGGER_URL, EPN_INFOLOGGER_URL } } = window; | ||
|
||
/** | ||
* Format the infologger URLs (FLP and EPN) with specific filters | ||
* | ||
* @param {object} filter the filter to apply to infologger | ||
* @param {string} [filter.environmentId] the id of environment to filter on (partition) | ||
* @param {number} [filter.runNumber] the runNumber of the run to filter on | ||
* @return {{flp: (string|null), epn: (string|null)}} the infologger URLs (null if no infologger is configured for the given type) | ||
*/ | ||
export const getInfologgerLink = ({ environmentId, runNumber }) => { | ||
const queryObject = {}; | ||
if (environmentId) { | ||
queryObject.partition = { match: environmentId }; | ||
} | ||
|
||
if (runNumber) { | ||
queryObject.run = { match: runNumber }; | ||
} | ||
|
||
// eslint-disable-next-line require-jsdoc | ||
const formatUrl = (origin) => origin ? `${origin}?q=${JSON.stringify(queryObject)}` : null; | ||
|
||
return { | ||
flp: formatUrl(FLP_INFOLOGGER_URL), | ||
epn: formatUrl(EPN_INFOLOGGER_URL), | ||
}; | ||
}; |
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
32 changes: 32 additions & 0 deletions
32
lib/public/views/Environments/format/displayEnvironmentInfologgerLinks.js
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,32 @@ | ||
/** | ||
* @license | ||
* Copyright CERN and copyright holders of ALICE O2. This software is | ||
* distributed under the terms of the GNU General Public License v3 (GPL | ||
* Version 3), copied verbatim in the file "COPYING". | ||
* | ||
* See http://alice-o2.web.cern.ch/license for full licensing information. | ||
* | ||
* In applying this license CERN does not waive the privileges and immunities | ||
* granted to it by virtue of its status as an Intergovernmental Organization | ||
* or submit itself to any jurisdiction. | ||
*/ | ||
import { h } from '/js/src/index.js'; | ||
import { getInfologgerLink } from '../../../services/externalRouting/getInfologgerLink.js'; | ||
|
||
/** | ||
* Display links to infologger for the given environment's | ||
* | ||
* @param {Environment} environment the environment for which links need to be displayed | ||
* @return {vnode} the infologger links | ||
*/ | ||
export const displayEnvironmentInfologgerLinks = ({ id }) => { | ||
const { flp, epn } = getInfologgerLink({ environmentId: id }); | ||
|
||
return h( | ||
'.flex-row.btn-group', | ||
[ | ||
flp && h('a.btn', { href: flp }, 'FLP'), | ||
epn && h('a.btn', { href: epn }, 'EPN'), | ||
], | ||
); | ||
}; |
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
Oops, something went wrong.