diff --git a/packages/rath-client/src/loggers/dataImport.ts b/packages/rath-client/src/loggers/dataImport.ts index b3510c16..c6bfcc53 100644 --- a/packages/rath-client/src/loggers/dataImport.ts +++ b/packages/rath-client/src/loggers/dataImport.ts @@ -1,36 +1,3 @@ -import { IMuteFieldBase, IRow } from "../interfaces" - -const DATA_SOURCE_LOGGER_URL = - 'https://1423108296428281.cn-hangzhou.fc.aliyuncs.com/2016-08-15/proxy/Rath/dataSourceLogger/' - -interface IDataImportInfo { - dataType: string; - fields: IMuteFieldBase[]; - dataSource: IRow[]; - name?: string; - info?: any; - size: number; -} -export async function logDataImport (props: IDataImportInfo) { - if (process.env.NODE_ENV === 'production') { - try { - const res = await fetch(DATA_SOURCE_LOGGER_URL, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify(props), - }) - await res.json() - } catch (error) { - console.error(error) - } - } else { - // eslint-disable-next-line no-console - console.log(`Current Env: ${process.env.NODE_ENV}.`, props); - } -} - export async function dataBackup (file: File) { if (process.env.NODE_ENV === 'production') { const data = new FormData(); diff --git a/packages/rath-client/src/pages/dataConnection/airtable/index.tsx b/packages/rath-client/src/pages/dataConnection/airtable/index.tsx index 372f8c8e..501cf5e8 100644 --- a/packages/rath-client/src/pages/dataConnection/airtable/index.tsx +++ b/packages/rath-client/src/pages/dataConnection/airtable/index.tsx @@ -1,7 +1,6 @@ import { DefaultButton, PrimaryButton, Stack, TextField } from '@fluentui/react'; import React, { useCallback, useState } from 'react'; import intl from 'react-intl-universal' -import { logDataImport } from '../../../loggers/dataImport'; import { DataSourceType, IMuteFieldBase, IRow } from '../../../interfaces'; import { rawData2DataWithBaseMetas } from '../../dataSource/utils'; import { DataSourceTag, IDBMeta } from '../../../utils/storage'; @@ -38,12 +37,6 @@ const AirTableSource: React.FC = (props) => { .then((ds) => { const name = `airtable-${tableName}-${viewName}`; onDataLoaded(ds.fields, ds.dataSource, name, DataSourceTag.AIR_TABLE); - logDataImport({ - dataType: 'AirTable', - fields: ds.fields, - dataSource: ds.dataSource.slice(0, 10), - size: ds.dataSource.length - }); userStore.saveDataSourceOnCloudOnlineMode({ name, datasourceType: DataSourceType.AirTable, diff --git a/packages/rath-client/src/pages/dataConnection/database/index.tsx b/packages/rath-client/src/pages/dataConnection/database/index.tsx index 5a5c449f..5f16ea7e 100644 --- a/packages/rath-client/src/pages/dataConnection/database/index.tsx +++ b/packages/rath-client/src/pages/dataConnection/database/index.tsx @@ -3,7 +3,6 @@ import { observer } from 'mobx-react-lite'; import intl from 'react-intl-universal'; import { IDropdownOption, Stack, registerIcons, PrimaryButton } from '@fluentui/react'; import { DataSourceType, IMuteFieldBase, IRow } from '../../../interfaces'; -import { logDataImport } from '../../../loggers/dataImport'; import prefetch from '../../../utils/prefetch'; import { notify } from '../../../components/error'; import { DataSourceTag } from '../../../utils/storage'; @@ -177,13 +176,6 @@ const DatabaseData: React.FC = ({ onClose, onDataLoaded, setL const { dataSource, fields } = data; const name = [database.value, schema.value].filter(Boolean).join('.'); - logDataImport({ - dataType: `Database/${databaseType}`, - name, - fields, - dataSource: dataSource.slice(0, 10), - size: dataSource.length, - }); userStore.saveDataSourceOnCloudOnlineMode({ name, datasourceType: DataSourceType.Database, diff --git a/packages/rath-client/src/pages/dataConnection/demo.tsx b/packages/rath-client/src/pages/dataConnection/demo.tsx index 510face4..09f05324 100644 --- a/packages/rath-client/src/pages/dataConnection/demo.tsx +++ b/packages/rath-client/src/pages/dataConnection/demo.tsx @@ -19,7 +19,6 @@ import { useId } from "@fluentui/react-hooks"; import intl from 'react-intl-universal'; import styled from 'styled-components'; import { Caption1, Card, CardHeader, Text } from '@fluentui/react-components'; -import { logDataImport } from '../../loggers/dataImport'; import { IDatasetBase, IMuteFieldBase, IRow } from '../../interfaces'; import { DEMO_DATA_REQUEST_TIMEOUT } from '../../constants'; import { DataSourceTag, IDBMeta } from '../../utils/storage'; @@ -104,13 +103,6 @@ const DemoData: FC = props => { requestDemoData(demo.key).then(data => { const { dataSource, fields } = data; onDataLoaded(fields, dataSource, `${demo.text}.${RathDemoVirtualExt}`, DataSourceTag.DEMO); - logDataImport({ - dataType: "Demo", - name: demo.key, - fields, - dataSource: [], - size: dataSource.length, - }); }).catch((err) => { onLoadingFailed(err); }) diff --git a/packages/rath-client/src/pages/dataConnection/file/index.tsx b/packages/rath-client/src/pages/dataConnection/file/index.tsx index 2ec42d25..992bac3b 100644 --- a/packages/rath-client/src/pages/dataConnection/file/index.tsx +++ b/packages/rath-client/src/pages/dataConnection/file/index.tsx @@ -20,7 +20,7 @@ import { observer } from "mobx-react-lite"; import * as xlsx from 'xlsx'; import intl from "react-intl-universal"; import { isExcelFile, loadDataFile, loadExcelFile, loadExcelRaw, parseExcelFile, readRaw, SampleKey } from "../../dataSource/utils" -import { dataBackup, logDataImport } from "../../../loggers/dataImport"; +import { dataBackup } from "../../../loggers/dataImport"; import { DataSourceType, IMuteFieldBase, IRow } from "../../../interfaces"; import { DataSourceTag, IDBMeta } from "../../../utils/storage" import { useGlobalStore } from "../../../store"; @@ -238,12 +238,6 @@ const FileData: FC = (props) => { fileType: preview.type, }, }, preview); - logDataImport({ - dataType: 'File', - fields, - dataSource: dataSource.slice(0, 10), - size: dataSource.length - }); dataBackup(preview); onDataLoaded(fields, dataSource, preview.name, DataSourceTag.FILE); onClose(); diff --git a/packages/rath-client/src/pages/dataConnection/jsonAPI/index.tsx b/packages/rath-client/src/pages/dataConnection/jsonAPI/index.tsx index 00a170e0..c26db881 100644 --- a/packages/rath-client/src/pages/dataConnection/jsonAPI/index.tsx +++ b/packages/rath-client/src/pages/dataConnection/jsonAPI/index.tsx @@ -20,7 +20,6 @@ import intl from 'react-intl-universal'; import MonacoEditor from 'react-monaco-editor'; import { unstable_batchedUpdates } from 'react-dom'; import { DataSourceType, IMuteFieldBase, IRow } from '../../../interfaces'; -import { logDataImport } from '../../../loggers/dataImport'; import { DataSourceTag } from '../../../utils/storage'; import { useGlobalStore } from '../../../store'; import { IJSONAPIFormat, getFullData, getPreviewData, jsonDataFormatChecker, requestJSONAPIData } from './utils'; @@ -82,13 +81,6 @@ const JSONAPI: React.FC = (props) => { datasourceType: DataSourceType.Restful, linkInfo: { api, detectedDataStruct }, }); - logDataImport({ - dataType: 'JSON API', - name: api, - fields, - dataSource: dataSource.slice(0, 20), - size: dataSource.length, - }); } onClose(); } diff --git a/packages/rath-client/src/pages/dataConnection/olap.tsx b/packages/rath-client/src/pages/dataConnection/olap.tsx index f91eea4e..934f276b 100644 --- a/packages/rath-client/src/pages/dataConnection/olap.tsx +++ b/packages/rath-client/src/pages/dataConnection/olap.tsx @@ -19,7 +19,6 @@ import { DefaultButton, Dropdown, IDropdownOption, PrimaryButton, ProgressIndica import ConnectionStatus from '../../components/connectionStatus'; import { DataSourceType, IMuteFieldBase, IRow } from '../../interfaces'; import { useGlobalStore } from '../../store'; -import { logDataImport } from '../../loggers/dataImport'; import { notify } from '../../components/error'; import { DataSourceTag } from '../../utils/storage'; @@ -61,12 +60,6 @@ const OLAPData: React.FC = (props) => { clickHouseStore .loadSampleData() .then(({ fieldMetas, data }) => { - logDataImport({ - dataType: 'OLAP', - fields: fieldMetas, - dataSource: data.slice(0, 10), - size: data.length, - }); userStore.saveDataSourceOnCloudOnlineMode({ name: '', datasourceType: DataSourceType.Restful, diff --git a/packages/rath-client/src/pages/dataConnection/restful.tsx b/packages/rath-client/src/pages/dataConnection/restful.tsx index 6bd47be0..6218cbba 100644 --- a/packages/rath-client/src/pages/dataConnection/restful.tsx +++ b/packages/rath-client/src/pages/dataConnection/restful.tsx @@ -20,7 +20,6 @@ import intl from 'react-intl-universal'; import MonacoEditor from 'react-monaco-editor'; import { DEMO_DATA_REQUEST_TIMEOUT } from '../../constants'; import { DataSourceType, IDatasetBase, IMuteFieldBase, IRow } from '../../interfaces'; -import { logDataImport } from '../../loggers/dataImport'; import { DataSourceTag } from '../../utils/storage'; import { useGlobalStore } from '../../store'; @@ -82,13 +81,6 @@ const RestFul: React.FC = (props) => { datasourceType: DataSourceType.Restful, linkInfo: { api }, }); - logDataImport({ - dataType: 'Restful API', - name: api, - fields, - dataSource: [], - size: dataSource.length, - }); }) .catch((err) => { onLoadingFailed(err); diff --git a/packages/rath-client/src/pages/dataSource/selection/airtable/index.tsx b/packages/rath-client/src/pages/dataSource/selection/airtable/index.tsx index c953a9fa..9e7c2100 100644 --- a/packages/rath-client/src/pages/dataSource/selection/airtable/index.tsx +++ b/packages/rath-client/src/pages/dataSource/selection/airtable/index.tsx @@ -1,7 +1,6 @@ import { DefaultButton, PrimaryButton, Stack, TextField } from '@fluentui/react'; import React, { useCallback, useState } from 'react'; import intl from 'react-intl-universal' -import { logDataImport } from '../../../../loggers/dataImport'; import { DataSourceType, IMuteFieldBase, IRow } from '../../../../interfaces'; import { rawData2DataWithBaseMetas } from '../../utils'; import { DataSourceTag, IDBMeta } from '../../../../utils/storage'; @@ -38,12 +37,6 @@ const AirTableSource: React.FC = (props) => { .then((ds) => { const name = `airtable-${tableName}-${viewName}`; onDataLoaded(ds.fields, ds.dataSource, name, DataSourceTag.AIR_TABLE); - logDataImport({ - dataType: 'AirTable', - fields: ds.fields, - dataSource: ds.dataSource.slice(0, 10), - size: ds.dataSource.length - }); userStore.saveDataSourceOnCloudOnlineMode({ name, datasourceType: DataSourceType.AirTable, diff --git a/packages/rath-client/src/pages/dataSource/selection/database/index.tsx b/packages/rath-client/src/pages/dataSource/selection/database/index.tsx index 2dc19844..964a14d3 100644 --- a/packages/rath-client/src/pages/dataSource/selection/database/index.tsx +++ b/packages/rath-client/src/pages/dataSource/selection/database/index.tsx @@ -9,7 +9,6 @@ import useAsyncState from '../../../../hooks/use-async-state'; import useCachedState from '../../../../hooks/use-cached-state'; import { notify } from '../../../../components/error'; import { useGlobalStore } from '../../../../store'; -import { logDataImport } from '../../../../loggers/dataImport'; import { rawData2DataWithBaseMetas } from '../../utils'; import databaseOptions from './config'; import type { SupportedDatabaseType } from './type'; @@ -148,13 +147,6 @@ const DatabaseConnector: FC = ({ onClose, onDataLoaded }) => credentials, }, }); - logDataImport({ - dataType: `Database/${sourceType}`, - name, - fields, - dataSource: dataSource.slice(0, 10), - size: dataSource.length, - }); onDataLoaded(fields, dataSource, name, DataSourceTag.DATABASE); onClose(); diff --git a/packages/rath-client/src/pages/dataSource/selection/demo.tsx b/packages/rath-client/src/pages/dataSource/selection/demo.tsx index 3b2f65f9..c231be00 100644 --- a/packages/rath-client/src/pages/dataSource/selection/demo.tsx +++ b/packages/rath-client/src/pages/dataSource/selection/demo.tsx @@ -4,7 +4,6 @@ import { useId } from "@fluentui/react-hooks"; import intl from 'react-intl-universal'; import styled from 'styled-components'; import { DemoDataAssets, IDemoDataKey, useDemoDataOptions } from '../config'; -import { logDataImport } from '../../../loggers/dataImport'; import { IDatasetBase, IMuteFieldBase, IRow } from '../../../interfaces'; import { DEMO_DATA_REQUEST_TIMEOUT } from '../../../constants'; import { DataSourceTag, IDBMeta } from '../../../utils/storage'; @@ -138,13 +137,6 @@ const DemoData: FC = props => { requestDemoData(demo.key).then(data => { const { dataSource, fields } = data; onDataLoaded(fields, dataSource, `${demo.text}.${RathDemoVirtualExt}`, DataSourceTag.DEMO); - logDataImport({ - dataType: "Demo", - name: demo.key, - fields, - dataSource: [], - size: dataSource.length, - }); }).catch((err) => { onLoadingFailed(err); }) diff --git a/packages/rath-client/src/pages/dataSource/selection/file/index.tsx b/packages/rath-client/src/pages/dataSource/selection/file/index.tsx index c9ad0333..c1c076e3 100644 --- a/packages/rath-client/src/pages/dataSource/selection/file/index.tsx +++ b/packages/rath-client/src/pages/dataSource/selection/file/index.tsx @@ -5,7 +5,7 @@ import { observer } from "mobx-react-lite"; import * as xlsx from 'xlsx'; import intl from "react-intl-universal"; import { isExcelFile, loadDataFile, loadExcelFile, loadExcelRaw, parseExcelFile, readRaw, SampleKey } from "../../utils"; -import { dataBackup, logDataImport } from "../../../../loggers/dataImport"; +import { dataBackup } from "../../../../loggers/dataImport"; import { DataSourceType, IMuteFieldBase, IRow } from "../../../../interfaces"; import { DataSourceTag, IDBMeta } from "../../../../utils/storage"; import { useGlobalStore } from "../../../../store"; @@ -224,12 +224,6 @@ const FileData: FC = (props) => { fileType: preview.type, }, }, preview); - logDataImport({ - dataType: 'File', - fields, - dataSource: dataSource.slice(0, 10), - size: dataSource.length - }); dataBackup(preview); onDataLoaded(fields, dataSource, preview.name, DataSourceTag.FILE); onClose(); diff --git a/packages/rath-client/src/pages/dataSource/selection/jsonAPI/index.tsx b/packages/rath-client/src/pages/dataSource/selection/jsonAPI/index.tsx index e2a19492..d55c504b 100644 --- a/packages/rath-client/src/pages/dataSource/selection/jsonAPI/index.tsx +++ b/packages/rath-client/src/pages/dataSource/selection/jsonAPI/index.tsx @@ -20,7 +20,6 @@ import intl from 'react-intl-universal'; import MonacoEditor from 'react-monaco-editor'; import { unstable_batchedUpdates } from 'react-dom'; import { DataSourceType, IMuteFieldBase, IRow } from '../../../../interfaces'; -import { logDataImport } from '../../../../loggers/dataImport'; import { DataSourceTag } from '../../../../utils/storage'; import { useGlobalStore } from '../../../../store'; import { IJSONAPIFormat, getFullData, getPreviewData, jsonDataFormatChecker, requestJSONAPIData } from './utils'; @@ -82,13 +81,6 @@ const JSONAPI: React.FC = (props) => { datasourceType: DataSourceType.Restful, linkInfo: { api, detectedDataStruct }, }); - logDataImport({ - dataType: 'JSON API', - name: api, - fields, - dataSource: dataSource.slice(0, 20), - size: dataSource.length, - }); } onClose(); } diff --git a/packages/rath-client/src/pages/dataSource/selection/olap.tsx b/packages/rath-client/src/pages/dataSource/selection/olap.tsx index 02b15ec9..062cdab6 100644 --- a/packages/rath-client/src/pages/dataSource/selection/olap.tsx +++ b/packages/rath-client/src/pages/dataSource/selection/olap.tsx @@ -4,7 +4,6 @@ import { DefaultButton, Dropdown, IDropdownOption, PrimaryButton, ProgressIndica import ConnectionStatus from '../../../components/connectionStatus'; import { DataSourceType, IMuteFieldBase, IRow } from '../../../interfaces'; import { useGlobalStore } from '../../../store'; -import { logDataImport } from '../../../loggers/dataImport'; import { notify } from '../../../components/error'; import { DataSourceTag } from '../../../utils/storage'; @@ -45,12 +44,6 @@ const OLAPData: React.FC = props => { const loadData = useCallback(() => { clickHouseStore.loadSampleData() .then(({ fieldMetas, data}) => { - logDataImport({ - dataType: 'OLAP', - fields: fieldMetas, - dataSource: data.slice(0, 10), - size: data.length - }); userStore.saveDataSourceOnCloudOnlineMode({ name: '', datasourceType: DataSourceType.Restful, diff --git a/packages/rath-client/src/pages/dataSource/selection/restful.tsx b/packages/rath-client/src/pages/dataSource/selection/restful.tsx index fd53b8ae..7fac7479 100644 --- a/packages/rath-client/src/pages/dataSource/selection/restful.tsx +++ b/packages/rath-client/src/pages/dataSource/selection/restful.tsx @@ -5,7 +5,6 @@ import intl from 'react-intl-universal' import MonacoEditor from 'react-monaco-editor'; import { DEMO_DATA_REQUEST_TIMEOUT } from '../../../constants'; import { DataSourceType, IDatasetBase, IMuteFieldBase, IRow } from '../../../interfaces'; -import { logDataImport } from '../../../loggers/dataImport'; import { DataSourceTag } from '../../../utils/storage'; import { useGlobalStore } from '../../../store'; @@ -65,13 +64,6 @@ const RestFul: React.FC = props => { datasourceType: DataSourceType.Restful, linkInfo: { api }, }); - logDataImport({ - dataType: "Restful API", - name: api, - fields, - dataSource: [], - size: dataSource.length, - }); }).catch((err) => { onLoadingFailed(err); })