AAfghahi commented on a change in pull request #13102: URL: https://github.com/apache/superset/pull/13102#discussion_r584025825
########## File path: superset-frontend/src/SqlLab/components/QuerySearch.tsx ########## @@ -0,0 +1,283 @@ +/** + * 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, { useState, useEffect } from 'react'; +import Select from 'src/components/Select'; +import Button from 'src/components/Button'; +import { styled, t, SupersetClient } from '@superset-ui/core'; +import { debounce } from 'lodash'; +import Loading from '../../components/Loading'; +import QueryTable from './QueryTable'; +import { + now, + epochTimeXHoursAgo, + epochTimeXDaysAgo, + epochTimeXYearsAgo, +} from '../../modules/dates'; +import { STATUS_OPTIONS, TIME_OPTIONS } from '../constants'; +import AsyncSelect from '../../components/AsyncSelect'; + +interface propTypes { + actions: { + addDangerToast: (msg: string) => void; + setDatabases: (data: Record<string, any>) => Record<string, any>; + }; + displayLimit: number; +} + +interface userMutatorProps { + value: number; + text: string; +} + +const TableWrapper = styled.div` + display: flex; + flex-direction: column; + flex: 1; + height: 100%; +`; + +const TableStyles = styled.div` + table { + background-color: ${({ theme }) => theme.colors.grayscale.light4}; + } + + .table > thead > tr > th { + border-bottom: ${({ theme }) => theme.gridUnit / 2}px solid + ${({ theme }) => theme.colors.grayscale.light2}; + background: ${({ theme }) => theme.colors.grayscale.light4}; + } +`; + +const StyledTableStylesContainer = styled.div` + overflow: auto; +`; +function QuerySearch({ actions, displayLimit }: propTypes) { + const [databaseId, setDatabaseId] = useState<any>(''); + const [userId, setUserId] = useState<string>(''); + const [searchText, setSearchText] = useState<string>(''); + const [from, setFrom] = useState<string>('28 days ago'); + const [to, setTo] = useState<string>('now'); + const [status, setStatus] = useState<string>('success'); + const [queriesArray, setQueriesArray] = useState<any>([]); Review comment: So, this one is a bit wonky because the queriesArray is actually taking in a json object that it puts in is an object. I went through some iteration where i was parsing through the json object you receive and pushing it into the empty array, but it wasn't rendering the table. My issue here was that I can create an object prop and then put it in there, but then that would need me to also create aa prop object for the useState (though I could potentially use null, now that I am thinking about it?). ---------------------------------------------------------------- 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]
