@liatrio/backstage-dora-plugin
Version:
A Backstage plugin for DORA metrics
27 lines (24 loc) • 760 B
JavaScript
import { useApi, identityApiRef } from '@backstage/core-plugin-api';
const COLOR_GREEN = "#24ae1d";
const COLOR_DARK = "#000";
const COLOR_LIGHT = "#FFF";
const getRepositoryName = (e) => {
if ("github.com/project-slug" in e.entity.metadata.annotations) {
return e.entity.metadata.annotations["github.com/project-slug"].split(
"/"
)[1];
}
return "";
};
const useAuthHeaderValueLookup = () => {
const identityApi = useApi(identityApiRef);
return async () => {
const obj = await identityApi.getCredentials();
if (obj.token) {
return `Bearer ${obj.token}`;
}
return void 0;
};
};
export { COLOR_DARK, COLOR_GREEN, COLOR_LIGHT, getRepositoryName, useAuthHeaderValueLookup };
//# sourceMappingURL=helper.esm.js.map