@@ -9,46 +9,29 @@ import { BackstagePlugin } from '@backstage/core-plugin-api';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { InfoCardVariants } from '@backstage/core-components';
|
||||
|
||||
// Warning: (ae-missing-release-tag) "EntitySonarQubeCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export const EntitySonarQubeCard: ({
|
||||
variant,
|
||||
duplicationRatings,
|
||||
}: {
|
||||
variant?: InfoCardVariants | undefined;
|
||||
duplicationRatings?:
|
||||
| {
|
||||
greaterThan: number;
|
||||
rating: '1.0' | '2.0' | '3.0' | '4.0' | '5.0';
|
||||
}[]
|
||||
| undefined;
|
||||
}) => JSX.Element;
|
||||
export type DuplicationRating = {
|
||||
greaterThan: number;
|
||||
rating: '1.0' | '2.0' | '3.0' | '4.0' | '5.0';
|
||||
};
|
||||
|
||||
// Warning: (ae-missing-release-tag) "isSonarQubeAvailable" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export const isSonarQubeAvailable: (entity: Entity) => boolean;
|
||||
|
||||
// Warning: (ae-missing-release-tag) "SonarQubeCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export const SonarQubeCard: ({
|
||||
variant,
|
||||
duplicationRatings,
|
||||
}: {
|
||||
export const EntitySonarQubeCard: (props: {
|
||||
variant?: InfoCardVariants | undefined;
|
||||
duplicationRatings?: DuplicationRating[] | undefined;
|
||||
}) => JSX.Element;
|
||||
|
||||
// Warning: (ae-missing-release-tag) "sonarQubePlugin" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export const isSonarQubeAvailable: (entity: Entity) => boolean;
|
||||
|
||||
// @public (undocumented)
|
||||
export const SonarQubeCard: (props: {
|
||||
variant?: InfoCardVariants;
|
||||
duplicationRatings?: DuplicationRating[];
|
||||
}) => JSX.Element;
|
||||
|
||||
// @public (undocumented)
|
||||
const sonarQubePlugin: BackstagePlugin<{}, {}, {}>;
|
||||
export { sonarQubePlugin as plugin };
|
||||
export { sonarQubePlugin };
|
||||
|
||||
// Warnings were encountered during analysis:
|
||||
//
|
||||
// src/components/SonarQubeCard/SonarQubeCard.d.ts:9:5 - (ae-forgotten-export) The symbol "DuplicationRating" needs to be exported by the entry point index.d.ts
|
||||
```
|
||||
|
||||
@@ -38,10 +38,7 @@ export const sonarQubeApiRef = createApiRef<SonarQubeApi>({
|
||||
});
|
||||
|
||||
export type SonarQubeApi = {
|
||||
getFindingSummary({
|
||||
componentKey,
|
||||
projectInstance,
|
||||
}: {
|
||||
getFindingSummary(options: {
|
||||
componentKey?: string;
|
||||
projectInstance?: string;
|
||||
}): Promise<FindingSummary | undefined>;
|
||||
|
||||
@@ -32,7 +32,6 @@ import { Percentage } from './Percentage';
|
||||
import { Rating } from './Rating';
|
||||
import { RatingCard } from './RatingCard';
|
||||
import { Value } from './Value';
|
||||
|
||||
import {
|
||||
EmptyState,
|
||||
InfoCard,
|
||||
@@ -40,7 +39,6 @@ import {
|
||||
MissingAnnotationEmptyState,
|
||||
Progress,
|
||||
} from '@backstage/core-components';
|
||||
|
||||
import { useApi } from '@backstage/core-plugin-api';
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
@@ -72,7 +70,8 @@ const useStyles = makeStyles(theme => ({
|
||||
},
|
||||
}));
|
||||
|
||||
type DuplicationRating = {
|
||||
/** @public */
|
||||
export type DuplicationRating = {
|
||||
greaterThan: number;
|
||||
rating: '1.0' | '2.0' | '3.0' | '4.0' | '5.0';
|
||||
};
|
||||
@@ -85,13 +84,15 @@ const defaultDuplicationRatings: DuplicationRating[] = [
|
||||
{ greaterThan: 20, rating: '5.0' },
|
||||
];
|
||||
|
||||
export const SonarQubeCard = ({
|
||||
variant = 'gridItem',
|
||||
duplicationRatings = defaultDuplicationRatings,
|
||||
}: {
|
||||
/** @public */
|
||||
export const SonarQubeCard = (props: {
|
||||
variant?: InfoCardVariants;
|
||||
duplicationRatings?: DuplicationRating[];
|
||||
}) => {
|
||||
const {
|
||||
variant = 'gridItem',
|
||||
duplicationRatings = defaultDuplicationRatings,
|
||||
} = props;
|
||||
const { entity } = useEntity();
|
||||
const sonarQubeApi = useApi(sonarQubeApiRef);
|
||||
|
||||
|
||||
@@ -27,8 +27,7 @@ const useStyles = makeStyles((theme: BackstageTheme) => {
|
||||
};
|
||||
});
|
||||
|
||||
export const Value = ({ value }: { value?: string }) => {
|
||||
export const Value = (props: { value?: string }) => {
|
||||
const classes = useStyles();
|
||||
|
||||
return <span className={classes.value}>{value}</span>;
|
||||
return <span className={classes.value}>{props.value}</span>;
|
||||
};
|
||||
|
||||
@@ -14,4 +14,5 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export type { DuplicationRating } from './SonarQubeCard';
|
||||
export { SonarQubeCard } from './SonarQubeCard';
|
||||
|
||||
@@ -19,6 +19,7 @@ import { Entity } from '@backstage/catalog-model';
|
||||
export const SONARQUBE_PROJECT_KEY_ANNOTATION = 'sonarqube.org/project-key';
|
||||
export const SONARQUBE_PROJECT_INSTANCE_SEPARATOR = '/';
|
||||
|
||||
/** @public */
|
||||
export const isSonarQubeAvailable = (entity: Entity) =>
|
||||
Boolean(entity.metadata.annotations?.[SONARQUBE_PROJECT_KEY_ANNOTATION]);
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import {
|
||||
identityApiRef,
|
||||
} from '@backstage/core-plugin-api';
|
||||
|
||||
/** @public */
|
||||
export const sonarQubePlugin = createPlugin({
|
||||
id: 'sonarqube',
|
||||
apis: [
|
||||
@@ -41,6 +42,7 @@ export const sonarQubePlugin = createPlugin({
|
||||
],
|
||||
});
|
||||
|
||||
/** @public */
|
||||
export const EntitySonarQubeCard = sonarQubePlugin.provide(
|
||||
createComponentExtension({
|
||||
name: 'EntitySonarQubeCard',
|
||||
|
||||
Reference in New Issue
Block a user