Skip to content

Commit

Permalink
Merge pull request #18 from jimccfun/master
Browse files Browse the repository at this point in the history
Fixed Object list bug
  • Loading branch information
leonwanghui authored Nov 28, 2018
2 parents 1d38d95 + 48c34a7 commit 4ac7a83
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
16 changes: 13 additions & 3 deletions src/app/business/resource/resource.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Router } from '@angular/router';
import { Component, OnInit, ViewContainerRef, ViewChild, Directive, ElementRef, HostBinding, HostListener } from '@angular/core';
import { I18NService, ParamStorService} from 'app/shared/api';
import { I18NService, ParamStorService, Consts} from 'app/shared/api';
import { Http } from '@angular/http';
import { trigger, state, style, transition, animate} from '@angular/animations';
import { I18nPluralPipe } from '@angular/common';
Expand Down Expand Up @@ -87,8 +87,6 @@ export class ResourceComponent implements OnInit{

if(ele.storageType == "" || ele.storageType == "block"){
this.blockStorages.push({name,ip,status,description,region,az,type});
}else{
this.objectStorages.push({name,ip,status,description,region,az,type});
}

});
Expand Down Expand Up @@ -117,6 +115,18 @@ export class ResourceComponent implements OnInit{
this.tabPrimary = "block";
}else{
this.tabPrimary = "object";
this.http.get('v1/{project_id}/backends').subscribe((res)=>{
let backends = res.json().backends ? res.json().backends :[];

this.objectStorages = backends.filter(element => {
return element.type == "fusionstorage-object";
})

this.objectStorages.forEach(element => {
element.type = Consts.CLOUD_TYPE_NAME[element.type];
element['status'] = "Enable";
})
})
}
}

Expand Down
5 changes: 2 additions & 3 deletions src/app/business/resource/resource.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,10 @@
<div *ngIf="tabPrimary=='object'">
<p-dataTable [immutable]="false" [globalFilter]="searchByName" [value]="objectStorages" [rows]="10" [paginator]="true" [pageLinks]="3" [rowsPerPageOptions]="[10,20,50]">
<p-column field="name" header="{{I18N.keyID['sds_block_volume_name']}}" [style]="{'width': '20%'}"></p-column>
<p-column field="ip" [style]="{'width':'auto'}" header="IP Address"></p-column>
<p-column field="status" header="{{I18N.keyID['sds_block_volume_status']}}"></p-column>
<p-column field="description" header="{{I18N.keyID['sds_block_volume_descri']}}"></p-column>
<p-column field="type" header="Type"></p-column>
<p-column field="endpoint" [style]="{'width':'auto'}" header="Endpoint"></p-column>
<p-column field="region" header="{{I18N.keyID['sds_resource_region']}}"></p-column>
<p-column field="az" header="{{I18N.keyID['sds_block_volume_az']}}"></p-column>
</p-dataTable>
</div>
</div>

0 comments on commit 4ac7a83

Please sign in to comment.