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>
</button>
</th>
<th scope="col" class="employees-list__column-head">Ta bort</th>
</tr>
</thead>
<tbody>
@@ -44,9 +45,12 @@
</ng-container>
</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>
Ta bort konto
</digi-button>
</td>
</tr>
@@ -55,7 +59,8 @@
</digi-table>
<!-- Modal/ Dialog window -->
<digi-ng-dialog *ngIf="employeeSelected$ | async as employee"
<digi-ng-dialog
*ngIf="employeeSelected$ | async as employee"
[afActive]="showDialog"
(afOnInactive)="openDialog(false)"
(afOnPrimaryClick)="openDialog(false)"
@@ -65,9 +70,7 @@
afPrimaryButtonText="Avbryt"
afSecondaryButtonText="Radera personalkonto"
>
<p>
Är du säker på att du vill ta bort personalkontot för {{employee?.fullName}}?
</p>
<p>Är du säker på att du vill ta bort personalkontot för {{employee?.fullName}}?</p>
</digi-ng-dialog>
<digi-navigation-pagination

View File

@@ -38,7 +38,7 @@ function generateDeltagare(amount = 10) {
const fornamn = faker.name.firstName();
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(''),
};
const educationLevel = EDUCATION_LEVELS[Math.floor(Math.random() * EDUCATION_LEVELS.length)];
@@ -90,7 +90,7 @@ function generateDeltagare(amount = 10) {
sun_kod: sunKod.sun_kod,
beskrivning_sun_kod: sunKod.beskrivning,
},
education: {
educations: {
utbildningar: chooseRandom(EDUCATIONS, faker.datatype.number(EDUCATIONS.length)),
},
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 = {
languages: languages.generate(),
employees: generatedEmployees,
@@ -87,7 +81,6 @@ const apiData = {
employeeId: generatedEmployees[Math.floor(Math.random() * generatedEmployees.length)].id,
})),
currentUser: currentUser.generate(),
authorizations: auths,
getTokenFullAccess: authTokens.auth_code_from_CIAM_with_all_permissions,
invites: [],
};

View File

@@ -61,7 +61,7 @@ router.render = (req, res) => {
let data = res.locals.data;
const employeeRegex = /(?:\/users\/)(.*)/;
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 avropRegex = /(?:\/avrop\/(?:tjanster|utforandeverksamheter|kommuner|\d))|(?:\/deltagare\/\d\/(avrop))/g;
const isAvropPath = avropRegex.exec(pathname);