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
e7f7bd8e
Commit
e7f7bd8e
authored
2 years ago
by
alfredo
Browse files
Options
Downloads
Patches
Plain Diff
if only one service, pop up that service
parent
64870a58
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
webserver/public/js/scriptIndex.js
+11
-3
11 additions, 3 deletions
webserver/public/js/scriptIndex.js
with
11 additions
and
3 deletions
webserver/public/js/scriptIndex.js
+
11
−
3
View file @
e7f7bd8e
...
@@ -16,18 +16,22 @@ const userPriviledges = await RequestToDomain.getUserPriviledges(domain);// "adm
...
@@ -16,18 +16,22 @@ const userPriviledges = await RequestToDomain.getUserPriviledges(domain);// "adm
const
boolArray
=
[
false
,
false
,
false
];
const
boolArray
=
[
false
,
false
,
false
];
let
atLeastOneOfOurServices
=
false
;
let
atLeastOneOfOurServices
=
false
;
let
countOurServices
=
0
;
for
(
const
service
of
servicesArray
)
{
for
(
const
service
of
servicesArray
)
{
if
(
service
===
'
antifurto
'
)
{
if
(
service
===
'
antifurto
'
)
{
boolArray
[
0
]
=
true
;
boolArray
[
0
]
=
true
;
atLeastOneOfOurServices
=
true
;
atLeastOneOfOurServices
=
true
;
countOurServices
++
;
}
}
else
if
(
service
===
'
scenari
'
)
{
else
if
(
service
===
'
scenari
'
)
{
boolArray
[
1
]
=
true
;
boolArray
[
1
]
=
true
;
atLeastOneOfOurServices
=
true
;
atLeastOneOfOurServices
=
true
;
countOurServices
++
;
}
}
else
if
(
service
===
'
luci
'
)
{
else
if
(
service
===
'
luci
'
)
{
boolArray
[
2
]
=
true
;
boolArray
[
2
]
=
true
;
atLeastOneOfOurServices
=
true
;
atLeastOneOfOurServices
=
true
;
countOurServices
++
;
}
}
}
}
...
@@ -42,30 +46,34 @@ if (!atLeastOneOfOurServices) {
...
@@ -42,30 +46,34 @@ if (!atLeastOneOfOurServices) {
new
api
.
default
(
boolArray
);
new
api
.
default
(
boolArray
);
const
sensori
=
await
import
(
'
./sensori.js
'
);
const
sensori
=
await
import
(
'
./sensori.js
'
);
new
sensori
.
default
();
new
sensori
.
default
();
let
usedIfOnlyOneService
=
null
;
// launch each class
// launch each class
if
(
boolArray
[
0
]){
if
(
boolArray
[
0
]){
const
antifurto
=
await
import
(
"
./antifurto.js
"
);
const
antifurto
=
await
import
(
"
./antifurto.js
"
);
new
antifurto
.
default
([
boolArray
[
1
],
boolArray
[
2
]]);
new
antifurto
.
default
([
boolArray
[
1
],
boolArray
[
2
]]);
antifurtoBtn
.
classList
.
remove
(
'
invisible
'
);
antifurtoBtn
.
classList
.
remove
(
'
invisible
'
);
usedIfOnlyOneService
=
'
antifurto
'
;
}
}
if
(
boolArray
[
1
]){
if
(
boolArray
[
1
]){
const
scenari
=
await
import
(
"
./scenari.js
"
);
const
scenari
=
await
import
(
"
./scenari.js
"
);
new
scenari
.
default
([
boolArray
[
0
],
boolArray
[
2
]]);
new
scenari
.
default
([
boolArray
[
0
],
boolArray
[
2
]]);
scenariBtn
.
classList
.
remove
(
'
invisible
'
);
scenariBtn
.
classList
.
remove
(
'
invisible
'
);
usedIfOnlyOneService
=
'
scenari
'
;
}
}
if
(
boolArray
[
2
]){
if
(
boolArray
[
2
]){
const
luci
=
await
import
(
'
./luci.js
'
);
const
luci
=
await
import
(
'
./luci.js
'
);
new
luci
.
default
([
boolArray
[
0
],
boolArray
[
1
]]);
new
luci
.
default
([
boolArray
[
0
],
boolArray
[
1
]]);
luciBtn
.
classList
.
remove
(
'
invisible
'
);
luciBtn
.
classList
.
remove
(
'
invisible
'
);
usedIfOnlyOneService
=
'
luci
'
;
}
}
// if there is only one service, click the related button
// if there is only one service, click the related button
// search if there's only one true in the boolArray
// search if there's only one true in the boolArray
if
(
servicesArray
.
length
===
1
)
{
if
(
countOurServices
===
1
)
{
const
btn
=
document
.
getElementById
(
`
${
se
rvicesArray
[
0
]
}
-btn`
);
const
btn
=
document
.
getElementById
(
`
${
u
se
dIfOnlyOneService
}
-btn`
);
btn
.
click
();
btn
.
click
();
// btn.classList.add('invisible');
// btn.classList.add('invisible');
}
}
...
@@ -75,4 +83,4 @@ if (!atLeastOneOfOurServices) {
...
@@ -75,4 +83,4 @@ if (!atLeastOneOfOurServices) {
const
admin
=
await
import
(
'
./adminControls.js
'
);
const
admin
=
await
import
(
'
./adminControls.js
'
);
new
admin
.
default
();
new
admin
.
default
();
}
}
}
}
\ 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