Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
963f5d4
Added message to prompt when attempting to delete application with Si…
AugustHA-Iterator Nov 12, 2021
456672f
Made the first additions to multicast in frontend. Will try to connec…
AugustHA-Iterator Nov 16, 2021
f73d376
Minor changes to make it work with backend.
AugustHA-Iterator Nov 17, 2021
4b11b86
PR Changes. Also made the check for sigfox devices in detail page, wh…
AugustHA-Iterator Nov 19, 2021
6d8c989
Minor changes so detail page will show how updated/created the multicast
AugustHA-Iterator Nov 19, 2021
0ca1526
PR Changes + formatting
AugustHA-Iterator Nov 22, 2021
16038ff
Moved two buttons, multicast and datatargets, to a tab bar in applica…
AugustHA-Iterator Nov 23, 2021
473c763
minor typo fix
AugustHA-Iterator Nov 24, 2021
7fffca2
Finalized CRUD in frontend. Removed list maps from datatarget and mul…
AugustHA-Iterator Nov 25, 2021
976b6bd
Merge branch 'master' into feature/IOT-16_FrontendCRUD
AugustHA-Iterator Nov 25, 2021
8a1dba2
Init api key menu item
AramAlsabti Nov 26, 2021
cb783e3
changed division in db so the frontend will receive a different promi…
AugustHA-Iterator Nov 29, 2021
8c02051
First additions to "add device to multicast". A dropdown is made with…
AugustHA-Iterator Nov 29, 2021
a73a2b6
Made frontend functionality so you can add devices to a multicast whe…
AugustHA-Iterator Nov 30, 2021
513ddc7
made snack for fail to load on multicast edit page
AugustHA-Iterator Nov 30, 2021
21f728f
Show api keys
AramAlsabti Nov 30, 2021
e25152c
removed 2 console logs
AugustHA-Iterator Dec 1, 2021
ff1ecf9
Api key management works
AramAlsabti Dec 1, 2021
a778291
Cleanup after api key
AramAlsabti Dec 1, 2021
2635888
Message to multicast. Made the form and service operations to send to…
AugustHA-Iterator Dec 2, 2021
5f88b68
Changed details page. Not splitted up in basic details, and lorawan d…
AugustHA-Iterator Dec 6, 2021
5780eae
PR changes plus search function for devices in multicast
AugustHA-Iterator Dec 14, 2021
e859ab1
PR changes - fixed pagination for multicast
AugustHA-Iterator Dec 15, 2021
144a650
Minor snack changes and check if devices is included before sending d…
AugustHA-Iterator Dec 16, 2021
44de7a5
PR Changes
AugustHA-Iterator Dec 22, 2021
101b8d8
Merge pull request #57 from OS2iot/issue/47_prompt-user-when-deleting…
augusthjerrild Jan 6, 2022
7112f40
merge conflicting
AugustHA-Iterator Jan 6, 2022
75d5641
Merge branch 'stage' into feature/IOT-16_MulticastFrontend
AugustHA-Iterator Jan 6, 2022
883aa87
Merge pull request #60 from OS2iot/feature/IOT-16_MulticastFrontend
augusthjerrild Jan 6, 2022
93dea8c
Cleanup
AramAlsabti Jan 24, 2022
c05ad16
Merge branch 'stage' into feature/1220_api-key
AramAlsabti Jan 24, 2022
0fb18cb
Remove unique permissions pipe
AramAlsabti Jan 24, 2022
4ee49a2
API key cleanup
AramAlsabti Jan 24, 2022
fc418c7
Merge pull request #62 from OS2iot/feature/1220_api-key
AramAlsabti Jan 24, 2022
ae572e0
Fix sigfox group id
AramAlsabti Jan 25, 2022
fc74b7b
Add edit api key
AramAlsabti Jan 26, 2022
aa8a3e9
Edit API key PR
AramAlsabti Jan 27, 2022
5b72e0d
Merge pull request #64 from OS2iot/feature/1247_edit-api-key
AramAlsabti Jan 27, 2022
c2b8ea2
Merge pull request #63 from OS2iot/feature/23540_class-validator-vuln…
AramAlsabti Jan 27, 2022
996e9da
Spell organization with "z"
AramAlsabti Feb 4, 2022
38c11a5
Multicast text description changes
AugustHA-Iterator Feb 14, 2022
8c0baa0
Merge pull request #66 from OS2iot/feature/IOT-1310_ChangeTextAtMulti…
AramAlsabti Feb 14, 2022
44e0bb3
Fixed deleted word "adressen" in multicast creation. Is added again.
AugustHA-Iterator Feb 14, 2022
1bed9dd
Moved hint description under the input form instead of before det inp…
AugustHA-Iterator Feb 14, 2022
f31a6f3
FIWARE datatarget (#67)
bkd231 Feb 17, 2022
7ce8ede
Optimize bulk import and the load on chirpstack (#65)
AramAlsabti Feb 22, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"typescript.tsdk": "node_modules\\typescript\\lib"
}
15 changes: 15 additions & 0 deletions src/app/admin/admin-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import { UserDetailComponent } from './users/user-detail/user-detail.component';
import { UserEditComponent } from './users/user-edit/user-edit.component';
import { UserListComponent } from './users/user-list/user-list.component';
import { UsersComponent } from './users/users.component';
import { ApiKeyComponent } from './api-key/api-key.component';
import { ApiKeyListComponent } from './api-key/api-key-list/api-key-list.component';
import { ApiKeyEditComponent } from './api-key/api-key-edit/api-key-edit.component';


const adminRoutes: Routes = [
Expand Down Expand Up @@ -44,6 +47,18 @@ const adminRoutes: Routes = [
},
],
},
{
path: 'api-key',
component: ApiKeyComponent,
children: [
{ path: '', component: ApiKeyListComponent },
{ path: 'new-api-key', component: ApiKeyEditComponent },
{
path: ':api-key-id/edit-api-key',
component: ApiKeyEditComponent,
},
],
},


];
Expand Down
12 changes: 12 additions & 0 deletions src/app/admin/admin.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ import { UsersComponent } from './users/users.component';
import { MatSelectModule } from '@angular/material/select';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatSelectSearchModule } from '@shared/components/mat-select-search/mat-select-search.module';
import { ApiKeyComponent } from './api-key/api-key.component';
import { ApiKeyListComponent } from './api-key/api-key-list/api-key-list.component';
import { ApiKeyTableComponent } from './api-key/api-key-list/api-key-table/api-key-table.component';
import { ApiKeyEditComponent } from './api-key/api-key-edit/api-key-edit.component';

@NgModule({
declarations: [
Expand All @@ -46,6 +50,10 @@ import { MatSelectSearchModule } from '@shared/components/mat-select-search/mat-
OrganisationDetailComponent,
OrganisationEditComponent,
OrganisationListComponent,
ApiKeyComponent,
ApiKeyListComponent,
ApiKeyTableComponent,
ApiKeyEditComponent,
],
imports: [
AdminRoutingModule,
Expand Down Expand Up @@ -79,6 +87,10 @@ import { MatSelectSearchModule } from '@shared/components/mat-select-search/mat-
OrganisationDetailComponent,
OrganisationEditComponent,
OrganisationListComponent,
ApiKeyComponent,
ApiKeyListComponent,
ApiKeyTableComponent,
ApiKeyEditComponent,
],
})
export class AdminModule {}
66 changes: 66 additions & 0 deletions src/app/admin/api-key/api-key-edit/api-key-edit.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<app-form-header [backButton]="backButton" [title]="title"></app-form-header>

<form (ngSubmit)="onSubmit()" class="os2-form p-3 mt-4">
<div *ngIf="errorMessages" class="error-messages p-3">
<ul class="mb-0">
<li *ngFor="let error of errorMessages">
{{ error | translate }}
</li>
</ul>
</div>

<div class="row mb-5">
<div class="form-group mt-3 col-12">
<label class="form-label" for="name">{{
'API-KEY.EDIT.NAME' | translate
}}</label
>*
<input
type="text"
class="form-control"
id="name"
name="name"
[placeholder]="'API-KEY.EDIT.NAME-PLACEHOLDER' | translate"
maxlength="50"
required
[(ngModel)]="apiKeyRequest.name"
[ngClass]="{
'is-invalid': formFailedSubmit && errorFields.includes('name'),
'is-valid': formFailedSubmit && !errorFields.includes('name')
}"
/>
</div>
</div>

<div class="row mb-5">
<div class="form-group mt-3 col-12">
<label class="form-label" for="permissions">{{
'QUESTION.PERMISSION.SELECT-PERMISSION' | translate
}}</label
>*
<mat-select
class="form-control"
name="permissions"
[compareWith]="compare"
[(ngModel)]="apiKeyRequest.permissionIds"
[multiple]="true"
>
<mat-option
*ngFor="let permission of permissions"
[value]="permission.id"
>
{{ permission.name }}
</mat-option>
</mat-select>
</div>
</div>

<div class="form-group mt-5">
<button (click)="routeBack()" class="btn btn-secondary" type="button">
{{ 'GEN.CANCEL' | translate }}
</button>
<button class="btn btn-primary ml-2" type="submit">
{{ 'GEN.SAVE' | translate }}
</button>
</div>
</form>
128 changes: 128 additions & 0 deletions src/app/admin/api-key/api-key-edit/api-key-edit.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
import { Location } from '@angular/common';
import { HttpErrorResponse } from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { PermissionResponse } from '@app/admin/permission/permission.model';
import { PermissionService } from '@app/admin/permission/permission.service';
import { TranslateService } from '@ngx-translate/core';
import { ErrorMessageService } from '@shared/error-message.service';
import { BackButton } from '@shared/models/back-button.model';
import { SharedVariableService } from '@shared/shared-variable/shared-variable.service';
import { ApiKeyRequest } from '../api-key.model';
import { ApiKeyService } from '../api-key.service';

@Component({
selector: 'app-api-key-edit',
templateUrl: './api-key-edit.component.html',
styleUrls: ['./api-key-edit.component.scss'],
})
export class ApiKeyEditComponent implements OnInit {
apiKeyRequest = new ApiKeyRequest();
public backButton: BackButton = {
label: '',
routerLink: ['admin', 'api-key'],
};
public title = '';
public submitButton = '';
public errorMessage: string;
public errorMessages: string[];
public errorFields: string[];
public formFailedSubmit = false;
public permissions: PermissionResponse[] = [];
private organizationId: number;
private id: number;

constructor(
private translate: TranslateService,
private route: ActivatedRoute,
private location: Location,
private apiKeyService: ApiKeyService,
private permissionService: PermissionService,
private errorMessageService: ErrorMessageService,
private sharedVariableService: SharedVariableService
) {}

ngOnInit(): void {
this.getPermissions();
this.translate.use('da');
this.translate
.get(['NAV.API-KEY', 'FORM.EDIT-API-KEY', 'API-KEY.EDIT.SAVE'])
.subscribe((translations) => {
this.backButton.label = translations['NAV.API-KEY'];
this.title = translations['FORM.EDIT-API-KEY'];
this.submitButton = translations['API-KEY.EDIT.SAVE'];
});

this.id = +this.route.snapshot.paramMap.get('api-key-id');

if (this.id > 0) {
this.getApiKey(this.id);
}
this.organizationId = this.sharedVariableService.getSelectedOrganisationId();
}

private getPermissions() {
this.permissionService
.getPermissions(
undefined,
undefined,
undefined,
undefined,
undefined,
this.organizationId
)
.subscribe(
(permissionsResponse) => {
this.permissions = permissionsResponse.data.filter(
(x) => x.organization?.id === this.organizationId
);
},
(error: HttpErrorResponse) => {
this.showError(error);
}
);
}

private getApiKey(id: number) {
this.apiKeyService.get(id).subscribe((key) => {
this.apiKeyRequest.id = key.id;
this.apiKeyRequest.name = key.name;
this.apiKeyRequest.permissionIds = key.permissions.map((pm) => pm.id);
});
}

onSubmit(): void {
this.id ? this.update() : this.create();
}

private create(): void {
this.apiKeyService.create(this.apiKeyRequest).subscribe(
() => this.routeBack(),
(err) => this.showError(err)
);
}

private update(): void {
this.apiKeyService.update(this.apiKeyRequest, this.id).subscribe(
() => this.routeBack(),
(err) => this.showError(err)
);
}

public compare(
matOptionValue: number,
ngModelObject: number
): boolean {
return matOptionValue === ngModelObject;
}

showError(err: HttpErrorResponse) {
const result = this.errorMessageService.handleErrorMessageWithFields(err);
this.errorFields = result.errorFields;
this.errorMessages = result.errorMessages;
}

routeBack(): void {
this.location.back();
}
}
17 changes: 17 additions & 0 deletions src/app/admin/api-key/api-key-list/api-key-list.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<app-top-bar
[title]="'NAV.API-KEY' | translate"
[ctaLabel]="'API-KEY.CREATE-NEW-API-KEY' | translate"
[ctaRouterLink]="'new-api-key'"
>
</app-top-bar>
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="jumbotron--table">
<app-api-key-table
[organisationId]="organisationId"
></app-api-key-table>
</div>
</div>
</div>
</div>
Empty file.
28 changes: 28 additions & 0 deletions src/app/admin/api-key/api-key-list/api-key-list.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Component, Input, OnInit } from '@angular/core';
import { Title } from '@angular/platform-browser';
import { TranslateService } from '@ngx-translate/core';
import { SharedVariableService } from '@shared/shared-variable/shared-variable.service';

@Component({
selector: 'app-api-key-list',
templateUrl: './api-key-list.component.html',
styleUrls: ['./api-key-list.component.scss'],
})
export class ApiKeyListComponent implements OnInit {
@Input() organisationId: number;

constructor(
public translate: TranslateService,
private titleService: Title,
private globalService: SharedVariableService
) {
translate.use('da');
}

ngOnInit(): void {
this.translate.get(['TITLE.API-KEY']).subscribe((translations) => {
this.titleService.setTitle(translations['TITLE.API-KEY']);
});
this.organisationId = this.globalService.getSelectedOrganisationId();
}
}
Loading