Skip to content

Commit

Permalink
VUU-31 Layout Server POC
Browse files Browse the repository at this point in the history
  • Loading branch information
vferraro-scottlogic committed Sep 11, 2023
1 parent 737bed8 commit a4ddbeb
Show file tree
Hide file tree
Showing 12 changed files with 1,863 additions and 6 deletions.
3 changes: 2 additions & 1 deletion vuu-ui/packages/vuu-layout/src/layout-reducer/layoutTypes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { ReactElement } from "react";
import { CSSProperties, ReactElement } from "react";
import { DragDropRect, DragInstructions } from "../drag-drop";
import { DropTarget } from "../drag-drop/DropTarget";
import { ContributionLocation } from "../layout-view";
Expand All @@ -26,6 +26,7 @@ export interface LayoutJSON extends WithType {
props?: { [key: string]: any };
state?: any;
type: string;
style?: CSSProperties
}

export interface WithActive {
Expand Down
3 changes: 2 additions & 1 deletion vuu-ui/packages/vuu-shell/src/layout-config/local-config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { LayoutJSON } from "@finos/vuu-layout/src/layout-reducer";
import { VuuUser } from "../shell";
import { Layout } from "../layout-management";

export const loadLocalConfig = (
saveUrl: string,
user: VuuUser,
id = "latest"
): Promise<LayoutJSON> =>
): Promise<Layout> =>
new Promise((resolve, reject) => {
console.log(
`load local config at ${saveUrl} for user ${user.username}, id ${id}`
Expand Down
3 changes: 2 additions & 1 deletion vuu-ui/packages/vuu-shell/src/layout-config/remote-config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { LayoutJSON } from "@finos/vuu-layout/src/layout-reducer";
import { VuuUser } from "../shell";
import { Layout } from "../layout-management";

export const loadRemoteConfig = (
saveUrl: string,
user: VuuUser,
id = "latest"
): Promise<LayoutJSON> =>
): Promise<Layout> =>
new Promise((resolve, reject) => {
fetch(`${saveUrl}/${user.username}/${id}`, {})
.then((response) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const useLayoutConfig = ({
async (id = "latest") => {
try {
const layout = await loadConfig(saveUrl, user, id);
_setLayout(layout);
_setLayout(layout.json);
} catch {
_setLayout(defaultLayout);
}
Expand Down
1 change: 1 addition & 0 deletions vuu-ui/packages/vuu-shell/src/shell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export const Shell = ({
const [layout, saveLayoutConfig, loadLayoutById] = useLayoutConfig({
defaultLayout,
saveLocation,
saveUrl,
user,
});

Expand Down
Loading

0 comments on commit a4ddbeb

Please sign in to comment.