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

Integrate API Share Workspace, Database #87

Merged
merged 27 commits into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
9553327
add value to popup share
sanglevinh Jul 28, 2023
64c4196
Merge branch 'develop-main' into feature/integrate_api_database_share
sanglevinh Jul 28, 2023
a12f040
add api get list user share
sanglevinh Jul 28, 2023
505a7c4
Merge branch 'feature/workspaces' into feature/integrate_api_database…
sanglevinh Jul 28, 2023
b29f2a8
add popshare database
sanglevinh Jul 28, 2023
24a0e6b
Merge branch 'feature/workspaces' into feature/integrate_api_database…
sanglevinh Jul 28, 2023
b526f73
integrate api share workspace
sanglevinh Jul 28, 2023
81bc59a
remove import not use
sanglevinh Jul 28, 2023
3e62add
fix eslint
sanglevinh Jul 28, 2023
077dc97
Add return type
sanglevinh Jul 28, 2023
e7737bd
remove type any
sanglevinh Jul 28, 2023
0d51d50
disable sort and filter column share in PopupShar, fix type share
sanglevinh Jul 31, 2023
fff5718
rename file
sanglevinh Jul 31, 2023
08fc194
refactor code
sanglevinh Jul 31, 2023
bf7351c
Merge branch 'develop-main' into feature/integrate_api_database_share
sanglevinh Aug 1, 2023
6f9971c
Merge branch 'develop-main' into feature/integrate_api_database_share
sanglevinh Aug 1, 2023
736b1ab
create foreignkey for user_id workspaces
quanpython Aug 1, 2023
1f84768
fix permission for database share
quanpython Aug 1, 2023
7cbefde
fix get expdb share
quanpython Aug 1, 2023
373d974
refactor list_user query
quanpython Jul 31, 2023
8b6de92
integrate API search user share
sanglevinh Aug 1, 2023
6e38132
add key to map
sanglevinh Aug 2, 2023
cc4834b
add dispatch getMe when submit login
sanglevinh Aug 2, 2023
235f679
Merge branch 'feature/refactor-db-models' into feature/integrate_api_…
sanglevinh Aug 2, 2023
3fa6c15
add keydown esc cancel search, del user when click IconCancel, fix sh…
sanglevinh Aug 2, 2023
e77818c
close popup when press esc
sanglevinh Aug 2, 2023
dd96179
Apply style adjustments
Aug 3, 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
5 changes: 5 additions & 0 deletions frontend/src/@types/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const enum SHARE {
NOSHARE = 0,
ORGANIZATION = 2,
USERS = 1,
}
11 changes: 11 additions & 0 deletions frontend/src/api/Workspace/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import axios from 'utils/axios'
import qs from 'qs'
import { ItemsWorkspace, WorkspaceDataDTO } from 'store/slice/Workspace/WorkspaceType'
import { ListShareDTO } from 'store/slice/Database/DatabaseType';

export type WorkspacePostDataDTO = { name: string; id?: number }

Expand Down Expand Up @@ -40,3 +41,13 @@ export const exportWorkspaceApi = async (id: number): Promise<void> => {
const response = await axios.get(`/workspace/export/${id}`)
return response.data
}

export const getListUserShareWorkspaceApi = async (id: number): Promise<ListShareDTO> => {
const response = await axios.get(`/workspace/share/${id}/status`)
return response.data
}

export const postListUserShareWorkspaceApi = async (id: number, data: {user_ids: number[]}): Promise<boolean> => {
const response = await axios.post(`/workspace/share/${id}/status`, data)
return response.data
}
22 changes: 16 additions & 6 deletions frontend/src/api/database/index.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,42 @@
import { DatabaseParams } from 'store/slice/Database/DatabaseType'
import { DatabaseDTO, DatabaseParams, ListShareDTO } from 'store/slice/Database/DatabaseType'
import axios from 'utils/axios'
import qs from 'qs'

export const getExperimentsPublicApi = async (params: DatabaseParams) => {
export const getExperimentsPublicApi = async (params: DatabaseParams): Promise<DatabaseDTO> => {
const paramsNew = qs.stringify(params, { indices: false })
const response = await axios.get(`/public/experiments?${paramsNew}`)
return response.data
}

export const getCellsPublicApi = async (params: DatabaseParams) => {
export const getCellsPublicApi = async (params: DatabaseParams): Promise<DatabaseDTO> => {
const paramsNew = qs.stringify(params, { indices: false })
const response = await axios.get(`/public/cells?${paramsNew}`)
return response.data
}

export const getExperimentsApi = async (params: DatabaseParams) => {
export const getExperimentsApi = async (params: DatabaseParams): Promise<DatabaseDTO> => {
const paramsNew = qs.stringify(params, { indices: false })
const response = await axios.get(`/expdb/experiments?${paramsNew}`)
return response.data
}

export const getCellsApi = async (params: DatabaseParams) => {
export const getCellsApi = async (params: DatabaseParams): Promise<DatabaseDTO> => {
const paramsNew = qs.stringify(params, { indices: false })
const response = await axios.get(`/expdb/cells?${paramsNew}`)
return response.data
}

export const postPublistApi = async (id: number, status: 'on' | 'off') => {
export const postPublistApi = async (id: number, status: 'on' | 'off'): Promise<boolean> => {
const response = await axios.post(`/expdb/experiment/publish/${id}/${status}`)
return response.data
}

export const getListUserShareApi = async (id: number): Promise<ListShareDTO> => {
const response = await axios.get(`/expdb/share/${id}/status`)
return response.data
}

export const postListUserShareApi = async (id: number, data: {share_type: number; user_ids: number[]}): Promise<boolean> => {
const response = await axios.post(`/expdb/share/${id}/status`, data)
return response.data
}
5 changes: 5 additions & 0 deletions frontend/src/api/users/UsersAdmin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,8 @@ export const deleteUserApi = async (uid: string): Promise<string> => {
const response = await axios.delete(`/admin/users/${uid}`)
return response.data
}

export const getListSearchApi = async (data: {keyword: string | null}): Promise<UserDTO[]> => {
const response = await axios.get(`/users/search/share_users${data.keyword ? `?keyword=${data.keyword}` : ''}`)
return response.data
}
5 changes: 4 additions & 1 deletion frontend/src/api/users/UsersApiDTO.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
export type UserDTO = {
id: number
uid: string
uid?: string
email: string
name?: string
create_at?: string
update_at?: string
}

export type AddUserDTO = {
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/components/Database/DatabaseCells.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,8 @@ const columns = (handleOpenDialog: (value: ImageUrls[], expId?: string) => void)
width={'100%'}
height={'100%'}
/>
</Box>
)
},
</Box>
)}
},
]

Expand Down
Loading