-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(portal): refactor settings (#2536)
* feat(portal): refactor settings * chore: refactor * small updates --------- Co-authored-by: Matt Hill <[email protected]>
- Loading branch information
Showing
54 changed files
with
7,640 additions
and
4,540 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
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
70 changes: 70 additions & 0 deletions
70
web/projects/ui/src/app/apps/portal/components/header/about.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,70 @@ | ||
import { CommonModule } from '@angular/common' | ||
import { ChangeDetectionStrategy, Component, inject } from '@angular/core' | ||
import { CopyService, EmverPipesModule } from '@start9labs/shared' | ||
import { | ||
TuiButtonModule, | ||
TuiCellModule, | ||
TuiTitleModule, | ||
} from '@taiga-ui/experimental' | ||
import { PolymorpheusComponent } from '@tinkoff/ng-polymorpheus' | ||
import { PatchDB } from 'patch-db-client' | ||
import { DataModel } from 'src/app/services/patch-db/data-model' | ||
import { ConfigService } from 'src/app/services/config.service' | ||
|
||
@Component({ | ||
template: ` | ||
<ng-container *ngIf="server$ | async as server"> | ||
<div tuiCell> | ||
<div tuiTitle> | ||
<strong>Version</strong> | ||
<div tuiSubtitle>{{ server.version | displayEmver }}</div> | ||
</div> | ||
</div> | ||
<div tuiCell> | ||
<div tuiTitle> | ||
<strong>Git Hash</strong> | ||
<div tuiSubtitle>{{ gitHash }}</div> | ||
</div> | ||
<button | ||
tuiIconButton | ||
appearance="icon" | ||
iconLeft="tuiIconCopy" | ||
(click)="copyService.copy(gitHash)" | ||
> | ||
Copy | ||
</button> | ||
</div> | ||
<div tuiCell> | ||
<div tuiTitle> | ||
<strong>CA fingerprint</strong> | ||
<div tuiSubtitle>{{ server['ca-fingerprint'] }}</div> | ||
</div> | ||
<button | ||
tuiIconButton | ||
appearance="icon" | ||
iconLeft="tuiIconCopy" | ||
(click)="copyService.copy(server['ca-fingerprint'])" | ||
> | ||
Copy | ||
</button> | ||
</div> | ||
</ng-container> | ||
`, | ||
styles: ['[tuiCell] { padding-inline: 0 }'], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
standalone: true, | ||
imports: [ | ||
CommonModule, | ||
EmverPipesModule, | ||
TuiTitleModule, | ||
TuiButtonModule, | ||
TuiCellModule, | ||
], | ||
}) | ||
export class AboutComponent { | ||
readonly server$ = inject(PatchDB<DataModel>).watch$('server-info') | ||
readonly copyService = inject(CopyService) | ||
readonly gitHash = inject(ConfigService).gitHash | ||
} | ||
|
||
export const ABOUT = new PolymorpheusComponent(AboutComponent) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<header appHeader>My server</header> | ||
<nav appNavigation></nav> | ||
<main> | ||
<router-outlet></router-outlet> | ||
<router-outlet /> | ||
</main> | ||
<app-drawer></app-drawer> | ||
<app-drawer /> |
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
50 changes: 50 additions & 0 deletions
50
web/projects/ui/src/app/apps/portal/routes/system/settings/components/button.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,50 @@ | ||
import { CommonModule } from '@angular/common' | ||
import { ChangeDetectionStrategy, Component, Input } from '@angular/core' | ||
import { RouterLink } from '@angular/router' | ||
import { TuiIconModule, TuiTitleModule } from '@taiga-ui/experimental' | ||
import { SettingBtn } from '../settings.types' | ||
|
||
@Component({ | ||
selector: 'settings-button', | ||
template: ` | ||
<button *ngIf="button.action" class="g-action" (click)="button.action()"> | ||
<ng-container *ngTemplateOutlet="template" /> | ||
</button> | ||
<a | ||
*ngIf="button.href" | ||
class="g-action" | ||
target="_blank" | ||
rel="noreferrer" | ||
[href]="button.href" | ||
> | ||
<ng-container *ngTemplateOutlet="template" /> | ||
</a> | ||
<a | ||
*ngIf="button.routerLink" | ||
class="g-action" | ||
[routerLink]="button.routerLink" | ||
> | ||
<ng-container *ngTemplateOutlet="template" /> | ||
</a> | ||
<ng-template #template> | ||
<tui-icon [icon]="button.icon" /> | ||
<div tuiTitle [style.flex]="1"> | ||
<strong>{{ button.title }}</strong> | ||
<div tuiSubtitle>{{ button.description }}</div> | ||
<ng-content /> | ||
</div> | ||
<tui-icon *ngIf="button.routerLink" icon="tuiIconChevronRight" /> | ||
<tui-icon *ngIf="button.href" icon="tuiIconExternalLink" /> | ||
</ng-template> | ||
`, | ||
styles: [ | ||
':host:not(:last-child) { display: block; box-shadow: 0 1px var(--tui-clear); }', | ||
], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
standalone: true, | ||
imports: [CommonModule, TuiIconModule, TuiTitleModule, RouterLink], | ||
}) | ||
export class SettingsButtonComponent { | ||
@Input({ required: true }) | ||
button!: SettingBtn | ||
} |
43 changes: 43 additions & 0 deletions
43
web/projects/ui/src/app/apps/portal/routes/system/settings/components/http.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,43 @@ | ||
import { ChangeDetectionStrategy, Component } from '@angular/core' | ||
import { TuiNotificationModule } from '@taiga-ui/core' | ||
import { | ||
TuiButtonModule, | ||
TuiCellModule, | ||
TuiTitleModule, | ||
} from '@taiga-ui/experimental' | ||
|
||
@Component({ | ||
selector: 'settings-http', | ||
template: ` | ||
<tui-notification status="warning"> | ||
<div tuiCell [style.padding]="0"> | ||
<div tuiTitle> | ||
Http detected | ||
<div tuiSubtitle> | ||
<div> | ||
Tor is faster over https. | ||
<a | ||
href="https://docs.start9.com/0.3.5.x/user-manual/trust-ca" | ||
target="_blank" | ||
rel="noreferrer" | ||
> | ||
Download and trust your server's Root CA | ||
</a> | ||
, then switch to https. | ||
</div> | ||
</div> | ||
</div> | ||
<ng-content /> | ||
</div> | ||
</tui-notification> | ||
`, | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
standalone: true, | ||
imports: [ | ||
TuiButtonModule, | ||
TuiCellModule, | ||
TuiNotificationModule, | ||
TuiTitleModule, | ||
], | ||
}) | ||
export class SettingsHttpsComponent {} |
Oops, something went wrong.