Skip to content

Commit 87f9f3a

Browse files
committed
Merge remote-tracking branch 'origin/main' into feature/177-ghcr_container_publishing
2 parents 901b1f2 + 05050b4 commit 87f9f3a

File tree

5 files changed

+28
-65
lines changed

5 files changed

+28
-65
lines changed

anms-core/anms/components/schemas/ARIs/rpt_entry.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@
2929

3030
# Shared properties
3131
class RptEntryBase(BaseModel):
32-
reference_time: Optional[str] = None
33-
agent_id: Optional[str] = None
34-
correlator_nonce: Optional[str] = None
32+
class Config:
33+
arbitrary_types_allowed = True
34+
35+
ari_rptset_id: Optional[str] = None
36+
reference_time: Optional[datetime] = None
3537
report_list: Optional[str] = None
36-
ari_rptset_id: Optional[int] = None
38+
agent_id: Optional[int] = None
3739

3840

3941
class RptEntryBaseInDBBase(RptEntryBase):

anms-core/anms/routes/ARIs/reports.py

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
# subcontract 1658085.
2323
#
2424
from typing import List
25+
import ast
2526

2627
from fastapi import APIRouter, Depends
2728
from fastapi import status
@@ -83,19 +84,20 @@ async def report_def_by_id(agent_id: int):
8384
agent_id_str = agent_id_str.agent_endpoint_uri
8485
for res in result.all():
8586
# select from exec_set
86-
nonce_cbor = res.nonce_cbor
8787
try:
88+
nonce_cbor = res.nonce_cbor
8889
stmt = select(ExecutionSet).where(and_(ExecutionSet.agent_id == agent_id_str, ExecutionSet.nonce_cbor == nonce_cbor) )
8990
result: Result = await session.scalars(stmt)
9091
exc_set = result.all()
9192
for res in exc_set:
9293
ari_val = ""
9394
if(res):
94-
hex_str = "0x"+res.entries.hex()
95-
hex_str = hex_str.upper()
95+
hex_str = res.entries.hex()
96+
hex_str = "0x"+hex_str.upper()
9697
ari_val = await transcoder.transcoder_put_cbor_await(hex_str)
9798
ari_val = ari_val['data']
98-
addition = {'exec_set': ari_val,'nonce_cbor':nonce_cbor}
99+
logger.info(str(nonce_cbor))
100+
addition = {'exec_set': ari_val,'nonce_cbor':str(nonce_cbor)}
99101
if addition not in final_res:
100102
final_res.append(addition)
101103
except Exception as e:
@@ -107,11 +109,16 @@ async def report_def_by_id(agent_id: int):
107109
# entries tabulated returns header and values in correct order
108110
@router.get("/entries/table/{agent_id}/{nonce_cbor}", status_code=status.HTTP_200_OK,
109111
response_model=list)
110-
async def report_ac(agent_id: int, nonce_cbor: bytes):
111-
final_res = []
112+
async def report_ac(agent_id: int, nonce_cbor: str):
113+
112114
ari = None
113115
dec = ace.ari_cbor.Decoder()
114-
buf = nonce_cbor
116+
enc = ace.ari_text.Encoder()
117+
try:
118+
nonce_cbor = ast.literal_eval(nonce_cbor)
119+
except Exception as e:
120+
logger.error(f"{e} while processing nonce")
121+
return []
115122

116123
agent_id_str =""
117124
agent_id_stmt = select(RegisteredAgent).where(RegisteredAgent.registered_agents_id == agent_id)
@@ -141,13 +148,13 @@ async def report_ac(agent_id: int, nonce_cbor: bytes):
141148
ari = dec.decode(io.BytesIO(in_bytes))
142149

143150
except Exception as err:
144-
logger.info(err)
151+
logger.error(err)
145152

146153
# current ARI should be an exection set
147154
if ari:
148155
if type(ari.value) == ace.ari.ExecutionSet:
149156
try:
150-
enc = ace.ari_text.Encoder()
157+
151158
# run through targets and their parameters to get all things parts translated
152159
for targ in ari.value.targets:
153160
buf = io.StringIO()
@@ -166,7 +173,7 @@ async def report_ac(agent_id: int, nonce_cbor: bytes):
166173
exec_set_dir[out_text_targ] = [exec_set_entry]
167174

168175
except Exception as err:
169-
logger.info(err)
176+
logger.error(err)
170177

171178

172179
# final_res.append(exec_set_entry)
@@ -205,9 +212,7 @@ async def report_ac(agent_id: int, nonce_cbor: bytes):
205212

206213
exec_set_dir[out_text].append(addition)
207214
except Exception as err:
208-
logger.error(err)
209-
210-
215+
logger.error(err)
211216

212217
return list(exec_set_dir.values())
213-
218+

anms-ui/public/app/components/management/agents/reports.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ export default {
5454
this.loading = true;
5555
let nonce_cbor = this.rptts[this.selected].nonce_cbor;
5656
nonce_cbor = nonce_cbor;
57-
// let rpt_adm = this.rptts[this.selected].adm;
58-
await api.methods.apiEntriesForReport(this.registered_agents_id, nonce_cbor)
57+
await api.methods.apiEntriesForReport(this.registered_agents_id,encodeURIComponent(nonce_cbor))
5958
.then(res => {
6059
this.processReport(res.data);
6160
this.reports[this.selected] = this.tableItems;

anms-ui/public/app/components/management/builder/ParameterView.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ export default {
161161
let curr_str= ""
162162
currValue = [];
163163
value.forEach((ari) => {
164-
currValue.push(ari.replaceAll('"', ""));
164+
currValue.push(ari);
165165
});
166166
if(currValue.length = 1 ){
167167
testResult.push(currValue[0])

anms-ui/server/components/reports.js

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@
4646
try {
4747
// /entry/values/{agent_id}/{ADM}/{report_name}
4848
let obj_agent_id = req.params.obj_agent_id
49-
let correlator_nonce = req.params.correlator_nonce
50-
49+
let correlator_nonce = encodeURIComponent(req.params.correlator_nonce)
5150

5251
const url = utils.generateAnmsCoreUrl(['report','entries','table', obj_agent_id, correlator_nonce]);
5352
const name_entries = await axios.get(url);
@@ -56,48 +55,6 @@
5655
return next(Boom.badGateway('Error Getting reports', err));
5756
}
5857
};
59-
60-
// exports.getReportsPaged = async function (req, res, next) {
61-
// try {
62-
// if (req.query.page === undefined) {
63-
// return next(Boom.badData('Invalid page=' + req.query.page));
64-
// }
65-
// if (req.query.size === undefined) {
66-
// return next(Boom.badData('Invalid size=' + req.query.size));
67-
// }
68-
// const params = {'page': req.query.page, 'size': req.query.size };
69-
// const url = utils.generateAnmsCoreUrl(['report','all'], params);
70-
71-
// const transcoderLog = await axios.get(url);
72-
// return res.status(200).json(transcoderLog.data);
73-
// } catch (err) {
74-
// return next(Boom.badGateway('Error Getting Paged Reports', err));
75-
// }
76-
// };
77-
78-
/*
79-
exports.getTranscoderPagedBySearch = async function (req, res, next) {
80-
try {
81-
const transcoderQuery = req.params.query;
82-
if (!_.isString(transcoderQuery)) {
83-
return next(Boom.badData('Invalid Agent Search'));
84-
}
85-
if (req.query.page === undefined) {
86-
return next(Boom.badData('Invalid page=' + req.query.page));
87-
}
88-
if (req.query.size === undefined) {
89-
return next(Boom.badData('Invalid size=' + req.query.size));
90-
}
91-
const params = {'page': req.query.page, 'size': req.query.size };
92-
const url = utils.generateAnmsCoreUrl(['transcoder', 'db', 'search', transcoderQuery], params);
93-
const transcoderLog = await axios.get(url);
94-
return res.status(200).json(transcoderLog.data);
95-
} catch (err) {
96-
return next(Boom.badGateway('Error Getting transcoderLog with search', err));
97-
}
98-
};
99-
*/
100-
10158
})();
10259

10360

0 commit comments

Comments
 (0)