From: Naman Munet Date: Mon, 9 Dec 2024 11:40:17 +0000 (+0530) Subject: mgr/dashboard: RGW user accounts UI X-Git-Tag: v20.0.0~305^2~4 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=d12857161df61c82d76aff7b3abafb832e8a2e57;p=ceph.git mgr/dashboard: RGW user accounts UI --> Integrated list endpoint Fixes: https://tracker.ceph.com/issues/69140 Signed-off-by: Naman Munet --- diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/models/rgw-user-accounts.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/models/rgw-user-accounts.ts new file mode 100644 index 0000000000000..2cc05048ec4d4 --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/models/rgw-user-accounts.ts @@ -0,0 +1,21 @@ +export interface Accounts { + id: string; + tenant: string; + name: string; + email: string; + quota: Quota; + bucket_quota: Quota; + max_users: number; + max_roles: number; + max_groups: number; + max_buckets: number; + max_access_keys: number; +} + +interface Quota { + enabled: boolean; + check_on_raw: boolean; + max_size: number; + max_size_kb: number; + max_objects: number; +} diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-accounts/rgw-user-accounts.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-accounts/rgw-user-accounts.component.html new file mode 100644 index 0000000000000..b10972a492a4a --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-accounts/rgw-user-accounts.component.html @@ -0,0 +1,24 @@ + + + User Accounts + + This feature allows administrators to assign unique credentials to individual users or applications, + ensuring granular access control and improved security across the cluster. + + + + + + diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-accounts/rgw-user-accounts.component.scss b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-accounts/rgw-user-accounts.component.scss new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-accounts/rgw-user-accounts.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-accounts/rgw-user-accounts.component.spec.ts new file mode 100644 index 0000000000000..d6bdd8a270c8a --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-accounts/rgw-user-accounts.component.spec.ts @@ -0,0 +1,22 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { RgwUserAccountsComponent } from './rgw-user-accounts.component'; + +describe('RgwUserAccountsComponent', () => { + let component: RgwUserAccountsComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [RgwUserAccountsComponent] + }).compileComponents(); + + fixture = TestBed.createComponent(RgwUserAccountsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-accounts/rgw-user-accounts.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-accounts/rgw-user-accounts.component.ts new file mode 100644 index 0000000000000..64686d251c3c4 --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-accounts/rgw-user-accounts.component.ts @@ -0,0 +1,101 @@ +import { Component, OnInit, ViewChild } from '@angular/core'; + +import { ActionLabelsI18n } from '~/app/shared/constants/app.constants'; +import { TableComponent } from '~/app/shared/datatable/table/table.component'; +import { CdTableAction } from '~/app/shared/models/cd-table-action'; +import { CdTableColumn } from '~/app/shared/models/cd-table-column'; +import { CdTableFetchDataContext } from '~/app/shared/models/cd-table-fetch-data-context'; +import { CdTableSelection } from '~/app/shared/models/cd-table-selection'; +import { Permission } from '~/app/shared/models/permissions'; +import { AuthStorageService } from '~/app/shared/services/auth-storage.service'; +import { Accounts } from '../models/rgw-user-accounts'; +import { RgwUserAccountsService } from '~/app/shared/api/rgw-user-accounts.service'; + +@Component({ + selector: 'cd-rgw-user-accounts', + templateUrl: './rgw-user-accounts.component.html', + styleUrls: ['./rgw-user-accounts.component.scss'] +}) +export class RgwUserAccountsComponent implements OnInit { + @ViewChild(TableComponent, { static: true }) + table: TableComponent; + permission: Permission; + tableActions: CdTableAction[] = []; + columns: CdTableColumn[] = []; + accounts: Accounts[] = []; + selection: CdTableSelection = new CdTableSelection(); + + constructor( + private authStorageService: AuthStorageService, + public actionLabels: ActionLabelsI18n, + private rgwUserAccountsService: RgwUserAccountsService + ) {} + + ngOnInit() { + this.permission = this.authStorageService.getPermissions().rgw; + this.columns = [ + { + name: $localize`Account Id`, + prop: 'id', + flexGrow: 1 + }, + { + name: $localize`Tenant`, + prop: 'tenant', + flexGrow: 1 + }, + { + name: $localize`Full name`, + prop: 'name', + flexGrow: 1 + }, + { + name: $localize`Email address`, + prop: 'email', + flexGrow: 1 + }, + { + name: $localize`Max Users`, + prop: 'max_users', + flexGrow: 1 + }, + { + name: $localize`Max Roles`, + prop: 'max_roles', + flexGrow: 1 + }, + { + name: $localize`Max Groups`, + prop: 'max_groups', + flexGrow: 1 + }, + { + name: $localize`Max. buckets`, + prop: 'max_buckets', + flexGrow: 1 + }, + { + name: $localize`Max Access Keys`, + prop: 'max_access_keys', + flexGrow: 1 + } + ]; + } + + getAccountsList(context: CdTableFetchDataContext) { + this.rgwUserAccountsService.list(true).subscribe({ + next: (accounts) => { + this.accounts = accounts; + }, + error: () => { + if (context) { + context.error(); + } + } + }); + } + + updateSelection(selection: CdTableSelection) { + this.selection = selection; + } +} diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-tabs/rgw-user-tabs.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-tabs/rgw-user-tabs.component.html index 8ad1ac19309e7..92069bb5785bb 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-tabs/rgw-user-tabs.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-tabs/rgw-user-tabs.component.html @@ -7,6 +7,14 @@ [routerLinkActiveOptions]="{exact: true}" i18n>Users +