diff --git a/web/dashboard-ui/src/App.tsx b/web/dashboard-ui/src/App.tsx
index 196ad0ae..f85dc4ae 100644
--- a/web/dashboard-ui/src/App.tsx
+++ b/web/dashboard-ui/src/App.tsx
@@ -9,6 +9,8 @@ import { MyThemeProvider } from './components/MyThemeProvider';
import { PageSettingsProvider } from './components/PageSettingsProvider';
import { ProgressProvider } from './components/ProgressProvider';
import { PasswordChangeDialogContext } from './views/organisms/PasswordChangeDialog';
+import { UserInfoDialogContext } from './views/organisms/UserActionDialog';
+import { UserAddonChangeDialogContext } from './views/organisms/UserAddonsChangeDialog';
import { UserContext } from './views/organisms/UserModule';
import { UserNameChangeDialogContext } from './views/organisms/UserNameChangeDialog';
import { SignIn } from './views/pages/SignIn';
@@ -65,11 +67,15 @@ function App() {
-
-
-
-
-
+
+
+
+
+
+
+
+
+
diff --git a/web/dashboard-ui/src/__tests__/views/organisms/__snapshots__/UserModule.spec.tsx.snap b/web/dashboard-ui/src/__tests__/views/organisms/__snapshots__/UserModule.spec.tsx.snap
index 6af0b6ee..129bf400 100644
--- a/web/dashboard-ui/src/__tests__/views/organisms/__snapshots__/UserModule.spec.tsx.snap
+++ b/web/dashboard-ui/src/__tests__/views/organisms/__snapshots__/UserModule.spec.tsx.snap
@@ -10,6 +10,7 @@ exports[`useTemplates > useTemplates getUserAddonTemplates > normal 1`] = `
"description": "",
"isClusterScope": false,
"name": "tmpl1",
+ "requiredUseraddons": [],
"requiredVars": [],
},
{
@@ -17,6 +18,7 @@ exports[`useTemplates > useTemplates getUserAddonTemplates > normal 1`] = `
"isClusterScope": false,
"isDefaultUserAddon": true,
"name": "tmpl2",
+ "requiredUseraddons": [],
"requiredVars": [
{
"defaultValue": "var1Value",
@@ -32,6 +34,7 @@ exports[`useTemplates > useTemplates getUserAddonTemplates > normal 1`] = `
"description": "",
"isClusterScope": false,
"name": "tmpl3",
+ "requiredUseraddons": [],
"requiredVars": [],
},
]
diff --git a/web/dashboard-ui/src/__tests__/views/organisms/__snapshots__/WorkspaceModule.spec.tsx.snap b/web/dashboard-ui/src/__tests__/views/organisms/__snapshots__/WorkspaceModule.spec.tsx.snap
index b97b6853..4bcf7779 100644
--- a/web/dashboard-ui/src/__tests__/views/organisms/__snapshots__/WorkspaceModule.spec.tsx.snap
+++ b/web/dashboard-ui/src/__tests__/views/organisms/__snapshots__/WorkspaceModule.spec.tsx.snap
@@ -69,12 +69,14 @@ exports[`useTemplates > normal 1`] = `
"description": "",
"isClusterScope": false,
"name": "tmpl1",
+ "requiredUseraddons": [],
"requiredVars": [],
},
{
"description": "",
"isClusterScope": false,
"name": "tmpl2",
+ "requiredUseraddons": [],
"requiredVars": [
{
"defaultValue": "",
@@ -90,6 +92,7 @@ exports[`useTemplates > normal 1`] = `
"description": "",
"isClusterScope": false,
"name": "tmpl3",
+ "requiredUseraddons": [],
"requiredVars": [],
},
]
diff --git a/web/dashboard-ui/src/views/organisms/UserActionDialog.tsx b/web/dashboard-ui/src/views/organisms/UserActionDialog.tsx
index 7ae18cb2..6155fd64 100644
--- a/web/dashboard-ui/src/views/organisms/UserActionDialog.tsx
+++ b/web/dashboard-ui/src/views/organisms/UserActionDialog.tsx
@@ -7,7 +7,7 @@ import {
Grid, IconButton, InputAdornment, List, ListItem, ListItemText, MenuItem, Paper, Stack, Table, TableBody, TableCell, TableContainer, TableRow, TextField, Tooltip, Typography
} from "@mui/material";
import React, { useEffect, useState } from "react";
-import { useFieldArray, useForm, UseFormRegisterReturn } from "react-hook-form";
+import { UseFormRegisterReturn, useFieldArray, useForm } from "react-hook-form";
import { DialogContext } from "../../components/ContextProvider";
import { Template } from "../../proto/gen/dashboard/v1alpha1/template_pb";
import { User, UserAddon } from "../../proto/gen/dashboard/v1alpha1/user_pb";
@@ -122,13 +122,14 @@ const UserActionDialog: React.FC = ({ title, actions, use
/**
* Info
*/
-export const UserInfoDialog: React.VFC<{ onClose: () => void, user: User }> = ({ onClose, user }) => {
+export const UserInfoDialog: React.VFC<{ onClose: () => void, user: User, defaultOpenUserAddon?: boolean }> = ({ onClose, user, defaultOpenUserAddon }) => {
console.log('UserInfoDialog');
return (
onClose()}
user={user}
+ defaultOpenUserAddon={defaultOpenUserAddon}
actions={} />
);
}
@@ -401,7 +402,7 @@ export const UserCreateDialog: React.VFC<{ onClose: () => void }> = ({ onClose }
/**
* Context
*/
-export const UserInfoDialogContext = DialogContext<{ user: User }>(
+export const UserInfoDialogContext = DialogContext<{ user: User, defaultOpenUserAddon?: boolean }>(
props => ());
export const UserDeleteDialogContext = DialogContext<{ user: User }>(
props => ());
diff --git a/web/dashboard-ui/src/views/templates/PageTemplate.tsx b/web/dashboard-ui/src/views/templates/PageTemplate.tsx
index 5986ecb7..817c310d 100644
--- a/web/dashboard-ui/src/views/templates/PageTemplate.tsx
+++ b/web/dashboard-ui/src/views/templates/PageTemplate.tsx
@@ -16,6 +16,8 @@ import { useLogin } from "../../components/LoginProvider";
import logo from "../../logo-with-name-small.png";
import { NameAvatar } from "../atoms/NameAvatar";
import { PasswordChangeDialogContext } from "../organisms/PasswordChangeDialog";
+import { UserInfoDialogContext } from "../organisms/UserActionDialog";
+import { UserAddonChangeDialogContext } from "../organisms/UserAddonsChangeDialog";
import { isAdminRole, isAdminUser, isPrivilegedRole } from "../organisms/UserModule";
import { UserNameChangeDialogContext } from "../organisms/UserNameChangeDialog";
@@ -49,6 +51,8 @@ export const PageTemplate: React.FC>
const { loginUser, logout } = useLogin();
const passwordChangeDialogDispach = PasswordChangeDialogContext.useDispatch();
const userNameChangeDialogDispach = UserNameChangeDialogContext.useDispatch();
+ const userAddonChangeDialogDispatch = UserAddonChangeDialogContext.useDispatch();
+ const userInfoDialogDispatch = UserInfoDialogContext.useDispatch();
const isAdmin = isAdminUser(loginUser);
const isSignIn = Boolean(loginUser);
const canChangePassword = Boolean(loginUser?.authType === 'password-secret');
@@ -65,6 +69,18 @@ export const PageTemplate: React.FC>
setAnchorEl(null);
}
+ const changeAddons = () => {
+ console.log('changeAddons');
+ userAddonChangeDialogDispatch(true, { user: loginUser! });
+ setAnchorEl(null);
+ }
+
+ const openUserInfoDialog = () => {
+ console.log('openUserInfoDialog');
+ userInfoDialogDispatch(true, { user: loginUser!, defaultOpenUserAddon: true });
+ setAnchorEl(null);
+ }
+
const [menuAnchorEl, setMenuAnchorEl] = React.useState(null);
const [anchorEl, setAnchorEl] = React.useState(null);
@@ -130,7 +146,7 @@ export const PageTemplate: React.FC>
onClose={() => setAnchorEl(null)}
>
-
+ openUserInfoDialog()} />
{loginUser?.displayName}
{loginUser?.name}
@@ -151,6 +167,10 @@ export const PageTemplate: React.FC>
Change password...
}
+ {isSignIn && isAdmin && }
{isSignIn &&