import { BsModalService } from 'ngx-bootstrap/modal';
import { RgwUserService } from '../../../shared/api/rgw-user.service';
+import { Icons } from '../../../shared/enum/icons.enum';
import { CdTableColumn } from '../../../shared/models/cd-table-column';
import { CdTableSelection } from '../../../shared/models/cd-table-selection';
import { RgwUserS3Key } from '../models/rgw-user-s3-key';
styleUrls: ['./rgw-user-details.component.scss']
})
export class RgwUserDetailsComponent implements OnChanges, OnInit {
- @ViewChild('accessKeyTpl')
+ @ViewChild('accessKeyTpl', { static: false })
public accessKeyTpl: TemplateRef<any>;
- @ViewChild('secretKeyTpl')
+ @ViewChild('secretKeyTpl', { static: false })
public secretKeyTpl: TemplateRef<any>;
@Input()
// Details tab
user: any;
+ maxBucketsMap: {};
// Keys tab
keys: any = [];
keysColumns: CdTableColumn[] = [];
keysSelection: CdTableSelection = new CdTableSelection();
+ icons = Icons;
+
constructor(
private rgwUserService: RgwUserService,
private bsModalService: BsModalService,
flexGrow: 1
}
];
+ this.maxBucketsMap = {
+ '-1': this.i18n('Disabled'),
+ 0: this.i18n('Unlimited')
+ };
}
ngOnChanges() {
// Process the keys.
this.keys = [];
- this.user.keys.forEach((key: RgwUserS3Key) => {
- this.keys.push({
- id: this.keys.length + 1, // Create an unique identifier
- type: 'S3',
- username: key.user,
- ref: key
+ if (this.user.keys) {
+ this.user.keys.forEach((key: RgwUserS3Key) => {
+ this.keys.push({
+ id: this.keys.length + 1, // Create an unique identifier
+ type: 'S3',
+ username: key.user,
+ ref: key
+ });
});
- });
- this.user.swift_keys.forEach((key: RgwUserSwiftKey) => {
- this.keys.push({
- id: this.keys.length + 1, // Create an unique identifier
- type: 'Swift',
- username: key.user,
- ref: key
+ }
+ if (this.user.swift_keys) {
+ this.user.swift_keys.forEach((key: RgwUserSwiftKey) => {
+ this.keys.push({
+ id: this.keys.length + 1, // Create an unique identifier
+ type: 'Swift',
+ username: key.user,
+ ref: key
+ });
});
- });
+ }
+
this.keys = _.sortBy(this.keys, 'user');
}
}