jscheffl commented on code in PR #38021:
URL: https://github.com/apache/airflow/pull/38021#discussion_r1520346592


##########
airflow/www/static/js/dag/details/taskInstance/Logs/LogBlock.tsx:
##########
@@ -59,10 +67,43 @@ const LogBlock = ({ parsedLogs, wrap, tryNumber }: Props) 
=> {
     }
   };
 
+  const onClick = (e: React.MouseEvent<HTMLElement>) => {
+    const target = e.target as HTMLElement;

Review Comment:
   I tried to apply this but it seems from typing perspective `currentTarget` 
is different than `target`. Here I need `target`to know which element was 
clicked in the log frame, not the log frame itself.
   
   `target` is of type `EventTarget`
   `currentTarget` is of type `EventTarget & HTMLElement`
   
   I tried multiple options but with `target` I get errors in pre-commit like:
   ```
   static/js/dag/details/taskInstance/Logs/LogBlock.tsx:71:18 - error TS2339: 
Property 'id' does not exist on type 'EventTarget'.
   
   71     alert(target.id?.endsWith("_unfold"));
                       ~~
   
   static/js/dag/details/taskInstance/Logs/LogBlock.tsx:72:16 - error TS2339: 
Property 'id' does not exist on type 'EventTarget'.
   
   72     if (target.id?.endsWith("_unfold")) {
                     ~~
   
   static/js/dag/details/taskInstance/Logs/LogBlock.tsx:73:26 - error TS2339: 
Property 'id' does not exist on type 'EventTarget'.
   
   73       const gId = target.id.substring(0, target.id.length - 7);
                               ~~
   
   static/js/dag/details/taskInstance/Logs/LogBlock.tsx:73:49 - error TS2339: 
Property 'id' does not exist on type 'EventTarget'.
   
   73       const gId = target.id.substring(0, target.id.length - 7);
                                                      ~~
   
   static/js/dag/details/taskInstance/Logs/LogBlock.tsx:78:14 - error TS2339: 
Property 'style' does not exist on type 'EventTarget'.
   
   78       target.style.display = "none";
                   ~~~~~
   
   static/js/dag/details/taskInstance/Logs/LogBlock.tsx:79:18 - error TS2339: 
Property 'nextElementSibling' does not exist on type 'EventTarget'.
   
   79       if (target.nextElementSibling) {
                       ~~~~~~~~~~~~~~~~~~
   
   static/js/dag/details/taskInstance/Logs/LogBlock.tsx:80:17 - error TS2339: 
Property 'nextElementSibling' does not exist on type 'EventTarget'.
   
   80         (target.nextElementSibling as HTMLElement).style.display = 
"inline";
                      ~~~~~~~~~~~~~~~~~~
   
   static/js/dag/details/taskInstance/Logs/LogBlock.tsx:83:16 - error TS2339: 
Property 'id' does not exist on type 'EventTarget'.
   
   83     if (target.id?.endsWith("_fold")) {
                     ~~
   
   static/js/dag/details/taskInstance/Logs/LogBlock.tsx:84:26 - error TS2339: 
Property 'id' does not exist on type 'EventTarget'.
   
   84       const gId = target.id.substring(0, target.id.length - 5);
                               ~~
   
   static/js/dag/details/taskInstance/Logs/LogBlock.tsx:84:49 - error TS2339: 
Property 'id' does not exist on type 'EventTarget'.
   
   84       const gId = target.id.substring(0, target.id.length - 5);
                                                      ~~
   
   static/js/dag/details/taskInstance/Logs/LogBlock.tsx:91:18 - error TS2339: 
Property 'parentElement' does not exist on type 'EventTarget'.
   
   91       if (target.parentElement) {
                       ~~~~~~~~~~~~~
   
   static/js/dag/details/taskInstance/Logs/LogBlock.tsx:92:16 - error TS2339: 
Property 'parentElement' does not exist on type 'EventTarget'.
   
   92         target.parentElement.style.display = "none";
                     ~~~~~~~~~~~~~
   
   static/js/dag/details/taskInstance/Logs/LogBlock.tsx:93:20 - error TS2339: 
Property 'parentElement' does not exist on type 'EventTarget'.
   
   93         if (target.parentElement.previousSibling) {
                         ~~~~~~~~~~~~~
   
   static/js/dag/details/taskInstance/Logs/LogBlock.tsx:94:19 - error TS2339: 
Property 'parentElement' does not exist on type 'EventTarget'.
   
   94           (target.parentElement.previousSibling as 
HTMLElement).style.display =
                        ~~~~~~~~~~~~~
   
   
   Found 14 errors in the same file, starting at: 
static/js/dag/details/taskInstance/Logs/LogBlock.tsx:71
   ```



-- 
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...@airflow.apache.org

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

Reply via email to