Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Clash Verge
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
many-archive
Clash Verge
Commits
06dabf1e
There was an error fetching the commit references. Please try again later.
Unverified
Commit
06dabf1e
authored
2 years ago
by
GyDi
Browse files
Options
Downloads
Patches
Plain Diff
fix: adjust service mode ui
parent
28d3691e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/setting/mods/service-viewer.tsx
+15
-6
15 additions, 6 deletions
src/components/setting/mods/service-viewer.tsx
src/components/setting/setting-system.tsx
+35
-29
35 additions, 29 deletions
src/components/setting/setting-system.tsx
with
50 additions
and
35 deletions
src/components/setting/mods/service-viewer.tsx
+
15
−
6
View file @
06dabf1e
...
...
@@ -24,7 +24,11 @@ export const ServiceViewer = forwardRef<DialogRef, Props>((props, ref) => {
const
{
data
:
status
,
mutate
:
mutateCheck
}
=
useSWR
(
"
checkService
"
,
checkService
,
{
revalidateIfStale
:
false
,
shouldRetryOnError
:
false
}
{
revalidateIfStale
:
false
,
shouldRetryOnError
:
false
,
focusThrottleInterval
:
36
e5
,
// 1 hour
}
);
useImperativeHandle
(
ref
,
()
=>
({
...
...
@@ -64,9 +68,14 @@ export const ServiceViewer = forwardRef<DialogRef, Props>((props, ref) => {
// fix unhandled error of the service mode
const
onDisable
=
useLockFn
(
async
()
=>
{
await
patchVergeConfig
({
enable_service_mode
:
false
});
mutateCheck
();
setOpen
(
false
);
try
{
await
patchVergeConfig
({
enable_service_mode
:
false
});
mutateCheck
();
setOpen
(
false
);
}
catch
(
err
:
any
)
{
mutateCheck
();
Notice
.
error
(
err
.
message
||
err
.
toString
());
}
});
return
(
...
...
@@ -81,8 +90,8 @@ export const ServiceViewer = forwardRef<DialogRef, Props>((props, ref) => {
{
(
state
===
"
unknown
"
||
state
===
"
uninstall
"
)
&&
(
<
Typography
>
Information: Please make sure the Clash Verge Service is
installed and
enabled
Information: Please make sure
that
the Clash Verge Service is
installed and
enabled
</
Typography
>
)
}
...
...
This diff is collapsed.
Click to expand it.
src/components/setting/setting-system.tsx
+
35
−
29
View file @
06dabf1e
...
...
@@ -27,7 +27,11 @@ const SettingSystem = ({ onError }: Props) => {
const
{
data
:
serviceStatus
}
=
useSWR
(
isWIN
?
"
checkService
"
:
null
,
checkService
,
{
revalidateIfStale
:
false
,
shouldRetryOnError
:
false
}
{
revalidateIfStale
:
false
,
shouldRetryOnError
:
false
,
focusThrottleInterval
:
36
e5
,
// 1 hour
}
);
const
serviceRef
=
useRef
<
DialogRef
>
(
null
);
...
...
@@ -70,47 +74,49 @@ const SettingSystem = ({ onError }: Props) => {
<
SettingItem
label
=
{
t
(
"
Service Mode
"
)
}
extra
=
{
(
serviceStatus
===
"
active
"
||
serviceStatus
===
"
installed
"
)
&&
(
<
PrivacyTipRounded
fontSize
=
"small"
style
=
{
{
cursor
:
"
pointer
"
,
opacity
:
0.75
}
}
onClick
=
{
()
=>
serviceRef
.
current
?.
open
()
}
/>
)
}
>
{
serviceStatus
===
"
active
"
||
serviceStatus
===
"
installed
"
?
(
<
GuardState
value
=
{
enable_service_mode
??
false
}
valueProps
=
"checked"
onCatch
=
{
onError
}
onFormat
=
{
onSwitchFormat
}
onChange
=
{
(
e
)
=>
onChangeData
({
enable_service_mode
:
e
})
}
onGuard
=
{
(
e
)
=>
patchVerge
({
enable_service_mode
:
e
})
}
>
<
Switch
edge
=
"end"
/>
</
GuardState
>
)
:
(
<
IconButton
color
=
"inherit"
size
=
"small"
sx
=
{
{
my
:
"
2px
"
}
}
onClick
=
{
()
=>
serviceRef
.
current
?.
open
()
}
>
<
ArrowForward
/>
<
PrivacyTipRounded
fontSize
=
"inherit"
style
=
{
{
cursor
:
"
pointer
"
,
opacity
:
0.75
}
}
/>
</
IconButton
>
)
}
}
>
<
GuardState
value
=
{
enable_service_mode
??
false
}
valueProps
=
"checked"
onCatch
=
{
onError
}
onFormat
=
{
onSwitchFormat
}
onChange
=
{
(
e
)
=>
onChangeData
({
enable_service_mode
:
e
})
}
onGuard
=
{
(
e
)
=>
patchVerge
({
enable_service_mode
:
e
})
}
>
<
Switch
edge
=
"end"
disabled
=
{
serviceStatus
!==
"
active
"
&&
serviceStatus
!==
"
installed
"
}
/>
</
GuardState
>
</
SettingItem
>
)
}
<
SettingItem
label
=
{
t
(
"
System Proxy
"
)
}
extra
=
{
<
Settings
fontSize
=
"small
"
s
tyle
=
{
{
cursor
:
"
pointer
"
,
opacity
:
0.75
}
}
<
IconButton
color
=
"inherit
"
s
ize
=
"small"
onClick
=
{
()
=>
sysproxyRef
.
current
?.
open
()
}
/>
>
<
Settings
fontSize
=
"inherit"
style
=
{
{
cursor
:
"
pointer
"
,
opacity
:
0.75
}
}
/>
</
IconButton
>
}
>
<
GuardState
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment