Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
xxxjinn committed Aug 31, 2024
2 parents f149bad + 886be7a commit 538b694
Show file tree
Hide file tree
Showing 14 changed files with 43 additions and 66 deletions.
13 changes: 5 additions & 8 deletions doc/getting-started-ko.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,11 @@ view → engine → vscode 순서대로 빌드를 시작합니다.
![](./getting-started-ko/3.png)
![](./getting-started-ko/4.png)

4. debug mode 로 실행된 vscode(githru의 vscode패키지) 의 settings 에 진입합니다. (단축키 : `ctrl + ,`)
![](./getting-started-ko/5.png)
4. debug mode 로 실행된 vscode(githru의 vscode패키지) 의 하단 상태표시줄에 "githru" 텍스트 버튼을 통해 githru 화면에 진입합니다.
![](./getting-started-ko/7.png)

5. settings 화면에서 "githru" 검색을 통해 githru 설정화면에 진입한 다음,
githru engine 에서 사용할 github access token 를 입력합니다.
(토큰 발급 참고자료 : https://docs.github.com/ko/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)
![](./getting-started-ko/6.png)
5. "확장 'githru-vscode-ext'은(는) GitHub을(를) 사용하여 로그인하려고 합니다."라는 메시지가 뜨면, "허용" 버튼을 클릭하고 외부 페이지에서 GitHub 로그인합니다.
![](./getting-started-ko/login-popup.png)

6. debug mode 로 실행된 vscode(githru의 vscode패키지) 의 하단 상태표시줄에 "githru" 텍스트 버튼을 통해 githru 화면에 진입합니다.
![](./getting-started-ko/7.png)
6. 로그인이 완료되면, vscode(githru의 vscode패키지) 에서 githru 화면이 뜹니다.
![](./getting-started-ko/8.png)
Binary file removed doc/getting-started-ko/5.png
Binary file not shown.
Binary file removed doc/getting-started-ko/6.png
Binary file not shown.
Binary file added doc/getting-started-ko/login-popup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions packages/analysis-engine/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
dist
coverage
.env
3 changes: 2 additions & 1 deletion packages/analysis-engine/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ export class AnalysisEngine {
if (this.isDebugMode) console.log("stemDict: ", stemDict);
const csmDict = buildCSMDict(commitDict, stemDict, this.baseBranchName, pullRequests);
if (this.isDebugMode) console.log("csmDict: ", csmDict);
const geminiCommitSummary = await getSummary(commitRaws?.slice(-10) ?? []);
const nodes = stemDict.get(this.baseBranchName)?.nodes?.map(({commit}) => commit);
const geminiCommitSummary = await getSummary(nodes ? nodes?.slice(-10) : []);
if (this.isDebugMode) console.log("GeminiCommitSummary: ", geminiCommitSummary);

return {
Expand Down
3 changes: 1 addition & 2 deletions packages/analysis-engine/src/summary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ const apiKey = process.env.GEMENI_API_KEY || '';
const apiUrl = "https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-latest:generateContent?key=";

export async function getSummary(csmNodes: CommitRaw[]) {
const commitMessages = csmNodes.map((csmNode) => csmNode.message).join(', ');
const commitMessages = csmNodes.map((csmNode) => csmNode.message.split('\n')[0]).join(', ');

console.log(commitMessages, 'apiKey');
try {
const response = await fetch(apiUrl + apiKey, {
method: "POST",
Expand Down
1 change: 0 additions & 1 deletion packages/view/src/components/FilteredClusters/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ import { selectedDataUpdater } from "components/VerticalClusterList/VerticalClus
import { getInitData, getClusterById } from "components/VerticalClusterList/Summary/Summary.util";
import { useGlobalData } from "hooks";

import "./FilteredClusters.scss";
import "./SelectedClusterGroup.scss";

const FilteredClusters = () => {
const SelectedClusterGroup = () => {
const { selectedData, setSelectedData } = useGlobalData();
const selectedClusters = getInitData(selectedData);

const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
const isOpen = Boolean(anchorEl);
const [menuAnchorElement, setMenuAnchorElement] = useState<null | HTMLElement>(null);
const isOpen = Boolean(menuAnchorElement);

const openSelectedList = (event: MouseEvent<HTMLButtonElement>) => {
setAnchorEl(event.currentTarget);
const openClusterGroup = (event: MouseEvent<HTMLButtonElement>) => {
setMenuAnchorElement(event.currentTarget);
};

const closeSelectedList = () => {
setAnchorEl(null);
const closeClusterGroup = () => {
setMenuAnchorElement(null);
};

const deselectCluster = (clusterId: number) => () => {
Expand All @@ -34,39 +34,37 @@ const FilteredClusters = () => {
return (
<div className="selected__content">
<Button
id="selected-list-button"
aria-controls={isOpen ? "selected-list" : undefined}
id="cluster-group-button"
aria-controls={isOpen ? "cluster-group-box" : undefined}
aria-expanded={isOpen ? "true" : undefined}
aria-haspopup="true"
sx={{ color: "inherit", padding: 0, textTransform: "none" }}
onClick={openSelectedList}
onClick={openClusterGroup}
>
<p>Clusters</p>
<p>Selected Nodes</p>
<ArrowDropDownRoundedIcon />
</Button>
<Menu
className="selected__cluster"
id="selected-list"
anchorEl={anchorEl}
id="cluster-group-box"
anchorEl={menuAnchorElement}
open={isOpen}
MenuListProps={{
"aria-labelledby": "selected-list-button",
"aria-labelledby": "cluster-group-button",
}}
onClose={closeSelectedList}
onClose={closeClusterGroup}
>
{selectedClusters.map((selectedCluster) => {
return (
<li key={selectedCluster.clusterId}>
<Chip
label={selectedCluster.summary.content.message}
onDelete={deselectCluster(selectedCluster.clusterId)}
/>
</li>
);
})}
{selectedClusters.map((selectedCluster) => (
<li key={selectedCluster.clusterId}>
<Chip
label={selectedCluster.summary.content.message}
onDelete={deselectCluster(selectedCluster.clusterId)}
/>
</li>
))}
</Menu>
</div>
);
};

export default FilteredClusters;
export default SelectedClusterGroup;
1 change: 1 addition & 0 deletions packages/view/src/components/SelectedClusterGroup/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as SelectedClusterGroup } from "./SelectedClusterGroup";
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useGlobalData } from "hooks";
import { FilteredAuthors } from "components/FilteredAuthors";
import { FilteredClusters } from "components/FilteredClusters";
import { SelectedClusterGroup } from "components/SelectedClusterGroup";

import { Summary } from "./Summary";

Expand All @@ -14,7 +14,7 @@ const VerticalClusterList = () => {
{selectedData.length > 0 && (
<div className="selected__container">
<FilteredAuthors />
<FilteredClusters />
<SelectedClusterGroup />
</div>
)}
<Summary />
Expand Down
26 changes: 6 additions & 20 deletions packages/view/tests/home.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ test.describe("home", () => {
await expect(page).toHaveTitle(/Githru/);
});

test("when click cluster", async ({ page }) => {
await page.waitForSelector("[data-testid=cluster-graph__container]", { state: "attached" });

const childContainers = await page.$$("[data-testid=cluster-graph__container]");
test("opens detail container on cluster click", async ({ page }) => {
await page.waitForSelector(".cluster-graph__container", { state: "attached" });
const childContainers = await page.$$(".cluster-graph__container");

if (childContainers.length > CLICK_INDEX) {
await childContainers[CLICK_INDEX].scrollIntoViewIfNeeded();
Expand All @@ -23,22 +22,9 @@ test.describe("home", () => {
}

// waiting for changing
await page.waitForTimeout(1000);

const newChildContainers = await page.$$("[data-testid=cluster-graph__container]");

const targetIndexForCheck = CLICK_INDEX + 1;
const transformPositionForCheck = 10 + targetIndexForCheck * 50 + 220;
if (newChildContainers.length > targetIndexForCheck) {
const transformValue = await newChildContainers[targetIndexForCheck].getAttribute("transform");
await page.waitForTimeout(10000);

if (transformValue !== null) {
expect(transformValue).toBe(`translate(2, ${transformPositionForCheck})`);
} else {
throw new Error("Transform attribute not found");
}
} else {
throw new Error("Not enough child containers found");
}
const detailContainer = await page.waitForSelector(".detail__container");
expect(detailContainer).toBeTruthy();
});
});
5 changes: 0 additions & 5 deletions packages/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@
"configuration": {
"title": "Githru",
"properties": {
"githru.github.token": {
"type": "string",
"default": "",
"description": "Insert your GitHub Token for GitHub API."
},
"githru.color.primary": {
"type": "string",
"default": "#ff8272",
Expand Down

0 comments on commit 538b694

Please sign in to comment.