Skip to content

Commit

Permalink
hopefully fixed IO problems
Browse files Browse the repository at this point in the history
  • Loading branch information
karchjd committed Oct 2, 2024
1 parent 38b83ad commit 95e0d3c
Show file tree
Hide file tree
Showing 63 changed files with 119,898 additions and 500 deletions.
10 changes: 5 additions & 5 deletions dev/compile_restart_dev.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
recompile_front <- F # nolint
release <- T
recompile_front <- T # nolint
release <- F

if (recompile_front) {
# Compile Svelte front end
Expand All @@ -11,7 +11,7 @@ if (recompile_front) {

if (ret_val != 0) {
stop("Failed to compile Svelte front end.")
}
}
}


Expand All @@ -28,5 +28,5 @@ HS.model <- " visual =~ x1 + x2 + myLabel * x3
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9"

fit <- cfa(HS.model, data = HolzingerSwineford1939)
lavaangui()
fit <- cfa('x8 ~~ x9', data = HolzingerSwineford1939)
lavaangui(fit)
77 changes: 47 additions & 30 deletions frontend/src/MenuTop/IO.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,33 @@ import * as Constants from "../Graph/classNames.js";
import { resetCounters } from "../Graph/graphmanipulation.js";
import { applyLinkedClass } from "../Shiny/applyLinkedClass.js";
import { checkNodeLoop } from "../Graph/checkNodeLoop.js";
import { tolavaan } from "../Shiny/toR";

export async function requestData(goal) {
// @ts-expect-error
Shiny.setInputValue("down-requestData", { goal: goal, random: Math.random() });
}

let appStateLocal = get(appState);
let modelOptionsLocal = get(modelOptions);
let fitCacheLocal = get(fitCache);
let gridViewOptionsLocal = get(gridViewOptions);

export function reset() {
let cy = get(cyStore);
cy.elements().remove();
resetCounters();
appStateLocal.parsedModel = false;
modelOptionsLocal.fix_first = true;
modelOptionsLocal.mode = "user model";
appState.update((state) => {
state.parsedModel = false;
return state;
});
modelOptions.update((state) => {
state.fix_first = true;
state.mode = "user model";
return state;
});
// @ts-expect-error
Shiny.setInputValue("show_help", Math.random());
for (let key in fitCacheLocal) {
fitCacheLocal[key] = null;
}
fitCache.update((cache) => {
for (let key in cache) {
cache[key] = null;
}
return cache;
});
}

export function parseModel(content) {
Expand All @@ -36,39 +39,50 @@ export function parseModel(content) {
let cy = get(cyStore);
let json;
json = JSON.parse(combinedData.model);
const modelOpt = JSON.parse(combinedData.modelOpt);
const gridViewOpt = JSON.parse(combinedData.gridViewOpt);
mergeExistingProperties(modelOptionsLocal, modelOpt);
mergeExistingProperties(modelOptionsLocal, gridViewOpt);
if (combinedData.fitCache != undefined) {
const modelOptData = JSON.parse(combinedData.modelOpt);
const gridViewOptData = JSON.parse(combinedData.gridViewOpt);
mergeExistingProperties(modelOptions, modelOptData);
mergeExistingProperties(modelOptions, gridViewOptData);
if (combinedData.fitCache !== undefined) {
const localCache = JSON.parse(combinedData.fitCache);
fitCacheLocal = localCache;
fitCache.set(localCache); // Use the set method to update the store with the new value
}

// Set loading mode, update diagram and perform checks
appStateLocal.loadingMode = true;
appState.update(state => {
state.loadingMode = true;
return state;
});
cy.json({ elements: json });

cy.nodes().forEach((node) => {
node.style({ width: node.data("width") });
node.style({ height: node.data("height") });
});

if (appStateLocal.dataAvail) {
applyLinkedClass(appStateLocal.columnNames);
if (get(appState).dataAvail) {
applyLinkedClass(get(appState).columnNames);
}

if (modelOptionsLocal.mode !== "user model") {
gridViewOptionsLocal.showLav = true;
if (get(modelOptions).mode !== "user model") {
gridViewOptions.update(state => {
state.showLav = true;
return state;
});
} else {
gridViewOptionsLocal.showLav = false;
gridViewOptions.update(state => {
state.showLav = false;
return state;
});
}

cy.nodes().forEach((node) => {
checkNodeLoop(node.id());
});
appStateLocal.loadingMode = false;
tolavaan(modelOptionsLocal.mode);
appState.update(state => {
state.loadingMode = false;
return state;
});
}

export function jsonModel() {
Expand Down Expand Up @@ -104,9 +118,12 @@ export function jsonModel() {


function mergeExistingProperties(target, source) {
for (let key in source) {
if (source.hasOwnProperty(key) && source[key] !== undefined) {
target[key] = source[key];
target.update((state) => {
for (let key in source) {
if (source.hasOwnProperty(key) && source[key] !== undefined) {
state[key] = source[key];
}
}
}
return state; // Return the updated state
});
}
1 change: 0 additions & 1 deletion inst/www/assets/@babel-75df473a.js

This file was deleted.

6 changes: 0 additions & 6 deletions inst/www/assets/@jaames-324f80d4.js

This file was deleted.

1 change: 0 additions & 1 deletion inst/www/assets/canvg-9877eea0.js

This file was deleted.

4 changes: 0 additions & 4 deletions inst/www/assets/core-js-bbf708ea.js

This file was deleted.

1 change: 0 additions & 1 deletion inst/www/assets/cose-base-3e61f9ec.js

This file was deleted.

1 change: 0 additions & 1 deletion inst/www/assets/cssesc-5de85916.js

This file was deleted.

15 changes: 0 additions & 15 deletions inst/www/assets/cytoscape-86e840ae.js

This file was deleted.

1 change: 0 additions & 1 deletion inst/www/assets/cytoscape-automove-085c6bfa.js

This file was deleted.

Loading

0 comments on commit 95e0d3c

Please sign in to comment.