mirror of
https://github.com/ae-utbm/sith.git
synced 2025-06-24 04:05:18 +00:00
Apply review comments
This commit is contained in:
parent
ca593c7d81
commit
d111023363
@ -5,7 +5,7 @@ import cytoscape, {
|
|||||||
type Singular,
|
type Singular,
|
||||||
} from "cytoscape";
|
} from "cytoscape";
|
||||||
import cxtmenu from "cytoscape-cxtmenu";
|
import cxtmenu from "cytoscape-cxtmenu";
|
||||||
import klay from "cytoscape-klay";
|
import klay, { type KlayLayoutOptions } from "cytoscape-klay";
|
||||||
import { type UserProfileSchema, familyGetFamilyGraph } from "#openapi";
|
import { type UserProfileSchema, familyGetFamilyGraph } from "#openapi";
|
||||||
|
|
||||||
cytoscape.use(klay);
|
cytoscape.use(klay);
|
||||||
@ -100,9 +100,9 @@ function createGraph(container: HTMLDivElement, data: GraphData, activeUserId: n
|
|||||||
{
|
{
|
||||||
selector: ".not-traversed",
|
selector: ".not-traversed",
|
||||||
style: {
|
style: {
|
||||||
"line-opacity": "0.5",
|
"line-opacity": 0.5,
|
||||||
"background-opacity": "0.5",
|
"background-opacity": 0.5,
|
||||||
"background-image-opacity": "0.5",
|
"background-image-opacity": 0.5,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -116,21 +116,14 @@ function createGraph(container: HTMLDivElement, data: GraphData, activeUserId: n
|
|||||||
nodePlacement: "INTERACTIVE",
|
nodePlacement: "INTERACTIVE",
|
||||||
layoutHierarchy: true,
|
layoutHierarchy: true,
|
||||||
},
|
},
|
||||||
},
|
} as KlayLayoutOptions,
|
||||||
});
|
});
|
||||||
const activeUser = cy
|
const activeUser = cy
|
||||||
.getElementById(activeUserId.toString())
|
.getElementById(activeUserId.toString())
|
||||||
.style("shape", "rectangle");
|
.style("shape", "rectangle");
|
||||||
/* Reset graph */
|
/* Reset graph */
|
||||||
const resetGraph = () => {
|
const resetGraph = () => {
|
||||||
cy.elements(((element: Singular) => {
|
cy.elements().removeClass("traversed not-traversed");
|
||||||
if (element.hasClass("traversed")) {
|
|
||||||
element.removeClass("traversed");
|
|
||||||
}
|
|
||||||
if (element.hasClass("not-traversed")) {
|
|
||||||
element.removeClass("not-traversed");
|
|
||||||
}
|
|
||||||
}) as unknown as string);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onNodeTap = (el: Singular) => {
|
const onNodeTap = (el: Singular) => {
|
||||||
@ -139,9 +132,7 @@ function createGraph(container: HTMLDivElement, data: GraphData, activeUserId: n
|
|||||||
if (el === activeUser) {
|
if (el === activeUser) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
cy.elements(((element: Singular) => {
|
cy.elements().addClass("not-traversed");
|
||||||
element.addClass("not-traversed");
|
|
||||||
}) as unknown as string);
|
|
||||||
|
|
||||||
for (const traversed of cy.elements().aStar({
|
for (const traversed of cy.elements().aStar({
|
||||||
root: el,
|
root: el,
|
||||||
@ -188,9 +179,12 @@ function createGraph(container: HTMLDivElement, data: GraphData, activeUserId: n
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface FamilyGraphConfig {
|
interface FamilyGraphConfig {
|
||||||
activeUser: number; // activeUser Id of the user to fetch the tree from
|
/**Id of the user to fetch the tree from*/
|
||||||
depthMin: number; // depthMin Minimum tree depth for godfathers and godchildren
|
activeUser: number;
|
||||||
depthMax: number; // depthMax Maximum tree depth for godfathers and godchildren
|
/**Minimum tree depth for godfathers and godchildren*/
|
||||||
|
depthMin: number;
|
||||||
|
/**Maximum tree depth for godfathers and godchildren*/
|
||||||
|
depthMax: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener("alpine:init", () => {
|
document.addEventListener("alpine:init", () => {
|
||||||
|
@ -97,11 +97,13 @@
|
|||||||
<div class="zoom-control" x-ref="zoomControl">
|
<div class="zoom-control" x-ref="zoomControl">
|
||||||
<button
|
<button
|
||||||
@click="graph.zoom(graph.zoom() + 1)"
|
@click="graph.zoom(graph.zoom() + 1)"
|
||||||
|
:disabled="!isZoomEnabled"
|
||||||
>
|
>
|
||||||
<i class="fa-solid fa-magnifying-glass-plus"></i>
|
<i class="fa-solid fa-magnifying-glass-plus"></i>
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
@click="graph.zoom(graph.zoom() - 1)"
|
@click="graph.zoom(graph.zoom() - 1)"
|
||||||
|
:disabled="!isZoomEnabled"
|
||||||
>
|
>
|
||||||
<i class="fa-solid fa-magnifying-glass-minus"></i>
|
<i class="fa-solid fa-magnifying-glass-minus"></i>
|
||||||
</button>
|
</button>
|
||||||
|
2
uv.lock
generated
2
uv.lock
generated
@ -1852,7 +1852,7 @@ dev = [
|
|||||||
{ name = "ipython", specifier = ">=9.0.2,<10.0.0" },
|
{ name = "ipython", specifier = ">=9.0.2,<10.0.0" },
|
||||||
{ name = "pre-commit", specifier = ">=4.1.0,<5.0.0" },
|
{ name = "pre-commit", specifier = ">=4.1.0,<5.0.0" },
|
||||||
{ name = "rjsmin", specifier = ">=1.2.4,<2.0.0" },
|
{ name = "rjsmin", specifier = ">=1.2.4,<2.0.0" },
|
||||||
{ name = "ruff", specifier = ">=0.11.11,<1.0.0" },
|
{ name = "ruff", specifier = ">=0.11.13,<1.0.0" },
|
||||||
]
|
]
|
||||||
docs = [
|
docs = [
|
||||||
{ name = "mkdocs", specifier = ">=1.6.1,<2.0.0" },
|
{ name = "mkdocs", specifier = ">=1.6.1,<2.0.0" },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user