diff --git a/.changeset/young-olives-cheer.md b/.changeset/young-olives-cheer.md
new file mode 100644
index 0000000000..a74f34eb42
--- /dev/null
+++ b/.changeset/young-olives-cheer.md
@@ -0,0 +1,5 @@
+---
+'@backstage/plugin-github-issues': minor
+---
+
+Add filtering and ordering to the graphql query
diff --git a/app-config.yaml b/app-config.yaml
index 8dacce900c..22ca1fcaff 100644
--- a/app-config.yaml
+++ b/app-config.yaml
@@ -300,7 +300,7 @@ auth:
development:
clientId: ${AUTH_GITHUB_CLIENT_ID}
clientSecret: ${AUTH_GITHUB_CLIENT_SECRET}
- # enterpriseInstanceUrl: ${AUTH_GITHUB_ENTERPRISE_INSTANCE_URL}
+ enterpriseInstanceUrl: ${AUTH_GITHUB_ENTERPRISE_INSTANCE_URL}
gitlab:
development:
clientId: ${AUTH_GITLAB_CLIENT_ID}
diff --git a/packages/app/package.json b/packages/app/package.json
index ade10e9c14..4181b036e9 100644
--- a/packages/app/package.json
+++ b/packages/app/package.json
@@ -33,7 +33,6 @@
"@backstage/plugin-gcalendar": "workspace:^",
"@backstage/plugin-gcp-projects": "workspace:^",
"@backstage/plugin-github-actions": "workspace:^",
- "@backstage/plugin-github-issues": "workspace:^",
"@backstage/plugin-gocd": "workspace:^",
"@backstage/plugin-graphiql": "workspace:^",
"@backstage/plugin-home": "workspace:^",
diff --git a/packages/app/src/components/catalog/EntityPage.tsx b/packages/app/src/components/catalog/EntityPage.tsx
index 6991f3fd67..c2f297a2d7 100644
--- a/packages/app/src/components/catalog/EntityPage.tsx
+++ b/packages/app/src/components/catalog/EntityPage.tsx
@@ -153,8 +153,6 @@ import {
ReportIssue,
} from '@backstage/plugin-techdocs-module-addons-contrib';
-import { GitHubIssuesCard } from '@backstage/plugin-github-issues';
-
const customEntityFilterKind = ['Component', 'API', 'System'];
const EntityLayoutWrapper = (props: { children?: ReactNode }) => {
@@ -344,18 +342,6 @@ const overviewContent = (
-
-
-
-
diff --git a/plugins/github-issues/api-report.md b/plugins/github-issues/api-report.md
index eb69fc8e8e..0ce8b77975 100644
--- a/plugins/github-issues/api-report.md
+++ b/plugins/github-issues/api-report.md
@@ -27,7 +27,41 @@ export const gitHubIssuesPlugin: BackstagePlugin<
export type GitHubIssuesProps = {
itemsPerPage?: number;
itemsPerRepo?: number;
+ filterBy?: IssuesFilters;
+ orderBy?: IssuesOrdering;
};
+// @public (undocumented)
+export interface IssuesByRepoOptions {
+ // (undocumented)
+ filterBy?: IssuesFilters;
+ // (undocumented)
+ orderBy?: IssuesOrdering;
+}
+
+// @public (undocumented)
+export interface IssuesFilters {
+ // (undocumented)
+ assignee?: string;
+ // (undocumented)
+ createdBy?: string;
+ // (undocumented)
+ labels?: string[];
+ // (undocumented)
+ mentioned?: string;
+ // (undocumented)
+ milestone?: string;
+ // (undocumented)
+ states?: ('OPEN' | 'CLOSED')[];
+}
+
+// @public (undocumented)
+export interface IssuesOrdering {
+ // (undocumented)
+ direction?: 'ASC' | 'DESC';
+ // (undocumented)
+ field: 'CREATED_AT' | 'UPDATED_AT' | 'COMMENTS';
+}
+
// (No @packageDocumentation comment for this package)
```
diff --git a/plugins/github-issues/src/api/gitHubIssuesApi.ts b/plugins/github-issues/src/api/gitHubIssuesApi.ts
index 01a6a59532..4d90f11de6 100644
--- a/plugins/github-issues/src/api/gitHubIssuesApi.ts
+++ b/plugins/github-issues/src/api/gitHubIssuesApi.ts
@@ -22,7 +22,6 @@ import {
} from '@backstage/core-plugin-api';
import { readGitHubIntegrationConfigs } from '@backstage/integration';
import { ForwardedError } from '@backstage/errors';
-import { IssuesByRepoOptions, IssuesFilters } from '../types';
/** @internal */
export type Assignee = {
@@ -74,6 +73,34 @@ export type IssuesByRepo = Record;
/** @internal */
export type GitHubIssuesApi = ReturnType;
+/**
+ * @public
+ */
+export interface IssuesFilters {
+ assignee?: string;
+ createdBy?: string;
+ labels?: string[];
+ mentioned?: string;
+ milestone?: string;
+ states?: ('OPEN' | 'CLOSED')[];
+}
+
+/**
+ * @public
+ */
+export interface IssuesOrdering {
+ field: 'CREATED_AT' | 'UPDATED_AT' | 'COMMENTS';
+ direction?: 'ASC' | 'DESC';
+}
+
+/**
+ * @public
+ */
+export interface IssuesByRepoOptions {
+ filterBy?: IssuesFilters;
+ orderBy?: IssuesOrdering;
+}
+
/** @internal */
export const gitHubIssuesApiRef = createApiRef({
id: 'plugin.githubissues.service',
diff --git a/plugins/github-issues/src/components/GitHubIssues/GitHubIssues.tsx b/plugins/github-issues/src/components/GitHubIssues/GitHubIssues.tsx
index a620797574..a8a192dece 100644
--- a/plugins/github-issues/src/components/GitHubIssues/GitHubIssues.tsx
+++ b/plugins/github-issues/src/components/GitHubIssues/GitHubIssues.tsx
@@ -24,7 +24,7 @@ import { useGetIssuesByRepoFromGitHub } from '../../hooks/useGetIssuesByRepoFrom
import { IssuesList } from './IssuesList';
import { NoRepositoriesInfo } from './NoRepositoriesInfo';
-import { IssuesByRepoOptions } from '../../types';
+import type { IssuesFilters, IssuesOrdering } from '../../api/gitHubIssuesApi';
/**
* @public
@@ -32,8 +32,8 @@ import { IssuesByRepoOptions } from '../../types';
export type GitHubIssuesProps = {
itemsPerPage?: number;
itemsPerRepo?: number;
- filterBy?: IssuesByRepoOptions['filterBy'];
- orderBy?: IssuesByRepoOptions['orderBy'];
+ filterBy?: IssuesFilters;
+ orderBy?: IssuesOrdering;
};
export const GitHubIssues = (props: GitHubIssuesProps) => {
diff --git a/plugins/github-issues/src/hooks/useGetIssuesByRepoFromGitHub.ts b/plugins/github-issues/src/hooks/useGetIssuesByRepoFromGitHub.ts
index ab9305693d..670cb0596a 100644
--- a/plugins/github-issues/src/hooks/useGetIssuesByRepoFromGitHub.ts
+++ b/plugins/github-issues/src/hooks/useGetIssuesByRepoFromGitHub.ts
@@ -16,8 +16,7 @@
import { useApi } from '@backstage/core-plugin-api';
import useAsyncRetry from 'react-use/lib/useAsyncRetry';
-import { gitHubIssuesApiRef } from '../api';
-import { IssuesByRepoOptions } from '../types';
+import { gitHubIssuesApiRef, IssuesByRepoOptions } from '../api';
export const useGetIssuesByRepoFromGitHub = (
repos: Array,
diff --git a/plugins/github-issues/src/index.ts b/plugins/github-issues/src/index.ts
index 5f6c248db7..f17cc1e2e6 100644
--- a/plugins/github-issues/src/index.ts
+++ b/plugins/github-issues/src/index.ts
@@ -20,3 +20,8 @@ export {
} from './plugin';
export type { GitHubIssuesProps } from './components/GitHubIssues';
+export type {
+ IssuesFilters,
+ IssuesOrdering,
+ IssuesByRepoOptions,
+} from './api/gitHubIssuesApi';
diff --git a/plugins/github-issues/src/types.ts b/plugins/github-issues/src/types.ts
deleted file mode 100644
index c8d238fa4f..0000000000
--- a/plugins/github-issues/src/types.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2022 The Backstage Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-type IssueState = 'OPEN' | 'CLOSED';
-
-/** @internal */
-export interface IssuesFilters {
- assignee?: string;
- createdBy?: string;
- labels?: string[];
- mentioned?: string;
- milestone?: string;
- states?: IssueState[];
-}
-
-export interface IssuesByRepoOptions {
- filterBy?: IssuesFilters;
- orderBy?: {
- field: 'CREATED_AT' | 'UPDATED_AT' | 'COMMENTS';
- direction?: 'ASC' | 'DESC';
- };
-}
diff --git a/query.graphql b/query.graphql
deleted file mode 100644
index 98a72fac26..0000000000
--- a/query.graphql
+++ /dev/null
@@ -1,77 +0,0 @@
-/* http://localhost:7007/api/auth/github /*
-
-{
- repository(owner: "backstage", name: "backstage") {
- issues(first: 1, filterBy: { labels: ["bug"] }) {
- nodes {
- title
- body
- bodyHTML
- bodyText
- number
- labels(first: 100) {
- nodes {
- color
- name
- id
- }
- }
- author {
- url
- avatarUrl
- login
- }
- }
- }
- }
-}
-
-
-
-fragment issues on Repository {
- issues(
- states: OPEN
- first: 40
- orderBy: { field: UPDATED_AT, direction: DESC }
- ) {
- totalCount
- edges {
- node {
- assignees(first: 10) {
- edges {
- node {
- avatarUrl
- login
- }
- }
- }
- author {
- login
- }
- repository {
- nameWithOwner
- }
- title
- url
- participants {
- totalCount
- }
- updatedAt
- createdAt
- comments(last: 1) {
- totalCount
- }
- }
- }
- }
-}
-
-
-query {
-
- backstage: repository(name: "backstage", owner: "backstage") {
- ...issues
- }
-
-}
-
\ No newline at end of file
diff --git a/yarn.lock b/yarn.lock
index 1df05d3c22..e5f10c942a 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -5604,7 +5604,7 @@ __metadata:
languageName: unknown
linkType: soft
-"@backstage/plugin-github-issues@workspace:^, @backstage/plugin-github-issues@workspace:plugins/github-issues":
+"@backstage/plugin-github-issues@workspace:plugins/github-issues":
version: 0.0.0-use.local
resolution: "@backstage/plugin-github-issues@workspace:plugins/github-issues"
dependencies:
@@ -22004,7 +22004,6 @@ __metadata:
"@backstage/plugin-gcalendar": "workspace:^"
"@backstage/plugin-gcp-projects": "workspace:^"
"@backstage/plugin-github-actions": "workspace:^"
- "@backstage/plugin-github-issues": "workspace:^"
"@backstage/plugin-gocd": "workspace:^"
"@backstage/plugin-graphiql": "workspace:^"
"@backstage/plugin-home": "workspace:^"