From 8ed60a3f80484b2e2ad0dfb35cb980eaf5ace0e2 Mon Sep 17 00:00:00 2001 From: David Linko Date: Mon, 29 Jul 2024 13:04:40 -0400 Subject: [PATCH 1/5] updated ion to fix TV (#101) * updated ion to fix TV * adding back namespace_id to obj_view --------- Co-authored-by: linkodm1 --- ion/src | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ion/src b/ion/src index 21f1450..6e95a2e 160000 --- a/ion/src +++ b/ion/src @@ -1 +1 @@ -Subproject commit 21f145056dc1d55e319cb142e4c361d3d2e11b6b +Subproject commit 6e95a2e7fd6975cd8d859627cee73323857ac161 From 92295e2ee541b7fc424d06af95497d436b0f0f7f Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 7 Aug 2024 10:42:13 -0600 Subject: [PATCH 2/5] Resolve #95: Fixed footer formatting when content expands beyond viewport (#102) * #95: Fixed footer formatting when content expands beyond viewport * #95 Updated amp documentation link to open new tab --- .../components/management/agents/Agents.vue | 73 +++++++++++-------- 1 file changed, 41 insertions(+), 32 deletions(-) diff --git a/anms-ui/public/app/components/management/agents/Agents.vue b/anms-ui/public/app/components/management/agents/Agents.vue index c25c88c..fd9a242 100644 --- a/anms-ui/public/app/components/management/agents/Agents.vue +++ b/anms-ui/public/app/components/management/agents/Agents.vue @@ -48,34 +48,41 @@ -
-
- Items per Page: - -
- - -
+ + + + + + Add + + + + +
+
+ Items per Page: + +
+ + +
+
+
- - -

Agent address is: {{ node }}

- + :agents="selectedAgents" + :cbor="cbor"> @@ -135,10 +143,10 @@ export default { selectAll: false, }; }, - props:{ + props: { cbor: { - type:String, - default:undefined + type: String, + default: undefined } }, mounted() { @@ -231,8 +239,9 @@ export default { .table-hover tbody tr:hover { cursor: pointer; } + .footer { - position: absolute; + position: fixed; bottom: 0; } From 80bf11e413f0022ceebc5306d808415f538243ca Mon Sep 17 00:00:00 2001 From: David Linko Date: Thu, 15 Aug 2024 10:01:36 -0400 Subject: [PATCH 3/5] 113 anms fun bld 002 generate reports report displays (#120) * adding multiprocessing * updated table display and processing * uncommented code --------- Co-authored-by: linkodm1 --- anms-core/anms/routes/ARIs/reports.py | 87 +++++++++++-------- .../components/management/agents/reports.vue | 24 +++-- 2 files changed, 65 insertions(+), 46 deletions(-) diff --git a/anms-core/anms/routes/ARIs/reports.py b/anms-core/anms/routes/ARIs/reports.py index 3077093..74eb281 100644 --- a/anms-core/anms/routes/ARIs/reports.py +++ b/anms-core/anms/routes/ARIs/reports.py @@ -31,6 +31,8 @@ from sqlalchemy.engine import Result import re from datetime import datetime +import multiprocessing as mp +import asyncio from anms.components.schemas import ARIs from anms.models.relational import get_async_session, get_session @@ -102,6 +104,37 @@ async def find_var_type(obj_metadata): return data_type_id +async def _process_report_entries(x): + entry, ac_types_and_id = x + # for entry in entries: + curr_values = [] + time = datetime.fromtimestamp(int(entry.time)).strftime('%Y-%m-%d %H:%M:%S') + + string_values = list(filter(None, re.split(r",|'(.*?)'", entry.string_values))) if entry.string_values else [] + uint_values = entry.uint_values.split(',') if entry.uint_values else [] + int_values = entry.int_values.split(',') if entry.int_values else [] + real32_values = entry.real32_values.split(',') if entry.real32_values else [] + real64_values = entry.real64_values.split(',') if entry.real64_values else [] + uvast_values = entry.uvast_values.split(',') if entry.uvast_values else [] + vast_values = entry.vast_values.split(',') if entry.vast_values else [] + value_matchup = {18: string_values, 19: int_values, 20: uint_values, 21: vast_values, 22: uvast_values, + 23: real32_values, 24: real64_values} + curr_values.append(time) + for type_id, obj_id in ac_types_and_id: + # find the type of ari + curr_type = type_id + if value_matchup[curr_type]: + curr_values.append(value_matchup[curr_type].pop(0)) + if not ac_types_and_id: + if string_values: curr_values.append(','.join(string_values)) + if uint_values: curr_values.append(','.join(uint_values)) + if int_values: curr_values.append(','.join(int_values)) + if real32_values: curr_values.append(','.join(real32_values)) + if real64_values: curr_values.append(','.join(real64_values)) + if uvast_values: curr_values.append(','.join(uvast_values)) + if vast_values: curr_values.append(','.join(vast_values)) + return curr_values + # entries tabulated returns header and values in correct order @router.get("/entries/table/{agent_id}/{adm}/{report_name}", status_code=status.HTTP_200_OK, @@ -147,52 +180,30 @@ async def report_ac(agent_id: str, adm: str, report_name: str): curr_name = result.one_or_none() ac_names.append(curr_name) - ac_types_and_id.append((entry.data_type_id, entry.obj_metadata_id)) - # unknown template - if ac_names == []: - ac_names = ["time","string_values", "uint_values", "int_values", "real32_values", "real64_values", "uvast_values","vast_values"] - + curr_type = entry.data_type_id + if curr_type == 2: + curr_type = await find_edd_type(entry.obj_metadata_id) + elif curr_type == 12: + curr_type = await find_var_type(entry.obj_metadata_id) + ac_types_and_id.append((curr_type, entry.obj_metadata_id)) + stmt = select(Report).where(Report.agent_id == agent_id , Report.ADM == adm_name , Report.report_name == report_name) - # find the type of ari - type_matchup = {2: find_edd_type, 12: find_var_type, } + # if a none formal report + if ac_id == None: + ac_names.append(report_name) + final_values = [] final_values.append(ac_names) async with get_async_session() as session: result: Result = await session.scalars(stmt) entries = result.all() - + args_to_use = [] for entry in entries: - curr_values = [] - time = datetime.fromtimestamp(int(entry.time)).strftime('%Y-%m-%d %H:%M:%S') - - string_values = list(filter(None, re.split(r",|'(.*?)'", entry.string_values))) if entry.string_values else [] - uint_values = entry.uint_values.split(',') if entry.uint_values else [] - int_values = entry.int_values.split(',') if entry.int_values else [] - real32_values = entry.real32_values.split(',') if entry.real32_values else [] - real64_values = entry.real64_values.split(',') if entry.real64_values else [] - uvast_values = entry.uvast_values.split(',') if entry.uvast_values else [] - vast_values = entry.vast_values.split(',') if entry.vast_values else [] - value_matchup = {18: string_values, 19: int_values, 20: uint_values, 21: vast_values, 22: uvast_values, - 23: real32_values, 24: real64_values} - curr_values.append(time) - for type_id, obj_id in ac_types_and_id: - if type_id in type_matchup: - curr_type = await type_matchup[type_id](obj_id) - else: - curr_type = type_id - if value_matchup[curr_type]: - curr_values.append(value_matchup[curr_type].pop(0)) - if ac_types_and_id is []: - curr_values.append(','.join(string_values)) - curr_values.append(','.join(uint_values)) - curr_values.append(','.join(int_values)) - curr_values.append(','.join(real32_values)) - curr_values.append(','.join(real64_values)) - curr_values.append(','.join(uvast_values)) - curr_values.append(','.join(vast_values)) - - final_values.append(curr_values) + args_to_use.append(_process_report_entries([entry, ac_types_and_id])) + result = await asyncio.gather(*args_to_use) + for res in result: + final_values.append(res) return final_values diff --git a/anms-ui/public/app/components/management/agents/reports.vue b/anms-ui/public/app/components/management/agents/reports.vue index 19cde6e..c6f13cf 100644 --- a/anms-ui/public/app/components/management/agents/reports.vue +++ b/anms-ui/public/app/components/management/agents/reports.vue @@ -18,14 +18,15 @@ :key="index" :value="index">{{ rpt.adm }}.{{ rpt.name }} - + > @@ -74,11 +75,15 @@ export default { this.loading = false; }, processReport(report) { - this.tableHeaders = report.shift(); + let holdHeader = report.shift(); + this.tableHeaders = []; + for (let i = 0; i < holdHeader.length; i++) { + this.tableHeaders.push({"key":holdHeader[i]}); + } for (let item of report) { let row = {}; - for (let i = 0; i < this.tableHeaders.length; i++) { - row[this.tableHeaders[i]] = item[i]; + for (let i = 0; i < holdHeader.length; i++) { + row[holdHeader[i]] = item[i]; } this.tableItems.push(row); } @@ -117,4 +122,7 @@ export default { .select-max-width { max-width: 600px; } +.b-table-sticky-header > .table.b-table > thead > tr > th { + position: sticky !important; +} From aad7dcee226bf3ff84a72c266fc71e1b26ad238b Mon Sep 17 00:00:00 2001 From: David Linko Date: Fri, 16 Aug 2024 14:09:51 -0400 Subject: [PATCH 4/5] 117 anms fun bld 010 state based rule no limits (#122) * adding multiprocessing * updated table display and processing * uncommented code * upadting submodules * updated submodules to latest * removing old code --------- Co-authored-by: linkodm1 --- .../components/management/agents/reports.vue | 37 +++++++------------ deps/anms-ace | 2 +- deps/anms-camp | 2 +- ion/src | 2 +- 4 files changed, 17 insertions(+), 26 deletions(-) diff --git a/anms-ui/public/app/components/management/agents/reports.vue b/anms-ui/public/app/components/management/agents/reports.vue index c6f13cf..1237610 100644 --- a/anms-ui/public/app/components/management/agents/reports.vue +++ b/anms-ui/public/app/components/management/agents/reports.vue @@ -53,25 +53,20 @@ export default { this.loading = true; this.tableHeaders = []; this.tableItems = []; - if (this.reports[this.selected] == undefined) { - this.loading = true; - let rpt_name = this.rptts[this.selected].name; - let rpt_adm = this.rptts[this.selected].adm; - await api.methods.apiEntriesForReport(this.agentName, rpt_adm, rpt_name) - .then(res => { - this.processReport(res.data); - this.reports[this.selected] = this.tableItems; - this.reportsHeader[this.selected] = this.tableHeaders; - }).catch(error => { - // handle error - console.error("reports error", error); - console.info("error obj:", error); - }); - } else{ - this.tableHeaders = this.reportsHeader[this.selected]; - this.tableItems = this.reports[this.selected]; - } - + this.loading = true; + let rpt_name = this.rptts[this.selected].name; + let rpt_adm = this.rptts[this.selected].adm; + await api.methods.apiEntriesForReport(this.agentName, rpt_adm, rpt_name) + .then(res => { + this.processReport(res.data); + this.reports[this.selected] = this.tableItems; + this.reportsHeader[this.selected] = this.tableHeaders; + }).catch(error => { + // handle error + console.error("reports error", error); + console.info("error obj:", error); + }); + this.loading = false; }, processReport(report) { @@ -93,14 +88,10 @@ export default { }, mounted() { this.loading = true; - - // this.title = this.adm + "." + this.reportName this.rptts.forEach((rpt, index) => { api.methods.apiEntriesForReport(this.agentName, rpt.adm, rpt.name) .then(res => { - this.reports[index] = res.data - // this.headers = this.reports.shift() }).catch(error => { // handle error console.error("reports error", error); diff --git a/deps/anms-ace b/deps/anms-ace index 55b82b1..ecf173c 160000 --- a/deps/anms-ace +++ b/deps/anms-ace @@ -1 +1 @@ -Subproject commit 55b82b178b067bdee7b28fc63d1f283c0961a568 +Subproject commit ecf173caa449cfa977b66c6886998e3e0cbe208a diff --git a/deps/anms-camp b/deps/anms-camp index 6c5c8a8..1302277 160000 --- a/deps/anms-camp +++ b/deps/anms-camp @@ -1 +1 @@ -Subproject commit 6c5c8a80fc7a8bc96165e48b09da85d4e5bf7d00 +Subproject commit 1302277adab1e0818293398d22a6351fb2616049 diff --git a/ion/src b/ion/src index 6e95a2e..0405843 160000 --- a/ion/src +++ b/ion/src @@ -1 +1 @@ -Subproject commit 6e95a2e7fd6975cd8d859627cee73323857ac161 +Subproject commit 0405843767d58b7dd3366ea702ccce084278eb6e From c478425b3dd170df4805da347698af6d00a390bb Mon Sep 17 00:00:00 2001 From: Brian Sipos Date: Wed, 21 Aug 2024 20:14:30 -0400 Subject: [PATCH 5/5] Use safe-characters for CI image tag (#124) --- .github/workflows/build-test.yaml | 5 ++++- .gitlab-ci.yml | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index e0ca728..a12af85 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -12,7 +12,6 @@ jobs: runs-on: ubuntu-latest env: DOCKER_BUILDKIT: "1" - DOCKER_IMAGE_TAG: ${{ github.head_ref || github.ref_name }} AUTHNZ_EMU: "1" ANMS_COMPOSE_OPTS: "-f docker-compose.yml -p anms" AGENT_COMPOSE_OPTS: "-f agent-compose.yml -p agents" @@ -26,6 +25,10 @@ jobs: uses: actions/checkout@v3 with: submodules: recursive + - name: Tag name env + run: | + DOCKER_IMAGE_TAG=$(echo ${{ github.head_ref || github.ref_name }} | sed 's/[^a-zA-Z0-9\-\._]/-/g') + echo "DOCKER_IMAGE_TAG=${DOCKER_IMAGE_TAG}" >> $GITHUB_ENV - name: Build run: | ./build.sh buildonly diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 17e15f5..7369412 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -46,7 +46,7 @@ variables: # for Ruby/bolt SSL_CERT_FILE: /etc/pki/tls/certs/ca-bundle.crt # Project-specific environment - DOCKER_IMAGE_TAG: $CI_COMMIT_REF_NAME + DOCKER_IMAGE_TAG: $CI_COMMIT_REF_SLUG DOCKER_IMAGE_PREFIX: $DOCKER_REGISTRY/$DOCKER_GROUP/ AUTHNZ_EMU: 1 ANMS_COMPOSE_OPTS: -f docker-compose.yml -p anms