Skip to content

Commit

Permalink
fix: dashboard test updated
Browse files Browse the repository at this point in the history
  • Loading branch information
ralfaron committed Jun 3, 2024
1 parent 8ee9221 commit eecfa3c
Show file tree
Hide file tree
Showing 12 changed files with 423 additions and 421 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { NgbActiveModal, NgbToast } from '@ng-bootstrap/ng-bootstrap';
import { TranslateService } from '@ngx-translate/core';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { Credentials, isValidEMail, isValidPassword, stringFormat } from 'common';
import isEmpty from 'lodash-es/isEmpty';

Expand All @@ -30,7 +30,7 @@ export interface LoginFormResult {
templateUrl: './login-form.component.html',
styleUrls: ['./login-form.component.scss'],
standalone: true,
imports: [NgbToast, FormsModule],
imports: [NgbToast, FormsModule, TranslateModule],
})
export class LoginFormComponent {
private newPasswordSent = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import isEmpty from 'lodash-es/isEmpty';
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { NgbActiveModal, NgbCollapse, NgbToast } from '@ng-bootstrap/ng-bootstrap';
import { TranslateService } from '@ngx-translate/core';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { getUserNameFromEMail, isValidEMail, isValidPassword, stringFormat, UserProfile } from 'common';
import { messageToString } from '../../convert';
import { ERRORS } from '../../types/errors';
Expand All @@ -26,7 +26,7 @@ export interface ProfileFormResult {
templateUrl: './profile-form.component.html',
styleUrls: ['./profile-form.component.scss'],
standalone: true,
imports: [NgbToast, FormsModule, NgbCollapse],
imports: [NgbToast, FormsModule, NgbCollapse, TranslateModule],
})
export class ProfileFormComponent {
private profile?: UserProfile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { NgbActiveModal, NgbToast } from '@ng-bootstrap/ng-bootstrap';
import { isValidEMail, isValidPassword, stringFormat, UserProfile, getUserNameFromEMail } from 'common';
import { TranslateService } from '@ngx-translate/core';
import { TranslateModule, TranslateService } from '@ngx-translate/core';

import { AuthApiService } from '../auth-api.service';
import { ERRORS } from '../../types/errors';
Expand All @@ -27,7 +27,7 @@ export interface RegisterFormResult {
templateUrl: './register-form.component.html',
styleUrls: ['./register-form.component.scss'],
standalone: true,
imports: [NgbToast, FormsModule],
imports: [NgbToast, FormsModule, TranslateModule],
})
export class RegisterFormComponent {
public constructor(
Expand Down
8 changes: 6 additions & 2 deletions projects/aas-portal/src/app/dashboard/dashboard.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { aas, convertToString, LiveNode, LiveRequest, parseNumber, WebSocketData
import { ClipboardService, LogType, NotifyService, WebSocketFactoryService, WindowService } from 'aas-lib';

import { SelectionMode } from '../types/selection-mode';
import { TranslateService } from '@ngx-translate/core';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { CommandHandlerService } from '../aas/command-handler.service';
import { MoveLeftCommand } from './commands/move-left-command';
import { MoveRightCommand } from './commands/move-right-command';
Expand Down Expand Up @@ -78,7 +78,7 @@ interface TimeSeries {
templateUrl: './dashboard.component.html',
styleUrls: ['./dashboard.component.scss'],
standalone: true,
imports: [NgClass, AsyncPipe, FormsModule],
imports: [NgClass, AsyncPipe, FormsModule, TranslateModule],
})
export class DashboardComponent implements OnInit, OnDestroy, AfterViewInit, AfterViewChecked {
private readonly map = new Map<string, UpdateTuple>();
Expand Down Expand Up @@ -121,6 +121,10 @@ export class DashboardComponent implements OnInit, OnDestroy, AfterViewInit, Aft
@ViewChild('dashboardToolbar', { read: TemplateRef })
public dashboardToolbar: TemplateRef<unknown> | null = null;

public get isEmpty(): boolean {
return this._activePage.items.length === 0;
}

public get activePage(): DashboardPage {
return this._activePage;
}
Expand Down
10 changes: 2 additions & 8 deletions projects/aas-portal/src/app/dashboard/dashboard.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import { Injectable } from '@angular/core';
import { v4 as uuid } from 'uuid';
import cloneDeep from 'lodash-es/cloneDeep';
import { BehaviorSubject, catchError, EMPTY, first, map, mergeMap, Observable, of } from 'rxjs';
import { BehaviorSubject, EMPTY, first, map, mergeMap, Observable, of } from 'rxjs';
import { encodeBase64Url, AuthService } from 'aas-lib';
import { aas, AASDocument, ApplicationError, getIdShortPath, getUnit, LiveNode, LiveRequest } from 'common';

Expand Down Expand Up @@ -107,9 +107,7 @@ export class DashboardService {
this.auth.getCookie('.DashboardPage').pipe(
map(value =>
this.auth.getCookie('.DashboardPages').pipe(
mergeMap(data => {
return data ? of(JSON.parse(data) as DashboardPage[]) : EMPTY;
}),
mergeMap(data => (data ? of(JSON.parse(data) as DashboardPage[]) : EMPTY)),
map(pages => {
this._pages = pages;
this.index$.next(
Expand All @@ -123,10 +121,6 @@ export class DashboardService {
),
),
),
catchError(error => {
console.error(error);
return EMPTY;
}),
)
.subscribe();
}
Expand Down
7 changes: 4 additions & 3 deletions projects/aas-portal/src/app/start/start.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@

<div id="start-container" class="container-fluid">
<fhg-aas-table [documents]="documents" [viewMode]="viewMode" [(selected)]="selected"
[filter]="filter" ></fhg-aas-table>
[filter]="filter"></fhg-aas-table>
</div>

<ng-template #startToolbar>
<div class="input-group me-2">
<button class="btn btn-outline-primary" type="button" (click)="addToFavorites().subscribe()">
<i class="bi bi-star"></i>
</button>
<select #selectFavorites [ngClass]="activeFavorites !== '' ? 'form-select fst-normal fw-normal' : 'form-select fst-italic fw-light'"
<select #selectFavorites
[ngClass]="activeFavorites !== '' ? 'form-select fst-normal fw-normal' : 'form-select fst-italic fw-light'"
[value]="activeFavorites" (change)="setActiveFavorites(selectFavorites.value)">
@for (option of favoritesLists; track option; let i = $index) {
@if (i === 0) {
Expand Down Expand Up @@ -115,4 +116,4 @@
[placeholder]="'PLACEHOLDER_FILTER' | translate" (change)="setFilter(textInput.value)"
(keydown.enter)="textInput.blur()">
</div>
</ng-template>
</ng-template>
26 changes: 15 additions & 11 deletions projects/aas-portal/src/app/view/view.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,20 @@
!
!---------------------------------------------------------------------------->

@switch (template()) {
@case('Nameplate'){
<fhg-digital-nameplate [submodels]="submodels()"></fhg-digital-nameplate>
}
@case ('CustomerFeedback') {
<fhg-customer-feedback [submodels]="submodels()"></fhg-customer-feedback>
}
@default {
<div class="alert alert-info" role="alert">No well known submodel selected.</div>
}
}
<div class="container-fluid">
@switch (template()) {
@case('Nameplate'){
<fhg-digital-nameplate [submodels]="submodels()"></fhg-digital-nameplate>
}
@case ('CustomerFeedback') {
<fhg-customer-feedback [submodels]="submodels()"></fhg-customer-feedback>
}
@default {
<div class="alert alert-info text-center" role="alert">
<span>{{template()}}</span><span>&nbsp;</span><span>{{'INFO_NOT_SUPPORTED_SUBMODEL_VIEW' | translate}}</span>
</div>
}
}
</div>

<ng-template #viewToolbar></ng-template>
3 changes: 2 additions & 1 deletion projects/aas-portal/src/app/view/view.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
} from '@angular/core';

import { ActivatedRoute } from '@angular/router';
import { TranslateModule } from '@ngx-translate/core';
import { EMPTY, from, mergeMap, of, Subscription, toArray, zip } from 'rxjs';

import { ToolbarService } from '../toolbar.service';
Expand All @@ -37,7 +38,7 @@ import {
templateUrl: './view.component.html',
styleUrls: ['./view.component.scss'],
standalone: true,
imports: [DigitalNameplateComponent, CustomerFeedbackComponent],
imports: [DigitalNameplateComponent, CustomerFeedbackComponent, TranslateModule],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
Expand Down
5 changes: 5 additions & 0 deletions projects/aas-portal/src/assets/i18n/de-de.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@
"INFO_NEW_PASSWORD_SENT": "Ein neues Passwort wurde an '{0}' gesendet",
"INFO_DOWNLOAD_FILE_SUCCESS": "{0} wurde erfolgreich heruntergeladen.",
"INFO_UPLOAD_AASX_FILE_SUCCESS": "{0} wurde erfolgreich hochgeladen.",
"INFO_EMPTY_DASHBOARD": "Das Dashboard ist leer.",
"INFO_NO_DOCUMENT": "Keine Verwaltungsschale verfügbar.",
"INFO_NO_SUBMODEL": "Kein Submodel verfügbar.",
"INFO_NOT_SUPPORTED_SUBMODEL_VIEW": "ist eine nicht unterstützte Submodel-Sicht.",
"INFO_NO_SHELLS_AVAILABLE": "Keine Verwaltungsschalen verfügbar.",
"CONFIRM_DELETE_FILE": "{0} unwiderruflich löschen?",
"CONFIRM_DELETE_FILES": "{0} Dateien unwiderruflich löschen?",
"CONFIRM_RESET_CONFIGURATION": "Möchten Sie die AASServer Standardkonfiguration wiederherstellen?",
Expand Down
4 changes: 4 additions & 0 deletions projects/aas-portal/src/assets/i18n/en-us.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@
"INFO_NEW_PASSWORD_SENT": "A new password was sent to '{0}'.",
"INFO_DOWNLOAD_FILE_SUCCESS": "{0} was downloaded successfully.",
"INFO_UPLOAD_AASX_FILE_SUCCESS": "{0} was uploaded successfully.",
"INFO_EMPTY_DASHBOARD": "The dashboard is empty.",
"INFO_NO_DOCUMENT": "No Asset Administration Shell available.",
"INFO_NOT_SUPPORTED_SUBMODEL_VIEW": "is an unsupported submodel view.",
"INFO_NO_SHELLS_AVAILABLE": "No Asset Administration Shells available.",
"CONFIRM_DELETE_FILE": "Permanently delete {0}?",
"CONFIRM_DELETE_FILES": "Permanently delete {0} files?",
"CONFIRM_RESET_CONFIGURATION": "Do you want to restore the default AASServer configuration?",
Expand Down
Loading

0 comments on commit eecfa3c

Please sign in to comment.