Address latest batch of comments

Signed-off-by: Erik Engervall <erik.engervall@gmail.com>
This commit is contained in:
Erik Engervall
2021-04-14 11:30:21 +02:00
parent e48f59a90b
commit c003e06cc0
8 changed files with 35 additions and 21 deletions
+2 -2
View File
@@ -6,13 +6,13 @@
Does it build and ship your code? **No**.
What `GRM` does is manage your **[releases](https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/managing-releases-in-a-repository)** on GitHub, building and shipping is entirely up to you as a developer to handle in your CI.
What `GRM` does is manage your **[releases](https://docs.github.com/en/github/administering-a-repository/managing-releases-in-a-repository)** on GitHub, building and shipping is entirely up to you as a developer to handle in your CI.
`GRM` is built with industry standards in mind and the flow is as follows:
![](./src/cards/info/flow.png)
> **GitHub**: The source control system where releases reside in a practical sense. Read more about GitHub releases [here](https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/. Note that this plugin works just as well with GitHub Enterprise)
> **GitHub**: The source control system where releases reside in a practical sense. Read more about [GitHub releases](https://docs.github.com/en/github/administering-a-repository/managing-releases-in-a-repository). Note that this plugin works just as well with GitHub Enterprise)
>
> **Release Candidate (RC)**: A GitHub pre-release intended primarily for internal testing
>
@@ -54,6 +54,10 @@ export class ApiClient {
this.githubCommonPath = `/repos/${this.repoPath}`;
}
public getHost() {
return this.pluginApiClient.host;
}
public getRepoPath() {
return this.repoPath;
}
@@ -19,7 +19,8 @@ import { readGitHubIntegrationConfigs } from '@backstage/integration';
export class PluginApiClientConfig {
private readonly githubAuthApi: OAuthApi;
readonly baseUrl: string;
private readonly baseUrl: string;
readonly host: string;
constructor({
configApi,
@@ -33,7 +34,12 @@ export class PluginApiClientConfig {
const configs = readGitHubIntegrationConfigs(
configApi.getOptionalConfigArray('integrations.github') ?? [],
);
const githubIntegrationConfig = configs.find(v => v.host === 'github.com');
const githubIntegrationConfig = configs.find(
v => v.host === 'github.com' || v.host.startsWith('ghe.'),
);
this.host = githubIntegrationConfig?.host ?? 'github.com';
this.baseUrl =
githubIntegrationConfig?.apiBaseUrl ?? 'https://api.github.com';
}
@@ -99,7 +99,7 @@ export async function createRc({
`;
responseSteps.push({
message: 'Fetched commit comparision',
message: 'Fetched commit comparison',
secondaryMessage: `${previousReleaseBranch}...${nextReleaseBranch}`,
link: comparison.html_url,
});
@@ -47,12 +47,12 @@ export const Info = ({
<Typography>
<strong>GitHub</strong>: The source control system where releases
reside in a practical sense. Read more about GitHub releases{' '}
reside in a practical sense. Read more about{' '}
<Link
href="https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/managing-releases-in-a-repository"
href="https://docs.github.com/en/github/administering-a-repository/managing-releases-in-a-repository"
target="_blank"
>
here
GitHub releases
</Link>
. Note that this plugin works just as well with GitHub Enterprise
(GHE)
@@ -16,8 +16,6 @@
import React, { useState } from 'react';
import { Alert, AlertTitle } from '@material-ui/lab';
import { useAsync, useAsyncFn } from 'react-use';
import FileCopyIcon from '@material-ui/icons/FileCopy';
import Paper from '@material-ui/core/Paper';
import {
Button,
Checkbox,
@@ -29,8 +27,10 @@ import {
ListItemIcon,
ListItemSecondaryAction,
ListItemText,
Paper,
Typography,
} from '@material-ui/core';
import FileCopyIcon from '@material-ui/icons/FileCopy';
import OpenInNewIcon from '@material-ui/icons/OpenInNew';
import { Differ } from '../../components/Differ';
@@ -229,12 +229,13 @@ export const PatchBody = ({
<ListItemSecondaryAction>
<IconButton
aria-label="commit"
disabled={commitExistsOnReleaseBranch}
disabled={commitExistsOnReleaseBranch || !releaseBranch}
onClick={() => {
const repoPath = apiClient.getRepoPath();
const host = apiClient.getHost();
const newTab = window.open(
`https://github.com/${repoPath}/compare/${releaseBranch?.name}...${commit.sha}`,
`https://${host}/${repoPath}/compare/${releaseBranch?.name}...${commit.sha}`,
'_blank',
);
newTab?.focus();
@@ -14,12 +14,15 @@
* limitations under the License.
*/
import React, { PropsWithChildren } from 'react';
import { List, CircularProgress } from '@material-ui/core';
import Button from '@material-ui/core/Button';
import Dialog from '@material-ui/core/Dialog';
import DialogActions from '@material-ui/core/DialogActions';
import DialogContent from '@material-ui/core/DialogContent';
import DialogTitle from '@material-ui/core/DialogTitle';
import {
List,
CircularProgress,
Button,
Dialog,
DialogActions,
DialogContent,
DialogTitle,
} from '@material-ui/core';
import { ResponseStep, SetRefetch } from '../../types/types';
import { TEST_IDS } from '../../test-helpers/test-ids';
@@ -14,8 +14,8 @@
* limitations under the License.
*/
import React, { useEffect, useState } from 'react';
import { green, red } from '@material-ui/core/colors';
import {
colors,
IconButton,
ListItem,
ListItemIcon,
@@ -78,7 +78,7 @@ export const ResponseStepListItem = ({
return (
<CheckCircleOutline
data-testid={TEST_IDS.components.responseStepListItemIconSuccess}
style={{ color: green[500] }}
style={{ color: colors.green[500] }}
/>
);
}
@@ -87,7 +87,7 @@ export const ResponseStepListItem = ({
return (
<ErrorOutlineIcon
data-testid={TEST_IDS.components.responseStepListItemIconFailure}
style={{ color: red[500] }}
style={{ color: colors.red[500] }}
/>
);
}