Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
4e5810e2
Commit
4e5810e2
authored
Aug 28, 2024
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: update workspace setting section
parent
a8ea2806
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
10 deletions
+9
-10
WorkspaceSection.tsx
web/src/components/Settings/WorkspaceSection.tsx
+9
-10
No files found.
web/src/components/Settings/WorkspaceSection.tsx
View file @
4e5810e2
import
{
Button
,
Select
,
Textarea
,
Option
,
Divider
}
from
"@mui/joy"
;
import
{
Button
,
Select
,
Textarea
,
Option
,
Divider
}
from
"@mui/joy"
;
import
{
isEqual
}
from
"lodash-es"
;
import
{
ExternalLinkIcon
}
from
"lucide-react"
;
import
{
ExternalLinkIcon
}
from
"lucide-react"
;
import
{
useState
}
from
"react"
;
import
{
useState
}
from
"react"
;
import
{
toast
}
from
"react-hot-toast"
;
import
{
toast
}
from
"react-hot-toast"
;
import
{
Link
}
from
"react-router-dom"
;
import
{
Link
}
from
"react-router-dom"
;
import
{
workspaceSettingServiceClient
}
from
"@/grpcweb"
;
import
{
workspaceSettingNamePrefix
,
useWorkspaceSettingStore
}
from
"@/store/v1"
;
import
{
workspaceSettingNamePrefix
,
useWorkspaceSettingStore
}
from
"@/store/v1"
;
import
{
WorkspaceGeneralSetting
}
from
"@/types/proto/api/v1/workspace_setting_service"
;
import
{
WorkspaceGeneralSetting
}
from
"@/types/proto/api/v1/workspace_setting_service"
;
import
{
WorkspaceSettingKey
}
from
"@/types/proto/store/workspace_setting"
;
import
{
WorkspaceSettingKey
}
from
"@/types/proto/store/workspace_setting"
;
...
@@ -13,9 +13,10 @@ import showUpdateCustomizedProfileDialog from "../UpdateCustomizedProfileDialog"
...
@@ -13,9 +13,10 @@ import showUpdateCustomizedProfileDialog from "../UpdateCustomizedProfileDialog"
const
WorkspaceSection
=
()
=>
{
const
WorkspaceSection
=
()
=>
{
const
t
=
useTranslate
();
const
t
=
useTranslate
();
const
workspaceSettingStore
=
useWorkspaceSettingStore
();
const
workspaceSettingStore
=
useWorkspaceSettingStore
();
const
[
workspaceGeneralSetting
,
setWorkspaceGeneralSetting
]
=
useState
<
WorkspaceGeneralSetting
>
(
const
originalSetting
=
WorkspaceGeneralSetting
.
fromPartial
(
WorkspaceGeneralSetting
.
fromPartial
(
workspaceSettingStore
.
getWorkspaceSettingByKey
(
WorkspaceSettingKey
.
GENERAL
)?.
generalSetting
||
{})
,
workspaceSettingStore
.
getWorkspaceSettingByKey
(
WorkspaceSettingKey
.
GENERAL
)?.
generalSetting
||
{}
,
);
);
const
[
workspaceGeneralSetting
,
setWorkspaceGeneralSetting
]
=
useState
<
WorkspaceGeneralSetting
>
(
originalSetting
);
const
handleUpdateCustomizedProfileButtonClick
=
()
=>
{
const
handleUpdateCustomizedProfileButtonClick
=
()
=>
{
showUpdateCustomizedProfileDialog
();
showUpdateCustomizedProfileDialog
();
...
@@ -35,11 +36,9 @@ const WorkspaceSection = () => {
...
@@ -35,11 +36,9 @@ const WorkspaceSection = () => {
const
handleSaveGeneralSetting
=
async
()
=>
{
const
handleSaveGeneralSetting
=
async
()
=>
{
try
{
try
{
await
workspaceSettingServiceClient
.
setWorkspaceSetting
({
await
workspaceSettingStore
.
setWorkspaceSetting
({
setting
:
{
name
:
`
${
workspaceSettingNamePrefix
}${
WorkspaceSettingKey
.
GENERAL
}
`
,
name
:
`
${
workspaceSettingNamePrefix
}${
WorkspaceSettingKey
.
GENERAL
}
`
,
generalSetting
:
workspaceGeneralSetting
,
generalSetting
:
workspaceGeneralSetting
,
},
});
});
}
catch
(
error
:
any
)
{
}
catch
(
error
:
any
)
{
toast
.
error
(
error
.
details
);
toast
.
error
(
error
.
details
);
...
@@ -118,8 +117,8 @@ const WorkspaceSection = () => {
...
@@ -118,8 +117,8 @@ const WorkspaceSection = () => {
<
Option
value=
{
1
}
>
Monday
</
Option
>
<
Option
value=
{
1
}
>
Monday
</
Option
>
</
Select
>
</
Select
>
</
div
>
</
div
>
<
div
>
<
div
className=
"mt-2 w-full flex justify-end"
>
<
Button
variant=
"outlined"
color=
"neutral"
onClick=
{
handleSaveGeneralSetting
}
>
<
Button
disabled=
{
isEqual
(
workspaceGeneralSetting
,
originalSetting
)
}
onClick=
{
handleSaveGeneralSetting
}
>
{
t
(
"common.save"
)
}
{
t
(
"common.save"
)
}
</
Button
>
</
Button
>
</
div
>
</
div
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment