Merge branch 'master' into af/add-readme-card-azure-devops
Signed-off-by: alissonfabiano <56898864+alissonfabiano@users.noreply.github.com>
This commit is contained in:
@@ -30,10 +30,12 @@ import {
|
||||
|
||||
import { createApiRef } from '@backstage/core-plugin-api';
|
||||
|
||||
/** @public */
|
||||
export const azureDevOpsApiRef = createApiRef<AzureDevOpsApi>({
|
||||
id: 'plugin.azure-devops.service',
|
||||
});
|
||||
|
||||
/** @public */
|
||||
export interface AzureDevOpsApi {
|
||||
getRepoBuilds(
|
||||
projectName: string,
|
||||
|
||||
@@ -28,10 +28,10 @@ import {
|
||||
Team,
|
||||
} from '@backstage/plugin-azure-devops-common';
|
||||
import { DiscoveryApi, IdentityApi } from '@backstage/core-plugin-api';
|
||||
|
||||
import { AzureDevOpsApi } from './AzureDevOpsApi';
|
||||
import { ResponseError } from '@backstage/errors';
|
||||
import { AzureDevOpsApi } from './AzureDevOpsApi';
|
||||
|
||||
/** @public */
|
||||
export class AzureDevOpsClient implements AzureDevOpsApi {
|
||||
private readonly discoveryApi: DiscoveryApi;
|
||||
private readonly identityApi: IdentityApi;
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { SvgIcon, SvgIconProps } from '@material-ui/core';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
/** @public */
|
||||
export const AzurePullRequestsIcon = (props: SvgIconProps) => (
|
||||
<SvgIcon {...props} viewBox="0 0 512 512">
|
||||
<circle
|
||||
|
||||
+2
-6
@@ -20,18 +20,14 @@ import { getAnnotationFromEntity } from '../../utils/getAnnotationFromEntity';
|
||||
import { useBuildRuns } from '../../hooks/useBuildRuns';
|
||||
import { useEntity } from '@backstage/plugin-catalog-react';
|
||||
|
||||
export const EntityPageAzurePipelines = ({
|
||||
defaultLimit,
|
||||
}: {
|
||||
defaultLimit?: number;
|
||||
}) => {
|
||||
export const EntityPageAzurePipelines = (props: { defaultLimit?: number }) => {
|
||||
const { entity } = useEntity();
|
||||
|
||||
const { project, repo, definition } = getAnnotationFromEntity(entity);
|
||||
|
||||
const { items, loading, error } = useBuildRuns(
|
||||
project,
|
||||
defaultLimit,
|
||||
props.defaultLimit,
|
||||
repo,
|
||||
definition,
|
||||
);
|
||||
|
||||
+2
-4
@@ -17,10 +17,8 @@
|
||||
import { PullRequestTable } from '../PullRequestTable/PullRequestTable';
|
||||
import React from 'react';
|
||||
|
||||
export const EntityPageAzurePullRequests = ({
|
||||
defaultLimit,
|
||||
}: {
|
||||
export const EntityPageAzurePullRequests = (props: {
|
||||
defaultLimit?: number;
|
||||
}) => {
|
||||
return <PullRequestTable defaultLimit={defaultLimit} />;
|
||||
return <PullRequestTable defaultLimit={props.defaultLimit} />;
|
||||
};
|
||||
|
||||
@@ -24,7 +24,6 @@ import {
|
||||
import { PullRequestColumnConfig, PullRequestGroup } from './lib/types';
|
||||
import React, { useState } from 'react';
|
||||
import { getPullRequestGroupConfigs, getPullRequestGroups } from './lib/utils';
|
||||
|
||||
import { FilterType } from './lib/filters';
|
||||
import { PullRequestGrid } from './lib/PullRequestGrid';
|
||||
import { useDashboardPullRequests } from '../../hooks';
|
||||
@@ -71,11 +70,9 @@ type PullRequestsPageProps = {
|
||||
defaultColumnConfigs?: PullRequestColumnConfig[];
|
||||
};
|
||||
|
||||
export const PullRequestsPage = ({
|
||||
projectName,
|
||||
pollingInterval,
|
||||
defaultColumnConfigs,
|
||||
}: PullRequestsPageProps) => {
|
||||
export const PullRequestsPage = (props: PullRequestsPageProps) => {
|
||||
const { projectName, pollingInterval, defaultColumnConfigs } = props;
|
||||
|
||||
const { pullRequests, loading, error } = useDashboardPullRequests(
|
||||
projectName,
|
||||
pollingInterval,
|
||||
|
||||
@@ -18,6 +18,7 @@ import { BaseFilter, FilterType, PullRequestFilter } from './types';
|
||||
|
||||
import { DashboardPullRequest } from '@backstage/plugin-azure-devops-common';
|
||||
|
||||
/** @public */
|
||||
export type AllFilter = BaseFilter & {
|
||||
type: FilterType.All;
|
||||
};
|
||||
|
||||
+2
-2
@@ -14,11 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { BaseFilter, FilterType, PullRequestFilter } from './types';
|
||||
|
||||
import { DashboardPullRequest } from '@backstage/plugin-azure-devops-common';
|
||||
import { BaseFilter, FilterType, PullRequestFilter } from './types';
|
||||
import { stringArrayHas } from '../../../../utils';
|
||||
|
||||
/** @public */
|
||||
export type AssignedToTeamFilter = BaseFilter & {
|
||||
type: FilterType.AssignedToTeam;
|
||||
teamId: string;
|
||||
|
||||
+2
-2
@@ -14,11 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { BaseFilter, FilterType, PullRequestFilter } from './types';
|
||||
|
||||
import { DashboardPullRequest } from '@backstage/plugin-azure-devops-common';
|
||||
import { BaseFilter, FilterType, PullRequestFilter } from './types';
|
||||
import { createAssignedToTeamFilter } from './assignedToTeamFilter';
|
||||
|
||||
/** @public */
|
||||
export type AssignedToTeamsFilter = BaseFilter &
|
||||
(
|
||||
| {
|
||||
|
||||
+2
-2
@@ -14,11 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { BaseFilter, FilterType, PullRequestFilter } from './types';
|
||||
|
||||
import { DashboardPullRequest } from '@backstage/plugin-azure-devops-common';
|
||||
import { BaseFilter, FilterType, PullRequestFilter } from './types';
|
||||
import { stringArrayHas } from '../../../../utils';
|
||||
|
||||
/** @public */
|
||||
export type AssignedToUserFilter = BaseFilter &
|
||||
(
|
||||
| {
|
||||
|
||||
+2
-2
@@ -14,11 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { BaseFilter, FilterType, PullRequestFilter } from './types';
|
||||
|
||||
import { DashboardPullRequest } from '@backstage/plugin-azure-devops-common';
|
||||
import { BaseFilter, FilterType, PullRequestFilter } from './types';
|
||||
import { stringArrayHas } from '../../../../utils';
|
||||
|
||||
/** @public */
|
||||
export type CreatedByTeamFilter = BaseFilter &
|
||||
({
|
||||
type: FilterType.CreatedByTeam;
|
||||
|
||||
+2
-2
@@ -14,11 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { BaseFilter, FilterType, PullRequestFilter } from './types';
|
||||
|
||||
import { DashboardPullRequest } from '@backstage/plugin-azure-devops-common';
|
||||
import { BaseFilter, FilterType, PullRequestFilter } from './types';
|
||||
import { createCreatedByTeamFilter } from './createdByTeamFilter';
|
||||
|
||||
/** @public */
|
||||
export type CreatedByTeamsFilter = BaseFilter &
|
||||
(
|
||||
| ({
|
||||
|
||||
+2
-2
@@ -14,11 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { BaseFilter, FilterType, PullRequestFilter } from './types';
|
||||
|
||||
import { DashboardPullRequest } from '@backstage/plugin-azure-devops-common';
|
||||
import { BaseFilter, FilterType, PullRequestFilter } from './types';
|
||||
import { equalsIgnoreCase } from '../../../../utils';
|
||||
|
||||
/** @public */
|
||||
export type CreatedByUserFilter = BaseFilter &
|
||||
(
|
||||
| {
|
||||
|
||||
@@ -23,6 +23,7 @@ import { CreatedByTeamsFilter } from './createdByTeamsFilter';
|
||||
import { CreatedByUserFilter } from './createdByUserFilter';
|
||||
import { DashboardPullRequest } from '@backstage/plugin-azure-devops-common';
|
||||
|
||||
/** @public */
|
||||
export enum FilterType {
|
||||
All = 'All',
|
||||
|
||||
@@ -41,6 +42,7 @@ export enum FilterType {
|
||||
CreatedByCurrentUsersTeams = 'CreatedByCurrentUsersTeams',
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export const FilterTypes = [
|
||||
FilterType.All,
|
||||
|
||||
@@ -57,10 +59,12 @@ export const FilterTypes = [
|
||||
FilterType.CreatedByCurrentUsersTeams,
|
||||
] as const;
|
||||
|
||||
/** @public */
|
||||
export type BaseFilter = {
|
||||
type: FilterType;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type Filter =
|
||||
| AssignedToUserFilter
|
||||
| CreatedByUserFilter
|
||||
@@ -80,4 +84,5 @@ export type {
|
||||
AllFilter,
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type PullRequestFilter = (pullRequest: DashboardPullRequest) => boolean;
|
||||
|
||||
@@ -14,22 +14,24 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { DashboardPullRequest } from '@backstage/plugin-azure-devops-common';
|
||||
import { Filter, PullRequestFilter } from './filters';
|
||||
|
||||
import { DashboardPullRequest } from '@backstage/plugin-azure-devops-common';
|
||||
|
||||
/** @public */
|
||||
export interface PullRequestColumnConfig {
|
||||
title: string;
|
||||
filters: Filter[];
|
||||
simplified?: boolean;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export interface PullRequestGroupConfig {
|
||||
title: string;
|
||||
filter: PullRequestFilter;
|
||||
simplified?: boolean;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export interface PullRequestGroup {
|
||||
title: string;
|
||||
pullRequests: DashboardPullRequest[];
|
||||
|
||||
@@ -38,9 +38,11 @@ import { AzureDevOpsClient } from './api/AzureDevOpsClient';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { azureDevOpsApiRef } from './api/AzureDevOpsApi';
|
||||
|
||||
/** @public */
|
||||
export const isAzureDevOpsAvailable = (entity: Entity) =>
|
||||
Boolean(entity.metadata.annotations?.[AZURE_DEVOPS_REPO_ANNOTATION]);
|
||||
|
||||
/** @public */
|
||||
export const isAzurePipelinesAvailable = (entity: Entity) =>
|
||||
Boolean(entity.metadata.annotations?.[AZURE_DEVOPS_REPO_ANNOTATION]) ||
|
||||
(Boolean(entity.metadata.annotations?.[AZURE_DEVOPS_PROJECT_ANNOTATION]) &&
|
||||
@@ -48,6 +50,7 @@ export const isAzurePipelinesAvailable = (entity: Entity) =>
|
||||
entity.metadata.annotations?.[AZURE_DEVOPS_BUILD_DEFINITION_ANNOTATION],
|
||||
));
|
||||
|
||||
/** @public */
|
||||
export const azureDevOpsPlugin = createPlugin({
|
||||
id: 'azureDevOps',
|
||||
apis: [
|
||||
@@ -60,6 +63,7 @@ export const azureDevOpsPlugin = createPlugin({
|
||||
],
|
||||
});
|
||||
|
||||
/** @public */
|
||||
export const AzurePullRequestsPage = azureDevOpsPlugin.provide(
|
||||
createRoutableExtension({
|
||||
name: 'AzurePullRequestsPage',
|
||||
@@ -69,6 +73,7 @@ export const AzurePullRequestsPage = azureDevOpsPlugin.provide(
|
||||
}),
|
||||
);
|
||||
|
||||
/** @public */
|
||||
export const EntityAzurePipelinesContent = azureDevOpsPlugin.provide(
|
||||
createRoutableExtension({
|
||||
name: 'EntityAzurePipelinesContent',
|
||||
@@ -80,6 +85,7 @@ export const EntityAzurePipelinesContent = azureDevOpsPlugin.provide(
|
||||
}),
|
||||
);
|
||||
|
||||
/** @public */
|
||||
export const EntityAzureGitTagsContent = azureDevOpsPlugin.provide(
|
||||
createRoutableExtension({
|
||||
name: 'EntityAzureGitTagsContent',
|
||||
@@ -91,6 +97,7 @@ export const EntityAzureGitTagsContent = azureDevOpsPlugin.provide(
|
||||
}),
|
||||
);
|
||||
|
||||
/** @public */
|
||||
export const EntityAzurePullRequestsContent = azureDevOpsPlugin.provide(
|
||||
createRoutableExtension({
|
||||
name: 'EntityAzurePullRequestsContent',
|
||||
|
||||
Reference in New Issue
Block a user