Skip to content

Commit

Permalink
delint
Browse files Browse the repository at this point in the history
Signed-off-by: Yuri Shkuro <github@ysh.us>
  • Loading branch information
yurishkuro committed Nov 11, 2023
1 parent caf070d commit ead543d
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions packages/jaeger-ui/src/utils/config/get-config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ import memoizeOne from 'memoize-one';
import processDeprecation from './process-deprecation';
import defaultConfig, { deprecations, mergeFields } from '../../constants/default-config';

let haveWarnedFactoryFn = false;
let haveWarnedDeprecations = false;

/**
* Merge the embedded config from the query service (if present) with the
* default config from `../../constants/default-config`.
Expand All @@ -34,18 +31,15 @@ const getConfig = memoizeOne(function getConfig() {
}
// check for deprecated config values
if (Array.isArray(deprecations)) {
deprecations.forEach(deprecation => processDeprecation(embedded, deprecation, !haveWarnedDeprecations));
haveWarnedDeprecations = true;
deprecations.forEach(deprecation => processDeprecation(embedded, deprecation, true));
}
const rv = { ...defaultConfig, ...embedded };
// mergeFields config values should be merged instead of fully replaced
const keys = mergeFields;
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
mergeFields.forEach(key => {
if (embedded && typeof embedded[key] === 'object' && embedded[key] !== null) {
rv[key] = { ...defaultConfig[key], ...embedded[key] };
}
}
});
return { ...rv, storageCapabilities: capabilities };
});

Expand All @@ -62,7 +56,7 @@ function getUiConfig() {
function getCapabilities() {
const getter = window.getJaegerStorageCapabilities;
const capabilities = typeof getter === 'function' ? getter() : null;
return capabilities ? capabilities : defaultConfig.storageCapabilities;
return capabilities ?? defaultConfig.storageCapabilities;
}

export default getConfig;
Expand Down

0 comments on commit ead543d

Please sign in to comment.