mirror of
https://github.com/immich-app/data.immich.app.git
synced 2026-09-30 13:23:26 +08:00
feat: chart for total merged PRs (#186)
* feat: chart for total merged PRs * fix: format
This commit is contained in:
@@ -11,6 +11,7 @@ export class ApiWorker {
|
||||
pullRequests: { metricName: 'immich_data_repository_pull_request_open_total' },
|
||||
stars: { metricName: 'immich_data_repository_star_total' },
|
||||
discussions: { metricName: 'immich_data_repository_discussion_total' },
|
||||
mergedPullRequests: { metricName: 'immich_data_repository_pull_request_merged_total' },
|
||||
};
|
||||
|
||||
const promises = Object.entries(metrics).map(async ([key, value]) => {
|
||||
|
||||
@@ -3,6 +3,7 @@ type GithubDataResponse = {
|
||||
pullRequests: GithubReportData;
|
||||
stars: GithubReportData;
|
||||
discussions: GithubReportData;
|
||||
mergedPullRequests: GithubReportData;
|
||||
};
|
||||
type GithubReportData = Array<[number, number]>;
|
||||
type GithubDataRecord = [number, number];
|
||||
@@ -11,15 +12,18 @@ export const githubStars = $state<{ value?: GithubDataRecord[] }>({});
|
||||
export const githubIssues = $state<{ value?: GithubDataRecord[] }>({});
|
||||
export const githubPullRequests = $state<{ value?: GithubDataRecord[] }>({});
|
||||
export const githubDiscussions = $state<{ value?: GithubDataRecord[] }>({});
|
||||
export const githubMergedPullRequests = $state<{ value?: GithubDataRecord[] }>({});
|
||||
|
||||
export const loadGithubData = async () => {
|
||||
const response = await fetch('/api/github');
|
||||
if (response.ok) {
|
||||
const { stars, issues, pullRequests, discussions } = (await response.json()) as GithubDataResponse;
|
||||
const { stars, issues, pullRequests, discussions, mergedPullRequests } =
|
||||
(await response.json()) as GithubDataResponse;
|
||||
|
||||
githubStars.value = stars;
|
||||
githubIssues.value = issues;
|
||||
githubPullRequests.value = pullRequests;
|
||||
githubDiscussions.value = discussions;
|
||||
githubMergedPullRequests.value = mergedPullRequests;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
githubIssues,
|
||||
githubPullRequests,
|
||||
githubStars,
|
||||
githubMergedPullRequests,
|
||||
loadGithubData,
|
||||
} from '$lib/services/api.svelte';
|
||||
import {
|
||||
@@ -170,6 +171,25 @@
|
||||
/>
|
||||
</CardBody>
|
||||
</Card>
|
||||
<Card color="secondary">
|
||||
<CardHeader>
|
||||
<CardTitle>
|
||||
<HStack>
|
||||
<Icon icon={mdiSourceBranch} />
|
||||
<span>Total PRs Merged (Cumulative)</span>
|
||||
</HStack>
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardBody>
|
||||
<GithubGraph
|
||||
color="green"
|
||||
id="merged-prs-chart"
|
||||
data={githubMergedPullRequests.value}
|
||||
{cursorOpts}
|
||||
label="Merged PRs"
|
||||
/>
|
||||
</CardBody>
|
||||
</Card>
|
||||
</div>
|
||||
</section>
|
||||
</Stack>
|
||||
|
||||
Reference in New Issue
Block a user