Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pissirSmartHome
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
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alfredo Chissotti
pissirSmartHome
Commits
4ac7943a
Commit
4ac7943a
authored
2 years ago
by
Alfredo Chissotti
Browse files
Options
Downloads
Patches
Plain Diff
pagina sensori
parent
a566f2b9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
webapp/.gitignore
+1
-0
1 addition, 0 deletions
webapp/.gitignore
webapp/index.html
+71
-22
71 additions, 22 deletions
webapp/index.html
webapp/js/scenari.js
+320
-136
320 additions, 136 deletions
webapp/js/scenari.js
webapp/js/toggles.js
+38
-1
38 additions, 1 deletion
webapp/js/toggles.js
with
430 additions
and
159 deletions
webapp/.gitignore
0 → 100644
+
1
−
0
View file @
4ac7943a
/testButtons
This diff is collapsed.
Click to expand it.
webapp/index.html
+
71
−
22
View file @
4ac7943a
...
...
@@ -112,20 +112,25 @@
</table>
<!-- <button type="button" class="btn btn-dark" data-bs-toggle="modal" data-bs-target="#scenari-modal"> -->
<div
class=
"d-flex justify-content-around"
>
<span></span>
<button
id=
"scenari-registra"
type=
"button"
class=
"btn btn-info"
data-bs-toggle=
"modal"
data-bs-target=
"#scenari-modal"
>
registra
<!-- FIXME -->
<span>
<span
id=
"termina-registrazione-launcher"
data-bs-toggle=
"modal"
data-bs-target=
"#termina-registrazione-modal"
>
<span
id=
"registra-modal-launcer"
data-bs-toggle=
"modal"
data-bs-target=
"#scenari-modal"
></span>
</span>
<!-- centered button -->
<button
id=
"scenari-registra"
type=
"button"
class=
"btn btn-info"
>
Registra
</button>
<!-- set to the right -->
<div>
<span>
Antifurto:
</span>
<!-- change btn-danger to btn-success when ON -->
<button
type=
"button"
class=
"btn btn-danger"
id=
"scenari-stato-antifurto"
data-bs-toggle=
"modal"
data-bs-target=
"#antifurto-modal"
>
<button
type=
"button"
class=
"btn btn-danger"
id=
"scenari-stato-antifurto"
>
OFF
</button>
<span
id=
"lancia-antifurto-modal"
data-bs-toggle=
"modal"
data-bs-target=
"#antifurto-modal"
></span>
</div>
</div>
</div>
...
...
@@ -174,9 +179,9 @@
<div
id=
"nuovaStanzaHelp"
class=
"form-text"
>
Inserisci il nome della nuova stanza.
</div>
</div>
</div>
<div
class=
"modal-footer"
>
<button
type=
"button"
class=
"btn btn-secondary"
data-bs-dismiss=
"modal"
>
Cancel
</button>
<button
type=
"submit"
class=
"btn btn-primary"
>
Add
</button>
<div
class=
"modal-footer
justify-content-around
"
>
<button
type=
"button"
class=
"btn btn-secondary
w-25
"
data-bs-dismiss=
"modal"
>
Cancel
</button>
<button
type=
"submit"
class=
"btn btn-primary
w-25
"
>
Add
</button>
</div>
</form>
</div>
...
...
@@ -187,25 +192,52 @@
<div
class=
"modal-dialog modal-dialog-centered"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
>
<h
5
class=
"modal-title"
>
Nuovo scenario
</h
5
>
<h
3
class=
"modal-title"
>
Avviso:
</h
3
>
<button
type=
"button"
class=
"btn-close"
data-bs-dismiss=
"modal"
aria-label=
"Close"
></button>
</div>
<div
class=
"modal-body"
>
<p>
Modal body text goes here.
</p>
<p>
Stai per attivare la registrazione dei comandi.
</p>
<p>
Dal momento in cui premerai sul bottone azzurro, inizierai a registrare tutte le interazioni con
le tue luci.
</p>
<p>
Inoltre disabiliterai eventuali scenari attivi.
</p>
<p>
Una volta che sarai soddisfatto del risultato, torna su questa pagina per terminare la
registrazione.
</p>
<p>
Iniziare la registrazione?
</p>
</div>
<div
class=
"modal-footer"
>
<button
type=
"button"
class=
"btn btn-
secondary
"
data-bs-dismiss=
"modal"
>
Close
</button>
<button
type=
"button"
class=
"btn btn-
primary"
>
Save changes
</button>
<div
class=
"modal-footer
justify-content-around
"
>
<button
type=
"button"
class=
"btn btn-
danger w-25
"
data-bs-dismiss=
"modal"
>
Annulla
</button>
<button
type=
"button"
class=
"btn btn-
info w-25"
>
Registra
</button>
</div>
</div>
</div>
</div>
<div
class=
"modal fade"
id=
"termina-registrazione-modal"
tabindex=
"-1"
aria-hidden=
"true"
>
<div
class=
"modal-dialog modal-dialog-centered"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
>
<h5
class=
"modal-title"
>
Registrazione dello scenario
</h5>
<button
type=
"button"
class=
"btn-close"
data-bs-dismiss=
"modal"
aria-label=
"Close"
></button>
</div>
<form
method=
"POST"
id=
"termina-registrazione-form"
>
<div
class=
"modal-body"
>
<label
for=
"nome-nuovo-scenario"
class=
"form-label"
>
Nome
</label>
<input
type=
"text"
class=
"form-control"
id=
"nome-nuovo-scenario"
placeholder=
"Nome della registrazione"
required
>
</div>
<div
class=
"modal-footer justify-content-around"
>
<button
type=
"button"
class=
"btn btn-danger w-25"
data-bs-dismiss=
"modal"
>
Annulla
</button>
<button
type=
"submit"
class=
"btn btn-success w-25"
>
Conferma
</button>
</div>
</form>
</div>
</div>
</div>
<div
class=
"modal fade"
id=
"attiva-scenari-modal"
tabindex=
"-1"
aria-hidden=
"true"
>
<div
class=
"modal-dialog modal-dialog-centered"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
>
<h5
class=
"modal-title"
>
Attenzione!
</h5>
<!--
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
-->
<button
type=
"button"
class=
"btn-close"
data-bs-dismiss=
"modal"
aria-label=
"Close"
></button>
</div>
<div
class=
"modal-body"
>
<p>
Attivando questo scenario, abiliterai l'antifurto.
</p>
...
...
@@ -217,12 +249,29 @@
<p
class=
"more-margin-top"
>
Inoltre disabiliterai gli altri scenari attivi.
</p>
<p>
Continuare l'attivazione?
</p>
</div>
<form
method=
"POST"
id=
"attiva-scenari-form"
>
<div
class=
"modal-footer justify-content-around"
>
<button
type=
"button"
class=
"btn btn-danger w-25"
data-bs-dismiss=
"modal"
>
Cancella
</button>
<button
type=
"submit"
class=
"btn btn-success w-25"
>
Attiva
</button>
</div>
</form>
<div
class=
"modal-footer justify-content-around"
>
<button
type=
"button"
class=
"btn btn-danger w-25"
data-bs-dismiss=
"modal"
>
Cancella
</button>
<button
type=
"button"
class=
"btn btn-success w-25"
id=
"attiva-scenari-btn"
>
Attiva
</button>
</div>
</div>
</div>
</div>
<!-- anteprima scenario -->
<span
class=
"invisible"
data-bs-toggle=
"modal"
data-bs-target=
"#anteprima-modal"
id=
"anteprima-modal-launcher"
></span>
<div
class=
"modal fade"
id=
"anteprima-modal"
tabindex=
"-1"
aria-hidden=
"true"
>
<div
class=
"modal-dialog modal-dialog-centered"
>
<div
class=
"modal-content"
>
<!-- <div class="modal-header">
<h5 class="modal-title">Anteprima</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div> -->
<div
class=
"modal-body"
>
Interno del body
</div>
<div
class=
"modal-footer justify-content-around"
>
<button
type=
"button"
class=
"btn btn-danger w-25"
data-bs-dismiss=
"modal"
>
Cancella
</button>
<button
type=
"button"
class=
"btn btn-success w-25"
id=
"anteprima-scenari-btn"
>
Attiva
</button>
</div>
</div>
</div>
</div>
...
...
@@ -240,7 +289,7 @@
</div>
<div
class=
"modal-footer justify-content-around"
>
<button
type=
"button"
class=
"btn btn-danger w-25"
data-bs-dismiss=
"modal"
>
Cancella
</button>
<button
type=
"button"
class=
"btn btn-success w-25"
>
Attiva
</button>
<button
type=
"button"
class=
"btn btn-success w-25"
id=
"attiva-antifurto-btn"
>
Attiva
</button>
</div>
</div>
</div>
...
...
This diff is collapsed.
Click to expand it.
webapp/js/scenari.js
+
320
−
136
View file @
4ac7943a
This diff is collapsed.
Click to expand it.
webapp/js/toggles.js
+
38
−
1
View file @
4ac7943a
"
use strict
"
;
import
Scenari
from
'
./scenari.js
'
;
function
setToggleMovement
()
{
const
toggles
=
document
.
querySelectorAll
(
'
.toggle-button
'
);
...
...
@@ -14,4 +15,40 @@ function setToggleMovement2(toggle) {
},
false
);
}
export
{
setToggleMovement
,
setToggleMovement2
};
\ No newline at end of file
function
scenariToggleListener
(
toggle
,
name
)
{
toggle
.
addEventListener
(
'
click
'
,
event
=>
{
event
.
preventDefault
// select the option from the dropdown
Scenari
.
addNameHere
.
value
=
name
;
// change text of the modal based on toggle state
const
modalBody
=
document
.
getElementById
(
'
attiva-scenari-modal
'
).
querySelector
(
'
.modal-body
'
);
const
children
=
modalBody
.
children
;
//p, fieldset, p.more-margin-top, p
//0, 1, 2, 3
const
okBtn
=
document
.
getElementById
(
'
attiva-scenari-btn
'
)
if
(
toggle
.
classList
.
contains
(
'
active
'
))
{
children
[
0
].
innerText
=
"
Disabilitando questo scenario, disabiliterai l'antifurto.
"
;
children
[
2
].
innerText
=
"
Disabilitare lo scenario?
"
;
children
[
3
].
classList
.
add
(
'
invisible
'
)
okBtn
.
innerText
=
"
Disabilita
"
;
}
else
{
children
[
0
].
innerText
=
"
Attivando questo scenario, abiliterai l'antifurto.
"
;
if
(
Scenari
.
scenarioAttivoToggle
!=
null
)
{
children
[
2
].
innerText
=
"
Inoltre disabiliterai gli altri scenari attivi.
"
;
children
[
3
].
classList
.
remove
(
'
invisible
'
)
}
else
{
children
[
2
].
innerText
=
"
Continuare l'attivazione?
"
;
children
[
3
].
classList
.
add
(
'
invisible
'
)
}
okBtn
.
innerText
=
"
Attiva
"
;
}
// launch the modal
const
modalLauncher
=
document
.
getElementById
(
'
launch-modal-
'
+
name
);
modalLauncher
.
click
();
},
false
);
}
export
{
setToggleMovement
,
setToggleMovement2
,
scenariToggleListener
};
\ No newline at end of file
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