Skip to content

Commit 0572b7a

Browse files
michelu89George Moscu
andauthored
Feature/refactor codebase (#238)
--------- Co-authored-by: George Moscu <[email protected]>
1 parent b8491c0 commit 0572b7a

File tree

198 files changed

+3507
-3200
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

198 files changed

+3507
-3200
lines changed

.github/workflows/push_request_check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
- name: Setup NodeJs
3939
uses: actions/setup-node@v3
4040
with:
41-
node-version: '20'
41+
node-version: '22'
4242
cache: 'npm'
4343
cache-dependency-path: '**/package-lock.json'
4444

.github/workflows/tagged_release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
- name: Setup NodeJs
4040
uses: actions/setup-node@v3
4141
with:
42-
node-version: '20'
42+
node-version: '22'
4343
cache: 'npm'
4444
cache-dependency-path: '**/package-lock.json'
4545

core/apps/ame-e2e/src/integration/drag-and-drop/new-elements.cy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ describe('Test drag and drop', () => {
3232
.then(() => cy.dragElement(SELECTOR_ecProperty, 100, 300).then(() => cy.clickShape('property2')));
3333
});
3434

35-
it('can add new Operation', () => cy.dragElement(SELECTOR_ecOperation, 350, 300).then(() => cy.clickShape('Characteristic1')));
35+
it('can add new Operation', () => cy.dragElement(SELECTOR_ecOperation, 350, 300).then(() => cy.clickShape('operation1')));
3636

37-
it('can add new Characteristic', () => cy.dragElement(SELECTOR_ecCharacteristic, 350, 300).then(() => cy.clickShape('Characteristic1')));
37+
it('can add new Characteristic', () => cy.dragElement(SELECTOR_ecCharacteristic, 350, 300).then(() => cy.clickShape('Characteristic2')));
3838

3939
it('can add new Entity', () => cy.dragElement(SELECTOR_ecEntity, 350, 300).then(() => cy.clickShape('Entity1')));
4040

core/apps/ame-e2e/src/integration/editor/create-recursive-element.cy.ts

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ describe('Test create recursive element', () => {
8080
expect(rdf).to.contain(':newProperty2 a samm:Property;\n' + ' samm:characteristic :NewCharacteristic.');
8181
expect(rdf).to.contain(':newProperty3 a samm:Property;\n' + ' samm:characteristic :NewCharacteristic.');
8282
cy.getAspect().then(aspect => {
83+
expect(aspect.properties[0].property.characteristic.name).to.equal('NewCharacteristic');
8384
expect(aspect.properties[0].property.characteristic.dataType.properties[0].property.characteristic.name).to.equal(
8485
'NewCharacteristic',
8586
);
@@ -95,37 +96,41 @@ describe('Test create recursive element', () => {
9596
it('change characteristic type', () => {
9697
cy.shapeExists('NewCharacteristic')
9798
.then(() => cy.dbClickShape('NewCharacteristic'))
98-
.then(() => cy.get(FIELD_characteristicName).click({force: true}).get('mat-option').contains('Text').click({force: true}))
99+
.then(() => cy.get(FIELD_characteristicName).click({force: true}).get('mat-option').contains('Code').click({force: true}))
99100
.then(() => cyHelp.clickSaveButton())
100101
.then(() => cy.getUpdatedRDF())
101102
.then(rdf => {
102-
expect(rdf).to.contain(':property1 a samm:Property;\n' + ' samm:characteristic samm-c:MultiLanguageText.');
103-
expect(rdf).to.contain(':newProperty2 a samm:Property;\n' + ' samm:characteristic samm-c:MultiLanguageText.');
104-
expect(rdf).to.contain(':newProperty3 a samm:Property;\n' + ' samm:characteristic samm-c:MultiLanguageText.');
103+
expect(rdf).to.contain(':NewCharacteristic a samm-c:Code');
104+
expect(rdf).to.contain(':property1 a samm:Property;\n' + ' samm:characteristic :NewCharacteristic.');
105+
expect(rdf).to.contain(':newProperty2 a samm:Property;\n' + ' samm:characteristic :NewCharacteristic.');
106+
expect(rdf).to.contain(':newProperty3 a samm:Property;\n' + ' samm:characteristic :NewCharacteristic.');
107+
cyHelp.hasAddShapeOverlay('property1').then(addShapeIcon => expect(addShapeIcon).to.be.false);
105108
cyHelp.hasAddShapeOverlay('newProperty2').then(addShapeIcon => expect(addShapeIcon).to.be.false);
106109
cyHelp.hasAddShapeOverlay('newProperty3').then(addShapeIcon => expect(addShapeIcon).to.be.false);
107110
});
108111
});
109112

110113
it('add constraint to characteristic using trait with recursive properties', () => {
111-
cy.shapeExists('MultiLanguageText')
112-
.then(() => cy.dbClickShape('MultiLanguageText'))
114+
cy.shapeExists('NewCharacteristic')
115+
.then(() => cy.dbClickShape('NewCharacteristic'))
113116
.then(() => cy.get(FIELD_characteristicName).click({force: true}).get('mat-option').contains('Characteristic').click({force: true}))
114117
.then(() => cyHelp.clickSaveButton())
115-
.then(() => cy.clickConnectShapes('Characteristic1', 'NewEntity'))
116-
.then(() => cy.clickConnectShapes('Characteristic1', 'newProperty2'))
117-
.then(() => cy.clickConnectShapes('Characteristic1', 'newProperty3'))
118-
.then(() => cy.clickAddTraitPlusIcon('Characteristic1'))
118+
.then(() => cy.clickConnectShapes('NewCharacteristic', 'NewEntity'))
119+
.then(() => cy.clickConnectShapes('NewCharacteristic', 'newProperty2'))
120+
.then(() => cy.clickConnectShapes('NewCharacteristic', 'newProperty3'))
121+
.then(() => cy.clickAddTraitPlusIcon('NewCharacteristic'))
119122
.then(() => cy.getUpdatedRDF())
120123
.then(rdf => {
121124
expect(rdf).to.contain(':property1 a samm:Property;\n' + ' samm:characteristic :Property1Trait.');
122125
expect(rdf).to.contain(':newProperty2 a samm:Property;\n' + ' samm:characteristic :Property1Trait.');
123126
expect(rdf).to.contain(':newProperty3 a samm:Property;\n' + ' samm:characteristic :Property1Trait.');
124127
expect(rdf).to.contain(
125-
':Property1Trait a samm-c:Trait;\n' + ' samm-c:baseCharacteristic :Characteristic1;\n' + ' samm-c:constraint :Constraint1.',
128+
':Property1Trait a samm-c:Trait;\n' +
129+
' samm-c:baseCharacteristic :NewCharacteristic;\n' +
130+
' samm-c:constraint :Constraint1.',
126131
);
127132
expect(rdf).to.contain(':Constraint1 a samm:Constraint.\n');
128-
expect(rdf).to.contain(':Characteristic1 a samm:Characteristic;\n' + ' samm:dataType :NewEntity.');
133+
expect(rdf).to.contain(':NewCharacteristic a samm:Characteristic;\n' + ' samm:dataType :NewEntity.');
129134
cyHelp.hasAddShapeOverlay('newProperty2').then(addShapeIcon => expect(addShapeIcon).to.be.false);
130135
cyHelp.hasAddShapeOverlay('newProperty3').then(addShapeIcon => expect(addShapeIcon).to.be.false);
131136
});

core/apps/ame-e2e/src/integration/editor/migrate-common-attributes.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ describe('Test migration of common attributes on Constraint/Characteristic type
8383
.then(() => cy.shapeExists('Characteristic1'))
8484
.then(() => cy.dbClickShape('Characteristic1'))
8585
.then(() => cy.get(FIELD_characteristicName).click({force: true}).get('mat-option').contains('Collection').click({force: true}))
86-
.then(() => cy.get('button[data-cy="clear-dataType-button"]').click({force: true}))
86+
.then(() => cy.get('[data-cy="clear-dataType-button"]').click({force: true}))
8787
.then(() =>
8888
cy
8989
.get(FIELD_elementCharacteristic)

core/apps/ame-e2e/src/support/commands.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ declare global {
289289
}
290290
}
291291

292-
Cypress.Commands.add('visitDefault', () => cy.visit('?e2e=true'));
292+
Cypress.Commands.add('visitDefault', () => cy.visit('?e2e=true').wait(2000));
293293

294294
Cypress.Commands.add('getAspect', () => cy.window().then(win => win['angular.modelService'].loadedAspect as Aspect));
295295

@@ -535,7 +535,7 @@ Cypress.Commands.add('saveAspectModelToWorkspace', () => {
535535
Cypress.Commands.add('openGenerationOpenApiSpec', () => {
536536
cy.intercept(
537537
'POST',
538-
'http://localhost:9091/ame/api/generate/open-api-spec?language=en&output=json&baseUrl=https://example.com&includeQueryApi=false&useSemanticVersion=false&pagingOption=NO_PAGING&includePost=false&includePut=false&includePatch=false&resourcePath=null&ymlProperties=&jsonProperties=',
538+
'http://localhost:9091/ame/api/generate/open-api-spec?language=en&output=json&baseUrl=https://example.com&includeQueryApi=false&useSemanticVersion=false&pagingOption=NO_PAGING&includePost=false&includePut=false&includePatch=false&resourcePath=/resource/%7BresourceId%7D&ymlProperties=&jsonProperties=',
539539
{fixture: 'AspectDefault-open-api.json'},
540540
);
541541

core/apps/ame/project.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
"prefix": "ame",
77
"targets": {
88
"build": {
9-
"executor": "@angular-devkit/build-angular:browser",
9+
"executor": "@angular-devkit/build-angular:browser-esbuild",
1010
"outputs": ["{options.outputPath}"],
1111
"options": {
1212
"outputPath": "dist/apps/ame",
1313
"index": "apps/ame/src/index.html",
1414
"main": "apps/ame/src/main.ts",
15-
"polyfills": "apps/ame/src/polyfills.ts",
15+
"polyfills": ["apps/ame/src/polyfills.ts"],
1616
"tsConfig": "apps/ame/tsconfig.app.json",
1717
"inlineStyleLanguage": "scss",
1818
"assets": [
@@ -64,9 +64,7 @@
6464
}
6565
},
6666
"development": {
67-
"buildOptimizer": false,
6867
"optimization": false,
69-
"vendorChunk": true,
7068
"extractLicenses": true,
7169
"sourceMap": true,
7270
"namedChunks": true
@@ -75,7 +73,7 @@
7573
"defaultConfiguration": "production"
7674
},
7775
"serve": {
78-
"executor": "@angular-devkit/build-angular:dev-server",
76+
"executor": "@nx/angular:dev-server",
7977
"configurations": {
8078
"production": {
8179
"buildTarget": "ame:build:production"

core/apps/ame/src/app/app.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,16 @@ import {ConfigurationService} from '@ame/settings-dialog';
1919
import {ThemeService} from '@ame/mx-graph';
2020
import {StartupService} from './startup.service';
2121
import {MigratorService} from '@ame/migrator';
22-
import {Router} from '@angular/router';
22+
import {Router, RouterOutlet} from '@angular/router';
2323
import {LanguageTranslationService} from '@ame/translation';
2424
import {SidebarStateService} from '@ame/sidebar';
2525
import {SearchesStateService} from '@ame/utils';
2626

2727
@Component({
2828
selector: 'ame-root',
2929
templateUrl: './app.component.html',
30+
standalone: true,
31+
imports: [RouterOutlet],
3032
})
3133
export class AppComponent implements OnInit {
3234
private language = 'en';

core/apps/ame/src/app/app.module.ts

Lines changed: 0 additions & 70 deletions
This file was deleted.

core/apps/ame/src/app/app-routing.module.ts renamed to core/apps/ame/src/app/app.routes.ts

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,20 @@
1111
* SPDX-License-Identifier: MPL-2.0
1212
*/
1313

14-
import {NgModule} from '@angular/core';
15-
import {RouterModule, Routes} from '@angular/router';
16-
import {EditorCanvasComponent} from './components/editor-canvas/editor-canvas.component';
17-
import {LoadingComponent} from './components/loading/loading.component';
14+
import {Routes} from '@angular/router';
1815

19-
const routes: Routes = [
16+
export const APP_ROUTES: Routes = [
2017
{
2118
path: '',
22-
component: LoadingComponent,
19+
loadComponent: () => import('./components/loading/loading.component').then(mod => mod.LoadingComponent),
2320
},
2421
{
2522
path: 'editor',
26-
component: EditorCanvasComponent,
23+
loadComponent: () => import('./components/editor-canvas/editor-canvas.component').then(mod => mod.EditorCanvasComponent),
2724
children: [
2825
{
2926
path: 'select/:urn',
30-
component: EditorCanvasComponent,
27+
loadComponent: () => import('./components/editor-canvas/editor-canvas.component').then(mod => mod.EditorCanvasComponent),
3128
},
3229
],
3330
},
@@ -37,9 +34,3 @@ const routes: Routes = [
3734
pathMatch: 'full',
3835
},
3936
];
40-
41-
@NgModule({
42-
imports: [RouterModule.forRoot(routes)],
43-
exports: [RouterModule],
44-
})
45-
export class AppRoutingModule {}

0 commit comments

Comments
 (0)