Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[View] cluster 요약에서 cluster의 releaseTag를 보여주는 방식 변경 #763

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { getClusterSizes } from "../ClusterGraph/ClusterGraph.util";
import { CLUSTER_HEIGHT, DETAIL_HEIGHT, NODE_GAP } from "../ClusterGraph/ClusterGraph.const";

import { usePreLoadAuthorImg } from "./Summary.hook";
import { getInitData, getClusterIds, getClusterById } from "./Summary.util";
import { getInitData, getClusterIds, getClusterById, getCommitLatestTag } from "./Summary.util";
import { Content } from "./Content";

const COLLAPSED_ROW_HEIGHT = CLUSTER_HEIGHT + NODE_GAP * 2;
Expand Down Expand Up @@ -85,7 +85,7 @@ const Summary = () => {
));
})}
</div>
<div>{cluster.latestReleaseTag}</div>
<div>{getCommitLatestTag(cluster.clusterTags)}</div>
<Content
content={cluster.summary.content}
clusterId={cluster.clusterId}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export type Summary = {
export type Cluster = {
clusterId: number;
summary: Summary;
latestReleaseTag: string;
clusterTags: string[];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

};

export type AuthSrcMap = Record<string, string>;
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function tagToNumber(tag: string, maxLength: number): number {
* @param tags
* @returns
*/
function getCommitLatestTag(tags: string[]): string {
export function getCommitLatestTag(tags: string[]): string {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오! 간단한 test case를 만들어보기 좋은 public 함수가 하나 나왔군요!!!

if (!Array.isArray(tags) || tags.length === 0) return "";

const validTags = tags.filter((tag) => isValidReleaseTag(tag));
Expand Down Expand Up @@ -77,7 +77,7 @@ export function getInitData(data: GlobalProps["data"]): Cluster[] {
count: clusterNode.commitNodeList.length - 1,
},
},
latestReleaseTag: "",
clusterTags: [],
};

const clusterTags: string[] = [];
Expand All @@ -94,16 +94,17 @@ export function getInitData(data: GlobalProps["data"]): Cluster[] {

// get releaseTags in cluster commitNodeList
commitNode.commit.releaseTags?.map((tag) => {
clusterTags.push(tag);
if (clusterTags.indexOf(tag) === -1) {
clusterTags.push(tag);
}
return clusterTags;
});

return commitNode;
});

// set latset release tag
const latestReleaseTag = getCommitLatestTag(clusterTags);
cluster.latestReleaseTag = latestReleaseTag;
// set release tag in cluster
cluster.clusterTags = clusterTags;

// remove name overlap
const authorsSet = cluster.summary.authorNames.reduce((set, authorArray) => {
Expand Down
Loading