Skip to content

Commit 288be50

Browse files
committed
fix: adjust the api for connections token check
1 parent 626db74 commit 288be50

File tree

3 files changed

+8
-15
lines changed

3 files changed

+8
-15
lines changed

config-ui/src/api/blueprint/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,5 @@ type TriggerQuery = {
4343

4444
export const trigger = (id: ID, data: TriggerQuery = { skipCollectors: false, fullSync: false }) =>
4545
request(`/blueprints/${id}/trigger`, { method: 'post', data });
46+
47+
export const connectionsTokenCheck = (id: ID) => request(`/blueprints/${id}/connections-token-check`);

config-ui/src/api/project/index.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,7 @@ export const list = (data: Pagination & { keyword?: string }): Promise<{ count:
2424

2525
export const get = (name: string): Promise<IProject> => request(`/projects/${encodeURIComponent(name)}`);
2626

27-
export const check = (
28-
name: string,
29-
data?: { check_token: 1 },
30-
): Promise<{
31-
exist: boolean;
32-
tokens: Array<{ pluginName: string; connectionId: ID; success: boolean }>;
33-
}> =>
34-
request(`/projects/${encodeURIComponent(name)}/check`, {
35-
data,
36-
});
27+
export const checkName = (name: string) => request(`/projects/${encodeURIComponent(name)}/check`);
3728

3829
export const create = (data: Pick<IProject, 'name' | 'description' | 'metrics'>) =>
3930
request('/projects', {

config-ui/src/routes/blueprint/detail/status-panel.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,15 @@ export const StatusPanel = ({ from, blueprint, pipelineId, onRefresh }: Props) =
7474
skipCollectors?: boolean;
7575
fullSync?: boolean;
7676
}) => {
77-
if (!skipCollectors && from === FromEnum.project) {
78-
const [success, res] = await operator(() => API.project.check(blueprint.projectName, { check_token: 1 }), {
77+
if (!skipCollectors) {
78+
const [success, res] = await operator(() => API.blueprint.connectionsTokenCheck(blueprint.id), {
7979
hideToast: true,
8080
setOperating,
8181
});
8282

83-
if (success && res.tokens.length) {
84-
const connectionFailed = res.tokens
85-
.filter((token: any) => !token.success)
83+
if (success && res.length) {
84+
const connectionFailed = res
85+
.filter((it: any) => !it.success)
8686
.map((it: any) => {
8787
const unique = `${it.pluginName}-${it.connectionId}`;
8888
const connection = connections.find((c) => c.unique === unique);

0 commit comments

Comments
 (0)