src/app/ceph/cephfs/cephfs-list/cephfs-list.component.ts
selector | cd-cephfs-list |
styleUrls | ./cephfs-list.component.scss |
templateUrl | ./cephfs-list.component.html |
Properties |
Methods |
constructor(cephfsService: CephfsService, i18n: I18n)
|
|||||||||
Parameters :
|
loadFilesystems | ||||||
loadFilesystems(context: CdTableFetchDataContext)
|
||||||
Parameters :
Returns :
void
|
ngOnInit |
ngOnInit()
|
Returns :
void
|
updateSelection | ||||||
updateSelection(selection: CdTableSelection)
|
||||||
Parameters :
Returns :
void
|
columns |
Type : CdTableColumn[]
|
filesystems |
Type : any
|
Default value : []
|
selection |
Default value : new CdTableSelection()
|
import { Component, OnInit } from '@angular/core';
import { I18n } from '@ngx-translate/i18n-polyfill';
import { CephfsService } from '../../../shared/api/cephfs.service';
import { CdTableColumn } from '../../../shared/models/cd-table-column';
import { CdTableFetchDataContext } from '../../../shared/models/cd-table-fetch-data-context';
import { CdTableSelection } from '../../../shared/models/cd-table-selection';
@Component({
selector: 'cd-cephfs-list',
templateUrl: './cephfs-list.component.html',
styleUrls: ['./cephfs-list.component.scss']
})
export class CephfsListComponent implements OnInit {
columns: CdTableColumn[];
filesystems: any = [];
selection = new CdTableSelection();
constructor(private cephfsService: CephfsService, private i18n: I18n) {}
ngOnInit() {
this.columns = [
{
name: this.i18n('Name'),
prop: 'mdsmap.fs_name',
flexGrow: 2
},
{
name: this.i18n('Created'),
prop: 'mdsmap.created',
flexGrow: 2
},
{
name: this.i18n('Enabled'),
prop: 'mdsmap.enabled',
flexGrow: 1
}
];
}
loadFilesystems(context: CdTableFetchDataContext) {
this.cephfsService.list().subscribe(
(resp: any[]) => {
this.filesystems = resp;
},
() => {
context.error();
}
);
}
updateSelection(selection: CdTableSelection) {
this.selection = selection;
}
}
<cd-table [data]="filesystems"
columnMode="flex"
[columns]="columns"
(fetchData)="loadFilesystems($event)"
identifier="id"
forceIdentifier="true"
selectionType="single"
(updateSelection)="updateSelection($event)">
<cd-cephfs-detail cdTableDetail
[selection]="selection">
</cd-cephfs-detail>
</cd-table>
./cephfs-list.component.scss