Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
Urbanite UI
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
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
URBANITE
Open
Urbanite UI
Commits
ec3eb963
Commit
ec3eb963
authored
Nov 14, 2022
by
Olabarrieta Palacios, Ignacio
Browse files
Options
Downloads
Patches
Plain Diff
adding name checking for maps, traffic and models...
parent
88e2aa51
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/app/pages/tecnalia-module/noise-comp/noise-comp.component.ts
+22
-3
22 additions, 3 deletions
.../pages/tecnalia-module/noise-comp/noise-comp.component.ts
with
22 additions
and
3 deletions
src/app/pages/tecnalia-module/noise-comp/noise-comp.component.ts
+
22
−
3
View file @
ec3eb963
...
...
@@ -59,7 +59,9 @@ export class NoiseCompComponent implements OnInit {
public
formData
:
FormData
;
public
filename
:
String
;
public
trafficFilename
:
String
;
public
map_names
=
[];
public
model_names
=
[];
public
traffic_names
=
[];
ngOnInit
():
void
{
let
pilotName
=
this
.
configService
.
getSettings
(
"
default_pilot
"
);
if
(
pilotName
===
"
BILBAO
"
||
pilotName
===
"
URBANITE
"
)
{
this
.
city
=
"
0
"
;
}
...
...
@@ -186,6 +188,10 @@ export class NoiseCompComponent implements OnInit {
console
.
log
(
'
loadMap::: bbox=
'
+
bbox
);
let
ele
:
HTMLInputElement
=
document
.
getElementById
(
"
newMapName
"
)
as
HTMLInputElement
;
let
name
=
ele
.
value
;
if
(
this
.
map_names
.
includes
(
name
)
){
alert
(
"
Name:
"
+
name
+
"
is already used in the platform.
\n
Please choose different name.
"
);
return
;
}
var
data
=
{};
data
[
"
name
"
]
=
name
;
data
[
"
bbox
"
]
=
bbox
;
...
...
@@ -202,6 +208,7 @@ export class NoiseCompComponent implements OnInit {
console
.
log
(
'
loadNewTraffic::: this.coords=
'
+
this
.
coords
);;
let
ole
:
HTMLInputElement
=
document
.
getElementById
(
"
newTrafficInput
"
)
as
HTMLInputElement
;
let
path
=
ole
.
value
;
console
.
log
(
'
path=
'
+
path
+
"
\t
trafficFilename=
"
+
this
.
trafficFilename
);
//let ele:HTMLInputElement = document.getElementById("newTrafficName") as HTMLInputElement;
//let name = ele.value;
var
data
=
{};
...
...
@@ -224,11 +231,13 @@ export class NoiseCompComponent implements OnInit {
el
.
textContent
=
"
0: do not use
"
;
el
.
value
=
"
0#NONE
"
;
select
.
appendChild
(
el
);
this
.
map_names
=
[];
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
console
.
log
(
"
getMapsFromDB0::: data[
"
+
i
+
"
]=
"
+
JSON
.
stringify
(
data
[
i
]));
var
opt
=
data
[
i
];
var
el
=
document
.
createElement
(
"
option
"
);
el
.
textContent
=
opt
[
"
id
"
]
+
"
:
"
+
opt
[
"
name
"
];
this
.
map_names
.
push
(
opt
[
"
name
"
]);
el
.
value
=
opt
[
"
loc
"
]
+
"
#
"
+
opt
[
"
bbox
"
];
console
.
log
(
"
getMapsFromDB0::: value=
"
+
el
.
value
);
select
.
appendChild
(
el
);
...
...
@@ -250,11 +259,13 @@ export class NoiseCompComponent implements OnInit {
el
.
value
=
"
0#NONE
"
;
console
.
log
(
"
getTrafficFromDB0::: value=
"
+
el
.
value
);
select
.
appendChild
(
el
);
this
.
traffic_names
=
[];
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
console
.
log
(
"
getTrafficFromDB0::: data[
"
+
i
+
"
]=
"
+
JSON
.
stringify
(
data
[
i
]));
var
opt
=
data
[
i
];
var
el
=
document
.
createElement
(
"
option
"
);
el
.
textContent
=
opt
[
"
id
"
]
+
"
:
"
+
opt
[
"
name
"
];
this
.
traffic_names
.
push
(
opt
[
'
name
'
]);
el
.
value
=
opt
[
"
id
"
]
+
"
#
"
+
opt
[
"
name
"
];
console
.
log
(
"
getTrafficFromDB0::: value=
"
+
el
.
value
);
select
.
appendChild
(
el
);
...
...
@@ -265,7 +276,7 @@ export class NoiseCompComponent implements OnInit {
getModelsFromDB0
(
data
,
ttype
){
//
console.log('getModelsFromDB0='+JSON.stringify(data));
console
.
log
(
'
getModelsFromDB0=
'
+
JSON
.
stringify
(
data
));
let
selectElement
=
document
.
getElementById
(
'
comps_combo
'
)
as
HTMLSelectElement
;
selectElement
.
innerText
=
null
;
this
.
pnts
=
[];
...
...
@@ -279,8 +290,10 @@ export class NoiseCompComponent implements OnInit {
this
.
vals8000
=
[];
this
.
valsleq
=
[];
this
.
valslaeq
=
[];
this
.
model_names
=
[];
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
var
opt
=
data
[
i
];
this
.
model_names
.
push
(
opt
[
'
name
'
]);
this
.
insertRow
(
opt
[
'
name
'
],
opt
[
'
status
'
],
opt
[
'
mapa
'
],
opt
[
'
traffic
'
]);
if
(
opt
[
"
gpss
"
]
!=
null
){
console
.
log
(
"
getModelsFromDB::: i=
"
+
i
+
"
\t
size=
"
+
opt
[
"
gpss
"
].
length
);
...
...
@@ -307,7 +320,7 @@ export class NoiseCompComponent implements OnInit {
insertRow
(
name
,
status
,
mapa
,
traffic
){
let
selectElement
=
document
.
getElementById
(
'
comps_combo
'
)
as
HTMLSelectElement
;
var
el
=
document
.
createElement
(
"
option
"
);
el
.
textContent
=
name
+
"
:
map=
"
+
mapa
.
replace
(
"
.osm
"
,
""
)
+
"
\t\t
[
"
+
status
+
"
]
"
;
el
.
textContent
=
name
+
"
:
<<
"
+
mapa
.
replace
(
"
.osm
"
,
""
)
+
"
,
"
+
traffic
+
"
>>
[
"
+
status
+
"
]
"
;
el
.
value
=
name
;
console
.
log
(
"
getMapsFromDB0::: value=
"
+
el
.
value
);
selectElement
.
appendChild
(
el
);
...
...
@@ -503,6 +516,9 @@ export class NoiseCompComponent implements OnInit {
create_model
(){
let
inputName
=
document
.
getElementById
(
'
nameID
'
)
as
HTMLInputElement
;
let
name
=
inputName
.
value
;
if
(
this
.
model_names
.
includes
(
name
)
){
alert
(
"
Name:
"
+
name
+
"
is already used in the platform.
\n
Please choose different name.
"
)
}
let
ele1
=
document
.
getElementById
(
'
map_combo
'
)
as
HTMLSelectElement
;
let
map
=
ele1
.
options
[
ele1
.
selectedIndex
].
value
.
split
(
'
#
'
)[
0
];
let
ele2
=
document
.
getElementById
(
'
traffic_combo
'
)
as
HTMLSelectElement
;
...
...
@@ -559,6 +575,9 @@ export class NoiseCompComponent implements OnInit {
const
file
:
File
=
event
.
target
.
files
[
0
];
this
.
trafficFilename
=
file
.
name
;
console
.
log
(
'
selectFile::: file=
'
+
file
.
name
);
if
(
this
.
traffic_names
.
includes
(
file
.
name
)
){
alert
(
file
.
name
+
"
is already uploaded to the platform.
\n
Please choose different file.
"
);
}
if
(
file
)
{
this
.
formData
=
new
FormData
();
this
.
formData
.
append
(
"
thumbnail
"
,
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