RIC Dashboard Release Notes
===========================
-Version 1.0.4, 20 June 2019
+Version 1.0.4, 21 June 2019
---------------------------
* Add AC xApp neighbor control screen
* Add ANR xApp neighbor cell relation table
* Add feature resilient to malformed instance data
* Extend Xapp Controller with config endpoints
* Add build number to dashboard version string
+* Move mock admin screen user data to backend
Version 1.0.3, 28 May 2019
--------------------------
public static final String ENDPOINT_PREFIX = "/api/";
public static final String HEALTHCHECK_PATH = "health";
public static final String VERSION_PATH = "version";
+ public static final String USER_PATH = "user";
}
* 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.
import org.oransc.ric.portal.dashboard.DashboardApplication;
import org.oransc.ric.portal.dashboard.DashboardConstants;
+import org.oransc.ric.portal.dashboard.model.DashboardUser;
import org.oransc.ric.portal.dashboard.model.SuccessTransport;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import io.swagger.annotations.ApiOperation;
/**
- * Answers REST requests for the API service health etc.
+ * Answers REST requests for admin services like version, health etc.
*/
@RestController
-@RequestMapping(value = DashboardConstants.ENDPOINT_PREFIX + "/dashboard", produces = MediaType.APPLICATION_JSON_VALUE)
-public class HealthcheckController {
+@RequestMapping(value = DashboardConstants.ENDPOINT_PREFIX + "/admin", produces = MediaType.APPLICATION_JSON_VALUE)
+public class AdminController {
- @ApiOperation(value = "Checks the health of the application by (TBD).", response = SuccessTransport.class)
- @RequestMapping(value = DashboardConstants.HEALTHCHECK_PATH, method = RequestMethod.GET)
- public SuccessTransport getDashblardHealth() {
- long count = 0;
- return new SuccessTransport(200, "(TBD) reports count is " + count);
+ private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+
+ private final DashboardUser[] users;
+
+ public AdminController() {
+ // Mock data
+ users = new DashboardUser[] { //
+ new DashboardUser(1, "John", "Doe", "Active"), //
+ new DashboardUser(2, "Alice", "Nolan", "Active"), //
+ new DashboardUser(3, "Pierce", "King", "Inactive"), //
+ new DashboardUser(4, "Paul", "Smith", "Inactive"), //
+ new DashboardUser(5, "Jack", "Reacher", "Active") };
}
@ApiOperation(value = "Gets the Dashboard MANIFEST.MF property Implementation-Version.", response = SuccessTransport.class)
@RequestMapping(value = DashboardConstants.VERSION_PATH, method = RequestMethod.GET)
- public SuccessTransport getDashboardVersion() {
+ public SuccessTransport getVersion() {
+ logger.debug("getVersion");
return new SuccessTransport(200,
DashboardApplication.getImplementationVersion(MethodHandles.lookup().lookupClass()));
}
+ @ApiOperation(value = "Checks the health of the application.", response = SuccessTransport.class)
+ @RequestMapping(value = DashboardConstants.HEALTHCHECK_PATH, method = RequestMethod.GET)
+ public SuccessTransport getHealth() {
+ logger.debug("getHealth");
+ return new SuccessTransport(200, "Dashboard is healthy!");
+ }
+
+ @ApiOperation(value = "Gets the list of application users.", response = DashboardUser.class, responseContainer = "List")
+ @RequestMapping(value = DashboardConstants.USER_PATH, method = RequestMethod.GET)
+ public DashboardUser[] getUsers() {
+ logger.debug("getUsers");
+ return users;
+ }
+
}
--- /dev/null
+/*-
+ * ========================LICENSE_START=================================
+ * O-RAN-SC
+ * %%
+ * Copyright (C) 2019 AT&T Intellectual Property and Nokia
+ * %%
+ * 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===================================
+ */
+
+/*
+ * TODO: this mocks user properties until integration with ONAP Portal is done.
+ */
+package org.oransc.ric.portal.dashboard.model;
+
+import java.util.Objects;
+
+public class DashboardUser {
+
+ private long id;
+ private String firstName;
+ private String lastName;
+ private String status;
+
+ public DashboardUser() {
+ }
+
+ public DashboardUser(long id, String firstName, String lastName, String status) {
+ this.id = id;
+ this.firstName = firstName;
+ this.lastName = lastName;
+ this.status = status;
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((firstName == null) ? 0 : firstName.hashCode());
+ result = prime * result + (int) (id ^ (id >>> 32));
+ result = prime * result + ((lastName == null) ? 0 : lastName.hashCode());
+ result = prime * result + ((status == null) ? 0 : status.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ DashboardUser other = (DashboardUser) obj;
+ return Objects.equals(id, other.id) && Objects.equals(firstName, other.firstName)
+ && Objects.equals(lastName, other.lastName) && Objects.equals(status, other.status);
+ }
+
+}
*/
import { Component, OnInit } from '@angular/core';
import { LocalDataSource } from 'ng2-smart-table';
-import { AdminService } from '../services/admin/admin.service';
+import { DashboardService } from '../services/dashboard/dashboard.service';
+import { DashboardUser } from '../interfaces/dashboard.types';
@Component({
selector: 'app-admin',
templateUrl: './admin.component.html',
styleUrls: ['./admin.component.css']
})
-export class AdminComponent {
-
+export class AdminComponent implements OnInit {
usersettings = {
columns: {
usersource: LocalDataSource = new LocalDataSource();
- constructor(private service: AdminService) {
- const data = this.service.getData();
- this.usersource.load(data);
+ constructor(private service: DashboardService) {
+ }
+
+ ngOnInit() {
+ this.service.getUsers().subscribe((res: DashboardUser[]) => this.usersource.load(res));
}
onDeleteUserConfirm(event): void {
import { LoginComponent } from './login/login.component';
import { CatalogComponent } from './catalog/catalog.component';
import { UiService } from './services/ui/ui.service';
-import { AdminService } from './services/admin/admin.service';
import { XappMgrService } from './services/xapp-mgr/xapp-mgr.service';
import { DashboardService } from './services/dashboard/dashboard.service';
import { E2ManagerService } from './services/e2-mgr/e2-mgr.service';
],
providers: [
UiService,
- AdminService,
XappMgrService,
DashboardService,
E2ManagerService,
* ========================LICENSE_END===================================
*/
-// Models of data used by the Dashboard
+// Models of data used by Dashboard admin services
export interface DashboardSuccessTransport {
status: number;
data: string;
}
+
+export interface DashboardUser {
+ id: number;
+ firstName: string;
+ lastName: string;
+ status: string;
+}
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2019 AT&T Intellectual Property and Nokia
- * %%
- * 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===================================
- */
-
-import { TestBed } from '@angular/core/testing';
-
-import { AdminService } from './admin.service';
-
-describe('ControlService', () => {
- beforeEach(() => TestBed.configureTestingModule({}));
-
- it('should be created', () => {
- const service: AdminService = TestBed.get(AdminService);
- expect(service).toBeTruthy();
- });
-});
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2019 AT&T Intellectual Property and Nokia
- * %%
- * 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===================================
- */
-import { Injectable } from '@angular/core';
-
-@Injectable()
-export class AdminService {
-
-data = [{
- id: 1,
- firstName: 'John',
- lastName: 'Doe',
- status: 'Active',
- }, {
- id: 2,
- firstName: 'Alice',
- lastName: 'Nolan',
- status: 'Active',
- }, {
- id: 3,
- firstName: 'Pierce',
- lastName: 'King',
- status: 'InActive',
- }, {
- id: 4,
- firstName: 'Paul',
- lastName: 'Smith',
- status: 'InActive',
- }, {
- id: 5,
- firstName: 'Jack',
- lastName: 'Reacher',
- status: 'Active',
- }];
-
- getData() {
- return this.data; // @TODO implement the service to fetch the backend data
- }
-}
*/
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
+import { Observable } from 'rxjs';
+import { DashboardSuccessTransport, DashboardUser } from '../../interfaces/dashboard.types';
@Injectable({
providedIn: 'root'
})
/**
- * Services to query the dashboard's healthcheck controller.
+ * Services to query the dashboard's admin endpoints.
*/
export class DashboardService {
- private basePath = 'api/dashboard/';
+ private basePath = 'api/admin/';
constructor(private httpClient: HttpClient) {
// injects to variable httpClient
* Checks app health
* @returns Observable that should yield a DashboardSuccessTransport
*/
- getHealth() {
- return this.httpClient.get(this.basePath + 'health');
+ getHealth(): Observable<DashboardSuccessTransport> {
+ return this.httpClient.get<DashboardSuccessTransport>(this.basePath + 'health');
}
/**
* Gets Dashboard version details
* @returns Observable that should yield a DashboardSuccessTransport object
*/
- getVersion() {
- return this.httpClient.get(this.basePath + 'version');
+ getVersion(): Observable<DashboardSuccessTransport> {
+ return this.httpClient.get<DashboardSuccessTransport>(this.basePath + 'version');
+ }
+
+ /**
+ * Gets Dashboard users
+ * @returns Observable that should yield a DashboardUser array
+ */
+ getUsers(): Observable<DashboardUser[]> {
+ return this.httpClient.get<DashboardUser[]>(this.basePath + 'user');
}
}