Made some changes to the mock-api

This commit is contained in:
Erik Tiekstra
2021-08-20 07:57:27 +02:00
parent fae7d9ad8c
commit 1e2d925d27
4 changed files with 12 additions and 16 deletions

View File

@@ -22,6 +22,7 @@
</ng-container> </ng-container>
</button> </button>
</th> </th>
<th scope="col" class="employees-list__column-head">Ta bort</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -44,9 +45,12 @@
</ng-container> </ng-container>
</td> </td>
<td> <td>
<digi-button af-variation="tertiary" [af-aria-label]="'Ta bort konto för ' + employee.fullName" (afOnClick)="openDialog(true, employee)"> <digi-button
af-variation="tertiary"
[afAriaLabel]="'Ta bort konto för ' + employee.fullName"
(afOnClick)="openDialog(true, employee)"
>
<digi-icon-x style="--digi--ui--width--icon: 1.25rem" slot="icon"></digi-icon-x> <digi-icon-x style="--digi--ui--width--icon: 1.25rem" slot="icon"></digi-icon-x>
Ta bort konto
</digi-button> </digi-button>
</td> </td>
</tr> </tr>
@@ -55,7 +59,8 @@
</digi-table> </digi-table>
<!-- Modal/ Dialog window --> <!-- Modal/ Dialog window -->
<digi-ng-dialog *ngIf="employeeSelected$ | async as employee" <digi-ng-dialog
*ngIf="employeeSelected$ | async as employee"
[afActive]="showDialog" [afActive]="showDialog"
(afOnInactive)="openDialog(false)" (afOnInactive)="openDialog(false)"
(afOnPrimaryClick)="openDialog(false)" (afOnPrimaryClick)="openDialog(false)"
@@ -65,9 +70,7 @@
afPrimaryButtonText="Avbryt" afPrimaryButtonText="Avbryt"
afSecondaryButtonText="Radera personalkonto" afSecondaryButtonText="Radera personalkonto"
> >
<p> <p>Är du säker på att du vill ta bort personalkontot för {{employee?.fullName}}?</p>
Är du säker på att du vill ta bort personalkontot för {{employee?.fullName}}?
</p>
</digi-ng-dialog> </digi-ng-dialog>
<digi-navigation-pagination <digi-navigation-pagination

View File

@@ -38,7 +38,7 @@ function generateDeltagare(amount = 10) {
const fornamn = faker.name.firstName(); const fornamn = faker.name.firstName();
const efternamn = faker.name.lastName(); const efternamn = faker.name.lastName();
const korkort = Math.random() > 0.8 && { const korkort = Math.random() > 0.2 && {
behorighet: chooseRandom(DRIVERS_LICENSES, faker.datatype.number(3)).join(''), behorighet: chooseRandom(DRIVERS_LICENSES, faker.datatype.number(3)).join(''),
}; };
const educationLevel = EDUCATION_LEVELS[Math.floor(Math.random() * EDUCATION_LEVELS.length)]; const educationLevel = EDUCATION_LEVELS[Math.floor(Math.random() * EDUCATION_LEVELS.length)];
@@ -90,7 +90,7 @@ function generateDeltagare(amount = 10) {
sun_kod: sunKod.sun_kod, sun_kod: sunKod.sun_kod,
beskrivning_sun_kod: sunKod.beskrivning, beskrivning_sun_kod: sunKod.beskrivning,
}, },
education: { educations: {
utbildningar: chooseRandom(EDUCATIONS, faker.datatype.number(EDUCATIONS.length)), utbildningar: chooseRandom(EDUCATIONS, faker.datatype.number(EDUCATIONS.length)),
}, },
translator: { translator: {

View File

@@ -68,12 +68,6 @@ generatedAvrop.forEach(({ tjanstekod, tjansteNamn, utforandeVerksamhetId, utfora
} }
}); });
generatedEmployees.forEach(employee => {
employee.authorizations = [
auths[Math.floor(Math.random() * auths.length)],
auths[Math.floor(Math.random() * auths.length)],
];
});
const apiData = { const apiData = {
languages: languages.generate(), languages: languages.generate(),
employees: generatedEmployees, employees: generatedEmployees,
@@ -87,7 +81,6 @@ const apiData = {
employeeId: generatedEmployees[Math.floor(Math.random() * generatedEmployees.length)].id, employeeId: generatedEmployees[Math.floor(Math.random() * generatedEmployees.length)].id,
})), })),
currentUser: currentUser.generate(), currentUser: currentUser.generate(),
authorizations: auths,
getTokenFullAccess: authTokens.auth_code_from_CIAM_with_all_permissions, getTokenFullAccess: authTokens.auth_code_from_CIAM_with_all_permissions,
invites: [], invites: [],
}; };

View File

@@ -61,7 +61,7 @@ router.render = (req, res) => {
let data = res.locals.data; let data = res.locals.data;
const employeeRegex = /(?:\/users\/)(.*)/; const employeeRegex = /(?:\/users\/)(.*)/;
const isEmployeePath = employeeRegex.exec(pathname); const isEmployeePath = employeeRegex.exec(pathname);
const deltagareRegex = /(?:\/deltagare\/)(?:\d\/)(contact|driverlicense|educationlevels\/highest|educations|translator|work\/disabilities|work\/languages|work\/experiences)/g; const deltagareRegex = /(?:\/deltagare\/)(?:\d*\/)(contact|driverlicense|educationlevels\/highest|educations|translator|work\/disabilities|work\/languages|work\/experiences)/g;
const isDeltagarePath = deltagareRegex.exec(pathname); const isDeltagarePath = deltagareRegex.exec(pathname);
const avropRegex = /(?:\/avrop\/(?:tjanster|utforandeverksamheter|kommuner|\d))|(?:\/deltagare\/\d\/(avrop))/g; const avropRegex = /(?:\/avrop\/(?:tjanster|utforandeverksamheter|kommuner|\d))|(?:\/deltagare\/\d\/(avrop))/g;
const isAvropPath = avropRegex.exec(pathname); const isAvropPath = avropRegex.exec(pathname);