jayeshchoudhary commented on code in PR #15400:
URL: https://github.com/apache/pinot/pull/15400#discussion_r2019991319


##########
pinot-controller/src/main/resources/app/components/Homepage/Operations/RebalanceServerStatusOp.tsx:
##########
@@ -0,0 +1,128 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import {
+    Button,
+    DialogContent,
+    Grid
+} from "@material-ui/core";
+import Dialog from "../../CustomDialog";
+import React, {useState} from "react";
+import moment from "moment/moment";
+import {RebalanceServerSection} from 
"./RebalanceServer/RebalanceServerSection";
+import CustomCodemirror from "../../CustomCodemirror";
+import './RebalanceServer/RebalanceServerResponses/CustomCodeMirror.css';
+import {RebalanceServerResponseCard} from 
"./RebalanceServer/RebalanceServerResponses/RebalanceServerResponseCard";
+import CustomizedTables from "../../Table";
+
+export type RebalanceTableSegmentJobs = {
+    [key: string]: {
+        jobId: string,
+        messageCount: number,
+        submissionTimeMs: number,
+        jobType: string,
+        tableName: string,
+        REBALANCE_PROGRESS_STATS: string,
+        REBALANCE_CONTEXT: string;
+    }
+}
+
+type RebalanceServerStatusOpProps = {
+    rebalanceServerStatus: RebalanceTableSegmentJobs;
+    hideModal: () => void;
+};
+
+export const RebalanceServerStatusOp = (
+    { rebalanceServerStatus, hideModal } : RebalanceServerStatusOpProps
+) => {
+    const [jobSelected, setJobSelected] = useState<string | null>(null);
+
+    const BackAction = () => {
+        return (
+            <Button
+                style={{ textTransform: 'none' }}

Review Comment:
   buttons are default capitalized across project. either we should change the 
default behaviour or keep it as is. 



##########
pinot-controller/src/main/resources/app/pages/TenantDetails.tsx:
##########
@@ -445,6 +450,17 @@ const TenantPageDetails = ({ match }: 
RouteComponentProps<Props>) => {
     }
   };
 
+  const handleRebalanceTableStatus = async () => {
+    try{
+      setShowRebalanceServerStatus(true);
+      const rebalanceServerJobs = await 
PinotMethodUtils.fetchTableJobs(tableName, "TABLE_REBALANCE");
+      setRebalanceTableJobsData(rebalanceServerJobs as 
RebalanceTableSegmentJobs);
+    } catch(error) {
+      dispatch({type: 'error', message: error, show: true});
+      setShowRebalanceServerStatus(false);
+    }
+  };
+

Review Comment:
   Are we showing loading until api fetch is complete?
   user clicks on rebalance status button -> open dialog -> call api -> api 
fails -> close dialog ??
   
   what if api takes 3 seconds? what about loading indicator ?



##########
pinot-controller/src/main/resources/app/pages/TenantDetails.tsx:
##########
@@ -445,6 +450,17 @@ const TenantPageDetails = ({ match }: 
RouteComponentProps<Props>) => {
     }
   };
 
+  const handleRebalanceTableStatus = async () => {
+    try{
+      setShowRebalanceServerStatus(true);
+      const rebalanceServerJobs = await 
PinotMethodUtils.fetchTableJobs(tableName, "TABLE_REBALANCE");
+      setRebalanceTableJobsData(rebalanceServerJobs as 
RebalanceTableSegmentJobs);
+    } catch(error) {
+      dispatch({type: 'error', message: error, show: true});
+      setShowRebalanceServerStatus(false);
+    }
+  };
+

Review Comment:
   IMO we should make api call in the Dialog itself in useEffect 



##########
pinot-controller/src/main/resources/app/components/Homepage/Operations/RebalanceServerStatusOp.tsx:
##########
@@ -0,0 +1,128 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import {
+    Button,
+    DialogContent,
+    Grid
+} from "@material-ui/core";
+import Dialog from "../../CustomDialog";
+import React, {useState} from "react";
+import moment from "moment/moment";
+import {RebalanceServerSection} from 
"./RebalanceServer/RebalanceServerSection";
+import CustomCodemirror from "../../CustomCodemirror";
+import './RebalanceServer/RebalanceServerResponses/CustomCodeMirror.css';
+import {RebalanceServerResponseCard} from 
"./RebalanceServer/RebalanceServerResponses/RebalanceServerResponseCard";
+import CustomizedTables from "../../Table";
+
+export type RebalanceTableSegmentJobs = {
+    [key: string]: {
+        jobId: string,
+        messageCount: number,
+        submissionTimeMs: number,
+        jobType: string,
+        tableName: string,
+        REBALANCE_PROGRESS_STATS: string,
+        REBALANCE_CONTEXT: string;
+    }
+}
+
+type RebalanceServerStatusOpProps = {
+    rebalanceServerStatus: RebalanceTableSegmentJobs;
+    hideModal: () => void;
+};
+
+export const RebalanceServerStatusOp = (
+    { rebalanceServerStatus, hideModal } : RebalanceServerStatusOpProps
+) => {
+    const [jobSelected, setJobSelected] = useState<string | null>(null);
+
+    const BackAction = () => {
+        return (
+            <Button
+                style={{ textTransform: 'none' }}
+                variant='outlined'
+                color='primary'
+                onClick={() => setJobSelected(null)}
+            >
+                Back
+            </Button>
+        );
+    }
+    return (
+        <Dialog
+            open={true}
+            handleClose={hideModal}
+            title="Rebalance Table Status"
+            showOkBtn={false}
+            size='lg'
+            moreActions={jobSelected ? <BackAction /> : null}
+        >
+            <DialogContent>
+                {
+                    !jobSelected ?
+                        <CustomizedTables
+                            title='Job Status'
+                            isCellClickable
+                            makeOnlyFirstCellClickable
+                            cellClickCallback={(cell: string) => {
+                                setJobSelected(cell);
+                            }}
+                            data={{
+                                records: 
Object.keys(rebalanceServerStatus).map(jobId => {
+                                    const progressStats = 
JSON.parse(rebalanceServerStatus[jobId].REBALANCE_PROGRESS_STATS);
+                                    return [
+                                        rebalanceServerStatus[jobId].jobId,
+                                        rebalanceServerStatus[jobId].tableName,
+                                        progressStats.status,
+                                        
moment(+rebalanceServerStatus[jobId].submissionTimeMs).format("MMMM Do YYYY, 
HH:mm:ss")
+                                    ];
+                                }),
+                                columns: ['Job id', 'Table name', 'Status', 
'Started at']
+                            }}
+                            showSearchBox
+                        /> :
+                        <Grid container spacing={2}>
+                            <Grid item xs={12}>
+                                <RebalanceServerResponseCard>
+                                    <RebalanceServerSection 
sectionTitle={"Progress Stats"} canHideSection showSectionByDefault={true}>
+                                        <CustomCodemirror
+                                            
customClass='rebalance_server_response_section'
+                                            
data={JSON.parse(rebalanceServerStatus[jobSelected].REBALANCE_PROGRESS_STATS)}
+                                            isEditable={false}

Review Comment:
   JSON.parse can throw exception. need handle exception somewhere



##########
pinot-controller/src/main/resources/app/components/Table.tsx:
##########
@@ -562,7 +564,7 @@ export default function CustomizedTables({
                         ) : (
                           <StyledTableCell
                             key={idx}
-                            className={isCellClickable ? 
classes.isCellClickable : (isSticky ? classes.isSticky : '')}
+                            className={isCellClickable && 
(!makeOnlyFirstCellClickable || !idx) ? classes.isCellClickable : (isSticky ? 
classes.isSticky : '')}

Review Comment:
   what is the usecase here?
   I don't see this in the reload segment table
   
   all the other columns are not clickable 
   <img width="1387" alt="image" 
src="https://github.com/user-attachments/assets/5ea03c02-848b-4ef9-a417-69d9b1bdbe69";
 />
   



-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to