web console services tab treat indexer as a real service (#9139)

This commit is contained in:
Clint Wylie 2020-01-07 18:14:04 -08:00 committed by Vadim Ogievetsky
parent 28edd3b44e
commit 7439f73c23
1 changed files with 18 additions and 12 deletions

View File

@ -133,6 +133,7 @@ interface MiddleManagerQueryResultRow {
blacklistedUntil: string | null; blacklistedUntil: string | null;
currCapacityUsed: number; currCapacityUsed: number;
lastCompletedTaskTime: string; lastCompletedTaskTime: string;
category: string;
runningTasks: string[]; runningTasks: string[];
worker: { worker: {
capacity: number; capacity: number;
@ -152,11 +153,12 @@ export class ServicesView extends React.PureComponent<ServicesViewProps, Service
private serviceQueryManager: QueryManager<Capabilities, ServiceResultRow[]>; private serviceQueryManager: QueryManager<Capabilities, ServiceResultRow[]>;
// Ranking // Ranking
// coordinator => 7 // coordinator => 8
// overlord => 6 // overlord => 7
// router => 5 // router => 6
// broker => 4 // broker => 5
// historical => 3 // historical => 4
// indexer => 3
// middle_manager => 2 // middle_manager => 2
// peon => 1 // peon => 1
@ -164,11 +166,12 @@ export class ServicesView extends React.PureComponent<ServicesViewProps, Service
"server" AS "service", "server_type" AS "service_type", "tier", "host", "plaintext_port", "tls_port", "curr_size", "max_size", "server" AS "service", "server_type" AS "service_type", "tier", "host", "plaintext_port", "tls_port", "curr_size", "max_size",
( (
CASE "server_type" CASE "server_type"
WHEN 'coordinator' THEN 7 WHEN 'coordinator' THEN 8
WHEN 'overlord' THEN 6 WHEN 'overlord' THEN 7
WHEN 'router' THEN 5 WHEN 'router' THEN 6
WHEN 'broker' THEN 4 WHEN 'broker' THEN 5
WHEN 'historical' THEN 3 WHEN 'historical' THEN 4
WHEN 'indexer' THEN 3
WHEN 'middle_manager' THEN 2 WHEN 'middle_manager' THEN 2
WHEN 'peon' THEN 1 WHEN 'peon' THEN 1
ELSE 0 ELSE 0
@ -426,7 +429,7 @@ ORDER BY "rank" DESC, "service" DESC`;
width: 100, width: 100,
filterable: false, filterable: false,
accessor: row => { accessor: row => {
if (row.service_type === 'middle_manager') { if (row.service_type === 'middle_manager' || row.service_type === 'indexer') {
return row.worker ? row.currCapacityUsed / row.worker.capacity : null; return row.worker ? row.currCapacityUsed / row.worker.capacity : null;
} else { } else {
return row.max_size ? row.curr_size / row.max_size : null; return row.max_size ? row.curr_size / row.max_size : null;
@ -440,6 +443,7 @@ ORDER BY "rank" DESC, "service" DESC`;
const totalMax = sum(originalHistoricals, s => s.max_size); const totalMax = sum(originalHistoricals, s => s.max_size);
return fillIndicator(totalCurr / totalMax); return fillIndicator(totalCurr / totalMax);
case 'indexer':
case 'middle_manager': case 'middle_manager':
const originalMiddleManagers = row.subRows.map(r => r._original); const originalMiddleManagers = row.subRows.map(r => r._original);
const totalCurrCapacityUsed = sum( const totalCurrCapacityUsed = sum(
@ -463,6 +467,7 @@ ORDER BY "rank" DESC, "service" DESC`;
case 'historical': case 'historical':
return fillIndicator(row.value); return fillIndicator(row.value);
case 'indexer':
case 'middle_manager': case 'middle_manager':
const currCapacityUsed = deepGet(row, 'original.currCapacityUsed') || 0; const currCapacityUsed = deepGet(row, 'original.currCapacityUsed') || 0;
const capacity = deepGet(row, 'original.worker.capacity'); const capacity = deepGet(row, 'original.worker.capacity');
@ -484,7 +489,7 @@ ORDER BY "rank" DESC, "service" DESC`;
width: 400, width: 400,
filterable: false, filterable: false,
accessor: row => { accessor: row => {
if (row.service_type === 'middle_manager') { if (row.service_type === 'middle_manager' || row.service_type === 'indexer') {
if (deepGet(row, 'worker.version') === '') return 'Disabled'; if (deepGet(row, 'worker.version') === '') return 'Disabled';
const details: string[] = []; const details: string[] = [];
@ -517,6 +522,7 @@ ORDER BY "rank" DESC, "service" DESC`;
segmentsToDropSize, segmentsToDropSize,
); );
case 'indexer':
case 'middle_manager': case 'middle_manager':
return row.value; return row.value;