Commit 0d7e95f3 authored by Huaqiao Zhang's avatar Huaqiao Zhang Committed by badboy-huaqiao
Browse files

feat: Add update method for device device update

Signed-off-by: default avatarHuaqiao Zhang <huaqiaoz@vmware.com>
parent fe54f74a
main dependabot/go_modules/github.com/eclipse/paho.mqtt.golang-1.3.3 dependabot/go_modules/github.com/eclipse/paho.mqtt.golang-1.3.4 dependabot/go_modules/github.com/edgexfoundry/go-mod-configuration/v2-2.0.0 dependabot/go_modules/github.com/edgexfoundry/go-mod-core-contracts/v2-2.0.0 dependabot/go_modules/github.com/edgexfoundry/go-mod-core-contracts/v2-2.0.0-dev.100 dependabot/go_modules/github.com/edgexfoundry/go-mod-core-contracts/v2-2.0.0-dev.101 dependabot/go_modules/github.com/edgexfoundry/go-mod-core-contracts/v2-2.0.0-dev.102 dependabot/go_modules/github.com/edgexfoundry/go-mod-core-contracts/v2-2.0.0-dev.103 dependabot/go_modules/github.com/edgexfoundry/go-mod-core-contracts/v2-2.0.0-dev.61 dependabot/go_modules/github.com/edgexfoundry/go-mod-core-contracts/v2-2.0.0-dev.62 dependabot/go_modules/github.com/edgexfoundry/go-mod-core-contracts/v2-2.0.0-dev.64 dependabot/go_modules/github.com/edgexfoundry/go-mod-core-contracts/v2-2.0.0-dev.66 dependabot/go_modules/github.com/edgexfoundry/go-mod-core-contracts/v2-2.0.0-dev.67 dependabot/go_modules/github.com/edgexfoundry/go-mod-core-contracts/v2-2.0.0-dev.69 dependabot/go_modules/github.com/edgexfoundry/go-mod-core-contracts/v2-2.0.0-dev.71 dependabot/go_modules/github.com/edgexfoundry/go-mod-core-contracts/v2-2.0.0-dev.73 dependabot/go_modules/github.com/edgexfoundry/go-mod-core-contracts/v2-2.0.0-dev.74 dependabot/go_modules/github.com/edgexfoundry/go-mod-core-contracts/v2-2.0.0-dev.76 dependabot/go_modules/github.com/edgexfoundry/go-mod-core-contracts/v2-2.0.0-dev.77 dependabot/go_modules/github.com/edgexfoundry/go-mod-core-contracts/v2-2.0.0-dev.78 dependabot/go_modules/github.com/edgexfoundry/go-mod-core-contracts/v2-2.0.0-dev.80 dependabot/go_modules/github.com/edgexfoundry/go-mod-core-contracts/v2-2.0.0-dev.82 dependabot/go_modules/github.com/edgexfoundry/go-mod-core-contracts/v2-2.0.0-dev.83 dependabot/go_modules/github.com/edgexfoundry/go-mod-core-contracts/v2-2.0.0-dev.84 dependabot/go_modules/github.com/edgexfoundry/go-mod-core-contracts/v2-2.0.0-dev.87 dependabot/go_modules/github.com/edgexfoundry/go-mod-core-contracts/v2-2.0.0-dev.89 dependabot/go_modules/github.com/edgexfoundry/go-mod-core-contracts/v2-2.0.0-dev.90 dependabot/go_modules/github.com/edgexfoundry/go-mod-core-contracts/v2-2.0.0-dev.91 dependabot/go_modules/github.com/edgexfoundry/go-mod-core-contracts/v2-2.0.0-dev.93 dependabot/go_modules/github.com/edgexfoundry/go-mod-core-contracts/v2-2.0.0-dev.94 dependabot/go_modules/github.com/edgexfoundry/go-mod-core-contracts/v2-2.0.0-dev.95 dependabot/go_modules/github.com/edgexfoundry/go-mod-core-contracts/v2-2.0.0-dev.97 dependabot/go_modules/github.com/edgexfoundry/go-mod-core-contracts/v2-2.0.0-dev.98 dependabot/go_modules/github.com/edgexfoundry/go-mod-core-contracts/v2-2.0.0-dev.99 dependabot/go_modules/github.com/edgexfoundry/go-mod-core-contracts/v2-2.1.0 dependabot/go_modules/github.com/edgexfoundry/go-mod-registry/v2-2.0.1-dev.5 dependabot/go_modules/github.com/edgexfoundry/go-mod-registry/v2-2.0.1-dev.6 dependabot/go_modules/github.com/edgexfoundry/go-mod-registry/v2-2.0.1-dev.7 dependabot/go_modules/github.com/edgexfoundry/go-mod-registry/v2-2.0.1-dev.8 dependabot/go_modules/github.com/edgexfoundry/go-mod-registry/v2-2.0.1-dev.9 dependabot/go_modules/github.com/edgexfoundry/go-mod-registry/v2-2.1.0 dependabot/go_modules/github.com/pelletier/go-toml-1.9.0 dependabot/go_modules/github.com/pelletier/go-toml-1.9.1 dependabot/go_modules/github.com/pelletier/go-toml-1.9.2 dependabot/go_modules/github.com/pelletier/go-toml-1.9.3 dependabot/go_modules/github.com/pelletier/go-toml-1.9.4 dependabot/npm_and_yarn/web/engine.io-4.1.2 dependabot/npm_and_yarn/web/follow-redirects-1.14.7 dependabot/npm_and_yarn/web/follow-redirects-1.14.8 dependabot/npm_and_yarn/web/karma-6.3.14 dependabot/npm_and_yarn/web/karma-6.3.16 dependabot/npm_and_yarn/web/nanoid-3.2.0 dependabot/npm_and_yarn/web/url-parse-1.5.10 master v2.1.1-dev.15 v2.1.1-dev.14 v2.1.1-dev.13 v2.1.1-dev.12 v2.1.1-dev.11 v2.1.1-dev.10 v2.1.1-dev.9 v2.1.1-dev.8 v2.1.1-dev.7 v2.1.1-dev.6 v2.1.1-dev.5 v2.1.1-dev.4 v2.1.1-dev.3 v2.1.1-dev.2 v2.1.1-dev.1 v2.1.0 v2.0.1-dev.33 v2.0.1-dev.32 v2.0.1-dev.31 v2.0.1-dev.30 v2.0.1-dev.29 v2.0.1-dev.28 v2.0.1-dev.27 v2.0.1-dev.26 v2.0.1-dev.25 v2.0.1-dev.24 v2.0.1-dev.23 v2.0.1-dev.22 v2.0.1-dev.21 v2.0.1-dev.20 v2.0.1-dev.19 v2.0.1-dev.18 v2.0.1-dev.17 v2.0.1-dev.16 v2.0.1-dev.15 v2.0.1-dev.14 v2.0.1-dev.13 v2.0.1-dev.12 v2.0.1-dev.11 v2.0.1-dev.10 v2.0.1-dev.9 v2.0.1-dev.8 v2.0.1-dev.7 v2.0.1-dev.6 v2.0.1-dev.5 v2.0.1-dev.4 v2.0.1-dev.3 v2.0.1-dev.2 v2.0.1-dev.1 v2.0.0 v2.0.0-dev.87 v2.0.0-dev.86 v2.0.0-dev.85 v2.0.0-dev.84 v2.0.0-dev.83 v2.0.0-dev.82 v2.0.0-dev.81 v2.0.0-dev.80 v2.0.0-dev.79 v2.0.0-dev.78 v2.0.0-dev.77 v2.0.0-dev.76 v2.0.0-dev.75 v2.0.0-dev.74 v2.0.0-dev.73 v2.0.0-dev.72 v2.0.0-dev.71 v2.0.0-dev.70 v2.0.0-dev.69 v2.0.0-dev.68 v2.0.0-dev.67 v2.0.0-dev.66 v2.0.0-dev.65 v2.0.0-dev.64 v2.0.0-dev.63 v2.0.0-dev.62 v2.0.0-dev.61 v2.0.0-dev.60 v2.0.0-dev.59 v2.0.0-dev.58 v2.0.0-dev.57 v2.0.0-dev.56 v2.0.0-dev.55 v2.0.0-dev.54 v2.0.0-dev.53 v2.0.0-dev.52 v2.0.0-dev.51 v2.0.0-dev.50 v2.0.0-dev.49 v2.0.0-dev.48 v2.0.0-dev.47 v2.0.0-dev.46 v2.0.0-dev.45 v2.0.0-dev.44 v2.0.0-dev.43 v2.0.0-dev.42 v2.0.0-dev.41 v2.0.0-dev.40 v2.0.0-dev.39 v2.0.0-dev.38 v2.0.0-dev.37 v2.0.0-dev.36 v2.0.0-dev.35 v2.0.0-dev.34 v2.0.0-dev.33 v2.0.0-dev.32 v2.0.0-dev.31 v2.0.0-dev.30 v2.0.0-dev.29 v2.0.0-dev.28 v2.0.0-dev.27 v2.0.0-dev.26 v2.0.0-dev.25
No related merge requests found
Showing with 120 additions and 6 deletions
+120 -6
<!--
*******************************************************************************
* Copyright © 2021-2022 VMware, Inc. All Rights Reserved.
*
* 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.
*
* @author: Huaqiao Zhang, <huaqiaoz@vmware.com>
*******************************************************************************
-->
<ul class="list-group p-0">
<li *ngFor="let svc of deviceServiceList" class="list-group-item list-group-item-action list-group-item-light">
<div class="media">
......@@ -7,14 +25,14 @@
<div class="media-body">
<div class="mt-0 mb-1">
<h5 class="d-inline mr-3 align-middle text-dark">{{svc.name}}</h5>
<span class="float-right">
<!-- <span class="float-right">
<i class="fa fa-calendar align-baseline text-primary"></i><span class="badge badge-light align-baseline"> {{svc.created | date:'yyyy-MM-dd hh:mm:ss'}}</span>
</span>
</span> -->
</div>
<p *ngIf="svc.description; else nodesc">{{svc.description}}</p>
<ng-template #nodesc> <p class="my-1">no description.</p> </ng-template>
<div>
<!-- <span class="badge badge-info mr-3">Port {{svc.addressable.port}}</span> -->
<span class="badge badge-info mr-3">Port {{getSvcPort(svc.baseAddress)}}</span>
<span [ngSwitch]="svc.adminState">
<span *ngSwitchCase="'UNLOCKED'" class="badge badge-success mr-3">{{svc.adminState}}</span>
<span *ngSwitchDefault class="badge badge-danger mr-3">{{svc.adminState}}</span>
......@@ -25,9 +43,36 @@
</span> -->
<a *ngIf="associatedDevices.size" class="badge badge-primary" role="button" (click)="associatedDevicesSkip(svc.name)">Associated Devices &nbsp; {{associatedDevices.get(svc.name)}}</a>
<span class="badge badge-secondary float-right" role="button"> <i class="fa fa-cog"></i> Setting</span>
<span class="badge badge-secondary float-right" role="button" (click)="edit(svc)"> <i class="fa fa-cog"></i> Setting</span>
</div>
</div>
</div>
</li>
</ul>
\ No newline at end of file
</ul>
<div *ngIf="deviceSvcSelected" class="card mt-3">
<div class="card-header">
<i class="fa fa-edit mr-1 text-danger"></i>
<span>edit {{ deviceSvcSelected.name }}</span>
<button class="btn btn-success btn-sm float-right" (click)="updateSvc()">Save</button>
</div>
<div class="card-body">
<form>
<div class="form-group row">
<label for="deviceDesc" class="col-md-2 col-form-label">Description</label>
<div class="col-md-10">
<input type="text" class="form-control" name="deviceSvcDescription" [(ngModel)]="deviceSvcSelected.description">
</div>
</div>
<div class="form-group row">
<label for="adminState" class="col-md-2 col-form-label" >AdminState</label>
<div class="col-md-10">
<select class="form-control" name="deviceSvcAdminState" [(ngModel)]="deviceSvcSelected.adminState">
<option value="UNLOCKED">UNLOCKED</option>
<option value="LOCKED">LOCKED</option>
</select>
</div>
</div>
</form>
</div>
</div>
\ No newline at end of file
/*******************************************************************************
* Copyright © 2021-2022 VMware, Inc. All Rights Reserved.
*
* 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.
*
* @author: Huaqiao Zhang, <huaqiaoz@vmware.com>
*******************************************************************************/
import { Component, OnInit } from '@angular/core';
import { Router, NavigationExtras, ActivatedRoute } from '@angular/router';
import { MetadataService } from '../../services/metadata.service';
import { DeviceService } from '../../contracts/v2/device-service';
import { MultiDeviceServiceResponse } from '../../contracts/v2/responses/device-service-response';
import { MultiDeviceResponse } from '../../contracts/v2/responses/device-response';
import { MessageService } from '../../message/message.service';
@Component({
selector: 'app-device-service-list',
......@@ -13,10 +30,11 @@ import { MultiDeviceResponse } from '../../contracts/v2/responses/device-respons
export class DeviceServiceListComponent implements OnInit {
deviceServiceList: DeviceService[] = [];
deviceSvcSelected?: DeviceService;
associatedDevices = new Map<string, number>();
// deviceServiceState = new Map<string, string>();
constructor(private metaSvc: MetadataService,
private msgSvc: MessageService,
private router: Router,
private route: ActivatedRoute) { }
......@@ -29,6 +47,23 @@ export class DeviceServiceListComponent implements OnInit {
})
}
getSvcPort(baseURL: string): string {
return (new URL(baseURL)).port
}
edit(svc: DeviceService) {
this.deviceSvcSelected = svc;
}
updateSvc() {
this.metaSvc
.updateDeviceService(this.deviceSvcSelected as DeviceService)
.subscribe(() => {
this.msgSvc.success("update device service",`name: ${this.deviceSvcSelected?.name}`);
this.deviceSvcSelected = undefined;
})
}
associatedDevicesSkip(svcName: string) {
let navParam: NavigationExtras = {
queryParams: { 'svcName': svcName },
......
/*******************************************************************************
* Copyright © 2021-2022 VMware, Inc. All Rights Reserved.
*
* 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.
*
* @author: Huaqiao Zhang, <huaqiaoz@vmware.com>
*******************************************************************************/
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
......
<!--
*******************************************************************************
* Copyright © 2021-2022 VMware, Inc. All Rights Reserved.
*
* 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.
*
* @author: Huaqiao Zhang, <huaqiaoz@vmware.com>
*******************************************************************************
-->
<div class="card">
<div class="card-header">
<ul class="nav nav-tabs card-header-tabs font-weight-bold">
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment