From: PatrikBuhr Date: Mon, 30 Nov 2020 13:27:24 +0000 (+0100) Subject: Added presentation of owner of EiJob X-Git-Tag: 2.1.0^2 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;ds=sidebyside;h=refs%2Fchanges%2F98%2F5198%2F1;p=portal%2Fnonrtric-controlpanel.git Added presentation of owner of EiJob Change-Id: I70ed2af455af7a5fa82f19c47b6cae7d18530da1 Issue-ID: NONRTRIC-294 Signed-off-by: PatrikBuhr --- diff --git a/webapp-backend/src/main/java/org/oransc/portal/nonrtric/controlpanel/model/JobInfo.java b/webapp-backend/src/main/java/org/oransc/portal/nonrtric/controlpanel/model/JobInfo.java index e8ec292..78bbd87 100644 --- a/webapp-backend/src/main/java/org/oransc/portal/nonrtric/controlpanel/model/JobInfo.java +++ b/webapp-backend/src/main/java/org/oransc/portal/nonrtric/controlpanel/model/JobInfo.java @@ -54,4 +54,9 @@ public class JobInfo { @JsonProperty("target_uri") public String targetUri; + @ApiModelProperty(value = "The owner of the job") + @SerializedName("owner") + @JsonProperty("owner") + public String owner; + } diff --git a/webapp-backend/src/test/java/org/oransc/portal/nonrtric/controlpanel/RestApiTest.java b/webapp-backend/src/test/java/org/oransc/portal/nonrtric/controlpanel/RestApiTest.java index 4243c34..c4acad2 100644 --- a/webapp-backend/src/test/java/org/oransc/portal/nonrtric/controlpanel/RestApiTest.java +++ b/webapp-backend/src/test/java/org/oransc/portal/nonrtric/controlpanel/RestApiTest.java @@ -91,6 +91,7 @@ class RestApiTest { .typeId("type1") // .jobData(getStringFromFile("job-1.json")) // .targetUri("http://example.com/") // + .owner("owner") // .build(); assertThat(jobs).hasSize(1) // .contains(gson.toJsonTree(wantedJobInfo)); diff --git a/webapp-backend/src/test/java/org/oransc/portal/nonrtric/controlpanel/mock/EiJob.java b/webapp-backend/src/test/java/org/oransc/portal/nonrtric/controlpanel/mock/EiJob.java deleted file mode 100644 index 56d3fc8..0000000 --- a/webapp-backend/src/test/java/org/oransc/portal/nonrtric/controlpanel/mock/EiJob.java +++ /dev/null @@ -1,42 +0,0 @@ -/*- - * ========================LICENSE_START================================= - * O-RAN-SC - * %% - * Copyright (C) 2019 Nordix Foundation - * Modifications Copyright (C) 2020 Nordix Foundation - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ========================LICENSE_END=================================== - */ -package org.oransc.portal.nonrtric.controlpanel.mock; - -import org.immutables.gson.Gson; -import org.immutables.value.Value; - -@Value.Immutable -@Gson.TypeAdapters -public interface EiJob { - - public String ei_job_identity(); - - public String target_uri(); - - public Object ei_job_data(); - - public String ei_type_identity(); - - public String owner(); - - public String status(); - -} diff --git a/webapp-backend/src/test/java/org/oransc/portal/nonrtric/controlpanel/mock/EiJobs.java b/webapp-backend/src/test/java/org/oransc/portal/nonrtric/controlpanel/mock/EiJobs.java index 0a486ec..ce831d3 100644 --- a/webapp-backend/src/test/java/org/oransc/portal/nonrtric/controlpanel/mock/EiJobs.java +++ b/webapp-backend/src/test/java/org/oransc/portal/nonrtric/controlpanel/mock/EiJobs.java @@ -22,7 +22,9 @@ package org.oransc.portal.nonrtric.controlpanel.mock; import java.util.ArrayList; -public class EiJobs extends ArrayList { +import org.oransc.portal.nonrtric.controlpanel.model.JobInfo; + +public class EiJobs extends ArrayList { private static final long serialVersionUID = -928428052502491021L; diff --git a/webapp-backend/src/test/java/org/oransc/portal/nonrtric/controlpanel/mock/EnrichmentControllerMockConfiguration.java b/webapp-backend/src/test/java/org/oransc/portal/nonrtric/controlpanel/mock/EnrichmentControllerMockConfiguration.java index 43be49f..c0fb4f1 100644 --- a/webapp-backend/src/test/java/org/oransc/portal/nonrtric/controlpanel/mock/EnrichmentControllerMockConfiguration.java +++ b/webapp-backend/src/test/java/org/oransc/portal/nonrtric/controlpanel/mock/EnrichmentControllerMockConfiguration.java @@ -33,10 +33,10 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Optional; import java.util.stream.Collectors; import org.oransc.portal.nonrtric.controlpanel.eiproducerapi.EiProducerApi; +import org.oransc.portal.nonrtric.controlpanel.model.JobInfo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.test.context.TestConfiguration; @@ -88,8 +88,8 @@ public class EnrichmentControllerMockConfiguration { @Override public ResponseEntity getEiJobsForOneEiProducer(String eiProducerId) { EiJobs result = new EiJobs(); - List inst = database.getEiJobsForOneEiProducer(Optional.of(eiProducerId)); - result.addAll(inst); + + result.addAll(database.getAllEiJobs()); return new ResponseEntity<>(gson.toJson(result), HttpStatus.OK); } @@ -122,7 +122,7 @@ public class EnrichmentControllerMockConfiguration { // Create EiJob instance schema = getStringFromFile("job-1.json"); - putEiJobInstance("type1", "job1", schema, "prod-1", "http://example.com/"); + putEiJobInstance("type1", "job1", schema, "owner", "http://example.com/"); } private String getStringFromFile(String path) { @@ -141,13 +141,12 @@ public class EnrichmentControllerMockConfiguration { } void putEiJobInstance(String typeId, String instanceId, Object instanceData, String owner, String targetUrl) { - EiJob i = ImmutableEiJob.builder() // - .ei_job_data(instanceData) // - .ei_job_identity(instanceId) // + JobInfo i = JobInfo.builder() // + .jobData(instanceData) // + .id(instanceId) // .owner(owner) // - .ei_type_identity(typeId) // - .target_uri(targetUrl) // - .status("ENABLED") // + .typeId(typeId) // + .targetUri(targetUrl) // .build(); // eiJobs.put(instanceId, i); } @@ -196,26 +195,12 @@ public class EnrichmentControllerMockConfiguration { return eiProducers.values(); } - public Collection getAllEiJobs() { - return eiJobs.values(); - } - - public List getEiJobsForOneEiProducer(Optional eiProducerId) { - List result = new ArrayList<>(); - for (EiJob i : eiJobs.values()) { - if (eiProducerId.isPresent()) { - if (i.owner().equals(eiProducerId.get())) { - result.add(i); - } + public List getAllEiJobs() { + return new ArrayList<>(eiJobs.values()); - } else { - result.add(i); - } - } - return result; } private Map eiProducers = new HashMap<>(); - private Map eiJobs = new HashMap<>(); + private Map eiJobs = new HashMap<>(); } } diff --git a/webapp-frontend/src/app/ei-coordinator/ei-coordinator.component.html b/webapp-frontend/src/app/ei-coordinator/ei-coordinator.component.html index ada0384..e90f945 100644 --- a/webapp-frontend/src/app/ei-coordinator/ei-coordinator.component.html +++ b/webapp-frontend/src/app/ei-coordinator/ei-coordinator.component.html @@ -63,10 +63,14 @@ limitations under the License. Type ID {{this.getEITypeId(eiJob)}} + + Owner + {{eiJob.owner}} + Target URI {{this.getTargetUri(eiJob)}} - - + + \ No newline at end of file diff --git a/webapp-frontend/src/app/ei-coordinator/ei-coordinator.component.ts b/webapp-frontend/src/app/ei-coordinator/ei-coordinator.component.ts index 3360577..15c4738 100644 --- a/webapp-frontend/src/app/ei-coordinator/ei-coordinator.component.ts +++ b/webapp-frontend/src/app/ei-coordinator/ei-coordinator.component.ts @@ -97,14 +97,14 @@ export class EICoordinatorComponent implements OnInit { } getEITypeId(eiJob: EIJob): string { - if (eiJob.ei_type_identity){ + if (eiJob.ei_type_identity) { return eiJob.ei_type_identity; } return '< No type >'; } getTargetUri(eiJob: EIJob): string { - if (eiJob.target_uri){ + if (eiJob.target_uri) { return eiJob.target_uri; } return '< No target URI >'; @@ -119,21 +119,21 @@ export class EICoordinatorComponent implements OnInit { } getEIProducerId(eiProducer: EIProducer): string { - if (eiProducer.ei_producer_id){ + if (eiProducer.ei_producer_id) { return eiProducer.ei_producer_id; } return '< No id>'; } getEIProducerTypes(eiProducer: EIProducer): string[] { - if (eiProducer.ei_producer_types){ + if (eiProducer.ei_producer_types) { return eiProducer.ei_producer_types; } return ['< No types >']; } getEIProducerStatus(eiProducer: EIProducer): string { - if (eiProducer.status){ + if (eiProducer.status) { return eiProducer.status; } return '< No status >'; diff --git a/webapp-frontend/src/app/interfaces/ei.jobs.ts b/webapp-frontend/src/app/interfaces/ei.jobs.ts index e7d034a..4ead13f 100644 --- a/webapp-frontend/src/app/interfaces/ei.jobs.ts +++ b/webapp-frontend/src/app/interfaces/ei.jobs.ts @@ -21,27 +21,28 @@ // Models of data used by the EI Coordinator export interface EIJobBis { - eiTypeId: string; - jobResultUri: string; - jobOwner: string; - jobStatusNotificationUri: string; - jobDefinition: any; - } + eiTypeId: string; + jobResultUri: string; + jobOwner: string; + jobStatusNotificationUri: string; + jobDefinition: any; +} - export interface EIJob { - ei_job_identity: string; - ei_job_data: any; - ei_type_identity: string; - target_uri: string; - } +export interface EIJob { + ei_job_identity: string; + ei_job_data: any; + ei_type_identity: string; + target_uri: string; + owner: string; +} - export interface EIType { - id: string; - description: string; - } +export interface EIType { + id: string; + description: string; +} - export interface EIProducer { - ei_producer_id: string; - ei_producer_types: string[]; - status: string; - } \ No newline at end of file +export interface EIProducer { + ei_producer_id: string; + ei_producer_types: string[]; + status: string; +} \ No newline at end of file