Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { WarningOutlined, ReloadOutlined } from '@ant-design/icons';
import { useTranslation } from 'react-i18next';
import _ from 'lodash';
import { Link } from 'react-router-dom';
import { getDataSourceList } from '@/pages/datasource/services';
import { getDatasourceBriefList } from '@/services/common';

export const DATASOURCE_ALL = 0;

Expand Down Expand Up @@ -54,7 +54,7 @@ export default function index({ setFieldsValue, cate, datasourceList, mode, requ
const datasourceIds = Form.useWatch('datasource_ids');
const invalidDatasourceIds = getInvalidDatasourceIds(datasourceIds, datasourceList, fullDatasourceList);
const fetchDatasourceList = () => {
getDataSourceList().then((res) => {
getDatasourceBriefList().then((res) => {
setFullDatasourceList(res);
});
};
Expand Down Expand Up @@ -88,8 +88,16 @@ export default function index({ setFieldsValue, cate, datasourceList, mode, requ
{_.map(invalidDatasourceIds, (item) => {
const result = _.find(fullDatasourceList, { id: item });
if (result) {
let url = `/help/source/edit/${result.plugin_type}/${result.id}`;
if (import.meta.env.VITE_IS_ENT === 'true') {
const cateMap = {
timeseries: 'datasource',
log: 'logging',
};
url = `/settings/${cateMap[result.category]}/edit/${result.id}`;
}
return (
<Link style={{ paddingLeft: 8 }} target='_blank' to={`/help/source/edit/${result.plugin_type}/${result.id}`}>
<Link style={{ paddingLeft: 8 }} target='_blank' to={url}>
{result.name}
</Link>
);
Expand Down
4 changes: 2 additions & 2 deletions src/pages/dashboard/Renderer/datasource/prometheus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ export default async function prometheusQuery(options: IOptions): Promise<Result
_step = target.step;
}
// TODO: 消除毛刺?
start = start - (start % _step!);
end = end - (end % _step!);
// start = start - (start % _step!);
// end = end - (end % _step!);

const realExpr = variableConfig
? replaceFieldWithVariable(
Expand Down
2 changes: 1 addition & 1 deletion src/pages/targets/locale/zh_CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const zh_CN = {
3分钟内没有心跳:红色
`,
remote_addr: '来源 IP',
remote_addr_tip: '来源 IP 是从 HTTP Header 中获取的,如果经过了代理,不一定是真是的来源IP',
remote_addr_tip: '来源 IP 是从 HTTP Header 中获取的,如果经过了代理,不一定是真实的来源IP',
agent_version: 'Agent 版本',
note: '备注',
unknown_tip: '机器元信息的展示,categraf 的版本需要高于 0.2.35',
Expand Down
2 changes: 1 addition & 1 deletion src/pages/targets/locale/zh_HK.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const zh_HK = {
3分鐘內沒有心跳:紅色
`,
remote_addr: '來源 IP',
remote_addr_tip: '來源 IP 是從 HTTP Header 中獲取的,如果經過了代理,不一定是真是的來源IP',
remote_addr_tip: '來源 IP 是從 HTTP Header 中獲取的,如果經過了代理,不一定是真实的來源IP',
agent_version: 'Agent 版本',
note: '備註',
unknown_tip: '機器元信息的展示,categraf 的版本需要高於 0.2.35',
Expand Down
11 changes: 0 additions & 11 deletions src/pages/traceCpt/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,6 @@ import { RequestMethod } from '@/store/common';
import { N9E_PATHNAME } from '@/utils/constant';
import { SearchTraceType, SearchTraceIDType } from './type';

export const getDataSourceList = () => {
return request(`/api/v1/datasource/list`, {
method: RequestMethod.Post,
data: {
p: 1,
limit: 100,
category: 'tracing',
},
}).then((res) => res.data.items.filter((item) => item.status === 'enabled'));
};

export const getTraceServices = (data_source_id) => {
return request(`/api/${N9E_PATHNAME}/proxy/${data_source_id}/api/services`, {
method: RequestMethod.Get,
Expand Down
32 changes: 0 additions & 32 deletions src/services/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,6 @@ import _ from 'lodash';
import request from '@/utils/request';
import { RequestMethod } from '@/store/common';

// 获取数据源列表
export function getDatasourceList(pluginTypes?: string[]): Promise<{ name: string; id: number; plugin_type: string }[]> {
let url = '/api/n9e/datasource/list';
// if (import.meta.env.VITE_IS_ENT === 'true') {
// url = '/api/v1/datasource/list';
// }
return request(url, {
method: RequestMethod.Post,
data: {
p: 1,
limit: 5000, // TODO: 假设 n9e 里面需要选择的数据源不会超过 5000 个
},
})
.then((res) => {
return _.map(
_.filter(res.data.items || res.data, (item) => {
return pluginTypes ? _.includes(pluginTypes, item.plugin_type) : true;
}),
(item) => {
return {
...item,
// 兼容 common ds
plugin_type: item.category ? _.replace(item.plugin_type, `.${item.category}`, '') : item.plugin_type,
};
},
);
})
.catch(() => {
return [];
});
}

// 匿名获取数据源列表
export function getDatasourceBriefList(): Promise<{ name: string; id: number; plugin_type: string }[]> {
const url = '/api/n9e/datasource/brief';
Expand Down