@@ -5,6 +5,7 @@ import { ConfigService } from '../config/config.service';
55import { PrinterState , PrinterStatus , TemperatureReading } from '../model' ;
66import { NotificationService } from '../notification/notification.service' ;
77import { EnclosureService } from '../services/enclosure/enclosure.service' ;
8+ import { ProfileService } from '../services/profiles/profiles.service' ;
89import { SocketService } from '../services/socket/socket.service' ;
910
1011@Component ( {
@@ -18,12 +19,14 @@ export class BottomBarComponent implements OnDestroy {
1819
1920 public printerStatus : PrinterState ;
2021 public enclosureTemperature : TemperatureReading ;
21-
22+ public profiles :boolean = false ;
23+ public PrinterName :String ;
2224 public constructor (
2325 private socketService : SocketService ,
2426 private configService : ConfigService ,
2527 private enclosureService : EnclosureService ,
2628 private notificationService : NotificationService ,
29+ private profileService : ProfileService
2730 ) {
2831 if ( this . configService . getAmbientTemperatureSensorName ( ) !== null ) {
2932 this . subscriptions . add (
@@ -52,17 +55,33 @@ export class BottomBarComponent implements OnDestroy {
5255 }
5356 } ) ,
5457 ) ;
58+ this . getPrinterName ( ) ;
5559 }
5660
5761 public getStringStatus ( printerState : PrinterState ) : string {
5862 return PrinterState [ printerState ] ;
5963 }
6064
61- public getPrinterName ( ) : string {
62- return this . configService . getPrinterName ( ) ;
65+ public getPrinterName ( ) : void {
66+ this . profileService . getActiveProfile ( ) . subscribe ( ( profile ) => {
67+ this . PrinterName = profile . name ;
68+ } ) ;
6369 }
6470
6571 public ngOnDestroy ( ) : void {
6672 this . subscriptions . unsubscribe ( ) ;
6773 }
74+
75+ public showProfiles ( ) {
76+ if ( this . printerStatus == PrinterState . operational ) {
77+ this . profiles = true ;
78+ }
79+ }
80+
81+ public hideProfiles ( ) : void {
82+ setTimeout ( ( ) : void => {
83+ this . profiles = false ;
84+ this . getPrinterName ( ) ;
85+ } , 350 ) ;
86+ }
6887}
0 commit comments