Skip to content

Commit a778291

Browse files
committed
Cleanup after api key
1 parent ff1ecf9 commit a778291

File tree

3 files changed

+7
-65
lines changed

3 files changed

+7
-65
lines changed

src/app/admin/api-key/api-key-edit/api-key-edit.component.ts

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,10 @@ export class ApiKeyEditComponent implements OnInit {
2424
};
2525
public title = '';
2626
public submitButton = '';
27-
private id: number;
2827
public errorMessage: string;
2928
public errorMessages: string[];
3029
public errorFields: string[];
3130
public formFailedSubmit = false;
32-
public isEditMode = false;
3331
public permissions: PermissionResponse[] = [];
3432
private organizationId: number;
3533

@@ -56,30 +54,9 @@ export class ApiKeyEditComponent implements OnInit {
5654
this.submitButton = translations['API-KEY.EDIT.SAVE'];
5755
});
5856

59-
this.id = +this.route.snapshot.paramMap.get('api-key-id');
6057
this.organizationId = this.sharedVariableService.getSelectedOrganisationId();
61-
62-
// if (this.id > 0) {
63-
// // TODO: Fetch current api key
64-
// this.getApiKey(this.id);
65-
// this.isEditMode = true;
66-
// }
6758
}
6859

69-
// private getApiKey(id: number) {
70-
// this.apiKeyService.get(id).subscribe(
71-
// (response) => {
72-
// console.log(response);
73-
// this.apiKeyRequest.id = response.id;
74-
// this.apiKeyRequest.name = response.name;
75-
// this.apiKeyRequest.permissions = response.permissions;
76-
// },
77-
// (error: HttpErrorResponse) => {
78-
// this.showError(error);
79-
// }
80-
// );
81-
// }
82-
8360
private getPermissions() {
8461
this.permissionService
8562
.getPermissions(
@@ -103,7 +80,7 @@ export class ApiKeyEditComponent implements OnInit {
10380
}
10481

10582
onSubmit(): void {
106-
this.id ? this.update() : this.create();
83+
this.create();
10784
}
10885

10986
private create(): void {
@@ -113,12 +90,6 @@ export class ApiKeyEditComponent implements OnInit {
11390
);
11491
}
11592

116-
private update(): void {
117-
this.apiKeyService
118-
.update(this.apiKeyRequest, this.id)
119-
.subscribe(this.routeBack, this.showError);
120-
}
121-
12293
public compare(o1: any, o2: any): boolean {
12394
return o1 === o2;
12495
}

src/app/admin/api-key/api-key-list/api-key-table/api-key-table.component.html

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -50,35 +50,12 @@
5050
<ng-container matColumnDef="menu">
5151
<th mat-header-cell *matHeaderCellDef></th>
5252
<td mat-cell *matCellDef="let element">
53-
<div class="dropdown" *ngIf="canAccess(element)">
54-
<a
55-
href="#"
56-
role="button"
57-
id="tableRowDropdown-{{ element.id }}"
58-
class="applicationRow__edit dropdown-toggle"
59-
data-toggle="dropdown"
60-
aria-expanded="false"
61-
[attr.aria-label]="'APPLICATION-TABLE-ROW.SHOW-OPTIONS' | translate"
62-
></a>
63-
<ul
64-
class="dropdown-menu dropdown-menu--table"
65-
attr.aria-labelledby="tableRowDropdown-{{ element.id }}"
66-
>
67-
<!-- TODO: Delete. Edit is not part of estimate. Since it's only one option, use a delete button instead -->
68-
<!-- <li class="dropdown-item">
69-
<a
70-
[routerLink]="['/admin/api-key', element.id, 'edit-api-key']"
71-
routerLinkActive="active"
72-
>{{ 'API-KEY.TABLE-ROW.EDIT' | translate }}
73-
</a>
74-
</li> -->
75-
<li class="dropdown-item">
76-
<a (click)="deleteApiKey(element.id)" [routerLink]=""
77-
>{{ 'API-KEY.TABLE-ROW.DELETE' | translate }}
78-
</a>
79-
</li>
80-
</ul>
81-
</div>
53+
<a
54+
*ngIf="canAccess(element)"
55+
(click)="deleteApiKey(element.id)"
56+
[routerLink]=""
57+
>{{ 'API-KEY.TABLE-ROW.DELETE' | translate }}
58+
</a>
8259
</td>
8360
</ng-container>
8461

src/app/admin/api-key/api-key.service.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@ export class ApiKeyService {
2525
});
2626
}
2727

28-
update(body: ApiKeyRequest, id: number): Observable<ApiKeyResponse> {
29-
return this.restService.put(this.endpoint, body, id, {
30-
observe: 'response',
31-
});
32-
}
33-
3428
get(id: number): Observable<ApiKeyResponse> {
3529
return this.restService.get(this.endpoint, {}, id).pipe(
3630
map((response: ApiKeyResponse) => {

0 commit comments

Comments
 (0)