General improvements
Signed-off-by: Erik Engervall <erik.engervall@gmail.com>
This commit is contained in:
@@ -706,7 +706,10 @@ export class PluginApiClient implements IPluginApiClient {
|
||||
const { data: cherryPickCommit } = await octokit.git.createCommit({
|
||||
owner,
|
||||
repo,
|
||||
message: `[patch ${bumpedTag}] ${selectedPatchCommit.commit.message}`,
|
||||
message: `[patch ${bumpedTag}] ${selectedPatchCommit.commit.message}
|
||||
|
||||
${selectedPatchCommit.sha}
|
||||
${selectedPatchCommit.htmlUrl}`,
|
||||
tree: mergeTree,
|
||||
parents: [releaseBranchSha],
|
||||
});
|
||||
|
||||
@@ -159,7 +159,9 @@ export const PatchBody = ({
|
||||
(commit, index) => {
|
||||
// FIXME: Performance improvement opportunity: Convert to object lookup
|
||||
const commitExistsOnReleaseBranch = !!githubDataResponse.value?.recentCommitsOnReleaseBranch.find(
|
||||
releaseBranchCommit => releaseBranchCommit.sha === commit.sha,
|
||||
releaseBranchCommit =>
|
||||
releaseBranchCommit.sha === commit.sha ||
|
||||
releaseBranchCommit.commit.message.includes(commit.sha), // The selected patch commit's sha is included in the commit message
|
||||
);
|
||||
const hasNoParent = !commit.firstParentSha;
|
||||
|
||||
@@ -216,11 +218,18 @@ export const PatchBody = ({
|
||||
</ListItemIcon>
|
||||
|
||||
<ListItemText
|
||||
style={{ marginRight: 15 }}
|
||||
id={commit.sha}
|
||||
primary={commit.commit.message}
|
||||
secondary={
|
||||
<>
|
||||
{commit.sha}{' '}
|
||||
<Link
|
||||
color="primary"
|
||||
href={commit.htmlUrl}
|
||||
target="_blank"
|
||||
>
|
||||
{commit.sha}
|
||||
</Link>{' '}
|
||||
<Link
|
||||
color="primary"
|
||||
href={commit.author.htmlUrl}
|
||||
|
||||
@@ -65,9 +65,12 @@ export function Owner({
|
||||
onChange={event => {
|
||||
const queryParams = getNewQueryParams({
|
||||
query,
|
||||
key: 'owner',
|
||||
value: event.target.value as string,
|
||||
updates: [
|
||||
{ key: 'repo', value: '' },
|
||||
{ key: 'owner', value: event.target.value as string },
|
||||
],
|
||||
});
|
||||
|
||||
navigate(`?${queryParams}`, { replace: true });
|
||||
}}
|
||||
className={formClasses.selectEmpty}
|
||||
|
||||
@@ -61,9 +61,9 @@ export function Repo({ project }: { project: Project }) {
|
||||
onChange={event => {
|
||||
const queryParams = getNewQueryParams({
|
||||
query,
|
||||
key: 'repo',
|
||||
value: event.target.value as string,
|
||||
updates: [{ key: 'repo', value: event.target.value as string }],
|
||||
});
|
||||
|
||||
navigate(`?${queryParams}`, { replace: true });
|
||||
}}
|
||||
className={formClasses.selectEmpty}
|
||||
|
||||
@@ -41,8 +41,9 @@ export function VersioningStrategy({ project }: { project: Project }) {
|
||||
if (!parsedQuery.versioningStrategy) {
|
||||
const queryParams = getNewQueryParams({
|
||||
query,
|
||||
key: 'versioningStrategy',
|
||||
value: project.versioningStrategy,
|
||||
updates: [
|
||||
{ key: 'versioningStrategy', value: project.versioningStrategy },
|
||||
],
|
||||
});
|
||||
|
||||
navigate(`?${queryParams}`, { replace: true });
|
||||
@@ -60,8 +61,7 @@ export function VersioningStrategy({ project }: { project: Project }) {
|
||||
onChange={event => {
|
||||
const queryParams = getNewQueryParams({
|
||||
query,
|
||||
key: 'versioningStrategy',
|
||||
value: event.target.value,
|
||||
updates: [{ key: 'versioningStrategy', value: event.target.value }],
|
||||
});
|
||||
|
||||
navigate(`?${queryParams}`, { replace: true });
|
||||
|
||||
@@ -26,24 +26,19 @@ export function getParsedQuery({ query }: { query: URLSearchParams }) {
|
||||
|
||||
export function getNewQueryParams({
|
||||
query,
|
||||
key,
|
||||
value,
|
||||
updates,
|
||||
}: {
|
||||
query: URLSearchParams;
|
||||
key: keyof Project;
|
||||
value: string;
|
||||
updates: {
|
||||
key: keyof Project;
|
||||
value: string;
|
||||
}[];
|
||||
}) {
|
||||
const queryParams = qs.parse(query.toString());
|
||||
queryParams[key] = value;
|
||||
|
||||
for (const { key, value } of updates) {
|
||||
queryParams[key] = value;
|
||||
}
|
||||
|
||||
return qs.stringify(queryParams);
|
||||
}
|
||||
|
||||
// TODO:
|
||||
// import { useQuery } from './useQuery';
|
||||
|
||||
// export function useGetNewQueryParams({}) {
|
||||
// const query = useQuery();
|
||||
|
||||
// return 1;
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user