mirror of https://github.com/buster-so/buster.git
Checkpoint before follow-up message
This commit is contained in:
parent
c0a89f5330
commit
99b27bc87a
|
@ -32,7 +32,7 @@ pub fn router() -> Router {
|
|||
.nest("/organizations", organizations::router())
|
||||
.nest("/chats", chats::router())
|
||||
.nest("/messages", messages::router())
|
||||
.nest("/metrics", metrics::router())
|
||||
.nest("/metric_files", metrics::router())
|
||||
.nest("/dashboards", dashboards::router())
|
||||
.nest("/users", users::router())
|
||||
.nest("/collections", collections::router())
|
||||
|
|
|
@ -25,14 +25,14 @@ import { mainApi } from '../instances';
|
|||
|
||||
export const getMetric = async (params: GetMetricRequest): Promise<GetMetricResponse> => {
|
||||
return mainApi
|
||||
.get<GetMetricResponse>(`/metrics/${params.id}`, {
|
||||
.get<GetMetricResponse>(`/metric_files/${params.id}`, {
|
||||
params
|
||||
})
|
||||
.then((res) => res.data);
|
||||
};
|
||||
|
||||
export const getMetric_server = async ({ id, password }: Parameters<typeof getMetric>[0]) => {
|
||||
return await serverFetch<GetMetricResponse>(`/metrics/${id}`, {
|
||||
return await serverFetch<GetMetricResponse>(`/metric_files/${id}`, {
|
||||
params: { ...(password && { password }) }
|
||||
});
|
||||
};
|
||||
|
@ -43,25 +43,25 @@ export const getMetricData = async ({
|
|||
password
|
||||
}: GetMetricDataRequest): Promise<MetricDataResponse> => {
|
||||
return mainApi
|
||||
.get<MetricDataResponse>(`/metrics/${id}/data`, { params: { password, version_number } })
|
||||
.get<MetricDataResponse>(`/metric_files/${id}/data`, { params: { password, version_number } })
|
||||
.then((res) => res.data);
|
||||
};
|
||||
|
||||
export const listMetrics = async (params: GetMetricListRequest) => {
|
||||
return mainApi.get<ListMetricsResponse>('/metrics', { params }).then((res) => res.data);
|
||||
return mainApi.get<ListMetricsResponse>('/metric_files', { params }).then((res) => res.data);
|
||||
};
|
||||
|
||||
export const listMetrics_server = async (params: Parameters<typeof listMetrics>[0]) => {
|
||||
return await serverFetch<ListMetricsResponse>('/metrics', { params });
|
||||
return await serverFetch<ListMetricsResponse>('/metric_files', { params });
|
||||
};
|
||||
|
||||
export const updateMetric = async (params: UpdateMetricRequest) => {
|
||||
return mainApi.put<UpdateMetricResponse>(`/metrics/${params.id}`, params).then((res) => res.data);
|
||||
return mainApi.put<UpdateMetricResponse>(`/metric_files/${params.id}`, params).then((res) => res.data);
|
||||
};
|
||||
|
||||
export const deleteMetrics = async (data: DeleteMetricRequest) => {
|
||||
return mainApi
|
||||
.delete<DeleteMetricResponse>('/metrics', {
|
||||
.delete<DeleteMetricResponse>('/metric_files', {
|
||||
data
|
||||
})
|
||||
.then((res) => res.data);
|
||||
|
@ -69,7 +69,7 @@ export const deleteMetrics = async (data: DeleteMetricRequest) => {
|
|||
|
||||
export const duplicateMetric = async (params: DuplicateMetricRequest) => {
|
||||
return mainApi
|
||||
.post<DuplicateMetricResponse>('/metrics/duplicate', params)
|
||||
.post<DuplicateMetricResponse>('/metric_files/duplicate', params)
|
||||
.then((res) => res.data);
|
||||
};
|
||||
|
||||
|
@ -77,7 +77,7 @@ export const bulkUpdateMetricVerificationStatus = async (
|
|||
params: BulkUpdateMetricVerificationStatusRequest
|
||||
) => {
|
||||
return mainApi
|
||||
.put<BulkUpdateMetricVerificationStatusResponse>('/metrics', params)
|
||||
.put<BulkUpdateMetricVerificationStatusResponse>('/metric_files', params)
|
||||
.then((res) => res.data);
|
||||
};
|
||||
|
||||
|
@ -85,13 +85,13 @@ export const bulkUpdateMetricVerificationStatus = async (
|
|||
|
||||
export const shareMetric = async ({ id, params }: { id: string; params: ShareMetricRequest }) => {
|
||||
return mainApi
|
||||
.post<ShareMetricResponse>(`/metrics/${id}/sharing`, params)
|
||||
.post<ShareMetricResponse>(`/metric_files/${id}/sharing`, params)
|
||||
.then((res) => res.data);
|
||||
};
|
||||
|
||||
export const unshareMetric = async ({ id, data }: { id: string; data: ShareDeleteRequest }) => {
|
||||
return mainApi
|
||||
.delete<ShareDeleteResponse>(`/metrics/${id}/sharing`, { data })
|
||||
.delete<ShareDeleteResponse>(`/metric_files/${id}/sharing`, { data })
|
||||
.then((res) => res.data);
|
||||
};
|
||||
|
||||
|
@ -102,5 +102,5 @@ export const updateMetricShare = async ({
|
|||
id: string;
|
||||
params: ShareUpdateRequest;
|
||||
}) => {
|
||||
return mainApi.put<ShareUpdateResponse>(`/metrics/${id}/sharing`, params).then((res) => res.data);
|
||||
return mainApi.put<ShareUpdateResponse>(`/metric_files/${id}/sharing`, params).then((res) => res.data);
|
||||
};
|
||||
|
|
|
@ -50,7 +50,7 @@ describe('useGetFileLink', () => {
|
|||
secondaryView: string;
|
||||
}) => {
|
||||
if (type === 'metric') {
|
||||
return `/metrics/${assetId}${versionNumber ? `/v${versionNumber}` : ''}${secondaryView ? `/${secondaryView}` : ''}`;
|
||||
return `/metric_files/${assetId}${versionNumber ? `/v${versionNumber}` : ''}${secondaryView ? `/${secondaryView}` : ''}`;
|
||||
}
|
||||
if (type === 'dashboard') {
|
||||
return `/dashboards/${assetId}${versionNumber ? `/v${versionNumber}` : ''}${secondaryView ? `/${secondaryView}` : ''}`;
|
||||
|
@ -81,7 +81,7 @@ describe('useGetFileLink', () => {
|
|||
versionNumber: 3,
|
||||
secondaryView: undefined
|
||||
});
|
||||
expect(link).toBe(`/metrics/${mockMetricId}/v3`);
|
||||
expect(link).toBe(`/metric_files/${mockMetricId}/v3`);
|
||||
});
|
||||
|
||||
it('should generate correct file link for dashboard', () => {
|
||||
|
@ -121,7 +121,7 @@ describe('useGetFileLink', () => {
|
|||
versionNumber: 3,
|
||||
secondaryView: 'version-history'
|
||||
});
|
||||
expect(link).toBe(`/metrics/${mockMetricId}/v3/version-history`);
|
||||
expect(link).toBe(`/metric_files/${mockMetricId}/v3/version-history`);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -220,7 +220,7 @@ describe('useGetFileLink', () => {
|
|||
});
|
||||
|
||||
expect(meta).toEqual({
|
||||
link: `/metrics/${mockMetricId}/v${mockMetricVersionNumber}`,
|
||||
link: `/metric_files/${mockMetricId}/v${mockMetricVersionNumber}`,
|
||||
isSelected: true,
|
||||
selectedVersionNumber: mockMetricVersionNumber
|
||||
});
|
||||
|
@ -253,7 +253,7 @@ describe('useGetFileLink', () => {
|
|||
});
|
||||
|
||||
expect(meta).toEqual({
|
||||
link: '/metrics/different-metric/v999',
|
||||
link: '/metric_files/different-metric/v999',
|
||||
isSelected: false,
|
||||
selectedVersionNumber: mockMetricVersionNumber
|
||||
});
|
||||
|
|
|
@ -4,10 +4,10 @@ export enum BusterAppRoutes {
|
|||
APP_HOME = '/app/home',
|
||||
APP_COLLECTIONS = '/app/collections',
|
||||
APP_COLLECTIONS_ID = '/app/collections/:collectionId',
|
||||
APP_METRIC = '/app/metrics',
|
||||
APP_METRIC_ID_CHART = '/app/metrics/:metricId/chart?secondary_view=:secondaryView&metric_version_number=:metricVersionNumber',
|
||||
APP_METRIC_ID_RESULTS = '/app/metrics/:metricId/results?secondary_view=:secondaryView&metric_version_number=:metricVersionNumber',
|
||||
APP_METRIC_ID_SQL = '/app/metrics/:metricId/sql?secondary_view=:secondaryView&metric_version_number=:metricVersionNumber',
|
||||
APP_METRIC = '/app/metric_files',
|
||||
APP_METRIC_ID_CHART = '/app/metric_files/:metricId/chart?secondary_view=:secondaryView&metric_version_number=:metricVersionNumber',
|
||||
APP_METRIC_ID_RESULTS = '/app/metric_files/:metricId/results?secondary_view=:secondaryView&metric_version_number=:metricVersionNumber',
|
||||
APP_METRIC_ID_SQL = '/app/metric_files/:metricId/sql?secondary_view=:secondaryView&metric_version_number=:metricVersionNumber',
|
||||
APP_DASHBOARDS = '/app/dashboards',
|
||||
APP_DASHBOARD_ID = '/app/dashboards/:dashboardId?secondary_view=:secondaryView&dashboard_version_number=:dashboardVersionNumber',
|
||||
APP_DASHBOARD_ID_FILE = '/app/dashboards/:dashboardId/file?dashboard_version_number=:dashboardVersionNumber&secondary_view=:secondaryView',
|
||||
|
@ -26,10 +26,10 @@ export enum BusterAppRoutes {
|
|||
APP_CHAT = '/app/chats',
|
||||
APP_CHAT_ID = '/app/chats/:chatId',
|
||||
APP_CHAT_ID_REASONING_ID = '/app/chats/:chatId/reasoning/:messageId',
|
||||
APP_CHAT_ID_METRIC_ID = '/app/chats/:chatId/metrics/:metricId?secondary_view=:secondaryView&metric_version_number=:metricVersionNumber',
|
||||
APP_CHAT_ID_METRIC_ID_CHART = '/app/chats/:chatId/metrics/:metricId/chart?secondary_view=:secondaryView&metric_version_number=:metricVersionNumber',
|
||||
APP_CHAT_ID_METRIC_ID_SQL = '/app/chats/:chatId/metrics/:metricId/sql?secondary_view=:secondaryView&metric_version_number=:metricVersionNumber',
|
||||
APP_CHAT_ID_METRIC_ID_RESULTS = '/app/chats/:chatId/metrics/:metricId/results?secondary_view=:secondaryView&metric_version_number=:metricVersionNumber',
|
||||
APP_CHAT_ID_METRIC_ID = '/app/chats/:chatId/metric_files/:metricId?secondary_view=:secondaryView&metric_version_number=:metricVersionNumber',
|
||||
APP_CHAT_ID_METRIC_ID_CHART = '/app/chats/:chatId/metric_files/:metricId/chart?secondary_view=:secondaryView&metric_version_number=:metricVersionNumber',
|
||||
APP_CHAT_ID_METRIC_ID_SQL = '/app/chats/:chatId/metric_files/:metricId/sql?secondary_view=:secondaryView&metric_version_number=:metricVersionNumber',
|
||||
APP_CHAT_ID_METRIC_ID_RESULTS = '/app/chats/:chatId/metric_files/:metricId/results?secondary_view=:secondaryView&metric_version_number=:metricVersionNumber',
|
||||
APP_CHAT_ID_COLLECTION_ID = '/app/chats/:chatId/collections/:collectionId',
|
||||
APP_CHAT_ID_DASHBOARD_ID = '/app/chats/:chatId/dashboards/:dashboardId?secondary_view=:secondaryView&dashboard_version_number=:dashboardVersionNumber',
|
||||
APP_CHAT_ID_DASHBOARD_ID_FILE = '/app/chats/:chatId/dashboards/:dashboardId/file?secondary_view=:secondaryView&dashboard_version_number=:dashboardVersionNumber',
|
||||
|
|
Loading…
Reference in New Issue