Skip to content

Commit

Permalink
Update various variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
backspace committed Apr 22, 2021
1 parent c1a7b48 commit d6fc44b
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions ui/app/components/global-search/control.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ export default class GlobalSearchControl extends Component {

const allJobResults = results.Matches.jobs || [];
const allNodeResults = results.Matches.nodes || [];
const allAllocResults = results.Matches.allocs || [];
const allGroupResults = results.Matches.groups || [];
const allPluginResults = results.Matches.plugins || [];
const allAllocationResults = results.Matches.allocs || [];
const allTaskGroupResults = results.Matches.groups || [];
const allCSIPluginResults = results.Matches.plugins || [];

const jobResults = allJobResults.slice(0, MAXIMUM_RESULTS).map(({ ID: name, Scope: [ namespace, id ]}) => ({
type: 'job',
Expand All @@ -70,48 +70,54 @@ export default class GlobalSearchControl extends Component {
label: name,
}));

const allocResults = allAllocResults.slice(0, MAXIMUM_RESULTS).map(({ ID: name, Scope: [ , id ]}) => ({
const allocationResults = allAllocationResults.slice(0, MAXIMUM_RESULTS).map(({ ID: name, Scope: [ , id ]}) => ({
type: 'allocation',
id,
label: name,
}));

const groupResults = allGroupResults.slice(0, MAXIMUM_RESULTS).map(({ ID: id, Scope: [ namespace, jobId ]}) => ({
const taskGroupResults = allTaskGroupResults.slice(0, MAXIMUM_RESULTS).map(({ ID: id, Scope: [ namespace, jobId ]}) => ({
type: 'task-group',
id,
namespace,
jobId,
label: id,
}));

const pluginResults = allPluginResults.slice(0, MAXIMUM_RESULTS).map(({ ID: id }) => ({
const csiPluginResults = allCSIPluginResults.slice(0, MAXIMUM_RESULTS).map(({ ID: id }) => ({
type: 'plugin',
id,
label: id,
}));

const truncations = results.Truncations;
const {
jobs: jobsTruncated,
nodes: nodesTruncated,
allocs: allocationsTruncated,
groups: taskGroupsTruncated,
plugins: csiPluginsTruncated,
} = results.Truncations;

return [
{
groupName: resultsGroupLabel('Jobs', jobResults, allJobResults, truncations.jobs),
groupName: resultsGroupLabel('Jobs', jobResults, allJobResults, jobsTruncated),
options: jobResults,
},
{
groupName: resultsGroupLabel('Clients', nodeResults, allNodeResults, truncations.nodes),
groupName: resultsGroupLabel('Clients', nodeResults, allNodeResults, nodesTruncated),
options: nodeResults,
},
{
groupName: resultsGroupLabel('Allocations', allocResults, allAllocResults, truncations.allocs),
options: allocResults,
groupName: resultsGroupLabel('Allocations', allocationResults, allAllocationResults, allocationsTruncated),
options: allocationResults,
},
{
groupName: resultsGroupLabel('Task Groups', groupResults, allGroupResults, truncations.groups),
options: groupResults,
groupName: resultsGroupLabel('Task Groups', taskGroupResults, allTaskGroupResults, taskGroupsTruncated),
options: taskGroupResults,
},
{
groupName: resultsGroupLabel('CSI Plugins', pluginResults, allPluginResults, truncations.plugins),
options: pluginResults,
groupName: resultsGroupLabel('CSI Plugins', csiPluginResults, allCSIPluginResults, csiPluginsTruncated),
options: csiPluginResults,
}
];
})
Expand Down

0 comments on commit d6fc44b

Please sign in to comment.