Skip to content
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
4 changes: 2 additions & 2 deletions web/app/analyze/[owner]/image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ export default async function Image ({ params }: { params: { owner: string } })
] =
await Promise.all([
Promise.all(['stars', 'pull-requests', 'issues', 'reviews'].map(dim =>
fetch(`https://api.ossinsight.io/q/orgs/${dim}/total?ownerId=${info.id}&period=past_28_days`)
fetch(`/queries/orgs/${dim}/total?ownerId=${info.id}&period=past_28_days`)
.then(res => res.json())
.then(data => data.data[0]?.current_period_total ?? 0),
)),
Promise.all(['active', 'new'].map(dim =>
fetch(`https://api.ossinsight.io/q/orgs/participants/${dim}/ranking?ownerId=${info.id}&activity=${dim}&period=past_28_days`)
fetch(`/queries/orgs/participants/${dim}/ranking?ownerId=${info.id}&activity=${dim}&period=past_28_days`)
.then(res => res.json())
.then(data => data.data.slice(0, 5)),
)),
Expand Down
20 changes: 10 additions & 10 deletions web/components/Analyze/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import { handleOApi } from '@ossinsight/widgets-core/src/utils/oapi';

const API_SERVER = 'https://api.ossinsight.io';
const PATH_GET_ORG_INFO = `/q/get-user-by-login`;
const PATH_GET_ORG_OVERVIEW = `/q/orgs/overview`;
const PATH_GET_ORG_STARS_LOCATIONS = `/q/orgs/stars/locations`;
const PATH_GET_ORG_STARS_ORGS = `/q/orgs/stars/organizations`;
const PATH_GET_ORG_PARTICIPANT_LOCATIONS = `/q/orgs/participants/locations`;
const PATH_GET_ORG_PARTICIPANT_ORGS = `/q/orgs/participants/organizations`;
const PATH_GET_ORG_OVERVIEW = `/queries/orgs/overview`;
const PATH_GET_ORG_STARS_LOCATIONS = `/queries/orgs/stars/locations`;
const PATH_GET_ORG_STARS_ORGS = `/queries/orgs/stars/organizations`;
const PATH_GET_ORG_PARTICIPANT_LOCATIONS = `/queries/orgs/participants/locations`;
const PATH_GET_ORG_PARTICIPANT_ORGS = `/queries/orgs/participants/organizations`;
const PATH_GET_USERS = `/gh/users/`;
const PATH_GET_REPO_BY_ID = `/gh/repositories/`;
const PATH_GET_FILLED_RATIO = `/q/orgs/{activity}/{target}/completion-rate`;
const PATH_GET_FILLED_RATIO = `/queries/orgs/{activity}/{target}/completion-rate`;

export interface OwnerInfo {
type: 'User' | 'Organization' | 'Bot';
Expand All @@ -31,7 +31,7 @@ export const getOrgInfo = (login: string) => {
};

export const getOrgOverview = (id: number, signal?: AbortSignal) => {
return fetch(`${API_SERVER}${PATH_GET_ORG_OVERVIEW}?ownerId=${id}`, { signal })
return fetch(`${PATH_GET_ORG_OVERVIEW}?ownerId=${id}`, { signal })
.then(handleOApi);
};

Expand Down Expand Up @@ -77,7 +77,7 @@ export const getOrgActivityLocations = (

const paramsStr = params2UrlSearch({ ...params, ownerId: id });

return fetch(`${API_SERVER}${path}?${paramsStr}`, { signal })
return fetch(`${path}?${paramsStr}`, { signal })
.then(handleOApi);
};

Expand Down Expand Up @@ -109,7 +109,7 @@ export const getOrgActivityOrgs = (
path = PATH_GET_ORG_PARTICIPANT_ORGS;
}

return fetch(`${API_SERVER}${path}?${paramsStr}`, { signal })
return fetch(`${path}?${paramsStr}`, { signal })
.then(handleOApi);
};

Expand All @@ -135,7 +135,7 @@ export const getCompletionRate = (
path = path.replace('{activity}', params?.activity || 'stars');
path = path.replace('{target}', params?.target || 'organizations');

return fetch(`${API_SERVER}${path}?${paramsStr}`, { signal }).then(
return fetch(`${path}?${paramsStr}`, { signal }).then(
handleOApi
);
};
Expand Down