Skip to content

Commit

Permalink
Merge pull request #245 from Digital-Engineering/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
DnOberon authored and GitHub Enterprise committed Feb 27, 2023
2 parents 4338c21 + f615fec commit 872fc33
Show file tree
Hide file tree
Showing 47 changed files with 11,064 additions and 1,362 deletions.
2 changes: 1 addition & 1 deletion .env-sample
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# express.js application configuration
# express.js application configuration
SERVER_PORT=8090
ROOT_ADDRESS=http://localhost:8090
# the maximum size in megabytes of request bodies sent to Deep Lynx
Expand Down
8 changes: 5 additions & 3 deletions AdminWebApp/src/views/FileManager.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
</edit-tag-dialog>

<v-btn
@click='open3DViewer(items[0])'
@click='open3DViewer(items)'
style="float: right"
>
{{$t('fileManager.fileManager3DViewer')}}
Expand Down Expand Up @@ -95,6 +95,7 @@ import {mdiFileDocumentMultiple} from "@mdi/js";
import ReprocessDataSourceDialog from "@/components/dataImport/reprocessDataSourceDialog.vue";
import EditFileSetDialog from "@/components/fileManager/editFileSetDialog.vue";
import EditTagDialog from "@/components/fileManager/editTagDialog.vue";
import Config from "../config";
@Component({components:{
CreateFileSetDialog,
Expand Down Expand Up @@ -138,8 +139,9 @@ export default class FileManager extends Vue {
.finally(() => this.fileSetsLoading = false)
}
open3DViewer() {
// TODO: Implement
open3DViewer(selectedTag: any) {
localStorage.setItem("webgl", JSON.stringify(selectedTag));
window.open(`${Config.deepLynxApiUri}/viewer`, "_blank");
}
copyID(id: string) {
Expand Down
6 changes: 6 additions & 0 deletions WebGLViewer/app/hooks/hooks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux';
import type { RootState, AppDispatch } from '../store';

// Use throughout your app instead of plain `useDispatch` and `useSelector`
export const useAppDispatch: () => AppDispatch = useDispatch;
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;
21 changes: 21 additions & 0 deletions WebGLViewer/app/hooks/use-thunk.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { useState, useCallback } from 'react';
import { useDispatch } from 'react-redux';

export function useThunk(thunk: any) {
const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState(null);
const dispatch = useDispatch();

const runThunk = useCallback(
(arg: any) => {
setIsLoading(true);
dispatch(thunk(arg))
.unwrap()
.catch((err: any) => setError(err))
.finally(() => setIsLoading(false));
},
[dispatch, thunk]
);

return [runThunk, isLoading, error];
}
42 changes: 39 additions & 3 deletions WebGLViewer/app/store/index.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,50 @@
import { createSlice, configureStore } from '@reduxjs/toolkit';
import { webGLReducer } from './slices/webGLSlice';

const initialState = {};
const initialState = {
openDrawerLeft: true,
openDrawerRight: false,
selectedAssetObject: {},
selectAssetOnScene: '',
highlightAssetOnScene: '',
dataViewObject: {},
};

const appStateSlice = createSlice({
name: 'appState',
initialState,
reducers: {},
reducers: {
toggleDrawerLeft: (state) => {
const store = state;
store.openDrawerLeft = !store.openDrawerLeft;
},
toggleDrawerRight: (state) => {
const store = state;
store.openDrawerRight = !store.openDrawerRight;
},
selectAssetObject: (state, action) => {
const store = state;
store.selectedAssetObject = action.payload;
},
selectAssetOnScene: (state, action) => {
const store = state;
store.selectAssetOnScene = action.payload;
},
highlightAssetOnScene: (state, action) => {
const store = state;
store.highlightAssetOnScene = action.payload;
},
setDataViewObject: (state, action) => {
const store = state;
store.dataViewObject = action.payload;
},
},
});


export const store = configureStore({
reducer: {
appState: appStateSlice.reducer,
webGL: webGLReducer
},
});

Expand All @@ -21,3 +54,6 @@ export const appStateActions = appStateSlice.actions;
export type RootState = ReturnType<typeof store.getState>
// Inferred type: {posts: PostsState, comments: CommentsState, users: UsersState}
export type AppDispatch = typeof store.dispatch


export * from './thunks/fetchWebGL';
26 changes: 26 additions & 0 deletions WebGLViewer/app/store/slices/webGLSlice.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { createSlice } from '@reduxjs/toolkit';
import { fetchWebGL } from '../thunks/fetchWebGL';

const webGLSlice = createSlice({
name: 'webGL',
initialState: {
isLoading: false,
data: [],
error: null,
},
extraReducers(builder) {
builder.addCase(fetchWebGL.pending, (state, action) => {
state.isLoading = true;
});
builder.addCase(fetchWebGL.fulfilled, (state, action) => {
state.isLoading = false;
state.data = action.payload;
});
builder.addCase(fetchWebGL.rejected, (state, action) => {
state.isLoading = false;
state.error = action.error;
});
},
});

export const webGLReducer = webGLSlice.reducer;
8 changes: 8 additions & 0 deletions WebGLViewer/app/store/thunks/fetchWebGL.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { createAsyncThunk } from '@reduxjs/toolkit';
import axios from 'axios';

const fetchWebGL = createAsyncThunk('webgl/fetch', async () => {

});

export { fetchWebGL };
7 changes: 5 additions & 2 deletions WebGLViewer/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/assets/data-gray.png" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL,[email protected],100..700,0..1,-50..200" />
<link rel="icon" type="image/svg+xml" href="viewer/assets/data-gray.png" />
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL,[email protected],100..700,0..1,-50..200"
/>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Deep Lynx WebGL Viewer</title>
</head>
Expand Down
Loading

0 comments on commit 872fc33

Please sign in to comment.