Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Account Manager Page #93

Merged
merged 89 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
bf32b7c
add account manager pages
sanglevinh Aug 2, 2023
6236a55
dashboard add account manager
sanglevinh Aug 2, 2023
553cdc4
add icon account manager
sanglevinh Aug 2, 2023
5d5e4ed
refactor type
sanglevinh Aug 2, 2023
769cdd4
refactor code
sanglevinh Aug 2, 2023
8d1fd00
fix name role
sanglevinh Aug 2, 2023
6500212
disable sort and filter
sanglevinh Aug 2, 2023
5f501b5
update link and icons.
Aug 3, 2023
4c7346a
Merge branch 'feature/check_role' into feature/account_manager
sanglevinh Aug 3, 2023
69e31f3
merge check role to account manager
sanglevinh Aug 3, 2023
8f67cc8
refactor code
sanglevinh Aug 3, 2023
6eb8fd8
Merge branch 'feature/refactor-db-models' into feature/account_manager
sanglevinh Aug 3, 2023
405fe68
Merge branch 'feature/refactor-db-models' into feature/account_manager
sanglevinh Aug 3, 2023
9dca33b
add popup add user
sanglevinh Aug 3, 2023
cbc0499
fix color type share users and organization
sanglevinh Aug 3, 2023
3d2c27f
Merge branch 'feature/account_manager' into feature/account_manager_a…
sanglevinh Aug 3, 2023
d62f6b4
change roleId to role_id
sanglevinh Aug 3, 2023
1d26011
add params sort and filter
sanglevinh Aug 3, 2023
275826f
Merge branch 'feature/account_manager' into feature/account_manager_a…
sanglevinh Aug 3, 2023
16205e0
add params sort and filter
sanglevinh Aug 3, 2023
c6b0567
Merge branch 'feature/account_manager' into feature/account_manager_a…
sanglevinh Aug 3, 2023
cde3064
create user
sanglevinh Aug 3, 2023
7a10de6
refactor loading
sanglevinh Aug 3, 2023
1b983f1
Merge branch 'feature/account_manager' into feature/account_manager_a…
sanglevinh Aug 3, 2023
4f0d4e0
fix button workspaces
sanglevinh Aug 4, 2023
90e7b27
Merge branch 'feature/account_manager' into feature/account_manager_a…
sanglevinh Aug 4, 2023
11ce676
fix bug email already alert succes
sanglevinh Aug 4, 2023
2dffbd3
fix loading
sanglevinh Aug 4, 2023
069c695
Merge branch 'feature/account_manager' into feature/account_manager_a…
sanglevinh Aug 4, 2023
1c31f5f
fix loading
sanglevinh Aug 4, 2023
3d7894e
Merge branch 'feature/account_manager' into feature/account_manager_a…
sanglevinh Aug 4, 2023
27fbd03
add params to workspaces in leftmenu
sanglevinh Aug 4, 2023
32a04af
Merge branch 'feature/account_manager' into feature/account_manager_a…
sanglevinh Aug 4, 2023
4e2c7e4
add sort and filter for user list API
quanpython Aug 3, 2023
4654619
Merge branch 'feature/account-api' into feature/account_manager
quanpython Aug 4, 2023
5ad8934
edit account
sanglevinh Aug 4, 2023
e0f3c19
fix params
sanglevinh Aug 4, 2023
42821f5
Merge branch 'feature/account_manager' into feature/account_manager_a…
sanglevinh Aug 4, 2023
1b342e3
Merge branch 'feature/account_manager_add_account' into feature/accou…
sanglevinh Aug 4, 2023
86444b7
fix list user
quanpython Aug 4, 2023
01ab29e
fix list user
quanpython Aug 4, 2023
b7f019e
fix pages not re-render
sanglevinh Aug 4, 2023
c209f04
Merge remote-tracking branch 'origin/feature/account_manager' into fe…
sanglevinh Aug 4, 2023
5cae5be
Merge branch 'feature/account_manager' into feature/account_manager_a…
sanglevinh Aug 4, 2023
4e87c1f
Merge branch 'feature/account_manager' into feature/account_manager_e…
sanglevinh Aug 4, 2023
038f65b
use enum in switch case
sanglevinh Aug 4, 2023
e6a5133
fix comment
sanglevinh Aug 4, 2023
6a93499
Merge branch 'feature/account_manager' into feature/account_manager_a…
sanglevinh Aug 4, 2023
86e7aa0
change Manager to Data Manager
sanglevinh Aug 4, 2023
e15efa9
Merge branch 'feature/account_manager' into feature/account_manager_a…
sanglevinh Aug 4, 2023
9ab0396
Merge branch 'feature/account_manager' into feature/account_manager_e…
sanglevinh Aug 4, 2023
a3c1542
add params to path account manager
sanglevinh Aug 4, 2023
5c0d3bb
Merge branch 'develop-main' into feature/account_manager
sanglevinh Aug 4, 2023
56bea57
Merge branch 'feature/account_manager' into feature/account_manager_a…
sanglevinh Aug 4, 2023
e9a77a5
Merge branch 'feature/account_manager' into feature/account_manager_e…
sanglevinh Aug 4, 2023
0794b24
Merge branch 'feature/account_manager_add_account' into feature/accou…
sanglevinh Aug 4, 2023
14f5069
edit account
sanglevinh Aug 4, 2023
c68b297
add sort for role_id
quanpython Aug 4, 2023
ce1c260
change MANAGER to DATA_MANAGER
sanglevinh Aug 4, 2023
a1aa5dc
Merge branch 'feature/account-api' into feature/account_manager
quanpython Aug 4, 2023
fc2c53d
fix filter only contains
sanglevinh Aug 4, 2023
ddaab2c
Merge branch 'feature/account_manager' into feature/account_manager_e…
sanglevinh Aug 4, 2023
508b571
Merge branch 'feature/account_manager' into feature/account_manager_a…
sanglevinh Aug 4, 2023
49b64b3
fix indent
sanglevinh Aug 4, 2023
3af2f92
Merge branch 'feature/account_manager_add_account' into feature/accou…
sanglevinh Aug 4, 2023
10ea406
fix check Admin in account manager
sanglevinh Aug 7, 2023
b6c2902
Merge branch 'feature/account_manager' into feature/account_manager_a…
sanglevinh Aug 7, 2023
aba7848
Merge branch 'feature/account_manager_add_account' into feature/accou…
sanglevinh Aug 7, 2023
c34e9bb
Merge branch 'develop-main' into feature/account_manager
sanglevinh Aug 7, 2023
c050311
Merge branch 'develop-main' into feature/account_manager_add_account
sanglevinh Aug 7, 2023
eca2a2e
Merge branch 'feature/account_manager_add_account' into feature/accou…
sanglevinh Aug 7, 2023
bcdccfe
fix pagination
sanglevinh Aug 8, 2023
bf45b65
Merge branch 'feature/account_manager' into feature/account_manager_a…
sanglevinh Aug 8, 2023
30144cd
Merge branch 'feature/account_manager_add_account' into feature/accou…
sanglevinh Aug 8, 2023
363c283
add alert when edit account
sanglevinh Aug 8, 2023
799527c
change type params update User
sanglevinh Aug 9, 2023
7ac1867
add sort for role string
quanpython Aug 9, 2023
951550d
fix sort account manager
sanglevinh Aug 9, 2023
c9a51ad
fix sort when reload page
sanglevinh Aug 9, 2023
a9fbf15
Merge branch 'develop-main' into feature/account_manager
sanglevinh Aug 9, 2023
25067f2
fix init sort
sanglevinh Aug 9, 2023
544d4f2
Merge branch 'feature/account_manager' into feature/account_manager_a…
sanglevinh Aug 9, 2023
6beed9c
Merge branch 'feature/account_manager_add_account' into feature/accou…
sanglevinh Aug 9, 2023
9a4df73
fix show column share and publish in open site
sanglevinh Aug 9, 2023
4b1e0bc
delete WorkspaceParams in UserAction
sanglevinh Aug 10, 2023
e0dde8d
Merge pull request #96 from arayabrain/feature/account_manager_add_ac…
itutu-tienday Aug 10, 2023
7be109f
Merge branch 'develop-main' into feature/account_manager
sanglevinh Aug 10, 2023
5404859
Merge branch 'feature/account_manager' into feature/account_manager_e…
sanglevinh Aug 10, 2023
aa8c4ee
Merge pull request #97 from arayabrain/feature/account_manager_edit_a…
itutu-tienday Aug 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/src/@types/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const enum ROLE {
ADMIN = 1,
MANAGER = 10,
DATA_MANAGER = 10,
ReiHashimoto marked this conversation as resolved.
Show resolved Hide resolved
OPERATOR = 20,
GUEST_OPERATOR = 30
}
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import Experiments from 'pages/Database/Experiments'
import PublicExperiments from 'pages/PublicDatabase/PublicExperiments'
import PublicCells from 'pages/PublicDatabase/PublicCells'
import Cells from 'pages/Database/Cells'
import AccountManager from "./pages/AccountManager";

const App: React.FC = () => {
return (
Expand Down Expand Up @@ -45,6 +46,7 @@ const App: React.FC = () => {
<Route path="/reset-password" element={<ResetPassword />} />
<Route path="/console" element={<Dashboard />} />
<Route path="/console/account" element={<Account />} />
<Route path="/console/account-manager" element={<AccountManager />} />
<Route path="/console/experiments" element={<Experiments />} />
<Route path="/console/cells" element={<Cells />} />
<Route path="/console/workspaces">
Expand Down
7 changes: 4 additions & 3 deletions frontend/src/api/users/UsersAdmin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import {
AddUserDTO,
UserDTO,
ListUsersQueryDTO,
UserListDTO,
UpdateUserDTO,
UpdateUserDTO, UserListDTO,
} from './UsersApiDTO'
import qs from "qs";

export const createUserApi = async (data: AddUserDTO): Promise<UserDTO> => {
const response = await axios.post('/admin/users', data)
Expand All @@ -20,7 +20,8 @@ export const getUserApi = async (uid: string): Promise<UserDTO> => {
export const listUsersApi = async (
data: ListUsersQueryDTO,
): Promise<UserListDTO> => {
const response = await axios.get('/admin/users', { params: data })
const paramsNew = qs.stringify(data, { indices: false })
const response = await axios.get(`/admin/users?${paramsNew}`)
return response.data
}

Expand Down
13 changes: 9 additions & 4 deletions frontend/src/api/users/UsersApiDTO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ export type UserDTO = {
name?: string
organization_id?: number
role_id?: number
create_at?: string
update_at?: string
created_at?: string
updated_at?: string
}

export type AddUserDTO = {
Expand All @@ -15,13 +15,18 @@ export type AddUserDTO = {
}

export type ListUsersQueryDTO = {
name?: string
email?: string
sort?: string[]
offset?: number
limit?: number
}

export type UserListDTO = {
data: UserDTO[]
total_page: number
items: UserDTO[]
total: number
limit: number
offset: number
}

export type UpdateUserDTO = {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Database/DatabaseExperiments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ const DatabaseExperiments = ({ user, cellPath }: DatabaseProps) => {
sx={{ cursor: 'pointer' }}
onClick={() => handleOpenShare(row.experiment_id, value, row.id)}
>
<GroupsIcon sx={{ color: `${value === SHARE.NOSHARE ? "bredlack" : value === SHARE.ORGANIZATION ? "blue" : "red" }`}}/>
<GroupsIcon sx={{ color: `${value === SHARE.NOSHARE ? "black" : value === SHARE.ORGANIZATION ? "red" : "blue" }`}}/>
</Box>
)
}
Expand Down
22 changes: 21 additions & 1 deletion frontend/src/components/Layout/LeftMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,19 @@ import ListItemText from '@mui/material/ListItemText'
import WebIcon from '@mui/icons-material/Web';
import DashboardIcon from '@mui/icons-material/Dashboard';
import StorageIcon from '@mui/icons-material/Storage'
import ManageAccountsIcon from '@mui/icons-material/ManageAccounts';
import AnalyticsIcon from '@mui/icons-material/Analytics'
import { DRAWER_WIDTH } from 'const/Layout'
import { Box } from '@mui/material'
import {useSelector} from "react-redux";
import {isAdmin} from "../../store/slice/User/UserSelector";

const LeftMenu: FC<{ open: boolean; handleDrawerClose: () => void }> = ({
open,
handleDrawerClose,
}) => {
const navigate = useNavigate()
const admin = useSelector(isAdmin)

const onClickDashboard = () => {
handleDrawerClose()
Expand All @@ -31,7 +35,12 @@ const LeftMenu: FC<{ open: boolean; handleDrawerClose: () => void }> = ({

const onClickWorkspaces = () => {
handleDrawerClose()
navigate('/console/workspaces')
navigate('/console/workspaces?limit=50&offset=0')
}

const onClickAccountManager = () => {
handleDrawerClose()
navigate('/console/account-manager?sort=&sort=&limit=50&offset=0')
ReiHashimoto marked this conversation as resolved.
Show resolved Hide resolved
}

const onClickOpenSite = () => {
Expand Down Expand Up @@ -68,6 +77,17 @@ const LeftMenu: FC<{ open: boolean; handleDrawerClose: () => void }> = ({
<ListItemText primary="Workspaces" />
</ListItemButton>
</ListItem>
{
admin ?
<ListItem key="account-manager" disablePadding>
<ListItemButton onClick={onClickAccountManager}>
<ListItemIcon>
<ManageAccountsIcon />
</ListItemIcon>
<ListItemText primary="Account Manager" />
</ListItemButton>
</ListItem> : null
}
<ListItem key="site" disablePadding>
<ListItemButton onClick={onClickOpenSite}>
<ListItemIcon>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/PopupShare.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useDispatch, useSelector } from "react-redux";
import { postListUserShare } from "../store/slice/Database/DatabaseActions";
import CancelIcon from '@mui/icons-material/Cancel'
import { postListUserShareWorkspaces } from "store/slice/Workspace/WorkspacesActions";
import { selectListSearch, selectListSearchLoading } from "../store/slice/User/UserSelector";
import { selectListSearch, selectLoading } from "../store/slice/User/UserSelector";
import { getListSearch } from "../store/slice/User/UserActions";
import Loading from "./common/Loading";
import { UserDTO } from "../api/users/UsersApiDTO";
Expand Down Expand Up @@ -78,7 +78,7 @@ const TableListSearch = ({usersSuggest, onClose, handleAddListUser, stateUserSha
const PopupShare = ({open, handleClose, data, usersShare, id, isWorkspace, title}: PopupType) => {
const [shareType, setShareType] = useState(data?.shareType || 0)
const usersSuggest = useSelector(selectListSearch)
const loading = useSelector(selectListSearchLoading)
const loading = useSelector(selectLoading)
const [textSearch, setTextSearch] = useState('')
const [stateUserShare, setStateUserShare] = useState(usersShare || undefined)
const dispatch = useDispatch()
Expand Down
Loading