Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
galene
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
galene
Commits
3d857120
Commit
3d857120
authored
Aug 31, 2022
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check for group existence on landing page.
parent
a21134d3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
5 deletions
+63
-5
static/index.html
static/index.html
+3
-1
static/mainpage.css
static/mainpage.css
+6
-0
static/mainpage.js
static/mainpage.js
+54
-4
No files found.
static/index.html
View file @
3d857120
...
@@ -18,8 +18,10 @@
...
@@ -18,8 +18,10 @@
<form
id=
"groupform"
>
<form
id=
"groupform"
>
<label
for=
"group"
>
Group:
</label>
<label
for=
"group"
>
Group:
</label>
<input
id=
"group"
type=
"text"
name=
"group"
class=
"form-control form-control-inline"
/>
<input
id=
"group"
type=
"text"
name=
"group"
class=
"form-control form-control-inline"
/>
<input
type=
"submit"
value=
"Join"
class=
"btn btn-default btn-large"
/><br/>
<input
id=
'submitbutton'
type=
"submit"
value=
"Join"
class=
"btn btn-default btn-large"
/><br/>
</form>
</form>
<p
id=
"errormessage"
></p>
<div
id=
"public-groups"
class=
"groups"
>
<div
id=
"public-groups"
class=
"groups"
>
<h2>
Public groups
</h2>
<h2>
Public groups
</h2>
...
...
static/mainpage.css
View file @
3d857120
...
@@ -4,6 +4,12 @@ body {
...
@@ -4,6 +4,12 @@ body {
flex-direction
:
column
;
flex-direction
:
column
;
}
}
#errormessage
{
color
:
red
;
font-weight
:
bold
;
height
:
12px
;
}
.groups
{
.groups
{
}
}
...
...
static/mainpage.js
View file @
3d857120
...
@@ -20,13 +20,63 @@
...
@@ -20,13 +20,63 @@
'
use strict
'
;
'
use strict
'
;
document
.
getElementById
(
'
groupform
'
).
onsubmit
=
function
(
e
)
{
document
.
getElementById
(
'
groupform
'
).
onsubmit
=
async
function
(
e
)
{
e
.
preventDefault
();
e
.
preventDefault
();
let
group
=
document
.
getElementById
(
'
group
'
).
value
.
trim
();
clearError
();
if
(
group
!==
''
)
let
groupinput
=
document
.
getElementById
(
'
group
'
)
location
.
href
=
'
/group/
'
+
group
+
'
/
'
;
let
button
=
document
.
getElementById
(
'
submitbutton
'
);
let
group
=
groupinput
.
value
.
trim
();
if
(
group
===
''
)
return
;
let
url
=
'
/group/
'
+
group
+
'
/
'
;
try
{
groupinput
.
disabled
=
true
;
button
.
disabled
=
true
;
try
{
let
resp
=
await
fetch
(
url
,
{
method
:
'
HEAD
'
,
});
if
(
!
resp
.
ok
)
{
if
(
resp
.
status
===
404
)
displayError
(
'
No such group
'
);
else
displayError
(
`The server said:
${
resp
.
status
}
${
resp
.
statusText
}
`
);
return
;
}
}
catch
(
e
)
{
displayError
(
`Coudln't connect:
${
e
.
toString
()}
`
);
return
;
}
}
finally
{
groupinput
.
disabled
=
false
;
button
.
disabled
=
false
;
}
location
.
href
=
url
;
};
};
var
clearErrorTimeout
=
null
;
function
displayError
(
message
)
{
clearError
();
let
p
=
document
.
getElementById
(
'
errormessage
'
);
p
.
textContent
=
message
;
clearErrorTimeout
=
setTimeout
(()
=>
{
let
p
=
document
.
getElementById
(
'
errormessage
'
);
p
.
textContent
=
''
;
clearErrorTimeout
=
null
;
},
2500
);
}
function
clearError
()
{
if
(
clearErrorTimeout
!=
null
)
{
clearTimeout
(
clearErrorTimeout
);
clearErrorTimeout
=
null
;
}
}
async
function
listPublicGroups
()
{
async
function
listPublicGroups
()
{
let
div
=
document
.
getElementById
(
'
public-groups
'
);
let
div
=
document
.
getElementById
(
'
public-groups
'
);
let
table
=
document
.
getElementById
(
'
public-groups-table
'
);
let
table
=
document
.
getElementById
(
'
public-groups-table
'
);
...
...
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