diff --git a/ui-ngx/src/app/modules/home/components/api-key/components/dialog/add-api-key-dialog.component.html b/ui-ngx/src/app/modules/home/components/api-key/components/dialog/add-api-key-dialog.component.html index f1db112383..e91ede1277 100644 --- a/ui-ngx/src/app/modules/home/components/api-key/components/dialog/add-api-key-dialog.component.html +++ b/ui-ngx/src/app/modules/home/components/api-key/components/dialog/add-api-key-dialog.component.html @@ -46,9 +46,11 @@
- - {{ value | dateExpiration }} - + @for (value of expirationTimeOptions; track value) { + + {{ value | dateExpiration }} + + } {{'api-key.expiration-time-never' | translate}} {{'api-key.expiration-time-custom' | translate}} diff --git a/ui-ngx/src/app/modules/home/components/api-key/components/dialog/add-api-key-dialog.component.ts b/ui-ngx/src/app/modules/home/components/api-key/components/dialog/add-api-key-dialog.component.ts index b5611bca5a..548f2661fe 100644 --- a/ui-ngx/src/app/modules/home/components/api-key/components/dialog/add-api-key-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/api-key/components/dialog/add-api-key-dialog.component.ts @@ -15,13 +15,13 @@ /// -import { Component, OnInit, Inject } from '@angular/core'; +import { Component, Inject } from '@angular/core'; import { DialogComponent } from '@shared/components/dialog.component'; import { Store } from '@ngrx/store'; import { AppState } from '@core/core.state'; import { Router } from '@angular/router'; import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; -import { FormBuilder, Validators, UntypedFormGroup } from '@angular/forms'; +import { FormBuilder, Validators } from '@angular/forms'; import { deepTrim } from '@core/utils'; import { ApiKeyService } from '@core/http/api-key.service'; import { ApiKeyInfo } from '@shared/models/api-key.models'; @@ -33,14 +33,16 @@ import { DAY } from '@shared/models/time/time.models'; templateUrl: './add-api-key-dialog.component.html', styleUrls: ['./add-api-key-dialog.component.scss'] }) -export class AddApiKeyDialogComponent extends DialogComponent implements OnInit{ - - apiKeyForm: UntypedFormGroup; +export class AddApiKeyDialogComponent extends DialogComponent { readonly startDate = new Date(); - readonly expirationDates = [7, 30, 60, 90].map(days => days * DAY); - - private defaultExpirationDate = this.expirationDates[1]; + readonly expirationTimeOptions: Array = [7, 30, 60, 90].map(days => days * DAY); + readonly apiKeyForm = this.fb.group({ + description: [{value: null, disabled: false}, [Validators.required]], + enabled: [{value: true, disabled: false}, []], + expirationTime: [{value: this.expirationTimeOptions[1] as string | number, disabled: false}, [Validators.required]], + customExpirationTime: [{value: null, disabled: true}, []], + }); constructor( protected store: Store, @@ -53,15 +55,6 @@ export class AddApiKeyDialogComponent extends DialogComponent -

{{ 'api-key.generated-title' | translate }}

+

{{ 'api-key.generated-api-key-title' | translate }}

+ + +
+
device.connectivity.execute-following-command
+ +
+
diff --git a/ui-ngx/src/app/modules/home/components/api-key/components/dialog/api-key-generated-dialog.component.scss b/ui-ngx/src/app/modules/home/components/api-key/components/dialog/api-key-generated-dialog.component.scss index 3ea6dcb614..ecd4de8363 100644 --- a/ui-ngx/src/app/modules/home/components/api-key/components/dialog/api-key-generated-dialog.component.scss +++ b/ui-ngx/src/app/modules/home/components/api-key/components/dialog/api-key-generated-dialog.component.scss @@ -14,10 +14,16 @@ * limitations under the License. */ :host{ - display: block; - width: 600px; + display: grid; + width: 500px; + height: 100%; max-width: 100%; - color: rgba(0, 0, 0, 0.76); + max-height: 100vh; + grid-template-rows: min-content minmax(auto, 1fr) min-content; + + .tb-install-instruction-text { + min-height: 42px; + } } :host ::ng-deep { diff --git a/ui-ngx/src/app/modules/home/components/api-key/components/dialog/api-key-generated-dialog.component.ts b/ui-ngx/src/app/modules/home/components/api-key/components/dialog/api-key-generated-dialog.component.ts index 034b1fcca5..b60ba9ecde 100644 --- a/ui-ngx/src/app/modules/home/components/api-key/components/dialog/api-key-generated-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/api-key/components/dialog/api-key-generated-dialog.component.ts @@ -21,6 +21,7 @@ import { AppState } from '@core/core.state'; import { Router } from '@angular/router'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { userInfoCommand, ApiKey } from '@shared/models/api-key.models'; +import { getOS } from '@core/utils'; export interface ApiKeyGeneratedDialogData { apiKey: ApiKey; @@ -34,12 +35,14 @@ export interface ApiKeyGeneratedDialogData { export class ApiKeyGeneratedDialogComponent extends DialogComponent { apiKeyCommand = userInfoCommand(this.data.apiKey.value); + selectedTab: number; constructor(protected store: Store, protected router: Router, protected dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public data: ApiKeyGeneratedDialogData) { super(store, router, dialogRef); + this.selectTabIndexForUserOS(); } close(): void { @@ -52,4 +55,23 @@ export class ApiKeyGeneratedDialogComponent extends DialogComponent - -

{{ 'api-key.manage-api-keys' | translate }}

- -
- -
- -
- +
+ +

{{ 'api-key.manage-api-keys' | translate }}

+ +
+ +
+
+ +
+
+ +
diff --git a/ui-ngx/src/app/modules/home/components/api-key/components/dialog/api-keys-table-dialog.component.scss b/ui-ngx/src/app/modules/home/components/api-key/components/dialog/api-keys-table-dialog.component.scss index 2de6ec9c16..1f10a6166e 100644 --- a/ui-ngx/src/app/modules/home/components/api-key/components/dialog/api-keys-table-dialog.component.scss +++ b/ui-ngx/src/app/modules/home/components/api-key/components/dialog/api-keys-table-dialog.component.scss @@ -14,23 +14,14 @@ * limitations under the License. */ -:host ::ng-deep { - tb-api-keys-table { - tb-entities-table { - .tb-absolute-fill { - position: relative; - } - .table-container { - width: 1000px; - min-height: 625px; - max-height: 625px; - } - .no-data-found { - position: absolute; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - } +:host { + .api-keys-dialog-container { + width: 1080px; + max-width: 100%; + + .api-keys-dialog-content { + height: 65vh; + border-radius: 0; } } } diff --git a/ui-ngx/src/app/modules/home/components/home-components.module.ts b/ui-ngx/src/app/modules/home/components/home-components.module.ts index 365b5fa82a..cfafe70a96 100644 --- a/ui-ngx/src/app/modules/home/components/home-components.module.ts +++ b/ui-ngx/src/app/modules/home/components/home-components.module.ts @@ -512,9 +512,6 @@ import { ResourcesLibraryComponent, ApiKeysTableComponent, ApiKeysTableDialogComponent, - AddApiKeyDialogComponent, - EditApiKeyDescriptionPanelComponent, - ApiKeyGeneratedDialogComponent, ], providers: [ WidgetComponentService, diff --git a/ui-ngx/src/app/modules/home/pages/user/user-tabs.component.html b/ui-ngx/src/app/modules/home/pages/user/user-tabs.component.html index 79a7a51b79..14be03c2f3 100644 --- a/ui-ngx/src/app/modules/home/pages/user/user-tabs.component.html +++ b/ui-ngx/src/app/modules/home/pages/user/user-tabs.component.html @@ -40,7 +40,7 @@ label="{{ 'audit-log.audit-logs' | translate }}" #auditLogsTab="matTab"> - diff --git a/ui-ngx/src/app/shared/models/id/public-api.ts b/ui-ngx/src/app/shared/models/id/public-api.ts index 14db7a4b14..86787da6b8 100644 --- a/ui-ngx/src/app/shared/models/id/public-api.ts +++ b/ui-ngx/src/app/shared/models/id/public-api.ts @@ -45,3 +45,4 @@ export * from './widgets-bundle-id'; export * from './edge-id'; export * from './asset-id'; export * from './ai-model-id'; +export * from './api-key-id'; diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index efe99ac061..7963f9d23d 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -998,9 +998,9 @@ "generate": "Generate", "generate-title": "Generate API key", "generate-text": "Note: The API key's permissions will inherit the rights of the user account that generates it.", - "generated-title": "API key successfully generated", - "generated-text": "Make sure to copy and save your API key now as you will not be able to see it again.", - "generated-command-title": "Execute following command to display information about current user:", + "generated-api-key-title": "API key generated. Let’s check connectivity!", + "generated-api-key-copy": "Make sure to copy and save your API key now as you will not be able to see it again.", + "generated-api-key-command": "Use the following instructions to check connectivity. As a result, you should receive the current user information:", "list": "{ count, plural, =1 {One API key} other {List of # API keys} }", "manage": "Manage", "manage-api-keys": "Manage API keys",