Add translation for result and status remove buildId value translation Fixes syntax in azure pipelines hide running status if finishedpull/1701/head
parent
2aeb3f4c89
commit
04cccfdd60
@ -0,0 +1,36 @@
|
||||
import { useTranslation } from "next-i18next";
|
||||
|
||||
import Container from "components/services/widget/container";
|
||||
import Block from "components/services/widget/block";
|
||||
import useWidgetAPI from "utils/proxy/use-widget-api";
|
||||
|
||||
export default function Component({ service }) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const { widget } = service;
|
||||
|
||||
const { data: pipelineData, error: pipelineError } = useWidgetAPI(widget);
|
||||
|
||||
if (pipelineError) {
|
||||
return <Container service={service} error={pipelineError} />;
|
||||
}
|
||||
|
||||
if (!pipelineData || !Array.isArray(pipelineData.value)) {
|
||||
return (
|
||||
<Container service={service}>
|
||||
<Block label="azurePipelines.result" />
|
||||
<Block label="azurePipelines.buildId" />
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Container service={service}>
|
||||
{pipelineData.value[0].result ?
|
||||
<Block label="azurePipelines.result" value={t(`azurePipelines.${pipelineData.value[0].result.toString()}`)} /> :
|
||||
<Block label="azurePipelines.status" value={t(`azurePipelines.${pipelineData.value[0].status.toString()}`)} />
|
||||
}
|
||||
<Block label="azurePipelines.buildId" value= { pipelineData.value[0].id } />
|
||||
</Container>
|
||||
);
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
import credentialedProxyHandler from "utils/proxy/handlers/credentialed";
|
||||
|
||||
const widget = {
|
||||
api: "https://dev.azure.com/{organization}/{project}/_apis/build/Builds?branchName={branchName}&definitions={definitionId}",
|
||||
proxyHandler: credentialedProxyHandler,
|
||||
};
|
||||
|
||||
export default widget;
|
Loading…
Reference in new issue