Skip to content

Commit

Permalink
feat: mysql based index implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
ralfaron committed Dec 30, 2023
1 parent f5a73a1 commit 2f7fdec
Show file tree
Hide file tree
Showing 23 changed files with 29,804 additions and 33,974 deletions.
3 changes: 2 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"WEB_ROOT": "projects/aas-portal/dist",
"ASSETS": "projects/aas-server/src/assets",
"USER_STORAGE": "mongodb://localhost:27017/aasportal-users",
"ENDPOINTS": "[\"file:///samples?name=Samples\",\"http://localhost:5001?name=AASXServer&type=AasxServer\"]"
"ENDPOINTS": "[\"file:///samples?name=Samples\",\"http://localhost:5001?name=AASXServer&type=AasxServer\"]",
// "AAS_INDEX": "mysql://aasportal:aas-server@localhost:3306"
}
},
{
Expand Down
1,341 changes: 826 additions & 515 deletions aasportal.mdx

Large diffs are not rendered by default.

196 changes: 174 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"dependencies": {
"@ngrx/component-store": "^16.3.0",
"lowdb": "^6.1.1",
"mysql2": "^3.6.5",
"uninstall": "^0.0.0"
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/******************************************************************************
*
* Copyright (c) 2019-2023 Fraunhofer IOSB-INA Lemgo,
* eine rechtlich nicht selbstaendige Einrichtung der Fraunhofer-Gesellschaft
* zur Foerderung der angewandten Forschung e.V.
*
*****************************************************************************/

import { Injectable } from '@angular/core';
import { ComponentStore } from '@ngrx/component-store';

Expand Down Expand Up @@ -47,4 +55,4 @@ export class FavoritesFormStore extends ComponentStore<FavoritesFormState> {
return { ...state, items };
});
}
}
}
2 changes: 0 additions & 2 deletions projects/aas-portal/src/app/start/start.reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ function addTree(state: StartState, nodes: AASDocument[]): StartState {
}

function setPage(state: StartState, page: AASPage, limit: number | undefined, filter: string | undefined): StartState {
console.debug(`setPage(...)`);
return {
...state,
viewMode: ViewMode.List,
Expand All @@ -70,7 +69,6 @@ function setPage(state: StartState, page: AASPage, limit: number | undefined, fi
documents: page.documents,
isFirstPage: page.previous === null,
isLastPage: page.next === null,
totalCount: page.totalCount,
};
}

Expand Down
1 change: 0 additions & 1 deletion projects/aas-portal/src/test/start/start.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ describe('StartComponent', () => {
previous: null,
next: null,
documents: [],
totalCount: 0,
}));

api.getContent.and.returnValue(of({
Expand Down
10 changes: 10 additions & 0 deletions projects/aas-server/src/app/aas-provider/aas-index-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { AASIndex } from './aas-index.js';
import { LowDbIndex } from './lowdb/lowdb-index.js';
import { Variable } from '../variable.js';
import { LowDbData } from './lowdb/lowdb-types.js';
import { MySqlIndex } from './mysql/mysql-index.js';

export class AASIndexFactory {
constructor(
Expand All @@ -22,6 +23,15 @@ export class AASIndexFactory {

public create(): AASIndex {
const variable = this.container.resolve(Variable);
if (variable.AAS_INDEX) {
const url = new URL(variable.AAS_INDEX);
if (url.protocol === 'mysql:') {
return new MySqlIndex(variable);
}

throw new Error('Not implemented.');
}

const dbFile = path.join(variable.CONTENT_ROOT, 'db.json');
const db = new Low<LowDbData>(new JSONFile(dbFile), { documents: [], endpoints: [], elements: [] });
return new LowDbIndex(db, variable);
Expand Down
Loading

0 comments on commit 2f7fdec

Please sign in to comment.