diff --git a/analytics-service/Dockerfile b/analytics-service/Dockerfile index 12e1bf6..45b0804 100644 --- a/analytics-service/Dockerfile +++ b/analytics-service/Dockerfile @@ -7,10 +7,14 @@ WORKDIR /apama_work USER root RUN microdnf install git +# RUN microdnf install unzip # USER sagadmin # Clone the apama-analytics-builder-block-sdk repository RUN git clone https://github.com/SoftwareAG/apama-analytics-builder-block-sdk.git +# alternatively +# RUN wget https://github.com/SoftwareAG/apama-analytics-builder-block-sdk/archive/refs/heads/rel/10.18.0.x.zip +# RUN unzip apama-analytics-builder-block-sdk-rel-10.18.0.x.zip COPY requirements.txt /apama_work COPY flask_wrapper.py /apama_work diff --git a/analytics-service/flask_wrapper.py b/analytics-service/flask_wrapper.py index 6902db1..e241097 100644 --- a/analytics-service/flask_wrapper.py +++ b/analytics-service/flask_wrapper.py @@ -22,9 +22,9 @@ app = Flask(__name__) agent = C8YAgent() access_token = agent.get_github_access_token() -logger.info( - f"Github access token: {access_token}" -) +# logger.info( +# f"Github access token: {access_token}" +# ) auth = Auth.Token(access_token) # initialize github endpoint gh = Github(auth=auth) diff --git a/analytics-service/requirements.txt b/analytics-service/requirements.txt index d21b32f..935dc2f 100644 --- a/analytics-service/requirements.txt +++ b/analytics-service/requirements.txt @@ -1,3 +1,4 @@ c8y_api flask -PyGithub \ No newline at end of file +PyGithub +python-dotenv \ No newline at end of file diff --git a/analytics-ui/src/sample/list/sample.component.ts b/analytics-ui/src/sample/list/sample.component.ts index 70f26ca..f3e9ddd 100644 --- a/analytics-ui/src/sample/list/sample.component.ts +++ b/analytics-ui/src/sample/list/sample.component.ts @@ -165,20 +165,22 @@ export class SampleGridComponent implements OnInit { } public async createExtension(ids: string[]) { - const initialState = {}; + const monitors = []; + for (let i = 0; i < this.samples.length; i++) { + if (ids.includes(this.samples[i].id)) { + monitors.push(this.samples[i].url); + } + } + const initialState = { + monitors + }; + const modalRef = this.bsModalService.show(NameExtensionComponent, { initialState, }); modalRef.content.closeSubject.subscribe(async (conf) => { console.log("Configuration after edit:", conf); if (conf) { - const monitors = []; - for (let i = 0; i < this.samples.length; i++) { - if (ids.includes(this.samples[i].id)) { - monitors.push(this.samples[i].url); - } - } - const response = await this.analyticsService.createExtensionsZIP( conf.name, monitors diff --git a/analytics-ui/src/wizard/name-extension-modal.component.ts b/analytics-ui/src/wizard/name-extension-modal.component.ts index 0455c09..1f6e590 100644 --- a/analytics-ui/src/wizard/name-extension-modal.component.ts +++ b/analytics-ui/src/wizard/name-extension-modal.component.ts @@ -1,8 +1,9 @@ import { Component, Input, OnInit, Output } from "@angular/core"; -import { ModalLabels } from "@c8y/ngx-components"; -import { Subject } from "rxjs"; +import { AlertService, ModalLabels } from "@c8y/ngx-components"; +import { BehaviorSubject, Subject } from "rxjs"; import { FormlyFieldConfig } from "@ngx-formly/core"; import { FormGroup } from "@angular/forms"; +import { AnalyticsService } from "../shared/analytics.service"; @Component({ selector: "name-extension-modal", @@ -26,12 +27,17 @@ import { FormGroup } from "@angular/forms"; }) export class NameExtensionComponent implements OnInit { @Output() closeSubject: Subject = new Subject(); + @Input() monitors: string[]; configuration: any = {}; configFormlyFields: FormlyFieldConfig[] = []; configFormly: FormGroup = new FormGroup({}); labels: ModalLabels = { ok: "Create extension", cancel: "Dismiss" }; + constructor( + public analyticsService: AnalyticsService, + public alertService: AlertService, + ) {} ngOnInit(): void { this.configFormlyFields = [ { @@ -52,9 +58,17 @@ export class NameExtensionComponent implements OnInit { this.closeSubject.next(undefined); } - onSave(event) { + async onSave(event) { console.log("Save"); + const response = await this.analyticsService.createExtensionsZIP( + this.configuration.name, + this.monitors + ); this.closeSubject.next(this.configuration); } + get progress(): BehaviorSubject { + return this.progress; + } + }