Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
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
ai-tech
dify
Commits
0d791839
Unverified
Commit
0d791839
authored
Aug 02, 2023
by
bowen
Committed by
GitHub
Aug 02, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf:repeated select workspace (#710)
parent
0fc76f7e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
index.tsx
...ents/header/account-dropdown/workplace-selector/index.tsx
+4
-3
No files found.
web/app/components/header/account-dropdown/workplace-selector/index.tsx
View file @
0d791839
...
@@ -27,10 +27,11 @@ const WorkplaceSelector = () => {
...
@@ -27,10 +27,11 @@ const WorkplaceSelector = () => {
const
{
t
}
=
useTranslation
()
const
{
t
}
=
useTranslation
()
const
{
notify
}
=
useContext
(
ToastContext
)
const
{
notify
}
=
useContext
(
ToastContext
)
const
{
workspaces
}
=
useWorkspacesContext
()
const
{
workspaces
}
=
useWorkspacesContext
()
const
currentW
rokspace
=
workspaces
.
filter
(
item
=>
item
.
current
)?.[
0
]
const
currentW
orkspace
=
workspaces
.
find
(
v
=>
v
.
current
)
const
handleSwitchWorkspace
=
async
(
tenant_id
:
string
)
=>
{
const
handleSwitchWorkspace
=
async
(
tenant_id
:
string
)
=>
{
try
{
try
{
if
(
currentWorkspace
?.
id
===
tenant_id
)
return
await
switchWorkspace
({
url
:
'/workspaces/switch'
,
body
:
{
tenant_id
}
})
await
switchWorkspace
({
url
:
'/workspaces/switch'
,
body
:
{
tenant_id
}
})
notify
({
type
:
'success'
,
message
:
t
(
'common.actionMsg.modifiedSuccessfully'
)
})
notify
({
type
:
'success'
,
message
:
t
(
'common.actionMsg.modifiedSuccessfully'
)
})
location
.
assign
(
`
${
location
.
origin
}
`
)
location
.
assign
(
`
${
location
.
origin
}
`
)
...
@@ -51,8 +52,8 @@ const WorkplaceSelector = () => {
...
@@ -51,8 +52,8 @@ const WorkplaceSelector = () => {
group hover:bg-gray-50 cursor-pointer ${open && 'bg-gray-50'} rounded-lg
group hover:bg-gray-50 cursor-pointer ${open && 'bg-gray-50'} rounded-lg
`
,
`
,
)
}
>
)
}
>
<
div
className=
{
itemIconClassName
}
>
{
currentW
ro
kspace
?.
name
[
0
].
toLocaleUpperCase
()
}
</
div
>
<
div
className=
{
itemIconClassName
}
>
{
currentW
or
kspace
?.
name
[
0
].
toLocaleUpperCase
()
}
</
div
>
<
div
className=
{
`${itemNameClassName} truncate`
}
>
{
currentW
ro
kspace
?.
name
}
</
div
>
<
div
className=
{
`${itemNameClassName} truncate`
}
>
{
currentW
or
kspace
?.
name
}
</
div
>
<
ChevronRight
className=
'shrink-0 w-[14px] h-[14px] text-gray-500'
/>
<
ChevronRight
className=
'shrink-0 w-[14px] h-[14px] text-gray-500'
/>
</
Menu
.
Button
>
</
Menu
.
Button
>
<
Transition
<
Transition
...
...
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