Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
df-aggregator
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Oleksandr Barabash
df-aggregator
Commits
afacb3cd
Commit
afacb3cd
authored
Nov 23, 2020
by
UsakoSenpai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add descriptive comments to JS code.
parent
e6ceb796
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
receiver_configurator.js
static/receiver_configurator.js
+28
-0
No files found.
static/receiver_configurator.js
View file @
afacb3cd
// *************************************************
// * Gets Rx data from backend
// *************************************************
function
updateRx
(
callBack
,
id
)
{
function
updateRx
(
callBack
,
id
)
{
fetch
(
"/rx_params"
)
fetch
(
"/rx_params"
)
.
then
(
data
=>
{
return
data
.
json
()})
.
then
(
data
=>
{
return
data
.
json
()})
.
then
(
res
=>
{
callBack
(
res
,
id
)})
.
then
(
res
=>
{
callBack
(
res
,
id
)})
}
}
// ******************************************************
// * Makes Changes to Receiver, Saves, & Refreshes Cards
// ******************************************************
function
editReceivers
(
rx_json
,
id
)
{
function
editReceivers
(
rx_json
,
id
)
{
const
receivers
=
rx_json
[
'receivers'
];
const
receivers
=
rx_json
[
'receivers'
];
var
stationUrlHtml
=
var
stationUrlHtml
=
...
@@ -92,6 +98,9 @@ function editReceivers(rx_json, id) {
...
@@ -92,6 +98,9 @@ function editReceivers(rx_json, id) {
}
}
}
}
// ****************************************************
// * Sends Rx station URL to backend and refreshes map
// ****************************************************
function
makeNewRx
(
url
)
{
function
makeNewRx
(
url
)
{
const
new_rx
=
{
"station_url"
:
url
};
const
new_rx
=
{
"station_url"
:
url
};
// console.log(new_rx);
// console.log(new_rx);
...
@@ -112,11 +121,17 @@ function makeNewRx(url) {
...
@@ -112,11 +121,17 @@ function makeNewRx(url) {
// loadCzml();
// loadCzml();
}
}
// *****************************************
// * Removes the Rx UI Card
// *****************************************
function
removerx
(
uid
)
{
function
removerx
(
uid
)
{
const
rxcard
=
document
.
getElementById
(
"rx-"
+
uid
);
const
rxcard
=
document
.
getElementById
(
"rx-"
+
uid
);
rxcard
.
remove
();
rxcard
.
remove
();
}
}
// *******************************************
// * Removes Rx from Backend and Reloads Map
// *******************************************
function
deleteReceiver
(
uid
)
{
function
deleteReceiver
(
uid
)
{
const
del_rx
=
{
"uid"
:
uid
};
const
del_rx
=
{
"uid"
:
uid
};
// console.log(new_rx);
// console.log(new_rx);
...
@@ -137,6 +152,9 @@ function deleteReceiver(uid) {
...
@@ -137,6 +152,9 @@ function deleteReceiver(uid) {
// loadCzml();
// loadCzml();
}
}
// *******************************************
// * Fills in Rx UI cards with Rx info
// *******************************************
function
showReceivers
(
rx_json
,
id
)
{
function
showReceivers
(
rx_json
,
id
)
{
const
receivers
=
rx_json
[
'receivers'
];
const
receivers
=
rx_json
[
'receivers'
];
...
@@ -177,6 +195,10 @@ function showReceivers(rx_json, id) {
...
@@ -177,6 +195,10 @@ function showReceivers(rx_json, id) {
}
}
// ****************************************************
// * Creates cards on UI for Receiver information.
// * Iterates through Rx objects on page load/Rx add.
// ****************************************************
function
createReceivers
(
rx_json
,
id
)
{
function
createReceivers
(
rx_json
,
id
)
{
var
receivers
var
receivers
if
(
id
==
true
)
{
if
(
id
==
true
)
{
...
@@ -246,6 +268,9 @@ function createReceivers(rx_json, id) {
...
@@ -246,6 +268,9 @@ function createReceivers(rx_json, id) {
}
}
}
}
// ****************************************************
// * Refreshes info on Rx UI Cards (Refresh button)
// ****************************************************
function
refreshRx
(
rx_json
,
id
)
{
function
refreshRx
(
rx_json
,
id
)
{
const
receivers
=
rx_json
[
'receivers'
];
const
receivers
=
rx_json
[
'receivers'
];
for
(
let
i
=
0
;
i
<
Object
.
keys
(
receivers
).
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
Object
.
keys
(
receivers
).
length
;
i
++
)
{
...
@@ -253,6 +278,9 @@ function refreshRx(rx_json, id) {
...
@@ -253,6 +278,9 @@ function refreshRx(rx_json, id) {
}
}
}
}
// ****************************************************
// * Main function - Loads all Receivers
// ****************************************************
function
loadRx
(
action
)
{
function
loadRx
(
action
)
{
updateRx
(
action
,
null
);
updateRx
(
action
,
null
);
}
}
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