summaryrefslogtreecommitdiffstats
path: root/usecaseui-portal/src/app/views/onboard-vnf-vm
diff options
context:
space:
mode:
Diffstat (limited to 'usecaseui-portal/src/app/views/onboard-vnf-vm')
-rw-r--r--usecaseui-portal/src/app/views/onboard-vnf-vm/onboard-vnf-vm.component.html245
-rw-r--r--usecaseui-portal/src/app/views/onboard-vnf-vm/onboard-vnf-vm.component.ts118
2 files changed, 251 insertions, 112 deletions
diff --git a/usecaseui-portal/src/app/views/onboard-vnf-vm/onboard-vnf-vm.component.html b/usecaseui-portal/src/app/views/onboard-vnf-vm/onboard-vnf-vm.component.html
index c48d68f9..34e78e60 100644
--- a/usecaseui-portal/src/app/views/onboard-vnf-vm/onboard-vnf-vm.component.html
+++ b/usecaseui-portal/src/app/views/onboard-vnf-vm/onboard-vnf-vm.component.html
@@ -16,108 +16,151 @@
<!-- tab -->
<nz-tabset [nzTabPosition]="'top'" [nzType]="'card'">
- <nz-tab *ngFor="let tab of tabs" [nzTitle]="tab" (nzClick)="handleTabChange(tab)"></nz-tab>
+ <nz-tab *ngFor="let tab of tabs" [nzTitle]="tab" (nzClick)="handleTabChange(tab)"></nz-tab>
</nz-tabset>
<div class="list">
- <!-- upload -->
- <div class="listUploadContainer">
- <div class="listupload">
- <nz-upload nzType="drag" [(nzFileList)]="fileList" [nzBeforeUpload]="beforeUpload">
- <p class="ant-upload-drag-icon">
- <i nz-icon type="inbox" class="anticon anticon-inbox"></i>
- </p>
- <p class="ant-upload-text"> {{"i18nTextDefine_Click_CSAR_File" | translate}} </p>
- <p class="ant-upload-hint"></p>
- </nz-upload>
- <button nz-button [nzLoading]="uploading" (click)="onClick()" [disabled]="fileList.length == 0" class="upload">
- {{ uploading ? 'Uploading' : 'Start Upload' }}
- </button>
- </div>
- <div class="listlin"></div>
- <div class="listfile">
- <div class="listFileTitle"> {{"i18nTextDefine_Uploaded_files" | translate}} </div>
- <div class="nouploadfile" [style.display]="display">{{"i18nTextDefine_Nofileuploading" | translate}}</div>
- <div class="listfilebgc" *ngIf="file">
- <i class="anticon anticon-link icon"></i>
- <div class="color" [ngClass]="{'progress':file.status}">{{file.name}}</div>
- <div class="color" *ngIf="file.status">
- <nz-progress [nzPercent]="file.progress" [nzShowInfo]="false"></nz-progress>
- </div>
- <div class="color" *ngIf="!file.status">
- <span *ngIf="file.success === 0">{{"i18nTextDefine_File_upload_completed" | translate}}</span>
- <span *ngIf="file.success === 1">{{"i18nTextDefine_File_upload_failed" | translate}}</span>
- </div>
- <div *ngIf="!file.status">
- <i class="anticon anticon-check-circle success" *ngIf="file.success === 0"></i>
- <i class="anticon anticon-exclamation-circle fail" *ngIf="file.success === 1"></i>
- </div>
- </div>
- </div>
- </div>
- <!-- table -->
- <nz-spin [nzSpinning]="isSpinning" class="listContainer">
- <div class="mask" *ngIf="isSpinning"></div>
- <nz-table #nzTable [nzData]="currentTab === 'NS'? nsTableData: (currentTab === 'VNF'? vnfTableData : pnfTableData)" nzShowSizeChanger [nzFrontPagination]="true"
- [nzShowQuickJumper]="true" [nzPageSizeOptions]="[5,10,15,20]" [(nzPageSize)]="pageSize"
- [(nzPageIndex)]='pageIndex' nzSize="middle">
- <thead>
- <tr class="theadColor">
- <th nzWidth="15%"> {{"i18nTextDefine_NO" | translate}} </th>
- <th nzWidth="15%"> {{"i18nTextDefine_Name" | translate}} </th>
- <th nzWidth="15%"> {{"i18nTextDefine_Version" | translate}} </th>
- <th nzWidth="15%"> {{"i18nTextDefine_OnboardingState" | translate}} </th>
- <th nzWidth="15%" *ngIf="currentTab !== 'PNF'"> {{"i18nTextDefine_OperationalState" | translate}} </th>
- <th nzWidth="10%"> {{"i18nTextDefine_UsageState" | translate}} </th>
- <th nzWidth="15%"> {{"i18nTextDefine_Operationbutton" | translate}} </th>
- </tr>
- </thead>
- <tbody *ngIf="currentTab === 'NS'">
- <tr *ngFor="let item of nzTable.data;let i = index;">
- <td>{{i+1}}</td>
- <td>{{item.nsdName || item.name }}</td>
- <td>{{item.nsdVersion || item.version}}</td>
- <td>{{item.nsdOnboardingState ? item.nsdOnboardingState : status}}</td>
- <td>{{item.nsdOperationalState}}</td>
- <td>{{item.nsdUsageState}}</td>
- <td>
- <i [ngClass]="{'cannotclick': isUpdate}"
- class="anticon anticon-upload upicon" #upload_icon (click)="updataService(item.uuid)"
- *ngIf="item.uuid"></i>
- <i class="anticon anticon-delete" (click)="showDeleteConfirm(item.id)"
- *ngIf="item.id"></i>
- </td>
- </tr>
- </tbody>
- <tbody *ngIf="currentTab === 'VNF'">
- <tr *ngFor="let item of nzTable.data;let i = index;">
- <td>{{i+1}}</td>
- <td>{{item.vnfProductName || item.name }}</td>
- <td>{{item.vnfdVersion || item.version}}</td>
- <td>{{item.onboardingState}}</td>
- <td>{{item.operationalState}}</td>
- <td>{{item.usageState}}</td>
- <td>
- <i [ngClass]="{'cannotclick': isUpdate}"
- class="anticon anticon-upload upicon" #upload_icon (click)="updataService(item.uuid)"
- *ngIf="item.uuid"></i>
- <i class="anticon anticon-delete" (click)="showDeleteConfirm(item.id)"
- *ngIf="item.id"></i>
- </td>
- </tr>
- </tbody>
- <tbody *ngIf="currentTab === 'PNF'" >
- <tr *ngFor="let item of nzTable.data; let i = index;">
- <td>{{i+1}}</td>
- <td>{{item.pnfdName}}</td>
- <td>{{item.pnfdVersion}}</td>
- <td>{{item.pnfdOnboardingState}}</td>
- <td>{{item.pnfdUsageState}}</td>
- <td>
- <i class="anticon anticon-delete" (click)="showDeleteConfirm(item.id)"></i>
- </td>
- </tr>
- </tbody>
- </nz-table>
- </nz-spin>
+ <!-- upload -->
+ <div class="listUploadContainer">
+ <div class="listupload">
+ <nz-upload nzType="drag" [(nzFileList)]="fileList" [nzBeforeUpload]="beforeUpload">
+ <p class="ant-upload-drag-icon">
+ <i nz-icon type="inbox" class="anticon anticon-inbox"></i>
+ </p>
+ <p class="ant-upload-text"> {{"i18nTextDefine_Click_CSAR_File" | translate}} </p>
+ <p class="ant-upload-hint"></p>
+ </nz-upload>
+ <button nz-button [nzLoading]="uploading" (click)="onClick()" [disabled]="fileList.length == 0" class="upload">
+ {{ uploading ? 'Uploading' : 'Start Upload' }}
+ </button>
+ </div>
+ <div class="listlin"></div>
+ <div class="listfile">
+ <div class="listFileTitle"> {{"i18nTextDefine_Uploaded_files" | translate}} </div>
+ <div class="nouploadfile" [style.display]="display">{{"i18nTextDefine_Nofileuploading" | translate}}</div>
+ <div class="listfilebgc" *ngIf="file">
+ <i class="anticon anticon-link icon"></i>
+ <div class="color" [ngClass]="{'progress':file.status}">{{file.name}}</div>
+ <div class="color" *ngIf="file.status">
+ <nz-progress [nzPercent]="file.progress" [nzShowInfo]="false"></nz-progress>
+ </div>
+ <div class="color" *ngIf="!file.status">
+ <span *ngIf="file.success === 0">{{"i18nTextDefine_File_upload_completed" | translate}}</span>
+ <span *ngIf="file.success === 1">{{"i18nTextDefine_File_upload_failed" | translate}}</span>
+ </div>
+ <div *ngIf="!file.status">
+ <i class="anticon anticon-check-circle success" *ngIf="file.success === 0"></i>
+ <i class="anticon anticon-exclamation-circle fail" *ngIf="file.success === 1"></i>
+ </div>
+ </div>
+ </div>
+ </div>
+ <!-- table -->
+ <nz-spin [nzSpinning]="isSpinning" class="listContainer">
+ <div class="mask" *ngIf="isSpinning"></div>
+ <nz-table
+ #nzTable
+ [nzData]="currentTab === 'NS'
+ ? nsTableData
+ : (currentTab === 'VNF'
+ ? vnfTableData
+ : (currentTab === 'PNF'
+ ? pnfTableData
+ : modelTableData
+ )
+ )"
+ nzShowSizeChanger
+ [nzFrontPagination]="true"
+ [nzShowQuickJumper]="true"
+ [nzPageSizeOptions]="[5,10,15,20]"
+ [(nzPageSize)]="pageSize"
+ [(nzPageIndex)]='pageIndex'
+ nzSize="middle"
+ >
+ <thead *ngIf="currentTab !== 'NLP Model Reource'">
+ <tr class="theadColor">
+ <th nzWidth="15%"> {{"i18nTextDefine_NO" | translate}} </th>
+ <th nzWidth="15%"> {{"i18nTextDefine_Name" | translate}} </th>
+ <th nzWidth="15%"> {{"i18nTextDefine_Version" | translate}} </th>
+ <th nzWidth="15%"> {{"i18nTextDefine_OnboardingState" | translate}} </th>
+ <th nzWidth="15%" *ngIf="currentTab !== 'PNF'"> {{"i18nTextDefine_OperationalState" | translate}} </th>
+ <th nzWidth="10%"> {{"i18nTextDefine_UsageState" | translate}} </th>
+ <th nzWidth="15%"> {{"i18nTextDefine_Operationbutton" | translate}} </th>
+ </tr>
+ </thead>
+ <thead *ngIf="currentTab === 'NLP Model Reource'">
+ <tr class="theadColor">
+ <th nzWidth="8%"> {{"i18nTextDefine_NO" | translate}} </th>
+ <th nzWidth="18%"> {{"i18nTextDefine_Name" | translate}} </th>
+ <th nzWidth="18%"> {{"i18nTextDefine_Size" | translate}} </th>
+ <th nzWidth="18%"> {{"i18nTextDefine_CreateTime" | translate}} </th>
+ <th nzWidth="18%"> {{"i18nTextDefine_Status" | translate}} </th>
+ <th nzWidth="20%"> {{"i18nTextDefine_Operation" | translate}} </th>
+ </tr>
+ </thead>
+ <tbody *ngIf="currentTab === 'NS'">
+ <tr *ngFor="let item of nzTable.data;let i = index;">
+ <td>{{i+1}}</td>
+ <td>{{item.nsdName || item.name }}</td>
+ <td>{{item.nsdVersion || item.version}}</td>
+ <td>{{item.nsdOnboardingState ? item.nsdOnboardingState : status}}</td>
+ <td>{{item.nsdOperationalState}}</td>
+ <td>{{item.nsdUsageState}}</td>
+ <td>
+ <i [ngClass]="{'cannotclick': isUpdate}"
+ class="anticon anticon-upload upicon" #upload_icon (click)="updataService(item.uuid)"
+ *ngIf="item.uuid"></i>
+ <i class="anticon anticon-delete" (click)="showDeleteConfirm(item.id)"
+ *ngIf="item.id"></i>
+ </td>
+ </tr>
+ </tbody>
+ <tbody *ngIf="currentTab === 'VNF'">
+ <tr *ngFor="let item of nzTable.data;let i = index;">
+ <td>{{i+1}}</td>
+ <td>{{item.vnfProductName || item.name }}</td>
+ <td>{{item.vnfdVersion || item.version}}</td>
+ <td>{{item.onboardingState}}</td>
+ <td>{{item.operationalState}}</td>
+ <td>{{item.usageState}}</td>
+ <td>
+ <i [ngClass]="{'cannotclick': isUpdate}"
+ class="anticon anticon-upload upicon" #upload_icon (click)="updataService(item.uuid)"
+ *ngIf="item.uuid"></i>
+ <i class="anticon anticon-delete" (click)="showDeleteConfirm(item.id)"
+ *ngIf="item.id"></i>
+ </td>
+ </tr>
+ </tbody>
+ <tbody *ngIf="currentTab === 'PNF'" >
+ <tr *ngFor="let item of nzTable.data; let i = index;">
+ <td>{{i+1}}</td>
+ <td>{{item.pnfdName}}</td>
+ <td>{{item.pnfdVersion}}</td>
+ <td>{{item.pnfdOnboardingState}}</td>
+ <td>{{item.pnfdUsageState}}</td>
+ <td>
+ <i class="anticon anticon-delete" (click)="showDeleteConfirm(item.id)"></i>
+ </td>
+ </tr>
+ </tbody>
+ <tbody *ngIf="currentTab === 'NLP Model Reource'">
+ <tr *ngFor="let item of nzTable.data;let i = index;">
+ <td>{{i+1}}</td>
+ <td>{{item.modelName}}</td>
+ <td>{{item.size}}</td>
+ <td>{{item.createTime}}</td>
+ <td>{{item.active ? 'Active' : 'Inactive'}}</td>
+ <td>
+ <button nz-button nzType="primary" class="buy-button" (click)="showDeleteConfirm(item.id)">
+ Delete
+ </button>
+ <button nz-button nzType="primary" class="buy-button" (click)="activedModelFile(item)">
+ Actived
+ </button>
+ </td>
+ </tr>
+ </tbody>
+ </nz-table>
+ </nz-spin>
</div>
<app-notification #notification [isServicesList]="false"></app-notification> \ No newline at end of file
diff --git a/usecaseui-portal/src/app/views/onboard-vnf-vm/onboard-vnf-vm.component.ts b/usecaseui-portal/src/app/views/onboard-vnf-vm/onboard-vnf-vm.component.ts
index 98f40637..0a25f2b1 100644
--- a/usecaseui-portal/src/app/views/onboard-vnf-vm/onboard-vnf-vm.component.ts
+++ b/usecaseui-portal/src/app/views/onboard-vnf-vm/onboard-vnf-vm.component.ts
@@ -31,7 +31,7 @@ export class OnboardVnfVmComponent implements OnInit {
@ViewChild('notification') notification: any;
// upload
- tabs: string[] = ['NS', 'VNF', 'PNF'];
+ tabs: string[] = ['NS', 'VNF', 'PNF', 'NLP Model Reource'];
currentTab: string = 'NS'
fileList: UploadFile[] = [];
uploading: boolean = false;
@@ -43,6 +43,7 @@ export class OnboardVnfVmComponent implements OnInit {
nsTableData: any[];
vnfTableData: any[];
pnfTableData: any[];
+ modelTableData: any[];
status: string = "Onboard Available";
pageIndex: number = 1;
pageSize: number = 10;
@@ -55,7 +56,8 @@ export class OnboardVnfVmComponent implements OnInit {
url = {
ns: '/api/nsd/v1/ns_descriptors/*_*/nsd_content',
vnf: '/api/vnfpkgm/v1/vnf_packages/*_*/package_content',
- pnf: '/api/nsd/v1/pnf_descriptors/*_*/pnfd_content'
+ pnf: '/api/nsd/v1/pnf_descriptors/*_*/pnfd_content',
+ model: '/api/usecaseui-server/v1/intent/uploadModel'
};
file: {
@@ -94,6 +96,9 @@ export class OnboardVnfVmComponent implements OnInit {
case 'PNF':
this.getTablePnfData()
break
+ case 'NLP Model Reource':
+ this.getTableModelData();
+ break
}
}
@@ -113,8 +118,10 @@ export class OnboardVnfVmComponent implements OnInit {
API = 'createNetworkServiceData';
} else if (this.currentTab === 'VNF') {
API = 'createVnfData';
- } else {
+ } else if (this.currentTab === 'PNF') {
API = 'createPnfData';
+ } else {
+ return false;
}
this.myhttp.getCreatensData(API, this.requestBody)//on-line
.subscribe((data) => {
@@ -128,8 +135,58 @@ export class OnboardVnfVmComponent implements OnInit {
// Drag and drop and click the upload button
onClick(): void {
this.display = 'none';
- let tab = this.currentTab === 'NS' ? 'ns' : (this.currentTab === 'VNF' ? 'vnf' : 'pnf')
- this.handleUpload(this.url[tab].replace("*_*", this.infoId));
+ let tab = this.currentTab === 'NS' ? 'ns' : (this.currentTab === 'VNF' ? 'vnf' : (this.currentTab === 'PNF' ? 'pnf' : 'model'));
+ let url = tab === "model" ? this.url[tab] : this.url[tab].replace("*_*", this.infoId);
+ tab === "model" ? this.handleUploadModel(url) : this.handleUpload(url);
+ }
+
+ handleUploadModel(url: string): void {
+ const formData = new FormData();
+ // tslint:disable-next-line:no-any
+ this.fileList.forEach((file: any) => {
+ formData.set('file', file);
+ });
+ this.uploading = true;
+ this.file = {
+ name: this.fileList[0].name,
+ uid: this.fileList[0].uid,
+ progress: 0,
+ status: true,
+ success: 0
+ };
+ let requery = (file) => {
+ file.progress += 3;
+ setTimeout(() => {
+ if (file.progress < 100) {
+ requery(file)
+ }
+ }, 100)
+ };
+ requery(this.file);
+ const req = new HttpRequest('POST', url, formData, {
+ reportProgress: true,
+ withCredentials: true
+ });
+ //Upload pre-empty array
+ this.fileList = [];
+ this.http.request(req)
+ .pipe(filter(e => e instanceof HttpResponse))
+ .subscribe(
+ (event: {}) => {
+ this.file.progress = 100;
+ this.file.status = false;
+ this.uploading = false;
+ this.msg.success('upload successfully.');
+ this.getTableModelData();
+ },
+ err => {
+ this.file.progress = 100;
+ this.file.status = false;
+ this.file.success = 1;
+ this.uploading = false;
+ this.msg.error('upload failed.');
+ }
+ );
}
handleUpload(url: string): void {
@@ -244,6 +301,22 @@ export class OnboardVnfVmComponent implements OnInit {
})
}
+ // Get Model list
+ getTableModelData() {
+ this.isSpinning = true;
+ this.myhttp.getOnboardTableModelData()
+ .subscribe((data) => {
+ data.forEach(element => {
+ element['size'] = `${element['size']}K`;
+ })
+ this.modelTableData = data;
+ this.isSpinning = false; //loading hide
+ }, (err) => {
+ console.error(err);
+ this.isSpinning = false;
+ })
+ }
+
// confirm
showConfirm(requestBody: object, id: string): void {
let API = this.currentTab === 'NS' ? 'getNsonboard' : 'getVnfonboard';
@@ -333,17 +406,20 @@ export class OnboardVnfVmComponent implements OnInit {
API = 'deleteNsIdData';
} else if (this.currentTab === 'VNF') {
API = 'deleteVnfIdData';
- } else {
+ } else if (this.currentTab === 'PNF') {
API = 'deletePnfIdData';
+ } else {
+ API = 'deleteModelIdData';
}
this.myhttp[API](pkgid)
.subscribe((data) => {
resolve()
- if(data.status === 'FAILED'){
- this.notification.notificationFailed(this.currentTab, 'delete', pkgid);
- }else {
- this.notification.notificationSuccess(this.currentTab, 'delete', pkgid);
- }
+ let tipTitle = this.currentTab === 'NLP Model Reource' ? 'MODELREOURCE' : this.currentTab
+ if(data.status === 'FAILED'){
+ this.notification.notificationFailed(tipTitle, 'delete', pkgid);
+ }else {
+ this.notification.notificationSuccess(tipTitle, 'delete', pkgid);
+ }
//refresh list after successful deletion
switch (this.currentTab) {
case 'NS':
@@ -355,10 +431,30 @@ export class OnboardVnfVmComponent implements OnInit {
case 'PNF':
this.getTablePnfData();
break
+ case 'NLP Model Reource':
+ this.getTableModelData();
+ break
}
}, (err) => {
console.log(err);
this.notification.notificationFailed(this.currentTab, 'delete', pkgid);
})
}
+
+ // Actived Model Resource
+ activedModelFile(data) {
+ console.log('actived model');
+ let url = `/api/usecaseui-server/v1/intent/activeModel?modelId=${data.id}`;
+ this.myhttp.getOnboardTableActiveModelData(url)
+ .subscribe((data) => {
+ if(data.status === 'FAILED'){
+ this.msg.success('Actived Failed');
+ return;
+ }
+ this.msg.success('Actived Successfully');
+ this.getTableModelData();
+ }, (err) => {
+ console.error(err);
+ });
+ }
}