as per feedback
Signed-off-by: Andrew Johnson <ajohnson@gocardless.com>
This commit is contained in:
@@ -63,6 +63,9 @@ spec:
|
||||
|
||||
### Self-hosted / Enterprise GitHub
|
||||
|
||||
The plugin will try to use `backstage.io/source-location` or `backstage.io/managed-by-location`
|
||||
annotations to figure out the location of the source code.
|
||||
|
||||
1. Add the `host` and `apiBaseUrl` to your `app-config.yaml`
|
||||
|
||||
```yaml
|
||||
@@ -73,21 +76,3 @@ integrations:
|
||||
- host: 'your-github-host.com'
|
||||
apiBaseUrl: 'https://api.your-github-host.com'
|
||||
```
|
||||
|
||||
2. Pass the host into the `EntityGithubDeploymentsCard`
|
||||
|
||||
```typescript
|
||||
// packages/app/src/components/catalog/EntityPage.tsx
|
||||
|
||||
import { EntityGithubDeploymentsCard } from '@backstage/plugin-github-deployments';
|
||||
|
||||
const OverviewContent = () => (
|
||||
<Grid container spacing={3} alignItems="stretch">
|
||||
// ...
|
||||
<Grid item xs={12} sm={6} md={4}>
|
||||
<EntityGithubDeploymentsCard host="your-github-host.com" />
|
||||
</Grid>
|
||||
// ...
|
||||
</Grid>
|
||||
);
|
||||
```
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
"clean": "backstage-cli clean"
|
||||
},
|
||||
"dependencies": {
|
||||
"@backstage/catalog-model": "^0.7.4",
|
||||
"@backstage/core": "^0.7.3",
|
||||
"@backstage/catalog-model": "^0.7.6",
|
||||
"@backstage/core": "^0.7.4",
|
||||
"@backstage/errors": "^0.1.1",
|
||||
"@backstage/integration": "^0.5.1",
|
||||
"@backstage/integration-react": "^0.1.1",
|
||||
@@ -37,9 +37,9 @@
|
||||
"react-use": "^15.3.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/cli": "^0.6.6",
|
||||
"@backstage/cli": "^0.6.7",
|
||||
"@backstage/dev-utils": "^0.1.13",
|
||||
"@backstage/test-utils": "^0.1.9",
|
||||
"@backstage/test-utils": "^0.1.10",
|
||||
"@testing-library/jest-dom": "^5.10.1",
|
||||
"@testing-library/react": "^11.2.5",
|
||||
"@testing-library/user-event": "^12.0.7",
|
||||
|
||||
@@ -60,16 +60,20 @@ export type GithubDeployment = {
|
||||
};
|
||||
};
|
||||
|
||||
type QueryOptions = {
|
||||
type QueryParams = {
|
||||
owner: string;
|
||||
repo: string;
|
||||
last: number;
|
||||
};
|
||||
|
||||
type QueryOptions = {
|
||||
locations: string[];
|
||||
};
|
||||
|
||||
export interface GithubDeploymentsApi {
|
||||
listDeployments(
|
||||
params: QueryParams,
|
||||
options: QueryOptions,
|
||||
location: string[],
|
||||
): Promise<GithubDeployment[]>;
|
||||
}
|
||||
|
||||
@@ -119,10 +123,10 @@ export class GithubDeploymentsApiClient implements GithubDeploymentsApi {
|
||||
}
|
||||
|
||||
async listDeployments(
|
||||
params: QueryParams,
|
||||
options: QueryOptions,
|
||||
locations: string[],
|
||||
): Promise<GithubDeployment[]> {
|
||||
const baseUrl = getBaseUrl(this.scmIntegrationsApi, locations);
|
||||
const baseUrl = getBaseUrl(this.scmIntegrationsApi, options.locations);
|
||||
const token = await this.githubAuthApi.getAccessToken(['repo']);
|
||||
|
||||
const graphQLWithAuth = graphql.defaults({
|
||||
@@ -134,7 +138,7 @@ export class GithubDeploymentsApiClient implements GithubDeploymentsApi {
|
||||
|
||||
const response: QueryResponse = await graphQLWithAuth(
|
||||
deploymentsQuery,
|
||||
options,
|
||||
params,
|
||||
);
|
||||
return response.repository?.deployments?.nodes?.reverse() || [];
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ const GithubDeploymentsComponent = ({
|
||||
const [owner, repo] = projectSlug.split('/');
|
||||
|
||||
const { loading, value, error, retry: reload } = useAsyncRetry(
|
||||
async () => await api.listDeployments({ owner, repo, last }, locations),
|
||||
async () => await api.listDeployments({ owner, repo, last }, { locations }),
|
||||
);
|
||||
|
||||
if (error) {
|
||||
|
||||
Reference in New Issue
Block a user