mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-17 15:36:48 +00:00
* feat: added changes for fething current version changelog * chore: added changes for showing changelog in sidebar * test: update ChangelogModal tests to use ChangelogSchema and mock data * chore: update changelog properties in app context mock * chore: removed changes for current version * chore: changed fetch key for fetching changelog by version * chore: added changes related to fetching tanent specific changelog * chore: fixed failing test for changelogRenderer * chore: remove what's new no feature available * chore: added changes for fetching changelog for specific tenant types * test: fixed test for changelogRenderer * Feat: changes for showing changelog to cloud users (#8512) * feat: added backend changes for storing seen changelog verion * feat: added changes for showing changelog to cloud users * chore: added useeffect cleanup * test: fixed test for changelogModal * chore: minor changes in changelogmodal * chore: minor PR review fixes
48 lines
1.4 KiB
TypeScript
48 lines
1.4 KiB
TypeScript
import { ErrorResponseHandler } from 'api/ErrorResponseHandler';
|
|
import axios, { AxiosError } from 'axios';
|
|
import { ErrorResponse, SuccessResponse } from 'types/api';
|
|
import {
|
|
ChangelogSchema,
|
|
DeploymentType,
|
|
} from 'types/api/changelog/getChangelogByVersion';
|
|
|
|
const getChangelogByVersion = async (
|
|
versionId: string,
|
|
deployment_type?: DeploymentType,
|
|
): Promise<SuccessResponse<ChangelogSchema> | ErrorResponse> => {
|
|
try {
|
|
let queryParams = `filters[version][$eq]=${versionId}&populate[features][sort]=sort_order:asc&populate[features][populate][media][fields]=id,ext,url,mime,alternativeText`;
|
|
|
|
if (
|
|
deployment_type &&
|
|
Object.values(DeploymentType).includes(deployment_type)
|
|
) {
|
|
const excludedDeploymentType =
|
|
deployment_type === DeploymentType.CLOUD_ONLY
|
|
? DeploymentType.OSS_ONLY
|
|
: DeploymentType.CLOUD_ONLY;
|
|
|
|
queryParams = `${queryParams}&populate[features][filters][deployment_type][$notIn]=${excludedDeploymentType}`;
|
|
}
|
|
|
|
const response = await axios.get(`
|
|
https://cms.signoz.cloud/api/release-changelogs?${queryParams}
|
|
`);
|
|
|
|
if (!Array.isArray(response.data.data) || response.data.data.length === 0) {
|
|
throw new Error('No changelog found!');
|
|
}
|
|
|
|
return {
|
|
statusCode: 200,
|
|
error: null,
|
|
message: response.statusText,
|
|
payload: response.data.data[0],
|
|
};
|
|
} catch (error) {
|
|
return ErrorResponseHandler(error as AxiosError);
|
|
}
|
|
};
|
|
|
|
export default getChangelogByVersion;
|