-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1130 from DSD-DBS/display-value-component
refactor: Add own display value component
- Loading branch information
Showing
10 changed files
with
119 additions
and
96 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
4 changes: 4 additions & 0 deletions
4
frontend/src/app/helpers/display-value/display-value.component.css
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 @@ | ||
/* | ||
* SPDX-FileCopyrightText: Copyright DB Netz AG and the capella-collab-manager contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ |
37 changes: 37 additions & 0 deletions
37
frontend/src/app/helpers/display-value/display-value.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,37 @@ | ||
<!-- | ||
~ SPDX-FileCopyrightText: Copyright DB Netz AG and the capella-collab-manager contributors | ||
~ SPDX-License-Identifier: Apache-2.0 | ||
--> | ||
|
||
<div class="mt-2 flex items-center"> | ||
<span class="mr-2 gap-1 rounded border p-2 font-mono"> | ||
<span [ngClass]="{ blur: !valueRevealed && blurValue }">{{ | ||
value | ||
}}</span></span | ||
> | ||
<button | ||
*ngIf="blurValue && !valueRevealed" | ||
(click)="valueRevealed = true" | ||
matTooltip="Show value" | ||
class="flex" | ||
> | ||
<mat-icon>blur_off</mat-icon> | ||
</button> | ||
<button | ||
*ngIf="blurValue && valueRevealed" | ||
(click)="valueRevealed = false" | ||
matTooltip="Hide value" | ||
class="flex" | ||
> | ||
<mat-icon>blur_on</mat-icon> | ||
</button> | ||
<button | ||
*ngIf="value" | ||
[cdkCopyToClipboard]="value!" | ||
matTooltip="Copy value to clipboard" | ||
(click)="showClipboardMessage()" | ||
class="flex" | ||
> | ||
<mat-icon>content_copy</mat-icon> | ||
</button> | ||
</div> |
40 changes: 40 additions & 0 deletions
40
frontend/src/app/helpers/display-value/display-value.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,40 @@ | ||
/* | ||
* SPDX-FileCopyrightText: Copyright DB Netz AG and the capella-collab-manager contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { Component, Input } from '@angular/core'; | ||
import { ToastService } from 'src/app/helpers/toast/toast.service'; | ||
|
||
@Component({ | ||
selector: 'app-display-value', | ||
templateUrl: './display-value.component.html', | ||
styleUrls: ['./display-value.component.css'], | ||
}) | ||
export class DisplayValueComponent { | ||
constructor(private toastService: ToastService) {} | ||
|
||
@Input() | ||
value?: string = undefined; | ||
|
||
@Input() | ||
blurValue = false; | ||
|
||
@Input() | ||
valueName?: string = undefined; | ||
|
||
showClipboardMessage(): void { | ||
this.toastService.showSuccess( | ||
`${ | ||
this.valueName ? this.capitalizeString(this.valueName) : 'Value' | ||
} copied`, | ||
`The ${this.valueName || 'value'} was copied to your clipboard.`, | ||
); | ||
} | ||
|
||
capitalizeString(value: string) { | ||
return value.charAt(0).toUpperCase() + value.slice(1); | ||
} | ||
|
||
valueRevealed = false; | ||
} |
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
17 changes: 0 additions & 17 deletions
17
...-sessions-wrapper/active-sessions/connect/guacamole-dialog/guacamole-dialog.component.css
This file was deleted.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
...s/user-sessions-wrapper/active-sessions/connection-dialog/connection-dialog.component.css
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 @@ | ||
/* | ||
* SPDX-FileCopyrightText: Copyright DB Netz AG and the capella-collab-manager contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ |
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