Skip to content

Commit e66f1ba

Browse files
committed
Update Entity display to Normalised/Simplified
1 parent 5bce260 commit e66f1ba

File tree

13 files changed

+25
-23
lines changed

13 files changed

+25
-23
lines changed

app/app.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ app.use(express.urlencoded({ extended: false }));
5151
app.use(cookieParser());
5252
app.use(flash());
5353

54+
console.log(sessionOff)
55+
5456
if (process.env.NODE_ENV === 'production' && !sessionOff) {
5557
// Use Mongo-DB to store session data.
5658
app.use(

app/controllers/ngsi-ld/animal.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ async function getAnimals(req, res) {
1515
const animals = await ngsiLD.listEntities(
1616
{
1717
type: 'Animal',
18-
options: 'concise',
18+
format: 'normalized',
1919
limit: ENTITY_LIMIT
2020
},
2121
headers
@@ -51,7 +51,7 @@ async function displayAnimal(req, res) {
5151
monitor('NGSI', 'readEntity ' + req.params.id);
5252
const animal = await ngsiLD.readEntity(
5353
req.params.id,
54-
{ options: 'concise' },
54+
{ format: 'normalized' },
5555
ngsiLD.setHeaders(req.session.access_token, LinkHeader)
5656
);
5757

@@ -60,7 +60,7 @@ async function displayAnimal(req, res) {
6060
if (imgId < 100) {
6161
imgId = `00${imgId % 10}`;
6262
}
63-
return res.render('animal', { title: animal.name, animal, imgId });
63+
return res.render('animal', { title: animal.name.value, animal, imgId });
6464
} catch (error) {
6565
// If no animal has been found, display an error screen
6666
return res.render('error', {

app/routes/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ router.get('/', async function (req, res) {
6868
const buildings = await ngsiLD.listEntities(
6969
{
7070
type: 'Building',
71-
options: 'concise',
71+
format: 'keyValues',
7272
attrs: 'name',
7373
limit: ENTITY_LIMIT
7474
},
@@ -78,7 +78,7 @@ router.get('/', async function (req, res) {
7878
const animals = await ngsiLD.listEntities(
7979
{
8080
type: 'Animal',
81-
options: 'concise',
81+
format: 'keyValues',
8282
attrs: 'name,species',
8383
limit: ENTITY_LIMIT
8484
},
@@ -88,7 +88,7 @@ router.get('/', async function (req, res) {
8888
const parcels = await ngsiLD.listEntities(
8989
{
9090
type: 'AgriParcel',
91-
options: 'concise',
91+
format: 'keyValues',
9292
attrs: 'name',
9393
limit: ENTITY_LIMIT
9494
},
@@ -99,7 +99,7 @@ router.get('/', async function (req, res) {
9999
const devices = await ngsiLD.listEntities(
100100
{
101101
type: 'Device',
102-
options: 'concise',
102+
format: 'keyValues',
103103
attrs: 'name',
104104
limit: ENTITY_LIMIT
105105
},

app/views/agri-device.pug

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ block content
8181
div.col
8282
div(class="card m-2")
8383
div.card-body
84-
summary.list-unstyled Entity
84+
summary.list-unstyled Entity (simplified)
8585
details
8686
pre #{JSON.stringify(device, null, 4)}
8787

app/views/agri-farm.pug

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,6 @@ block content
9898
div.col
9999
div(class="card m-2")
100100
div.card-body
101-
summary.list-unstyled
101+
summary.list-unstyled Entity (simplified)
102102
details
103103
pre #{JSON.stringify(farm, null, 4)}

app/views/animal.pug

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ extends layout
22

33
block content
44
h1
5-
| #{animal.name} -
5+
| #{animal.name.value} -
66
- if (animal.id)
77
small
88
code(style="text-transform:initial")
@@ -22,11 +22,11 @@ block content
2222
dl.row
2323
- if (animal.species)
2424
dt.col-lg-3 Species:
25-
dd.col-lg-9 #{animal.species}
26-
- if (animal.legalId||animal.legalID)
25+
dd.col-lg-9 #{animal.species.value}
26+
- if (animal.legalId||animal.legalID.value)
2727
dt.col-lg-3 Legal ID:
2828
dd.col-lg-9
29-
code #{animal.legalId||animal.legalID}
29+
code #{animal.legalId.value||animal.legalID.value}
3030
- if (animal.phenologicalCondition)
3131
dt.col-lg-3 Phenological
3232
br
@@ -44,10 +44,10 @@ block content
4444
dt.col-lg-3 Sex:
4545
dd.col-lg-3 #{animal.sex.vocab||animal.sex}
4646
dt.col-lg-3 Date of Birth:
47-
dd.col-lg-3 #{animal.birthdate ? animal.birthdate.substring(0,10) : 'unknown'}
47+
dd.col-lg-3 #{animal.birthdate ? animal.birthdate.value.substring(0,10) : 'unknown'}
4848
- if (animal.fedWith)
4949
dt.col-lg-3 Fed With:
50-
dd.col-lg-3 #{animal.fedWith}
50+
dd.col-lg-3 #{animal.fedWith.value}
5151
- if (animal.weight)
5252
dt.col-lg-3 Weight
5353
dd.col-lg-3
@@ -114,7 +114,7 @@ block content
114114
div.col
115115
div(class="card m-2")
116116
div.card-body
117-
summary.list-unstyled
117+
summary.list-unstyled Entity (normalised)
118118
details
119119
pre
120120
code #{JSON.stringify(animal, null, 4)}

app/views/building.pug

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ block content
5151
div.col
5252
div(class="card m-2")
5353
div.card-body
54-
summary.list-unstyled
54+
summary.list-unstyled Entity (simplified)
5555
details
5656
pre #{JSON.stringify(building, null, 4)}
5757
div.row

app/views/crop.pug

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ block content
3737
div.col
3838
div(class="card m-2")
3939
div.card-body
40-
summary.list-unstyled
40+
summary.list-unstyled Entity (simplified)
4141
details
4242
pre #{JSON.stringify(crop, null, 4)}

app/views/land.pug

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,6 @@ block content
5858
div.col
5959
div(class="card m-2")
6060
div.card-body
61-
summary.list-unstyled
61+
summary.list-unstyled Entity (simplified)
6262
details
6363
pre #{JSON.stringify(land, null, 4)}

app/views/person.pug

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ block content
1818
div.col
1919
div(class="card m-2")
2020
div.card-body
21-
summary.list-unstyled
21+
summary.list-unstyled Entity (simplified)
2222
details
2323
pre #{JSON.stringify(person, null, 4)}

0 commit comments

Comments
 (0)