Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
BBB Dashboard
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Jonas Zohren
BBB Dashboard
Commits
63b7b5a8
Commit
63b7b5a8
authored
4 years ago
by
Jonas Zohren
Browse files
Options
Downloads
Patches
Plain Diff
Add form input checks for attach and broadcast
parent
35d75f83
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
client/src/components/AttachRoomPanel.svelte
+28
-8
28 additions, 8 deletions
client/src/components/AttachRoomPanel.svelte
client/src/components/ChatBroadcastPanel.svelte
+3
-2
3 additions, 2 deletions
client/src/components/ChatBroadcastPanel.svelte
with
31 additions
and
10 deletions
client/src/components/AttachRoomPanel.svelte
+
28
−
8
View file @
63b7b5a8
...
@@ -4,16 +4,36 @@
...
@@ -4,16 +4,36 @@
import
{
API_BASE_URL
}
from
'
../stores.js
'
;
import
{
API_BASE_URL
}
from
'
../stores.js
'
;
export
let
roomUrl
=
""
;
export
let
roomUrl
=
""
;
$
:
trimmedUrlInput
=
roomUrl
.
trim
();
$
:
isValidBBBUrl
=
trimmedUrlInput
.
length
>
0
&&
isValidUrl
(
trimmedUrlInput
);
let
createRoomRequestInProgress
=
false
;
function
isValidUrl
(
inputString
)
{
try
{
const
_
=
new
URL
(
inputString
);
return
true
;
}
catch
(
error
)
{
return
(
error
instanceof
TypeError
)
?
false
:
error
;
}
}
async
function
requestAttachToRoom
()
{
async
function
requestAttachToRoom
()
{
await
fetch
(
API_BASE_URL
+
'
/attach
'
,
{
createRoomRequestInProgress
=
true
;
method
:
'
POST
'
,
try
{
headers
:
{
await
fetch
(
API_BASE_URL
+
'
/attach
'
,
{
'
Content-Type
'
:
'
application/json
'
method
:
'
POST
'
,
},
headers
:
{
body
:
JSON
.
stringify
({
url
:
roomUrl
})
'
Content-Type
'
:
'
application/json
'
})
},
body
:
JSON
.
stringify
({
url
:
trimmedUrlInput
})
})
}
catch
(
error
)
{
console
.
error
(
"
Could not send request to attach to room
"
,
trimmedUrlInput
);
console
.
error
(
error
);
}
roomUrl
=
''
;
roomUrl
=
''
;
createRoomRequestInProgress
=
false
;
}
}
</script>
</script>
...
@@ -28,7 +48,7 @@
...
@@ -28,7 +48,7 @@
<br
/>
<br
/>
</div>
</div>
<div
class=
"panel-block"
>
<div
class=
"panel-block"
>
<button
class=
"button is-success is-outlined is-fullwidth"
on:click=
{
requestAttachToRoom
}
>
<button
type=
"submit"
class:is-loading=
{
createRoomRequestInProgress
}
class=
"button is-success is-outlined is-fullwidth"
disabled=
{
!
isValidBBBUrl
}
on:click=
{
requestAttachToRoom
}
>
Attach
Attach
</button>
</button>
</div>
</div>
...
...
This diff is collapsed.
Click to expand it.
client/src/components/ChatBroadcastPanel.svelte
+
3
−
2
View file @
63b7b5a8
<script>
<script>
import
{
API_BASE_URL
}
from
'
../stores.js
'
;
import
{
API_BASE_URL
}
from
'
../stores.js
'
;
let
content
=
""
;
let
content
=
""
;
$
:
hasContent
=
content
.
trim
().
length
!==
0
;
async
function
sendBroadcast
()
{
async
function
sendBroadcast
()
{
try
{
try
{
...
@@ -34,8 +35,8 @@
...
@@ -34,8 +35,8 @@
<br
/>
<br
/>
</div>
</div>
<div
class=
"panel-block"
>
<div
class=
"panel-block"
>
<button
class=
"button is-link is-outlined is-fullwidth"
on:click=
{
sendBroadcast
}
>
<button
type=
"submit"
class=
"button is-link is-outlined is-fullwidth"
disabled=
{
!
hasContent
}
on:click=
{
sendBroadcast
}
>
Send to
all
attached rooms
Send to attached rooms
</button>
</button>
</div>
</div>
</nav>
</nav>
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