-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e6b21c6
commit 0c3c5db
Showing
22 changed files
with
217 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import {Pipe, PipeTransform} from '@angular/core'; | ||
|
||
@Pipe({ | ||
name: 'compass', | ||
standalone: true | ||
}) | ||
export class CompassPipe implements PipeTransform { | ||
transform(value: string[]): string { | ||
return value | ||
.map(directions => directions | ||
.split('_') | ||
.map(direction => direction.at(0)) | ||
.join('')) | ||
.join(', '); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export interface Device { | ||
id: string; | ||
name: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import {Device} from "./device.dto"; | ||
|
||
export interface RollerShutter extends Device { | ||
|
||
currentLift: number; | ||
currentTilt: number; | ||
open: boolean; | ||
config?: { | ||
compassDirection: string[]; | ||
closeAt: string; | ||
openAt: string; | ||
noAutomaticsUntil: string | undefined; | ||
closeWithInterrupt: string; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
frontend/src/app/pages/roller-shutter-page/roller-shutter-page-container.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import {ChangeDetectionStrategy, Component} from "@angular/core"; | ||
import {AsyncPipe} from "@angular/common"; | ||
import {DevicesService} from "../../services/devices.service"; | ||
import {map, Observable} from "rxjs"; | ||
import {RollerShutter} from "../../models/devices/roller-shutter.dto"; | ||
import {RollerShutterPageComponent} from "./roller-shutter-page.component"; | ||
|
||
@Component({ | ||
standalone: true, | ||
imports: [ | ||
AsyncPipe, | ||
RollerShutterPageComponent | ||
], | ||
template: ` | ||
@if (rollerShutters$ | async; as rollerShutters) { | ||
<app-roller-shutter-page [rollerShutters]="rollerShutters"/> | ||
}`, | ||
changeDetection: ChangeDetectionStrategy.OnPush | ||
}) | ||
export class RollerShutterPageContainerComponent { | ||
|
||
rollerShutters$: Observable<RollerShutter[]>; | ||
|
||
constructor(devicesService: DevicesService) { | ||
this.rollerShutters$ = devicesService.rollerShutters$.pipe(map(deviceMap => [...deviceMap.values()])); | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
frontend/src/app/pages/roller-shutter-page/roller-shutter-page.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@for (rollerShutter of rollerShutters(); track rollerShutter.id) { | ||
<app-roller-shutter-cell [rollerShutter]="rollerShutter"/> | ||
} |
10 changes: 10 additions & 0 deletions
10
frontend/src/app/pages/roller-shutter-page/roller-shutter-page.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
:host { | ||
display: grid; | ||
grid-template-columns: 33% 33% 33% | ||
} | ||
|
||
@media screen and (max-width: 1000px) { | ||
:host { | ||
grid-template-columns: 100%; | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
frontend/src/app/pages/roller-shutter-page/roller-shutter-page.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import {ComponentFixture, TestBed} from '@angular/core/testing'; | ||
|
||
import {RollerShutterPageComponent} from './roller-shutter-page.component'; | ||
|
||
describe('RollerShutterPageComponent', () => { | ||
let component: RollerShutterPageComponent; | ||
let fixture: ComponentFixture<RollerShutterPageComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [RollerShutterPageComponent] | ||
}) | ||
.compileComponents(); | ||
|
||
fixture = TestBed.createComponent(RollerShutterPageComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
19 changes: 19 additions & 0 deletions
19
frontend/src/app/pages/roller-shutter-page/roller-shutter-page.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import {ChangeDetectionStrategy, Component, input} from '@angular/core'; | ||
import {RollerShutter} from "../../models/devices/roller-shutter.dto"; | ||
import {RollerShutterCellComponent} from "./roller-shutter-cell/roller-shutter-cell.component"; | ||
|
||
@Component({ | ||
selector: 'app-roller-shutter-page', | ||
standalone: true, | ||
imports: [ | ||
RollerShutterCellComponent | ||
], | ||
templateUrl: './roller-shutter-page.component.html', | ||
styleUrl: './roller-shutter-page.component.scss', | ||
changeDetection: ChangeDetectionStrategy.OnPush | ||
}) | ||
export class RollerShutterPageComponent { | ||
|
||
public rollerShutters = input.required<RollerShutter[]>(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import {Routes} from '@angular/router'; | ||
import {TrainStationPageComponent} from "./train-station-page/train-station-page.component"; | ||
import {WeatherPageComponent} from "./weather-page/weather-page.component"; | ||
import {UnauthorizedPageComponent} from "./unauthorized-page/unauthorized-page.component"; | ||
import {AuthGuard} from "../core/auth.service"; | ||
import {StartPageContainerComponent} from "./start-page/start-page-container.component"; | ||
import {LivecamPageComponent} from "./livecam-page/livecam-page.component"; | ||
import {TrelloPageComponent} from "./trello-page/trello-page.component"; | ||
import {AnimationPageContainerComponent} from "./animation-page/animation-page-container.component"; | ||
import {RollerShutterPageContainerComponent} from "./roller-shutter-page/roller-shutter-page-container.component"; | ||
|
||
export const routes: Routes = [ | ||
{ | ||
path: '', | ||
component: StartPageContainerComponent, | ||
canActivate: [AuthGuard] | ||
}, | ||
{ | ||
path: 'train', | ||
component: TrainStationPageComponent, | ||
canActivate: [AuthGuard] | ||
}, | ||
{ | ||
path: 'weather', | ||
component: WeatherPageComponent, | ||
canActivate: [AuthGuard] | ||
}, | ||
{ | ||
path: 'livecam', | ||
component: LivecamPageComponent, | ||
canActivate: [AuthGuard] | ||
}, | ||
{ | ||
path: 'animation', | ||
component: AnimationPageContainerComponent, | ||
canActivate: [AuthGuard] | ||
}, | ||
{ | ||
path: 'roller-shutter', | ||
component: RollerShutterPageContainerComponent, | ||
canActivate: [AuthGuard] | ||
}, | ||
{ | ||
path: 'trello', | ||
component: TrelloPageComponent, | ||
canActivate: [AuthGuard] | ||
}, | ||
{ | ||
path: 'unauthorized', | ||
component: UnauthorizedPageComponent | ||
} | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.