Skip to content

Commit

Permalink
Merge pull request #474 from TencentBlueKing/feat_bkbase_data_source
Browse files Browse the repository at this point in the history
fix: 新建采集时选择计算平台已有数据源进行上报报错 --bug=135106919
  • Loading branch information
0RAJA authored Dec 16, 2024
2 parents 8f14504 + 8c79c7e commit d7e617c
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/backend/config/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@
"watermark": os.getenv("BKAPP_FEATURE_WATERMARK", "deny"),
"bkvision": os.getenv("BKAPP_FEATURE_BKVISION", "deny"),
"bknotice": os.getenv("BKAPP_FEATURE_BKNOTICE", "deny"),
"bkbase_data_source": os.getenv("BKAPP_FEATURE_BKBASE_DATA_SOURCE", "on"),
}

# BkLog
Expand Down
4 changes: 3 additions & 1 deletion src/frontend/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ declare interface Window {
timezone: string;
}

declare module 'js-cookie'
declare module 'js-cookie';

declare module 'dompurify';

declare module '@blueking/notice-component';

Expand Down
7 changes: 7 additions & 0 deletions src/frontend/src/domain/service/collector-manage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,4 +317,11 @@ export default {
return CollectorSource.createApiPush(params)
.then(({ data }) => data);
},
/**
* @desc 是否显示:上报方式,计算平台已有数据源
*/
fetchBkbaseFeature(params: {feature_id: string}) {
return CollectorSource.getBkbaseFeature(params)
.then(({ data }) => data);
},
};
4 changes: 4 additions & 0 deletions src/frontend/src/domain/source/collector-manage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,10 @@ class CollectorManage extends ModuleBase {
payload,
});
}
// 判断上报方式,计算平台已有数据源是否显示
getBkbaseFeature(params: {feature_id: string}) {
return Request.get<Record<'enabled', boolean>>(`/api/v1/feature/${params.feature_id}/`);
}
}

export default new CollectorManage();
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
property="test">
<bk-radio-group v-model="reportMethod">
<bk-radio-button
v-for="item in reportMethodRadioList"
v-for="item in reportMethodRadioList.filter(item => showBkbase.enabled || item.id !== 'bkbase')"
:key="item.id"
class="form-raido-common"
:disabled="isEditMode"
Expand Down Expand Up @@ -334,7 +334,7 @@
yaml_config: '',
});
const reportMethod = ref('newlog');
const reportMethodRadioList = [
const reportMethodRadioList = ref([
{
id: 'newlog',
name: t('新建日志采集'),
Expand All @@ -343,7 +343,7 @@
id: 'bkbase',
name: t('计算平台已有数据源'),
},
];
]);
type environmentType = keyof typeof comMap
const isEditMode = route.name === 'collectorEdit' || route.name === 'dataIdEdit';
const formRef = ref();
Expand Down Expand Up @@ -518,6 +518,18 @@
});
}

const {
data: showBkbase,
} = useRequest(CollectorManageService.fetchBkbaseFeature, {
defaultValue: {
enabled: false,
},
defaultParams: {
feature_id: 'bkbase_data_source',
},
manual: true,
});


const {
run: fecthDetail,
Expand Down

0 comments on commit d7e617c

Please sign in to comment.