From 6bedfce4131c30c58dd221583b23a6ff411d7a42 Mon Sep 17 00:00:00 2001 From: chriszhu Date: Thu, 14 Oct 2021 17:41:25 +0800 Subject: [PATCH 1/3] add PaDockerfile --- PaDockerfile | 166 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 166 insertions(+) create mode 100644 PaDockerfile diff --git a/PaDockerfile b/PaDockerfile new file mode 100644 index 0000000000000..ce39d279e0054 --- /dev/null +++ b/PaDockerfile @@ -0,0 +1,166 @@ +# +# 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. +# + +###################################################################### +# PY stage that simply does a pip install on our requirements +###################################################################### +ARG PY_VER=3.7.9 +FROM python:${PY_VER} AS superset-py + +RUN mkdir /app \ + && apt-get update -y \ + && apt-get install -y --no-install-recommends \ + build-essential \ + default-libmysqlclient-dev \ + libpq-dev \ + libsasl2-dev \ + libecpg-dev \ + && rm -rf /var/lib/apt/lists/* + +# First, we just wanna install requirements, which will allow us to utilize the cache +# in order to only build if and only if requirements change +COPY ./requirements/*.txt /app/requirements/ +COPY setup.py MANIFEST.in README.md /app/ +COPY superset-frontend/package.json /app/superset-frontend/ +RUN cd /app \ + && mkdir -p superset/static \ + && touch superset/static/version_info.json \ + && pip install --no-cache -r requirements/local.txt + + +###################################################################### +# Node stage to deal with static asset construction +###################################################################### +FROM node:14 AS superset-node + +ARG NPM_VER=7 +RUN npm install -g npm@${NPM_VER} + +ARG NPM_BUILD_CMD="build" +ENV BUILD_CMD=${NPM_BUILD_CMD} + +# NPM ci first, as to NOT invalidate previous steps except for when package.json changes +RUN mkdir -p /app/superset-frontend +RUN mkdir -p /app/superset/assets +COPY ./docker/frontend-mem-nag.sh / +COPY ./superset-frontend/package* /app/superset-frontend/ +RUN /frontend-mem-nag.sh \ + && cd /app/superset-frontend \ + && npm ci + +# Next, copy in the rest and let webpack do its thing +COPY ./superset-frontend /app/superset-frontend +# This is BY FAR the most expensive step (thanks Terser!) +RUN cd /app/superset-frontend \ + && npm run ${BUILD_CMD} \ + && rm -rf node_modules + + +###################################################################### +# Final lean image... +###################################################################### +ARG PY_VER=3.7.9 +FROM python:${PY_VER} AS lean + +ENV LANG=C.UTF-8 \ + LC_ALL=C.UTF-8 \ + FLASK_ENV=production \ + FLASK_APP="superset.app:create_app()" \ + PYTHONPATH="/app/pythonpath" \ + SUPERSET_HOME="/app/superset_home" \ + SUPERSET_PORT=8088 + +RUN mkdir -p ${PYTHONPATH} \ + && useradd --user-group -d ${SUPERSET_HOME} -m --no-log-init --shell /bin/bash superset \ + && apt-get update -y \ + && apt-get install -y --no-install-recommends \ + build-essential \ + default-libmysqlclient-dev \ + libsasl2-modules-gssapi-mit \ + libpq-dev \ + && rm -rf /var/lib/apt/lists/* + +COPY ./superset_config.py /app/pythonpath +COPY --from=superset-py /usr/local/lib/python3.7/site-packages/ /usr/local/lib/python3.7/site-packages/ +# Copying site-packages doesn't move the CLIs, so let's copy them one by one +COPY --from=superset-py /usr/local/bin/gunicorn /usr/local/bin/celery /usr/local/bin/flask /usr/bin/ +COPY --from=superset-node /app/superset/static/assets /app/superset/static/assets +COPY --from=superset-node /app/superset-frontend /app/superset-frontend + +## Lastly, let's install superset itself +COPY superset /app/superset +COPY setup.py MANIFEST.in README.md /app/ +RUN cd /app \ + && chown -R superset:superset * \ + && pip install -e . + +COPY ./docker/docker-entrypoint.sh /usr/bin/ + +WORKDIR /app + +USER superset + +HEALTHCHECK CMD curl -f "http://localhost:$SUPERSET_PORT/health" + +EXPOSE ${SUPERSET_PORT} + +ENTRYPOINT ["/usr/bin/docker-entrypoint.sh"] + +###################################################################### +# Dev image... +###################################################################### +# FROM lean AS dev +# ARG GECKODRIVER_VERSION=v0.28.0 +# ARG FIREFOX_VERSION=88.0 + +# COPY ./requirements/*.txt ./docker/requirements-*.txt/ /app/requirements/ + +# USER root + +# RUN apt-get update -y \ +# && apt-get install -y --no-install-recommends libnss3 libdbus-glib-1-2 libgtk-3-0 libx11-xcb1 + +# # Install GeckoDriver WebDriver +# RUN wget https://github.com/mozilla/geckodriver/releases/download/${GECKODRIVER_VERSION}/geckodriver-${GECKODRIVER_VERSION}-linux64.tar.gz -O /tmp/geckodriver.tar.gz && \ +# tar xvfz /tmp/geckodriver.tar.gz -C /tmp && \ +# mv /tmp/geckodriver /usr/local/bin/geckodriver && \ +# rm /tmp/geckodriver.tar.gz + +# # Install Firefox +# RUN wget https://download-installer.cdn.mozilla.net/pub/firefox/releases/${FIREFOX_VERSION}/linux-x86_64/en-US/firefox-${FIREFOX_VERSION}.tar.bz2 -O /opt/firefox.tar.bz2 && \ +# tar xvf /opt/firefox.tar.bz2 -C /opt && \ +# ln -s /opt/firefox/firefox /usr/local/bin/firefox + +# # Cache everything for dev purposes... +# RUN cd /app \ +# && pip install --no-cache -r requirements/docker.txt \ +# && pip install --no-cache -r requirements/requirements-local.txt || true +# USER superset + + +# ###################################################################### +# # CI image... +# ###################################################################### +# FROM lean AS ci + +# COPY --chown=superset ./docker/docker-bootstrap.sh /app/docker/ +# COPY --chown=superset ./docker/docker-init.sh /app/docker/ +# COPY --chown=superset ./docker/docker-ci.sh /app/docker/ + +# RUN chmod a+x /app/docker/*.sh + +# CMD /app/docker/docker-ci.sh From 6222ef50f7147d144ad10ba55b4c88ad437539ee Mon Sep 17 00:00:00 2001 From: chriszhu Date: Thu, 21 Oct 2021 15:48:12 +0800 Subject: [PATCH 2/3] 1. get clientName from url or chartName instead spcify one 2. add [MODIFY-TIMEZONE] --- docker-compose.yml | 4 +- superset-frontend/src/chart/chartAction.js | 17 ++++++++ .../TableChartTableCollection.tsx | 42 +++++++++++++++++-- .../components/PaExploreChartPanel.jsx | 12 +++++- .../components/PaExploreViewContainer.jsx | 22 ++++++---- 5 files changed, 85 insertions(+), 12 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 93a79809178e5..31a57b4635437 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -26,6 +26,8 @@ x-superset-volumes: &superset-volumes - ./superset-frontend:/app/superset-frontend - superset_home:/app/superset_home - ./tests:/app/tests + - /etc/timezone:/etc/timezone + - /etc/localtime:/etc/localtime version: "3.7" services: @@ -44,7 +46,7 @@ services: container_name: superset_db restart: unless-stopped ports: - - "127.0.0.1:5432:5432" + - "127.0.0.1:35432:5432" volumes: - db_home:/var/lib/postgresql/data diff --git a/superset-frontend/src/chart/chartAction.js b/superset-frontend/src/chart/chartAction.js index 5052416df37ee..af2d8405f627b 100644 --- a/superset-frontend/src/chart/chartAction.js +++ b/superset-frontend/src/chart/chartAction.js @@ -367,6 +367,7 @@ export function exploreJSON( ) { return async dispatch => { const logStart = Logger.getTimestamp(); + console.log("@370", logStart) const controller = new AbortController(); const requestParams = { @@ -540,6 +541,22 @@ export function postChartFormData( * This will post the form data to the endpoint, returning a new chart. * */ + + /* + * [MODIFY-TIMEZONE] + */ + console.log("@544", formData['time_range'].split(" : ")[0], formData['time_range'].split(" : ")[1]) + console.log("@544", !isNaN(Date.parse(formData['time_range'].split(" : ")[0]))) + if (!isNaN(Date.parse(formData['time_range'].split(" : ")[0]))) { + const since = Date.parse(formData['time_range'].split(" : ")[0]); + const until = Date.parse(formData['time_range'].split(" : ")[1]); + console.log("@544", since, until); + const utcSince = new Date(since).toISOString().split(".")[0]; + const utcUntil = new Date(until).toISOString().split(".")[0]; + console.log("@544", utcSince, utcUntil); + formData['time_range'] = utcSince + " : " + utcUntil; + } + console.log("@551 formData", formData, formData['time_range']); return exploreJSON( formData, force, diff --git a/superset-frontend/src/components/dataViewCommon/TableChartTableCollection.tsx b/superset-frontend/src/components/dataViewCommon/TableChartTableCollection.tsx index 4f5a3dbceaedb..e839e5c25d457 100644 --- a/superset-frontend/src/components/dataViewCommon/TableChartTableCollection.tsx +++ b/superset-frontend/src/components/dataViewCommon/TableChartTableCollection.tsx @@ -293,6 +293,20 @@ export default React.memo( })} > {row.cells.map(cell => { + // console.log("@296", cell); + /* + * [MODIFY-TIMEZONE] + * have to change event ts to local timezone. + */ + try { + if (!isNaN(Date.parse(cell.value)) && ("P_EVENT_TS" === cell.column.Header || "event_ts" === cell.column.Header)) { + cell.value = new Date(Date.parse(cell.value.split(".")[0]) + 16 * 3600 * 1000).toISOString(); + // console.log("@296-1", cell.value); + } + } catch { + // console.log("@296-2 not a date"); + } + // console.log("@296-3", cell); if (cell.column.hidden) return null; const columnCellProps = cell.column.cellProps || {}; @@ -311,7 +325,9 @@ export default React.memo( className={cx({ 'loading-bar': loading })} role={loading ? 'progressbar' : undefined} > - {cell.render('Cell')} + { + cell.value + } ); @@ -325,12 +341,32 @@ export default React.memo( ); let showRowData = (row: object) => { - let clientName = "msi"; - // let clientName = process.env.CLIENT_NAME; + /* + * normally it will get clientName from superset-[clientName].standalone... + * if the domain is not superset..., you can set [clientName]-- at chart name head. + * Example: demo--[Workstations_Chart] clientName = demo. + */ + let clientName = ""; + try { + clientName = window.location.href.split("superset-")[1].split(".standalone")[0] || ""; + } catch { + + } + if ("" === clientName) { + const chartName = $(".editable-title").children().attr('value'); + clientName = chartName?.split("--")[0] || ""; + } let entityCode = row['original']['P_DEVICE_ID']; let pos = row['original']['P_POS']; let endTime = Date.parse(row['original']['P_EVENT_TS']); let startTime = endTime - row['original']['P_VALUE'] * 1000; + if (undefined === entityCode) { + entityCode = row['original']['device_id']; + pos = row['original']['pos']; + endTime = row['original']['event_ts']; + startTime = endTime - row['original']['cycle_time'] * 1000 + console.log("@338", endTime); + } let url = 'https://manage-' + clientName + '.standalone.powerarena.com:10443/admin/mark-for-reason/?tab=single-view&entity_code=' + entityCode + '&pos=' + pos + '&start_ts=' + startTime + '&end_ts=' + endTime; window.open(url, '_blank')?.focus(); } \ No newline at end of file diff --git a/superset-frontend/src/explore/components/PaExploreChartPanel.jsx b/superset-frontend/src/explore/components/PaExploreChartPanel.jsx index 312d7a1aa3147..343a5867ef466 100644 --- a/superset-frontend/src/explore/components/PaExploreChartPanel.jsx +++ b/superset-frontend/src/explore/components/PaExploreChartPanel.jsx @@ -268,7 +268,7 @@ const ExploreChartPanel = props => { props.updateTableForm({ 'value': [targetItem[0], targetItem[2]], 'type': 'P_VALUE', - 'ops': ['>=', '<'] + 'ops': ['>', '<='] }, props.chartName); } } @@ -311,6 +311,16 @@ const ExploreChartPanel = props => { }, props.chartName)} > {value.x} + case props.chartName.includes('[Flatten_Workstations_Chart]'): + return default: return

} diff --git a/superset-frontend/src/explore/components/PaExploreViewContainer.jsx b/superset-frontend/src/explore/components/PaExploreViewContainer.jsx index 31f9362c0b199..3e9c31f49c99b 100644 --- a/superset-frontend/src/explore/components/PaExploreViewContainer.jsx +++ b/superset-frontend/src/explore/components/PaExploreViewContainer.jsx @@ -57,8 +57,7 @@ import { } from '../../logger/LogUtils'; import { tableFormDataObject, - FilterPDataType, - FilterMWorkstationName + flattenTableFormDataObject } from '../tableFormDataObject'; import { ConsoleSqlOutlined } from '@ant-design/icons'; @@ -277,6 +276,9 @@ function ExploreViewContainer(props) { case chartName.includes('[Workstations_Chart]'): handleAdhocFiltersWorkstationAndDataType(data); break; + case chartName.includes('[Flatten_Workstations_Chart]'): + handleAdhocFiltersWorkstationAndDataType(data); + break; case chartName.includes('[Distribution_Chart]'): handleAdhocFiltersValue(data); break; @@ -292,12 +294,18 @@ function ExploreViewContainer(props) { let month = monthParse[item[1]]; let day = item[2].split(",")[0]; let hour = "AM" === item[4] ? parseInt(item[3]) + 8 : parseInt(item[3]) + 12 + 8; + if (!hour) { + hour = 8; + } + if ("PM" == item[4] && 12 === parseInt(item[3])) { + hour = parseInt(item[3]) + 8; + } let start = new Date(year, month, day, hour).getTime(); let end = start + 3600 * 1000; handleTimeRange(new Date(start).toISOString().split(".")[0] + ' : ' + new Date(end).toISOString().split(".")[0]); break; case chartName.includes('Workstation Hourly'): - // handleAdhocFilters(data.value); + handleAdhocFilters(data.value); break; } } @@ -326,7 +334,7 @@ function ExploreViewContainer(props) { "isExtra": false, "isNew": false, "operator": data.ops[op], - "operatorId": ">=" === data.ops[op] ? "GREATER_THAN_OR_EQUAL" : "LESS_THAN", + "operatorId": ">=" === data.ops[op] ? "GREATER_THAN" : "LESS_THAN_OR_EQUAL", "sqlExpression": null, "subject": "P_VALUE" }); @@ -336,10 +344,10 @@ function ExploreViewContainer(props) { function handleAdhocFiltersWorkstationAndDataType(data) { for (let i = 0; i < data.type.length; i++) { clearTableFormDataPreviouslyAdhocFilters(data.type[i]); - if ("M_WORKSTATION_NAME" === data.type[i]) { + if ("M_WORKSTATION_NAME" === data.type[i] || "workstation_name" === data.type[i]) { tableFormData.adhoc_filters.push({ "expressionType": "SIMPLE", - "subject": "M_WORKSTATION_NAME", + "subject": data.type[i], "operator": "IN", "operatorId": "IN", "comparator": data.value[i], @@ -352,7 +360,7 @@ function ExploreViewContainer(props) { } else if ("P_DATA_TYPE" === data.type[i]) { tableFormData.adhoc_filters.push({ "expressionType": "SIMPLE", - "subject": "P_DATA_TYPE", + "subject": data.type[i], "operator": "IN", "operatorId": "IN", "comparator": data.value[i], From 6219bacc9ed1e2bd3e4439c9ac2a9920cd6c6541 Mon Sep 17 00:00:00 2001 From: chriszhu Date: Fri, 22 Oct 2021 13:39:50 +0800 Subject: [PATCH 3/3] 1. delete useless log 2. disable some datefilter function --- superset-frontend/src/chart/chartAction.js | 20 +++++-- .../TableChartTableCollection.tsx | 1 - .../components/PaExploreChartPanel.jsx | 2 - .../components/PaExploreViewContainer.jsx | 10 ++-- .../DateFilterControl/utils/constants.ts | 10 ++-- .../src/explore/tableFormDataObject.js | 55 +++++++++++++++++++ 6 files changed, 80 insertions(+), 18 deletions(-) diff --git a/superset-frontend/src/chart/chartAction.js b/superset-frontend/src/chart/chartAction.js index af2d8405f627b..aa642a3f29a74 100644 --- a/superset-frontend/src/chart/chartAction.js +++ b/superset-frontend/src/chart/chartAction.js @@ -367,7 +367,6 @@ export function exploreJSON( ) { return async dispatch => { const logStart = Logger.getTimestamp(); - console.log("@370", logStart) const controller = new AbortController(); const requestParams = { @@ -545,18 +544,27 @@ export function postChartFormData( /* * [MODIFY-TIMEZONE] */ - console.log("@544", formData['time_range'].split(" : ")[0], formData['time_range'].split(" : ")[1]) - console.log("@544", !isNaN(Date.parse(formData['time_range'].split(" : ")[0]))) if (!isNaN(Date.parse(formData['time_range'].split(" : ")[0]))) { const since = Date.parse(formData['time_range'].split(" : ")[0]); const until = Date.parse(formData['time_range'].split(" : ")[1]); - console.log("@544", since, until); const utcSince = new Date(since).toISOString().split(".")[0]; const utcUntil = new Date(until).toISOString().split(".")[0]; - console.log("@544", utcSince, utcUntil); formData['time_range'] = utcSince + " : " + utcUntil; } - console.log("@551 formData", formData, formData['time_range']); + const mappings = { + "Last": {"index": 1, "day": 1, "week": 7, "month": 31, "quarter": 91, "year": 365}, + "previous": {"index": 2, "week": 7, "month": 30, "year": 365} + } + if ("Last" === formData.time_range.split(" ")[0] || "previous" === formData.time_range.split(" ")[0]) { + let type = formData.time_range.split(" ")[0]; + const utcSince = new Date( + Date.parse(new Date(Date.now()).toDateString()) + - mappings[type][formData.time_range.split(" ")[mappings[type]["index"]]] * 24 * 3600 * 1000 + ).toISOString().split(".")[0]; + const utcUntil = new Date(Date.parse(new Date(Date.now()).toDateString())).toISOString().split(".")[0]; + formData['time_range'] = utcSince + " : " + utcUntil; + } + return exploreJSON( formData, force, diff --git a/superset-frontend/src/components/dataViewCommon/TableChartTableCollection.tsx b/superset-frontend/src/components/dataViewCommon/TableChartTableCollection.tsx index e839e5c25d457..b5424ee4d19d2 100644 --- a/superset-frontend/src/components/dataViewCommon/TableChartTableCollection.tsx +++ b/superset-frontend/src/components/dataViewCommon/TableChartTableCollection.tsx @@ -365,7 +365,6 @@ let showRowData = (row: object) => { pos = row['original']['pos']; endTime = row['original']['event_ts']; startTime = endTime - row['original']['cycle_time'] * 1000 - console.log("@338", endTime); } let url = 'https://manage-' + clientName + '.standalone.powerarena.com:10443/admin/mark-for-reason/?tab=single-view&entity_code=' + entityCode + '&pos=' + pos + '&start_ts=' + startTime + '&end_ts=' + endTime; window.open(url, '_blank')?.focus(); diff --git a/superset-frontend/src/explore/components/PaExploreChartPanel.jsx b/superset-frontend/src/explore/components/PaExploreChartPanel.jsx index 343a5867ef466..26c851990a7f0 100644 --- a/superset-frontend/src/explore/components/PaExploreChartPanel.jsx +++ b/superset-frontend/src/explore/components/PaExploreChartPanel.jsx @@ -115,7 +115,6 @@ const Styles = styled.div` `; const ExploreChartPanel = props => { - console.log("@118 form_data", props.form_data) const theme = useTheme(); const gutterMargin = theme.gridUnit * GUTTER_SIZE_FACTOR; const gutterHeight = theme.gridUnit * GUTTER_SIZE_FACTOR; @@ -278,7 +277,6 @@ const ExploreChartPanel = props => { $(".panel-body").unbind("click").click( function (e) { let target = $(".nvtooltip").children("div").children("table").children("thead").text(); - console.log("@281", target); props.updateTableForm({ 'value': [target], 'type': ['P_EVENT_TS'], diff --git a/superset-frontend/src/explore/components/PaExploreViewContainer.jsx b/superset-frontend/src/explore/components/PaExploreViewContainer.jsx index 3e9c31f49c99b..fdeb33c26d32b 100644 --- a/superset-frontend/src/explore/components/PaExploreViewContainer.jsx +++ b/superset-frontend/src/explore/components/PaExploreViewContainer.jsx @@ -166,7 +166,6 @@ function useWindowSize({ delayMs = 250 } = {}) { function ExploreViewContainer(props) { // const chartName = $(".editable-title").text() ? $(".editable-title").text() : ""; const chartName = $(".editable-title").children().attr('value'); - console.log("@169", chartName) const dynamicPluginContext = usePluginContext(); const dynamicPlugin = dynamicPluginContext.dynamicPlugins[props.vizType]; const isDynamicPluginLoading = dynamicPlugin && dynamicPlugin.mounting; @@ -283,7 +282,6 @@ function ExploreViewContainer(props) { handleAdhocFiltersValue(data); break; case chartName.includes('[Alerts_Overtime]'): - console.log("@286", data, data['value']); let monthParse = { 'Jan': '00', 'Feb': '01', 'Mar': '02', 'Apr': '03', 'May': '04', 'Jun': '05', 'Jul': '06', 'Aug': '07', 'Sep': '08', 'Oct': '09', 'Nov': '10', 'Dec': '11' @@ -491,8 +489,7 @@ function ExploreViewContainer(props) { tableFormData.time_range = props.form_data.time_range; } - console.log("@485") - + console.log("@495", tableFormData, props.form_data); if (tableFormData.adhoc_filters) { for (let i = 0; i < props.form_data.adhoc_filters.length; i++) { if (props.form_data.adhoc_filters[i]['subject'] == "P_DATA_TYPE") { @@ -509,6 +506,11 @@ function ExploreViewContainer(props) { tableFormData.datasource = props.form_data.datasource; tableFormData.row_limit = props.form_data.row_limit; + const datasetName = $(".title-select").text(); + if (datasetName.includes("flatten")) { + tableFormData.all_columns = flattenTableFormDataObject.all_columns + } + // key should large than props.form_data.slice_id; props.actions.postChartFormData(tableFormData, false, 60, 10000000000, undefined, undefined) .then(json => { diff --git a/superset-frontend/src/explore/components/controls/DateFilterControl/utils/constants.ts b/superset-frontend/src/explore/components/controls/DateFilterControl/utils/constants.ts index 22ccd5b5edf1f..ad1f72388cdcf 100644 --- a/superset-frontend/src/explore/components/controls/DateFilterControl/utils/constants.ts +++ b/superset-frontend/src/explore/components/controls/DateFilterControl/utils/constants.ts @@ -29,9 +29,9 @@ import { export const FRAME_OPTIONS: SelectOptionType[] = [ { value: 'Common', label: t('Last') }, - { value: 'Calendar', label: t('Previous') }, + // { value: 'Calendar', label: t('Previous') }, { value: 'Custom', label: t('Custom') }, - { value: 'Advanced', label: t('Advanced') }, + // { value: 'Advanced', label: t('Advanced') }, { value: 'No filter', label: t('No filter') }, ]; @@ -82,9 +82,9 @@ export const UNTIL_GRAIN_OPTIONS: SelectOptionType[] = GRAIN_OPTIONS.map( export const SINCE_MODE_OPTIONS: SelectOptionType[] = [ { value: 'specific', label: t('Specific Date/Time') }, - { value: 'relative', label: t('Relative Date/Time') }, - { value: 'now', label: t('Now') }, - { value: 'today', label: t('Midnight') }, + // { value: 'relative', label: t('Relative Date/Time') }, + // { value: 'now', label: t('Now') }, + // { value: 'today', label: t('Midnight') }, ]; export const UNTIL_MODE_OPTIONS: SelectOptionType[] = SINCE_MODE_OPTIONS.slice(); diff --git a/superset-frontend/src/explore/tableFormDataObject.js b/superset-frontend/src/explore/tableFormDataObject.js index be766cdd6b68c..3c967d502b116 100644 --- a/superset-frontend/src/explore/tableFormDataObject.js +++ b/superset-frontend/src/explore/tableFormDataObject.js @@ -73,4 +73,59 @@ export const tableFormDataObject = { "show_cell_bars": true, "color_pn": true, "extra_form_data": {} +} + +export const flattenTableFormDataObject = { + "viz_type": "table", + "datasource": "", + "slice_id": 42, + "url_params": {}, + "time_range_endpoints": [ + "inclusive", + "exclusive" + ], + "granularity_sqla": "event_ts", + "time_grain_sqla": "PT1H", + "time_range": "DATEADD(DATETIME(\"2021-09-16T00:00:00\"), -24, hour) : 2021-09-16T00:00:00", + "query_mode": "raw", + "groupby": [ + "workstation_name" + ], + "all_columns": [ + "workstation_name", + "event_ts", + "cycle_time", + "process_time", + "idle_time", + "target_ct_time", + "production_line_code", + "pos", + "product_code", + "device_id", + ], + "percent_metrics": [], + "order_by_cols": [], + "row_limit": 10000, + "server_page_length": 10, + "order_desc": true, + "adhoc_filters": [ + { + "expressionType": "SIMPLE", + "subject": "workstation_name", + "operator": "IN", + "operatorId": "IN", + "comparator": [ + "A01" + ], + "clause": "WHERE", + "sqlExpression": null, + "isExtra": false, + "isNew": false, + "filterOptionName": "filter_pnegf7yxd1g_3523x62uhnf" + } + ], + "table_timestamp_format": "smart_date", + "show_cell_bars": true, + "color_pn": true, + "extra_form_data": {} } \ No newline at end of file