Skip to content

Commit 3f9eeed

Browse files
committed
fix isFork
1 parent 45fe6d8 commit 3f9eeed

4 files changed

Lines changed: 52 additions & 12 deletions

File tree

backend/app/services/gexy_node_service.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,16 @@ def generate_gexf_nodes_for_topics(self, topics):
6161
topics_lower = [t.lower() for t in topics]
6262
placeholders = ",".join(["?"] * len(topics_lower))
6363

64+
# Debug: Check what columns actually exist in the repos table
65+
schema_query = "DESCRIBE repos"
66+
# try:
67+
# schema_result = self.con.execute(schema_query).fetchall()
68+
# # print("Repos table schema:")
69+
# # for col in schema_result:
70+
# # print(f" {col}")
71+
# except Exception as e:
72+
# print(f"Could not get schema: {e}")
73+
6474
query = f"""
6575
WITH repo_topics_agg AS (
6676
SELECT r.nameWithOwner,
@@ -70,7 +80,7 @@ def generate_gexf_nodes_for_topics(self, topics):
7080
WHERE LOWER(t.topic) IN ({placeholders})
7181
GROUP BY r.nameWithOwner
7282
)
73-
SELECT DISTINCT r.nameWithOwner, r.stars, r.forks, r.watchers, r.isFork, r.isArchived,
83+
SELECT DISTINCT r.nameWithOwner, r.stars, r.forks, r.watchers, r.isArchived,
7484
r.languageCount, r.pullRequests, r.issues, r.primaryLanguage, r.createdAt,
7585
r.license, rt.topics
7686
FROM repos r
@@ -79,12 +89,17 @@ def generate_gexf_nodes_for_topics(self, topics):
7989
WHERE LOWER(t.topic) IN ({placeholders})
8090
"""
8191
result = self.con.execute(query, topics_lower + topics_lower).fetchall()
92+
93+
# Debug: Print the first few rows to see what we're getting
94+
if result:
95+
print(f"First row sample: {result[0]}")
96+
print(f"Number of results: {len(result)}")
97+
8298
columns = [
8399
"nameWithOwner",
84100
"stars",
85101
"forks",
86102
"watchers",
87-
"isFork",
88103
"isArchived",
89104
"languageCount",
90105
"pullRequests",
@@ -102,7 +117,6 @@ def generate_gexf_nodes_for_topics(self, topics):
102117
"stars": 0,
103118
"forks": 0,
104119
"watchers": 0,
105-
"isFork": False,
106120
"isArchived": False,
107121
"languageCount": 0,
108122
"pullRequests": 0,
@@ -119,7 +133,6 @@ def generate_gexf_nodes_for_topics(self, topics):
119133
'stars': {'type': 'integer'},
120134
'forks': {'type': 'integer'},
121135
'watchers': {'type': 'integer'},
122-
'isFork': {'type': 'boolean'},
123136
'isArchived': {'type': 'boolean'},
124137
'languageCount': {'type': 'integer'},
125138
'pullRequests': {'type': 'integer'},
@@ -157,6 +170,9 @@ def generate_gexf_nodes_for_topics(self, topics):
157170
elif col == "topics":
158171
# Store topics as a comma-separated string
159172
node_attrs[col] = val if val else default_values[col]
173+
elif col == "isArchived":
174+
# Ensure isArchived is always a boolean value
175+
node_attrs[col] = bool(val) if val is not None else False
160176
else:
161177
# Use default value if the value is None
162178
node_attrs[col] = default_values[col] if val is None else val

src/views/EditionPanel.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,11 @@ const EditionPanel: FC<{ isExpanded: boolean }> = ({ isExpanded }) => {
209209
colorable: "color",
210210
}[key];
211211

212+
// Debug logging
213+
if (key === "sizeable") {
214+
console.log(`Field: ${f}, Type: ${field.type}, Disabled: ${disabled}, Checked: ${checked}`);
215+
}
216+
212217
return (
213218
<td key={key} className="align-middle text-center">
214219
<input

src/views/GraphControls.tsx

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { keyBy, take } from "lodash";
55
import React, { FC, useCallback, useContext, useEffect, useMemo, useState } from "react";
66
import { BiRadioCircleMarked } from "react-icons/bi";
77
import { BsSearch, BsZoomIn, BsZoomOut } from "react-icons/bs";
8-
import { FaFileImage } from "react-icons/fa";
8+
import { FaFileImage, FaDownload } from "react-icons/fa";
99
import { OptionProps } from "react-select";
1010
import AsyncSelect from "react-select/async";
1111
import { Coordinates } from "sigma/types";
@@ -38,11 +38,11 @@ function cropOptions(options: Option[]): Option[] {
3838
const moreOptionsCount = options.length - MAX_OPTIONS;
3939
return moreOptionsCount > 1
4040
? take(options, MAX_OPTIONS).concat({
41-
type: TYPE_MESSAGE,
42-
value: RETINA_FIELD_PREFIX + "more-values",
43-
label: `...and ${moreOptionsCount > 1 ? moreOptionsCount + " more nodes" : "one more node"}`,
44-
isDisabled: true,
45-
})
41+
type: TYPE_MESSAGE,
42+
value: RETINA_FIELD_PREFIX + "more-values",
43+
label: `...and ${moreOptionsCount > 1 ? moreOptionsCount + " more nodes" : "one more node"}`,
44+
isDisabled: true,
45+
})
4646
: options;
4747
}
4848

@@ -174,6 +174,7 @@ const GraphSearch: FC = () => {
174174
const GraphControls: FC = () => {
175175
const sigma = useSigma();
176176
const graph = sigma.getGraph();
177+
const { graphFile } = useContext(GraphContext);
177178

178179
const zoom = useCallback(
179180
(ratio?: number): void => {
@@ -198,6 +199,20 @@ const GraphControls: FC = () => {
198199
});
199200
}, [graph, sigma]);
200201

202+
const downloadGraph = useCallback(() => {
203+
if (graphFile) {
204+
const blob = new Blob([graphFile.textContent], { type: "application/xml" });
205+
const url = URL.createObjectURL(blob);
206+
const a = document.createElement("a");
207+
a.href = url;
208+
a.download = graphFile.name || "graph.gexf";
209+
document.body.appendChild(a);
210+
a.click();
211+
document.body.removeChild(a);
212+
URL.revokeObjectURL(url);
213+
}
214+
}, [graphFile]);
215+
201216
return (
202217
<>
203218
<GraphSearch />
@@ -217,6 +232,10 @@ const GraphControls: FC = () => {
217232
<button className="btn btn-outline-dark graph-button mt-3" onClick={downloadImage} title="Download as image">
218233
<FaFileImage />
219234
</button>
235+
236+
<button className="btn btn-outline-dark graph-button mt-3" onClick={downloadGraph} title="Download graph file (.gexf)">
237+
<FaDownload />
238+
</button>
220239
</>
221240
);
222241
};

src/views/GraphSumUp.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ const GraphSumUp: FC = () => {
9797
<MdOutlineOpenInNew />
9898
</a>
9999
)}
100-
<button className="btn btn-outline-dark me-2 mt-1" onClick={downloadData}>
100+
{/* <button className="btn btn-outline-dark me-2 mt-1" onClick={downloadData}>
101101
<FaFileDownload /> Download the Graph File (.gexf)
102-
</button>
102+
</button> */}
103103
{navState.role !== "v" && (
104104
<button
105105
className="btn btn-outline-dark mt-1"

0 commit comments

Comments
 (0)