gianm commented on code in PR #19253:
URL: https://github.com/apache/druid/pull/19253#discussion_r3113510688


##########
web-console/src/views/services-view/services-view.tsx:
##########
@@ -366,6 +483,40 @@ ORDER BY
           });
         }
 
+        if (capabilities.hasCoordinatorAccess() && 
visibleColumns.shown('Detail')) {
+          auxiliaryQueries.push(async (servicesWithAuxiliaryInfo, signal) => {
+            const [cloneStatusResp, configResp] = await Promise.all([
+              getApiArrayFromKey<CloneStatusInfo & { targetServer: string }>(
+                '/druid/coordinator/v1/config/cloneStatus',
+                'cloneStatus',
+                signal,
+              ).catch(() => [] as (CloneStatusInfo & { targetServer: string 
})[]),
+              Api.instance
+                .get('/druid/coordinator/v1/config', { signal })

Review Comment:
   I think this should be `Api.instance.get<CoordinatorDynamicConfig>` in order 
to pick up the types for the Coordinator config.



##########
web-console/src/views/services-view/services-view.tsx:
##########
@@ -220,6 +243,100 @@ function aggregateLoadQueueInfos(loadQueueInfos: 
LoadQueueInfo[]): LoadQueueInfo
   };
 }
 
+interface DetailCellProps {
+  original: ServiceResultRow;
+  workerInfoLookup: Record<string, WorkerInfo>;
+}
+
+function DetailCell({ original, workerInfoLookup }: DetailCellProps) {
+  const { service_type, service, is_leader } = original;
+  const loadQueueInfoContext = useContext(LoadQueueInfoContext);
+  const cloneStatusContext = useContext(CloneStatusContext);
+  const serverModeInfo = useContext(ServerModeContext);
+
+  switch (service_type) {
+    case 'middle_manager':
+    case 'indexer': {
+      const workerInfo = workerInfoLookup[service];
+      if (!workerInfo) return null;
+
+      if (workerInfo.worker.version === '') return <>Disabled</>;
+
+      const details: string[] = [];
+      if (workerInfo.lastCompletedTaskTime) {
+        details.push(`Last completed task: 
${formatDate(workerInfo.lastCompletedTaskTime)}`);
+      }
+      if (workerInfo.blacklistedUntil) {
+        details.push(`Blacklisted until: 
${formatDate(workerInfo.blacklistedUntil)}`);
+      }
+      return <>{details.join(' ') || null}</>;
+    }
+
+    case 'coordinator':
+    case 'overlord':
+      return <>{is_leader === 1 ? 'Leader' : ''}</>;
+
+    case 'historical': {
+      const loadQueueInfo = loadQueueInfoContext[service];
+      const cloneInfo = cloneStatusContext[service];
+
+      const parts: string[] = [];
+      if (serverModeInfo.decommissioningNodes.has(service)) {
+        parts.push('DECOMMISSIONING');
+      }
+      if (serverModeInfo.turboLoadingNodes.has(service)) {
+        parts.push('TURBO SEGMENT LOADING');

Review Comment:
   Similar comment here, how about "Turbo loading"? (also suggesting cutting 
the word "segment" for length.)



##########
web-console/src/views/services-view/services-view.tsx:
##########
@@ -366,6 +483,40 @@ ORDER BY
           });
         }
 
+        if (capabilities.hasCoordinatorAccess() && 
visibleColumns.shown('Detail')) {
+          auxiliaryQueries.push(async (servicesWithAuxiliaryInfo, signal) => {
+            const [cloneStatusResp, configResp] = await Promise.all([
+              getApiArrayFromKey<CloneStatusInfo & { targetServer: string }>(

Review Comment:
   why not add `targetServer` to `CloneStatusInfo`?



##########
web-console/src/views/services-view/services-view.tsx:
##########
@@ -220,6 +243,100 @@ function aggregateLoadQueueInfos(loadQueueInfos: 
LoadQueueInfo[]): LoadQueueInfo
   };
 }
 
+interface DetailCellProps {
+  original: ServiceResultRow;
+  workerInfoLookup: Record<string, WorkerInfo>;
+}
+
+function DetailCell({ original, workerInfoLookup }: DetailCellProps) {
+  const { service_type, service, is_leader } = original;
+  const loadQueueInfoContext = useContext(LoadQueueInfoContext);
+  const cloneStatusContext = useContext(CloneStatusContext);
+  const serverModeInfo = useContext(ServerModeContext);
+
+  switch (service_type) {
+    case 'middle_manager':
+    case 'indexer': {
+      const workerInfo = workerInfoLookup[service];
+      if (!workerInfo) return null;
+
+      if (workerInfo.worker.version === '') return <>Disabled</>;
+
+      const details: string[] = [];
+      if (workerInfo.lastCompletedTaskTime) {
+        details.push(`Last completed task: 
${formatDate(workerInfo.lastCompletedTaskTime)}`);
+      }
+      if (workerInfo.blacklistedUntil) {
+        details.push(`Blacklisted until: 
${formatDate(workerInfo.blacklistedUntil)}`);
+      }
+      return <>{details.join(' ') || null}</>;
+    }
+
+    case 'coordinator':
+    case 'overlord':
+      return <>{is_leader === 1 ? 'Leader' : ''}</>;
+
+    case 'historical': {
+      const loadQueueInfo = loadQueueInfoContext[service];
+      const cloneInfo = cloneStatusContext[service];
+
+      const parts: string[] = [];
+      if (serverModeInfo.decommissioningNodes.has(service)) {
+        parts.push('DECOMMISSIONING');
+      }
+      if (serverModeInfo.turboLoadingNodes.has(service)) {
+        parts.push('TURBO SEGMENT LOADING');
+      }
+      if (loadQueueInfo) {
+        parts.push(formatLoadQueueInfo(loadQueueInfo));
+      }
+      if (cloneInfo) {
+        if (cloneInfo.state === 'SOURCE_SERVER_MISSING') {
+          parts.push(`Clone of ${cloneInfo.sourceServer} (source missing)`);
+        } else if (cloneInfo.segmentLoadsRemaining > 0 || 
cloneInfo.segmentDropsRemaining > 0) {
+          const details: string[] = [];
+          if (cloneInfo.segmentLoadsRemaining > 0) {
+            details.push(
+              `${pluralIfNeeded(
+                cloneInfo.segmentLoadsRemaining,
+                'segment',
+              )} to load (${formatBytesCompact(cloneInfo.bytesToLoad)})`,
+            );
+          }
+          if (cloneInfo.segmentDropsRemaining > 0) {
+            details.push(`${pluralIfNeeded(cloneInfo.segmentDropsRemaining, 
'segment')} to drop`);
+          }
+          parts.push(`Cloning from ${cloneInfo.sourceServer}: 
${details.join(', ')}`);
+        } else {
+          parts.push(`Clone of ${cloneInfo.sourceServer} (synced)`);
+        }
+      }
+      return <>{parts.join('; ') || null}</>;
+    }
+
+    default:
+      return null;
+  }
+}
+
+interface AggregatedDetailCellProps {
+  subRows: { _original: ServiceResultRow }[];
+}
+
+function AggregatedDetailCell({ subRows }: AggregatedDetailCellProps) {

Review Comment:
   This could include aggregated info on decommissioning and turbo loading 
servers (e.g. count them and do "X decommissioning" and/or "Y turbo loading" if 
any are in those states).



##########
web-console/src/views/services-view/services-view.tsx:
##########
@@ -220,6 +243,100 @@ function aggregateLoadQueueInfos(loadQueueInfos: 
LoadQueueInfo[]): LoadQueueInfo
   };
 }
 
+interface DetailCellProps {
+  original: ServiceResultRow;
+  workerInfoLookup: Record<string, WorkerInfo>;
+}
+
+function DetailCell({ original, workerInfoLookup }: DetailCellProps) {
+  const { service_type, service, is_leader } = original;
+  const loadQueueInfoContext = useContext(LoadQueueInfoContext);
+  const cloneStatusContext = useContext(CloneStatusContext);
+  const serverModeInfo = useContext(ServerModeContext);
+
+  switch (service_type) {
+    case 'middle_manager':
+    case 'indexer': {
+      const workerInfo = workerInfoLookup[service];
+      if (!workerInfo) return null;
+
+      if (workerInfo.worker.version === '') return <>Disabled</>;
+
+      const details: string[] = [];
+      if (workerInfo.lastCompletedTaskTime) {
+        details.push(`Last completed task: 
${formatDate(workerInfo.lastCompletedTaskTime)}`);
+      }
+      if (workerInfo.blacklistedUntil) {
+        details.push(`Blacklisted until: 
${formatDate(workerInfo.blacklistedUntil)}`);
+      }
+      return <>{details.join(' ') || null}</>;
+    }
+
+    case 'coordinator':
+    case 'overlord':
+      return <>{is_leader === 1 ? 'Leader' : ''}</>;
+
+    case 'historical': {
+      const loadQueueInfo = loadQueueInfoContext[service];
+      const cloneInfo = cloneStatusContext[service];
+
+      const parts: string[] = [];
+      if (serverModeInfo.decommissioningNodes.has(service)) {
+        parts.push('DECOMMISSIONING');

Review Comment:
   Seems needlessly screamy. How about "Decommissioning"? It would better match 
the casing of the existing things that go into this line.



##########
web-console/src/views/services-view/services-view.tsx:
##########
@@ -366,6 +483,40 @@ ORDER BY
           });
         }
 
+        if (capabilities.hasCoordinatorAccess() && 
visibleColumns.shown('Detail')) {
+          auxiliaryQueries.push(async (servicesWithAuxiliaryInfo, signal) => {
+            const [cloneStatusResp, configResp] = await Promise.all([
+              getApiArrayFromKey<CloneStatusInfo & { targetServer: string }>(
+                '/druid/coordinator/v1/config/cloneStatus',
+                'cloneStatus',
+                signal,
+              ).catch(() => [] as (CloneStatusInfo & { targetServer: string 
})[]),
+              Api.instance
+                .get('/druid/coordinator/v1/config', { signal })
+                .then(r => r.data)
+                .catch(() => null),

Review Comment:
   When the load queue infos fail to fetch, there's a toast that says there was 
an error fetching them. Consider that here too. (and also for a failure on 
`/druid/coordinator/v1/config/cloneStatus`)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to