OPS-339: Replace api keys page (#144)

This commit is contained in:
Rinat Arsaev 2023-08-28 15:13:49 +04:00 committed by GitHub
parent 8a70a839e0
commit c152e05222
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 7 additions and 146 deletions

View File

@ -1,7 +1,7 @@
name: Main
on:
push:
branches: ['master', 'main']
branches: ['master', 'main', 'epic/**']
jobs:
build:
name: Build

View File

@ -1,16 +0,0 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { ApiKeyComponent } from './api-key.component';
const ROUTES: Routes = [
{
path: '',
component: ApiKeyComponent,
},
];
@NgModule({
imports: [RouterModule.forChild(ROUTES)],
})
export class ApiKeyRoutingModule {}

View File

@ -1,31 +0,0 @@
<dsh-card
*transloco="let t; scope: 'payment-section'; read: 'paymentSection.apiKey'"
fxLayout="column"
>
<dsh-card-content fxLayout="column" fxLayoutGap="32px">
<div class="dsh-headline">{{ t('title') }}</div>
<div fxLayout="column" fxLayoutGap="24px">
<div class="dsh-subheading-2">
{{ t('description') }}
<a [href]="paymentsApiSpecEndpoint" target="_blank">{{ t('api') }}</a>
</div>
<div class="ym-hide-content" fxLayout="column" fxLayoutGap="32px">
<mat-form-field>
<input [value]="token$ | async" class="ym-disable-keys" matInput readonly />
</mat-form-field>
<div fxLayout fxLayoutAlign="stretch" fxLayoutAlign.gt-sm="end">
<button
[cdkCopyToClipboard]="token$ | async"
color="accent"
dsh-button
fxFlex
fxFlex.gt-sm="none"
(cdkCopyToClipboardCopied)="copied($event)"
>
{{ t('copy') }}
</button>
</div>
</div>
</div>
</dsh-card-content>
</dsh-card>

View File

@ -1,3 +0,0 @@
:host {
width: 100%;
}

View File

@ -1,35 +0,0 @@
import { Component } from '@angular/core';
import { TranslocoService } from '@ngneat/transloco';
import { KeycloakService } from 'keycloak-angular';
import { from } from 'rxjs';
import { NotificationService } from '@dsh/app/shared';
import { ConfigService } from '../../../../config';
@Component({
templateUrl: 'api-key.component.html',
styleUrls: ['api-key.component.scss'],
})
export class ApiKeyComponent {
token$ = from(this.keycloakService.getToken());
paymentsApiSpecEndpoint = this.configService.docsEndpoints.payments;
constructor(
private keycloakService: KeycloakService,
private configService: ConfigService,
private notificationService: NotificationService,
private transloco: TranslocoService,
) {}
copied(isCopied: boolean): void {
if (isCopied)
this.notificationService.success(
this.transloco.translate('shared.copied', null, 'components'),
);
else
this.notificationService.success(
this.transloco.translate('shared.copyFailed', null, 'components'),
);
}
}

View File

@ -1,27 +0,0 @@
import { ClipboardModule } from '@angular/cdk/clipboard';
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FlexModule } from '@angular/flex-layout';
import { MatInputModule } from '@angular/material/input';
import { TranslocoModule } from '@ngneat/transloco';
import { ButtonModule } from '@dsh/components/buttons';
import { CardModule } from '@dsh/components/layout';
import { ApiKeyRoutingModule } from './api-key-routing.module';
import { ApiKeyComponent } from './api-key.component';
@NgModule({
imports: [
ApiKeyRoutingModule,
FlexModule,
TranslocoModule,
CardModule,
MatInputModule,
CommonModule,
ButtonModule,
ClipboardModule,
],
declarations: [ApiKeyComponent],
})
export class ApiKeyModule {}

View File

@ -1 +0,0 @@
export * from './api-key.module';

View File

@ -3,8 +3,6 @@ import { RouterModule, Routes } from '@angular/router';
import { createPrivateRoute, RoleAccessName } from '@dsh/app/auth';
import { environment } from '../../../../environments';
import { IntegrationsComponent } from './integrations.component';
const ROUTES: Routes = [
@ -29,9 +27,7 @@ const ROUTES: Routes = [
createPrivateRoute(
{
path: 'api-keys',
loadChildren: environment.stage
? () => import('./api-keys').then((m) => m.ApiKeysModule)
: () => import('./api-key').then((m) => m.ApiKeyModule),
loadChildren: () => import('./api-keys').then((m) => m.ApiKeysModule),
},
[RoleAccessName.ApiKeys],
),

View File

@ -1,8 +1,6 @@
import { Component } from '@angular/core';
import { TranslocoService } from '@ngneat/transloco';
import { environment } from '../../../../environments';
@Component({
templateUrl: 'integrations.component.html',
})
@ -18,17 +16,11 @@ export class IntegrationsComponent {
},
{
path: 'api-keys',
label$: environment.stage
? this.transloco.selectTranslate(
'integrations.tabs.api-keys',
null,
'payment-section',
)
: this.transloco.selectTranslate(
'integrations.tabs.api-key',
null,
'payment-section',
),
label$: this.transloco.selectTranslate(
'integrations.tabs.api-keys',
null,
'payment-section',
),
},
{
path: 'webhooks',

View File

@ -12,12 +12,6 @@
},
"unsuccessfulPaymentReasons": "Unsuccessful payments reasons"
},
"apiKey": {
"api": "API",
"copy": "Copy",
"description": "Your private key to access the",
"title": "API key"
},
"apiKeys": {
"apiKey": "API key",
"copy": {
@ -116,7 +110,6 @@
},
"integrations": {
"tabs": {
"api-key": "API KEY",
"api-keys": "API KEYS",
"payment-link": "PAYMENT LINK",
"webhooks": "WEBHOOKS"

View File

@ -12,12 +12,6 @@
},
"unsuccessfulPaymentReasons": "Причины неуспешных платежей"
},
"apiKey": {
"api": "API",
"copy": "Скопировать",
"description": "Ваш приватный ключ для доступа к",
"title": "API ключ"
},
"apiKeys": {
"apiKey": "API ключ",
"copy": {
@ -116,7 +110,6 @@
},
"integrations": {
"tabs": {
"api-key": "API КЛЮЧ",
"api-keys": "API КЛЮЧИ",
"payment-link": "ПЛАТЕЖНАЯ ССЫЛКА",
"webhooks": "WEBHOOKS"