mirror of
https://github.com/gethomepage/homepage.git
synced 2025-12-07 09:35:54 -08:00
Run pre-commit hooks over existing codebase
Co-Authored-By: Ben Phelps <ben@phelps.io>
This commit is contained in:
@@ -12,14 +12,11 @@ export default function Component({ service }) {
|
||||
const { data: prData, error: prError } = useWidgetAPI(widget, includePR ? "pr" : null);
|
||||
const { data: pipelineData, error: pipelineError } = useWidgetAPI(widget, "pipeline");
|
||||
|
||||
if (
|
||||
pipelineError ||
|
||||
(includePR && (prError || prData?.errorCode !== undefined))
|
||||
) {
|
||||
if (pipelineError || (includePR && (prError || prData?.errorCode !== undefined))) {
|
||||
let finalError = pipelineError ?? prError;
|
||||
if (includePR && prData?.errorCode !== null) {
|
||||
// pr call failed possibly with more specific message
|
||||
finalError = { message: prData?.message ?? 'Error communicating with Azure API' }
|
||||
finalError = { message: prData?.message ?? "Error communicating with Azure API" };
|
||||
}
|
||||
return <Container service={service} error={finalError} />;
|
||||
}
|
||||
@@ -42,24 +39,27 @@ export default function Component({ service }) {
|
||||
) : (
|
||||
<Block label="azuredevops.status" value={t(`azuredevops.${pipelineData.value[0].status.toString()}`)} />
|
||||
)}
|
||||
|
||||
|
||||
{includePR && <Block label="azuredevops.totalPrs" value={t("common.number", { value: prData.count })} />}
|
||||
{includePR && <Block
|
||||
{includePR && (
|
||||
<Block
|
||||
label="azuredevops.myPrs"
|
||||
value={t("common.number", {
|
||||
value: prData.value?.filter((item) => item.createdBy.uniqueName.toLowerCase() === userEmail.toLowerCase())
|
||||
.length,
|
||||
})}
|
||||
/>}
|
||||
{includePR && <Block
|
||||
label="azuredevops.approved"
|
||||
value={t("common.number", {
|
||||
value: prData.value
|
||||
?.filter((item) => item.createdBy.uniqueName.toLowerCase() === userEmail.toLowerCase())
|
||||
.filter((item) => item.reviewers.some((reviewer) => [5,10].includes(reviewer.vote))).length
|
||||
})}
|
||||
/>}
|
||||
|
||||
/>
|
||||
)}
|
||||
{includePR && (
|
||||
<Block
|
||||
label="azuredevops.approved"
|
||||
value={t("common.number", {
|
||||
value: prData.value
|
||||
?.filter((item) => item.createdBy.uniqueName.toLowerCase() === userEmail.toLowerCase())
|
||||
.filter((item) => item.reviewers.some((reviewer) => [5, 10].includes(reviewer.vote))).length,
|
||||
})}
|
||||
/>
|
||||
)}
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6,11 +6,11 @@ const widget = {
|
||||
|
||||
mappings: {
|
||||
pr: {
|
||||
endpoint: "git/repositories/{repositoryId}/pullrequests"
|
||||
endpoint: "git/repositories/{repositoryId}/pullrequests",
|
||||
},
|
||||
|
||||
|
||||
pipeline: {
|
||||
endpoint: "build/Builds?branchName={branchName}&definitions={definitionId}"
|
||||
endpoint: "build/Builds?branchName={branchName}&definitions={definitionId}",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user