riahk commented on a change in pull request #11634:
URL: 
https://github.com/apache/incubator-superset/pull/11634#discussion_r527273954



##########
File path: superset-frontend/src/views/CRUD/data/query/QueryList.tsx
##########
@@ -292,15 +289,18 @@ function QueryList({ addDangerToast, addSuccessToast }: 
QueryListProps) {
       {
         accessor: 'sql',
         Header: t('SQL'),
-        Cell: ({
-          row: {
-            original: { sql },
-          },
-        }: any) => {
+        Cell: ({ row: { original, id } }: any) => {
           return (
-            <StyledSyntaxHighlighter language="sql" style={github}>
-              {shortenSQL(sql)}
-            </StyledSyntaxHighlighter>
+            <div
+              tabIndex={0}
+              role="button"
+              data-test={`open-sql-preview-${id}`}
+              onClick={() => setQueryCurrentlyPreviewing(original)}
+            >
+              <StyledSyntaxHighlighter language="sql" style={github}>

Review comment:
       What's the difference between setting the `language` prop here and 
calling `SyntaxHighlighter.registerLanguage` above? Does the latter just load 
in the highlighting logic for while former explicitly sets it?

##########
File path: 
superset-frontend/src/views/CRUD/data/components/SyntaxHighlighterCopy/index.tsx
##########
@@ -0,0 +1,110 @@
+/**
+ * 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 React from 'react';
+import { styled, t } from '@superset-ui/core';
+import { SyntaxHighlighterProps } from 'react-syntax-highlighter';
+import sql from 'react-syntax-highlighter/dist/cjs/languages/hljs/sql';
+import github from 'react-syntax-highlighter/dist/cjs/styles/hljs/github';
+import SyntaxHighlighter from 'react-syntax-highlighter/dist/cjs/light';
+import { ToastProps } from 'src/messageToasts/enhancers/withToasts';
+import Icon from 'src/components/Icon';
+
+SyntaxHighlighter.registerLanguage('sql', sql);

Review comment:
       Would it make sense to add a language prop so we can use this component 
with `json`/`css`/etc.?

##########
File path: superset-frontend/src/views/CRUD/data/hooks.ts
##########
@@ -0,0 +1,75 @@
+/**
+ * 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 { useState, useEffect } from 'react';
+
+type BaseQueryObject = {
+  id: number;
+};
+export function useQueryPreviewState<D extends BaseQueryObject = any>({

Review comment:
       nice 👌 




----------------------------------------------------------------
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.

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