Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
actual-vt-capstone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container 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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
danieljk
actual-vt-capstone
Commits
cc1e17b1
Unverified
Commit
cc1e17b1
authored
2 years ago
by
Jed Fox
Browse files
Options
Downloads
Patches
Plain Diff
Auto-add https: protocol, and prompt to add http:// if that doesn’t work
parent
9abe7fa2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/desktop-client/src/components/manager/ConfigServer.js
+24
-3
24 additions, 3 deletions
...ges/desktop-client/src/components/manager/ConfigServer.js
with
24 additions
and
3 deletions
packages/desktop-client/src/components/manager/ConfigServer.js
+
24
−
3
View file @
cc1e17b1
...
@@ -24,10 +24,12 @@ export default function ConfigServer() {
...
@@ -24,10 +24,12 @@ export default function ConfigServer() {
let
[
loading
,
setLoading
]
=
useState
(
false
);
let
[
loading
,
setLoading
]
=
useState
(
false
);
let
[
error
,
setError
]
=
useState
(
null
);
let
[
error
,
setError
]
=
useState
(
null
);
function
getErrorMessage
(
error
)
{
function
getErrorMessage
(
error
,
url
)
{
switch
(
error
)
{
switch
(
error
)
{
case
'
network-failure
'
:
case
'
network-failure
'
:
return
'
Server is not running at this URL
'
;
return
'
Server is not running at this URL
'
;
case
'
add-http
'
:
return
'
Server is not running at this URL. Did you mean to add "http://"?
'
;
default
:
default
:
return
'
Server does not look like an Actual server. Is it set up correctly?
'
;
return
'
Server does not look like an Actual server. Is it set up correctly?
'
;
}
}
...
@@ -41,11 +43,30 @@ export default function ConfigServer() {
...
@@ -41,11 +43,30 @@ export default function ConfigServer() {
setError
(
null
);
setError
(
null
);
setLoading
(
true
);
setLoading
(
true
);
let
{
error
}
=
await
send
(
'
set-server-url
'
,
{
url
});
let
{
error
}
=
await
send
(
'
set-server-url
'
,
{
url
});
setLoading
(
false
);
if
(
error
)
{
if
(
error
===
'
network-failure
'
&&
!
url
.
startsWith
(
'
http://
'
)
&&
!
url
.
startsWith
(
'
https://
'
)
)
{
let
{
error
}
=
await
send
(
'
set-server-url
'
,
{
url
:
'
https://
'
+
url
});
if
(
error
===
'
network-failure
'
)
{
setError
(
'
add-http
'
);
if
(
!
url
.
startsWith
(
'
http://
'
))
{
setUrl
(
'
http://
'
+
url
);
}
}
else
if
(
error
)
{
setError
(
error
);
}
else
{
await
dispatch
(
signOut
());
history
.
push
(
'
/
'
);
}
setLoading
(
false
);
}
else
if
(
error
)
{
setLoading
(
false
);
setError
(
error
);
setError
(
error
);
}
else
{
}
else
{
setLoading
(
false
);
await
dispatch
(
signOut
());
await
dispatch
(
signOut
());
history
.
push
(
'
/
'
);
history
.
push
(
'
/
'
);
}
}
...
...
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