Skip to content

Commit

Permalink
fix: bug fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
ralfaron committed Nov 12, 2024
1 parent 76c6a10 commit 8dc1520
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 23 deletions.
1 change: 1 addition & 0 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions projects/aas-portal/src/app/start/start.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
}
<div class="btn-group me-2 my-1">
<div ngbDropdown class="btn-group" role="group">
<button type="button" class="btn btn-primary" ngbDropdownToggle id="menuEndpoints">
<i class="bi bi-gear"></i>
<button type="button" class="btn btn-primary" ngbDropdownToggle id="menuEndpoints" translate>
Start.ENDPOINT
</button>
<div ngbDropdownMenu class="dropdown-menu" id="menuEndpoints">
<button ngbDropdownItem (click)="addEndpoint().subscribe()" translate>Start.ADD_ENDPOINT</button>
Expand Down
5 changes: 3 additions & 2 deletions projects/aas-portal/src/assets/i18n/de-de.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@
"TEXT_ADD_FAVORITES": "{0} Favoriten hinzufügen ({1}).",
"Start": {
"FAVORITES": "Alle Verwaltungsschalen",
"ENDPOINT": "Endpunkt",
"ADD_ENDPOINT": "Hinzufügen...",
"UPDATE_ENDPOINT": "Bearbeiten...",
"REMOVE_ENDPOINT": "Entfernen...",
Expand All @@ -190,7 +191,7 @@
"PLACEHOLDER_URL_OPCUA": "opc.tcp://",
"PLACEHOLDER_URL_WEBDAV": "http(s)://",
"ADVANCED_SETTINGS": "Erweiterte Einstellungen",
"SCHEDULE": "Endpunkt durchsuchen",
"SCHEDULE": "Endpunkt-Index aktualisieren",
"MANUAL": "manuell",
"ONCE": "einmalig",
"EVERY": "zyklisch",
Expand All @@ -212,7 +213,7 @@
"PLACEHOLDER_URL_HTTP": "http(s)://",
"PLACEHOLDER_URL_OPCUA": "opc.tcp://",
"PLACEHOLDER_URL_WEBDAV": "http(s)://",
"SCHEDULE": "Endpunkt durchsuchen",
"SCHEDULE": "Endpunkt-Index aktualisieren",
"MANUAL": "manuell",
"ONCE": "einmalig",
"EVERY": "zyklisch",
Expand Down
5 changes: 3 additions & 2 deletions projects/aas-portal/src/assets/i18n/en-us.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@
"TEXT_ADD_FAVORITES": "Add {0} favorites ({1}).",
"Start": {
"FAVORITES": "All shells",
"ENDPOINT": "Endpoint",
"ADD_ENDPOINT": "Add...",
"UPDATE_ENDPOINT": "Edit...",
"REMOVE_ENDPOINT": "Remove...",
Expand All @@ -191,7 +192,7 @@
"PLACEHOLDER_URL_OPCUA": "opc.tcp://",
"PLACEHOLDER_URL_WEBDAV": "http(s)://",
"ADVANCED_SETTINGS": "Advanced settings",
"SCHEDULE": "Search endpoint",
"SCHEDULE": "Update endpoint index",
"MANUAL": "manual",
"ONCE": "once",
"EVERY": "cyclic",
Expand All @@ -213,7 +214,7 @@
"PLACEHOLDER_URL_HTTP": "http(s)://",
"PLACEHOLDER_URL_OPCUA": "opc.tcp://",
"PLACEHOLDER_URL_WEBDAV": "http(s)://",
"SCHEDULE": "Search endpoint",
"SCHEDULE": "Update endpoint index",
"MANUAL": "manual",
"ONCE": "once",
"EVERY": "cyclic",
Expand Down
2 changes: 1 addition & 1 deletion projects/aas-server/src/app/aas-index/aas-index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export abstract class AASIndex {

public abstract removeEndpoint(endpointName: string): Promise<boolean>;

public abstract getDocuments(cursor: AASCursor, query?: string, language?: string): Promise<AASPagedResult>;
public abstract getDocuments(cursor: AASCursor, expression?: string, language?: string): Promise<AASPagedResult>;

public abstract nextPage(
endpointName: string,
Expand Down
20 changes: 12 additions & 8 deletions projects/aas-server/src/app/aas-index/lowdb/lowdb-index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,27 +183,31 @@ export class LowDbIndex extends AASIndex {
return { result, paging_metadata: { cursor: encodeBase64Url(items[k].id) } };
}

public override async getDocuments(cursor: AASCursor, query?: string, language?: string): Promise<AASPagedResult> {
public override async getDocuments(
cursor: AASCursor,
expression?: string,
language?: string,
): Promise<AASPagedResult> {
await this.promise;

let filter: LowDbQuery | undefined;
if (query) {
filter = new LowDbQuery(query, language ?? 'en');
let query: LowDbQuery | undefined;
if (expression) {
query = new LowDbQuery(expression, language ?? 'en');
}

if (cursor.next) {
return this.getNextPage(cursor.next, cursor.limit, filter);
return this.getNextPage(cursor.next, cursor.limit, query);
}

if (cursor.previous) {
return this.getPreviousPage(cursor.previous, cursor.limit, filter);
return this.getPreviousPage(cursor.previous, cursor.limit, query);
}

if (cursor.previous === null) {
return this.getFirstPage(cursor.limit, filter);
return this.getFirstPage(cursor.limit, query);
}

return this.getLastPage(cursor.limit, filter);
return this.getLastPage(cursor.limit, query);
}

public override async update(document: AASDocument): Promise<void> {
Expand Down
16 changes: 8 additions & 8 deletions projects/aas-server/src/app/aas-index/mysql/mysql-index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,25 +211,25 @@ export class MySqlIndex extends AASIndex {
}
}

public override getDocuments(cursor: AASCursor, query?: string, language?: string): Promise<AASPagedResult> {
let q: MySqlQuery | undefined;
if (query) {
q = new MySqlQuery(query, language ?? 'en');
public override getDocuments(cursor: AASCursor, expression?: string, language?: string): Promise<AASPagedResult> {
let query: MySqlQuery | undefined;
if (expression) {
query = new MySqlQuery(expression, language ?? 'en');
}

if (cursor.next) {
return this.getNextPage(cursor.next, cursor.limit);
return this.getNextPage(cursor.next, cursor.limit, query);
}

if (cursor.previous) {
return this.getPreviousPage(cursor.previous, cursor.limit);
return this.getPreviousPage(cursor.previous, cursor.limit, query);
}

if (cursor.previous === null) {
return this.getFirstPage(cursor.limit, q);
return this.getFirstPage(cursor.limit, query);
}

return this.getLastPage(cursor.limit);
return this.getLastPage(cursor.limit, query);
}

public override async nextPage(
Expand Down

0 comments on commit 8dc1520

Please sign in to comment.