Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #375 : remove outdated log service #376

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 0 additions & 33 deletions packages/rath-client/src/loggers/dataImport.ts
Original file line number Diff line number Diff line change
@@ -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();
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -38,12 +37,6 @@ const AirTableSource: React.FC<AirTableSourceProps> = (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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -177,13 +176,6 @@ const DatabaseData: React.FC<DatabaseDataProps> = ({ 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,
Expand Down
8 changes: 0 additions & 8 deletions packages/rath-client/src/pages/dataConnection/demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -104,13 +103,6 @@ const DemoData: FC<DemoDataProps> = 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);
})
Expand Down
8 changes: 1 addition & 7 deletions packages/rath-client/src/pages/dataConnection/file/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -238,12 +238,6 @@ const FileData: FC<FileDataProps> = (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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -82,13 +81,6 @@ const JSONAPI: React.FC<JSONAPIProps> = (props) => {
datasourceType: DataSourceType.Restful,
linkInfo: { api, detectedDataStruct },
});
logDataImport({
dataType: 'JSON API',
name: api,
fields,
dataSource: dataSource.slice(0, 20),
size: dataSource.length,
});
}
onClose();
}
Expand Down
7 changes: 0 additions & 7 deletions packages/rath-client/src/pages/dataConnection/olap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -61,12 +60,6 @@ const OLAPData: React.FC<OLAPDataProps> = (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,
Expand Down
8 changes: 0 additions & 8 deletions packages/rath-client/src/pages/dataConnection/restful.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -82,13 +81,6 @@ const RestFul: React.FC<RestFulProps> = (props) => {
datasourceType: DataSourceType.Restful,
linkInfo: { api },
});
logDataImport({
dataType: 'Restful API',
name: api,
fields,
dataSource: [],
size: dataSource.length,
});
})
.catch((err) => {
onLoadingFailed(err);
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -38,12 +37,6 @@ const AirTableSource: React.FC<AirTableSourceProps> = (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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -148,13 +147,6 @@ const DatabaseConnector: FC<DatabaseDataProps> = ({ onClose, onDataLoaded }) =>
credentials,
},
});
logDataImport({
dataType: `Database/${sourceType}`,
name,
fields,
dataSource: dataSource.slice(0, 10),
size: dataSource.length,
});
onDataLoaded(fields, dataSource, name, DataSourceTag.DATABASE);

onClose();
Expand Down
8 changes: 0 additions & 8 deletions packages/rath-client/src/pages/dataSource/selection/demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -138,13 +137,6 @@ const DemoData: FC<DemoDataProps> = 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);
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -224,12 +224,6 @@ const FileData: FC<FileDataProps> = (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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -82,13 +81,6 @@ const JSONAPI: React.FC<JSONAPIProps> = (props) => {
datasourceType: DataSourceType.Restful,
linkInfo: { api, detectedDataStruct },
});
logDataImport({
dataType: 'JSON API',
name: api,
fields,
dataSource: dataSource.slice(0, 20),
size: dataSource.length,
});
}
onClose();
}
Expand Down
7 changes: 0 additions & 7 deletions packages/rath-client/src/pages/dataSource/selection/olap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -45,12 +44,6 @@ const OLAPData: React.FC<OLAPDataProps> = 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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -65,13 +64,6 @@ const RestFul: React.FC<RestFulProps> = props => {
datasourceType: DataSourceType.Restful,
linkInfo: { api },
});
logDataImport({
dataType: "Restful API",
name: api,
fields,
dataSource: [],
size: dataSource.length,
});
}).catch((err) => {
onLoadingFailed(err);
})
Expand Down