Skip to content

Commit

Permalink
Migrating to ngrx instead of akita.
Browse files Browse the repository at this point in the history
  • Loading branch information
renemadsen committed May 9, 2024
1 parent af9f5a7 commit ee6b97f
Show file tree
Hide file tree
Showing 140 changed files with 1,878 additions and 3,496 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -557,71 +557,71 @@ public List<PluginMenuItemModel> GetNavigationMenu(IServiceProvider serviceProvi
},
}
},
new PluginMenuItemModel
{
Name = "Reports",
E2EId = "trash-inspection-pn-reports",
Link = "/plugins/trash-inspection-pn/reports",
Type = MenuItemTypeEnum.Link,
Position = 6,
MenuTemplate = new PluginMenuTemplateModel
{
Name = "Reports",
E2EId = "trash-inspection-pn-reports",
DefaultLink = "/plugins/trash-inspection-pn/reports",
Permissions = new List<PluginMenuTemplatePermissionModel>
{
new PluginMenuTemplatePermissionModel
{
ClaimName = TrashInspectionClaims.AccessReports,
PermissionName = "Obtain reports",
PermissionTypeName = "Reports",
}
},
Translations = new List<PluginMenuTranslationModel>
{
new PluginMenuTranslationModel
{
LocaleName = LocaleNames.English,
Name = "Reports",
Language = LanguageNames.English,
},
new PluginMenuTranslationModel
{
LocaleName = LocaleNames.German,
Name = "Reports",
Language = LanguageNames.German,
},
new PluginMenuTranslationModel
{
LocaleName = LocaleNames.Danish,
Name = "Rapporter",
Language = LanguageNames.Danish,
},
}
},
Translations = new List<PluginMenuTranslationModel>
{
new PluginMenuTranslationModel
{
LocaleName = LocaleNames.English,
Name = "Reports",
Language = LanguageNames.English,
},
new PluginMenuTranslationModel
{
LocaleName = LocaleNames.German,
Name = "Reports",
Language = LanguageNames.German,
},
new PluginMenuTranslationModel
{
LocaleName = LocaleNames.Danish,
Name = "Rapporter",
Language = LanguageNames.Danish,
},
}
}
// new PluginMenuItemModel
// {
// Name = "Reports",
// E2EId = "trash-inspection-pn-reports",
// Link = "/plugins/trash-inspection-pn/reports",
// Type = MenuItemTypeEnum.Link,
// Position = 6,
// MenuTemplate = new PluginMenuTemplateModel
// {
// Name = "Reports",
// E2EId = "trash-inspection-pn-reports",
// DefaultLink = "/plugins/trash-inspection-pn/reports",
// Permissions = new List<PluginMenuTemplatePermissionModel>
// {
// new PluginMenuTemplatePermissionModel
// {
// ClaimName = TrashInspectionClaims.AccessReports,
// PermissionName = "Obtain reports",
// PermissionTypeName = "Reports",
// }
// },
// Translations = new List<PluginMenuTranslationModel>
// {
// new PluginMenuTranslationModel
// {
// LocaleName = LocaleNames.English,
// Name = "Reports",
// Language = LanguageNames.English,
// },
// new PluginMenuTranslationModel
// {
// LocaleName = LocaleNames.German,
// Name = "Reports",
// Language = LanguageNames.German,
// },
// new PluginMenuTranslationModel
// {
// LocaleName = LocaleNames.Danish,
// Name = "Rapporter",
// Language = LanguageNames.Danish,
// },
// }
// },
// Translations = new List<PluginMenuTranslationModel>
// {
// new PluginMenuTranslationModel
// {
// LocaleName = LocaleNames.English,
// Name = "Reports",
// Language = LanguageNames.English,
// },
// new PluginMenuTranslationModel
// {
// LocaleName = LocaleNames.German,
// Name = "Reports",
// Language = LanguageNames.German,
// },
// new PluginMenuTranslationModel
// {
// LocaleName = LocaleNames.Danish,
// Name = "Rapporter",
// Language = LanguageNames.Danish,
// },
// }
// }
}
}
};
Expand Down Expand Up @@ -691,14 +691,14 @@ public MenuModel HeaderMenu(IServiceProvider serviceProvider)
Guards = new List<string> { TrashInspectionClaims.AccessTransporters },
Position = 5,
},
new MenuItemModel
{
Name = localizationService.GetString("Reports"),
E2EId = "trash-inspection-pn-reports",
Link = "/plugins/trash-inspection-pn/reports",
Guards = new List<string> { TrashInspectionClaims.AccessReports },
Position = 6,
}
// new MenuItemModel
// {
// Name = localizationService.GetString("Reports"),
// E2EId = "trash-inspection-pn-reports",
// Link = "/plugins/trash-inspection-pn/reports",
// Guards = new List<string> { TrashInspectionClaims.AccessReports },
// Position = 6,
// }
}
});
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Page from '../Page';
import myEformsPage from '../MyEforms.page';
import trashInspectionsPage from './TrashInspections.page';
import {selectValueInNgSelector} from '../../Helpers/helper-functions';
import { $ } from '@wdio/globals';

export class TrashInspectionFractionPage extends Page {
constructor() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Page from '../Page';
import trashInspectionsPage from './TrashInspections.page';
import { $ } from '@wdio/globals';

export class TrashInspectionInstallationPage extends Page {
constructor() {
Expand Down Expand Up @@ -110,7 +111,7 @@ export class TrashInspectionInstallationPage extends Page {
}

public async page2Object() {
const ele = (await $('.mat-paginator-range-label'));
const ele = (await $('.mat-mdc-paginator-range-label'));
// ele.waitForDisplayed({timeout: 20000});
// ele.waitForClickable({timeout: 20000});
return ele;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Page from '../Page';
import trashInspectionsPage from './TrashInspections.page';
import { $ } from '@wdio/globals';

export class TrashInspectionSegmentsPage extends Page {
constructor() {
Expand Down Expand Up @@ -127,6 +128,7 @@ export class TrashInspectionSegmentsPage extends Page {
}
await (await this.segmentnBtn()).waitForClickable({timeout: 20000});
await (await this.segmentnBtn()).click();
await (await $('#spinner-animation')).waitForDisplayed({ timeout: 50000, reverse: true });
await (await this.createSegmentBtn()).waitForClickable({timeout: 20000});
}

Expand All @@ -139,6 +141,7 @@ export class TrashInspectionSegmentsPage extends Page {
async createSegment(createModel?: CreateUpdateSegment, clickCancel = false) {
await this.openCreateSegment(createModel);
await this.closeCreateSegment(clickCancel);
await (await $('#spinner-animation')).waitForDisplayed({ timeout: 50000, reverse: true });
}

async openCreateSegment(createModel?: CreateUpdateSegment) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Page from '../Page';
import { $ } from '@wdio/globals';

export class TrashInspectionSettingsPage extends Page {
constructor() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Page from '../Page';
import { $ } from '@wdio/globals';

export class TrashInspectionsPage extends Page {
constructor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {expect} from 'chai';
import loginPage from '../../../Page objects/Login.page';
import fractionsPage from '../../../Page objects/trash-inspection/TrashInspection-Fraction.page';
import {generateRandmString} from '../../../Helpers/helper-functions';
import { $ } from '@wdio/globals';

const createModel = {
name: generateRandmString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {expect} from 'chai';
import loginPage from '../../../Page objects/Login.page';
import fractionsPage from '../../../Page objects/trash-inspection/TrashInspection-Fraction.page';
import {generateRandmString} from '../../../Helpers/helper-functions';
import { $ } from '@wdio/globals';

const createModel = {
name: generateRandmString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import loginPage from '../../../Page objects/Login.page';
import fractionsPage, {FractionsCreateUpdate} from '../../../Page objects/trash-inspection/TrashInspection-Fraction.page';
import myEformsPage from '../../../Page objects/MyEforms.page';
import {generateRandmString} from '../../../Helpers/helper-functions';
import { $ } from '@wdio/globals';

const createModel: FractionsCreateUpdate = {
name: generateRandmString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {expect} from 'chai';
import loginPage from '../../../Page objects/Login.page';
import installationPage from '../../../Page objects/trash-inspection/TrashInspection-Installation.page';
import {generateRandmString} from '../../../Helpers/helper-functions';
import { $ } from '@wdio/globals';

describe('Trash Inspection Plugin - Installation', function () {
before(async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import installationPage from '../../../Page objects/trash-inspection/TrashInspec
import {expect} from 'chai';
import loginPage from '../../../Page objects/Login.page';
import {generateRandmString} from '../../../Helpers/helper-functions';
import { $ } from '@wdio/globals';

const name = generateRandmString();
describe('Trash Inspection Plugin - Installation', function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import installationPage from '../../../Page objects/trash-inspection/TrashInspec
import {expect} from 'chai';
import loginPage from '../../../Page objects/Login.page';
import {generateRandmString} from '../../../Helpers/helper-functions';
import { $ } from '@wdio/globals';

describe('Trash Inspection Plugin - Installation', function () {
before(async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {expect} from 'chai';
import loginPage from '../../../Page objects/Login.page';
import installationPage from '../../../Page objects/trash-inspection/TrashInspection-Installation.page';
import {generateRandmString} from '../../../Helpers/helper-functions';
import { $ } from '@wdio/globals';

describe('Trash Inspection Plugin - Installation', function () {
before(async () => {
Expand All @@ -14,7 +15,7 @@ describe('Trash Inspection Plugin - Installation', function () {
for (let i = 0; i < 11; i++) {
await installationPage.createInstallation(generateRandmString());
}
expect(await (await installationPage.page2Object()).getText()).equal('1 – 10 of 11');
expect(await (await installationPage.page2Object()).getText()).equal('Side 1 af 2');
});
after(async () => {
await loginPage.open('/');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {expect} from 'chai';
import loginPage from '../../../Page objects/Login.page';
import segmentPage, {CreateUpdateSegment} from '../../../Page objects/trash-inspection/TrashInspection-Segment.page';
import {generateRandmString, getRandomInt} from '../../../Helpers/helper-functions';
import { $ } from '@wdio/globals';

const createModel: CreateUpdateSegment = {
name: generateRandmString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {expect} from 'chai';
import loginPage from '../../../Page objects/Login.page';
import segmentPage, {CreateUpdateSegment} from '../../../Page objects/trash-inspection/TrashInspection-Segment.page';
import {generateRandmString, getRandomInt} from '../../../Helpers/helper-functions';
import { $ } from '@wdio/globals';

describe('Trash Inspection Plugin - Segment', function () {
before(async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {expect} from 'chai';
import loginPage from '../../../Page objects/Login.page';
import segmentPage, {CreateUpdateSegment} from '../../../Page objects/trash-inspection/TrashInspection-Segment.page';
import {generateRandmString, getRandomInt} from '../../../Helpers/helper-functions';
import { $ } from '@wdio/globals';

describe('Trash Inspection Plugin - Segment', function () {
before(async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import loginPage from '../../Page objects/Login.page';
import myEformsPage from '../../Page objects/MyEforms.page';
import pluginPage from '../../Page objects/Plugin.page';
import { expect } from 'chai';
import { $ } from '@wdio/globals';


describe('Application settings page - site header section', function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import {TranslateService} from '@ngx-translate/core';
import {translates} from './../i18n/translates';
import {AuthStateService} from 'src/app/common/store';
import {LocaleService} from 'src/app/common/services';
import {Subscription} from 'rxjs';
import {Subscription, take} from 'rxjs';
import {Store} from '@ngrx/store';
import {addPluginToVisited, selectPluginsVisitedPlugins} from 'src/app/state';

@Component({
selector: 'app-trash-inspection-pn-layout',
Expand All @@ -13,24 +15,32 @@ import {Subscription} from 'rxjs';
export class TrashInspectionPnLayoutComponent
implements AfterContentInit, OnInit, OnDestroy {
currentUserLocaleAsyncSub$: Subscription;
private pluginName = 'trashinspection';
constructor(
private localeService: LocaleService,
private translateService: TranslateService,
private authStateService: AuthStateService
store: Store
) {
store.select(selectPluginsVisitedPlugins)
.pipe(take(1))
.subscribe(x => {
// check current plugin in activated plugin
if (x.findIndex(y => y === this.pluginName) === -1) {
// add all plugin translates one time
Object.keys(translates).forEach(locale => {
this.translateService.setTranslation(locale, translates[locale], true);
});
// add plugin to visited plugins
store.dispatch(addPluginToVisited(this.pluginName));
}
});
}

ngOnInit() {
}

ngAfterContentInit() {
this.currentUserLocaleAsyncSub$ = this.authStateService.currentUserLocaleAsync.subscribe(lang => {
const i18n = translates[lang];
this.translateService.setTranslation(lang, i18n, true);
});
}

ngOnDestroy(): void {
this.currentUserLocaleAsyncSub$.unsubscribe();
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export class ProducerPnRequestModel {
pageSize: number;
nameFilter: string;
//nameFilter: string;
sort: string;
pageIndex: number;
isSortDsc: boolean;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export class TransporterPnRequestModel {
pageSize: number;
nameFilter: string;
//nameFilter: string;
sort: string;
pageIndex: number;
isSortDsc: boolean;
Expand Down
Loading

0 comments on commit ee6b97f

Please sign in to comment.