-
Notifications
You must be signed in to change notification settings - Fork 513
Update energymonitor arrows #3375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
da-Kai
wants to merge
9
commits into
OpenEMS:develop
Choose a base branch
from
da-Kai:feature/migrate-live-animations
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+320
−272
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
420051d
Migrate animations to native css
da-Kai 086a736
use variable
da-Kai 306db78
add animation service
da-Kai 73deedc
move animationSpeed variable
da-Kai d480c3d
linting
da-Kai 3dc6cc2
revert import
da-Kai 97b3e01
Merge remote-tracking branch 'origin/develop' into feature/migrate-li…
da-Kai 27f6a95
alternate animations instead of delay.
da-Kai 9bfbc22
remove "@angular/animations" from package.json
da-Kai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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,83 @@ | ||
| $animation-duration: 600ms; | ||
| $opacity-low: 0.1; | ||
| $opacity-medium: 0.4; | ||
|
|
||
| %provide-power-show { | ||
| opacity: $opacity-medium; | ||
| transition: opacity 0ms none, transform 0ms none; | ||
| } | ||
|
|
||
| %provide-power-hide { | ||
| opacity: $opacity-low; | ||
| transition: opacity $animation-duration ease-in, transform $animation-duration ease-in; | ||
| } | ||
|
|
||
| %consume-power-show { | ||
| opacity: $opacity-low; | ||
| transition: opacity 0ms none, transform 0ms none; | ||
| } | ||
|
|
||
| %consume-power-hide { | ||
| opacity: $opacity-medium; | ||
| transition: opacity $animation-duration ease-out, transform $animation-duration ease-out; | ||
| } | ||
|
|
||
| .grid-buy-show { | ||
| @extend %provide-power-show; | ||
| transform: translateX(0%); | ||
| } | ||
|
|
||
| .grid-buy-hide { | ||
| @extend %provide-power-hide; | ||
| transform: translateX(17%); | ||
| } | ||
|
|
||
| .grid-sell-show { | ||
| @extend %consume-power-show; | ||
| transform: translateX(0%); | ||
| } | ||
|
|
||
| .grid-sell-hide { | ||
| @extend %consume-power-hide; | ||
| transform: translateX(-17%); | ||
| } | ||
|
|
||
| .consumption-show { | ||
| @extend %consume-power-show; | ||
| transform: translateX(0%); | ||
| } | ||
|
|
||
| .consumption-hide { | ||
| @extend %consume-power-hide; | ||
| transform: translateX(17%); | ||
| } | ||
|
|
||
| .production-show { | ||
| @extend %provide-power-show; | ||
| transform: translateY(0%); | ||
| } | ||
|
|
||
| .production-hide { | ||
| @extend %provide-power-hide; | ||
| transform: translateY(17%); | ||
| } | ||
|
|
||
| .storage-discharge-show { | ||
| @extend %provide-power-show; | ||
| transform: translateY(0); | ||
| } | ||
|
|
||
| .storage-discharge-hide { | ||
| @extend %provide-power-hide; | ||
| transform: translateY(-17%); | ||
| } | ||
|
|
||
| .storage-charge-show { | ||
| @extend %consume-power-show; | ||
| transform: translateY(0); | ||
| } | ||
|
|
||
| .storage-charge-hide { | ||
| @extend %consume-power-hide; | ||
| transform: translateY(17%); | ||
| } |
This file contains hidden or 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
21 changes: 21 additions & 0 deletions
21
ui/src/app/edge/live/energymonitor/chart/section/animation.service.ts
This file contains hidden or 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,21 @@ | ||
| import { Injectable } from "@angular/core"; | ||
| import { BehaviorSubject, interval, Observable } from "rxjs"; | ||
|
|
||
| @Injectable({ | ||
| providedIn: "root", | ||
| }) | ||
| export class AnimationService { | ||
| public readonly toggleAnimation$: Observable<boolean>; | ||
|
|
||
| private readonly animationSpeed = 605; | ||
| private toggleAnimSubject = new BehaviorSubject(true); | ||
| private value: boolean = true; | ||
|
|
||
| constructor() { | ||
| this.toggleAnimation$ = this.toggleAnimSubject.asObservable(); | ||
| interval(this.animationSpeed).subscribe(() => { | ||
| this.value = !this.value; | ||
| this.toggleAnimSubject.next(this.value); | ||
| }); | ||
| } | ||
| } |
69 changes: 35 additions & 34 deletions
69
ui/src/app/edge/live/energymonitor/chart/section/consumption.component.html
This file contains hidden or 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 |
|---|---|---|
| @@ -1,38 +1,39 @@ | ||
| <svg:path [attr.d]="outlinePath" fill="var(--ion-color-light)" stroke="var(--ion-color-medium-soft)"></svg:path> | ||
| @if (isEnabled) { | ||
| @if (isEnabled) { | ||
| <svg:path [attr.d]="valuePath" fill="var(--ion-color-warning)" stroke="var(--ion-color-warning)"> | ||
| </svg:path> | ||
| } | ||
| @if (isEnabled && energyFlow) { | ||
| <svg:g> | ||
| </svg:path> | ||
| } | ||
| @if (isEnabled && energyFlow) { | ||
| <svg:g> | ||
| <svg:defs> | ||
| <svg:linearGradient [attr.id]="sectionId" [attr.x1]="energyFlow.gradient.x1" [attr.y1]="energyFlow.gradient.y1" | ||
| [attr.x2]="energyFlow.gradient.x2" [attr.y2]="energyFlow.gradient.y2"> | ||
| <svg:stop offset="0%" stop-color="var(--ion-item-background)" /> | ||
| <svg:stop offset="100%" stop-color="var(--ion-color-warning)" /> | ||
| <svg:linearGradient [attr.id]="sectionId" [attr.x1]="energyFlow.gradient.x1" | ||
| [attr.y1]="energyFlow.gradient.y1" [attr.x2]="energyFlow.gradient.x2" | ||
| [attr.y2]="energyFlow.gradient.y2"> | ||
| <svg:stop offset="0%" stop-color="var(--ion-item-background)" /> | ||
| <svg:stop offset="100%" stop-color="var(--ion-color-warning)" /> | ||
| </svg:linearGradient> | ||
| </svg:defs> | ||
| <svg:polygon [attr.points]="energyFlow.points" attr.fill="{{ fillRef }}" /> | ||
| <svg:polygon [@Consumption]="stateName" [attr.points]="energyFlow.animationPoints" | ||
| style="fill: var(--ion-item-background)" /> | ||
| </svg:g> | ||
| } | ||
| @if (isEnabled && squarePosition && square) { | ||
| <svg:g | ||
| attr.transform="translate({{squarePosition.x}},{{squarePosition.y}})"> | ||
| <svg:text [attr.x]="square.valueText.x" [attr.y]="square.valueText.y" [attr.text-anchor]="square.valueText.anchor" | ||
| font-family="sans-serif" font-size="square.valueText.fontsize" fill="var(--ion-text-color)"> | ||
| <!-- Adjusting the color of the Text to be flexiable with Light and Dark mode --> | ||
| @if (valueText) { | ||
| <ng-container>{{valueText}}</ng-container> | ||
| } @else { | ||
| <ng-template [ngTemplateOutlet]="no_text"></ng-template> | ||
| } | ||
| <ng-template #no_text>-</ng-template> | ||
| </svg:text> | ||
| <svg:use style="color: var(--ion-color-warning)" [attr.x]="square.image.x" [attr.y]="square.image.y" | ||
| [attr.width]="square.image.length" [attr.height]="square.image.length" | ||
| [attr.href]="square.image.image + '#root'"> | ||
| </svg:use> | ||
| </svg:g> | ||
| } | ||
| </svg:defs> | ||
| <svg:polygon [attr.points]="energyFlow.points" attr.fill="{{ fillRef }}" /> | ||
| <svg:polygon [class]="getAnimationClass()" [attr.points]="energyFlow.animationPoints" | ||
| style="fill: var(--ion-item-background)" /> | ||
| </svg:g> | ||
| } | ||
| @if (isEnabled && squarePosition && square) { | ||
| <svg:g attr.transform="translate({{squarePosition.x}},{{squarePosition.y}})"> | ||
| <svg:text [attr.x]="square.valueText.x" [attr.y]="square.valueText.y" | ||
| [attr.text-anchor]="square.valueText.anchor" font-family="sans-serif" font-size="square.valueText.fontsize" | ||
| fill="var(--ion-text-color)"> | ||
| <!-- Adjusting the color of the Text to be flexiable with Light and Dark mode --> | ||
| @if (valueText) { | ||
| <ng-container>{{valueText}}</ng-container> | ||
| } @else { | ||
| <ng-template [ngTemplateOutlet]="no_text"></ng-template> | ||
| } | ||
| <ng-template #no_text>-</ng-template> | ||
| </svg:text> | ||
| <svg:use style="color: var(--ion-color-warning)" [attr.x]="square.image.x" [attr.y]="square.image.y" | ||
| [attr.width]="square.image.length" [attr.height]="square.image.length" | ||
| [attr.href]="square.image.image + '#root'"> | ||
| </svg:use> | ||
| </svg:g> | ||
| } |
This file contains hidden or 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
83 changes: 42 additions & 41 deletions
83
ui/src/app/edge/live/energymonitor/chart/section/grid.component.html
This file contains hidden or 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 |
|---|---|---|
| @@ -1,46 +1,47 @@ | ||
| <svg:path [attr.d]="outlinePath" fill="var(--ion-color-light)" stroke="var(--ion-color-medium-soft)"></svg:path> | ||
| @if (isEnabled) { | ||
| @if (isEnabled) { | ||
| <svg:path [attr.d]="valuePath" fill="var(--ion-color-dark)" stroke="var(--ion-color-dark)"></svg:path> | ||
| } | ||
| @if (isEnabled && energyFlow) { | ||
| <svg:g> | ||
| } | ||
| @if (isEnabled && energyFlow) { | ||
| <svg:g> | ||
| <svg:defs> | ||
| <svg:linearGradient [attr.id]="sectionId" [attr.x1]="energyFlow.gradient.x1" [attr.y1]="energyFlow.gradient.y1" | ||
| [attr.x2]="energyFlow.gradient.x2" [attr.y2]="energyFlow.gradient.y2"> | ||
| <svg:stop offset="0%" stop-color="var(--ion-item-background)" /> | ||
| <svg:stop offset="100%" stop-color="var(--ion-color-dark)" /> | ||
| <svg:linearGradient [attr.id]="sectionId" [attr.x1]="energyFlow.gradient.x1" | ||
| [attr.y1]="energyFlow.gradient.y1" [attr.x2]="energyFlow.gradient.x2" | ||
| [attr.y2]="energyFlow.gradient.y2"> | ||
| <svg:stop offset="0%" stop-color="var(--ion-item-background)" /> | ||
| <svg:stop offset="100%" stop-color="var(--ion-color-dark)" /> | ||
| </svg:linearGradient> | ||
| </svg:defs> | ||
| <svg:polygon [attr.points]="energyFlow.points" attr.fill="{{ fillRef }}" /> | ||
| @if (buyAnimationTrigger) { | ||
| <ng-container> | ||
| <svg:polygon [@GridBuy]="stateNameBuy" [attr.points]="energyFlow.animationPoints" | ||
| style="fill: var(--ion-item-background)" /> | ||
| </ng-container> | ||
| </svg:defs> | ||
| <svg:polygon [attr.points]="energyFlow.points" attr.fill="{{ fillRef }}" /> | ||
| @if (buyAnimationTrigger) { | ||
| <ng-container> | ||
| <svg:polygon [class]="getBuyAnimationClass()" [attr.points]="energyFlow.animationPoints" | ||
| style="fill: var(--ion-item-background)" /> | ||
| </ng-container> | ||
| } | ||
| @if (sellAnimationTrigger) { | ||
| <ng-container> | ||
| <svg:polygon [class]="getSellAnimationClass()" [attr.points]="energyFlow.animationPoints" | ||
| style="fill: var(--ion-item-background)" /> | ||
| </ng-container> | ||
| } | ||
| </svg:g> | ||
| } | ||
| @if (isEnabled && squarePosition && square) { | ||
| <svg:g attr.transform="translate({{squarePosition.x}},{{squarePosition.y}})"> | ||
| <svg:text [attr.x]="square.valueText.x" [attr.y]="square.valueText.y" | ||
| [attr.text-anchor]="square.valueText.anchor" font-family="sans-serif" font-size="square.valueText.fontsize" | ||
| fill="var(--ion-text-color)"> | ||
| @if (valueText) { | ||
| <ng-container>{{valueText}}</ng-container> | ||
| } @else { | ||
| <ng-template [ngTemplateOutlet]="no_text"></ng-template> | ||
| } | ||
| @if (sellAnimationTrigger) { | ||
| <ng-container> | ||
| <svg:polygon [@GridSell]="stateNameSell" [attr.points]="energyFlow.animationPoints" | ||
| style="fill: var(--ion-item-background)" /> | ||
| </ng-container> | ||
| } | ||
| </svg:g> | ||
| } | ||
| @if (isEnabled && squarePosition && square) { | ||
| <svg:g | ||
| attr.transform="translate({{squarePosition.x}},{{squarePosition.y}})"> | ||
| <svg:text [attr.x]="square.valueText.x" [attr.y]="square.valueText.y" [attr.text-anchor]="square.valueText.anchor" | ||
| font-family="sans-serif" font-size="square.valueText.fontsize" fill="var(--ion-text-color)"> | ||
| @if (valueText) { | ||
| <ng-container>{{valueText}}</ng-container> | ||
| } @else { | ||
| <ng-template [ngTemplateOutlet]="no_text"></ng-template> | ||
| } | ||
| <ng-template #no_text>-</ng-template> | ||
| </svg:text> | ||
| <svg:use style="color: var(--ion-color-dark)" [attr.x]="square.image.x" [attr.y]="square.image.y" | ||
| [attr.width]="square.image.length" [attr.height]="square.image.length" | ||
| [attr.href]="square.image.image + '#root'"> | ||
| </svg:use> | ||
| </svg:g> | ||
| } | ||
| <ng-template #no_text>-</ng-template> | ||
| </svg:text> | ||
| <svg:use style="color: var(--ion-color-dark)" [attr.x]="square.image.x" [attr.y]="square.image.y" | ||
| [attr.width]="square.image.length" [attr.height]="square.image.length" | ||
| [attr.href]="square.image.image + '#root'"> | ||
| </svg:use> | ||
| </svg:g> | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.