chore: address comments

This commit is contained in:
waterplea
2024-07-05 18:23:18 +05:00
parent 6234391229
commit d85e621bb3
10 changed files with 107 additions and 32 deletions

View File

@@ -28,7 +28,7 @@ import { GetBackupIconPipe } from '../pipes/get-backup-icon.pipe'
@if (current.id === job.id) { @if (current.id === job.id) {
<span [style.color]="'var(--tui-positive)'">Running</span> <span [style.color]="'var(--tui-positive)'">Running</span>
} @else { } @else {
{{ job.next | date: 'MMM d, y, h:mm a' }} {{ job.next | date: 'medium' }}
} }
</td> </td>
<td class="name">{{ job.name }}</td> <td class="name">{{ job.name }}</td>
@@ -59,7 +59,11 @@ import { GetBackupIconPipe } from '../pipes/get-backup-icon.pipe'
grid-template-columns: 1fr 1fr; grid-template-columns: 1fr 1fr;
} }
.date, .date {
order: 1;
grid-column: span 2;
}
.name { .name {
grid-column: span 2; grid-column: span 2;
} }

View File

@@ -9,10 +9,12 @@ import { FormsModule } from '@angular/forms'
import { ErrorService, LoadingService } from '@start9labs/shared' import { ErrorService, LoadingService } from '@start9labs/shared'
import { ALWAYS_FALSE_HANDLER, ALWAYS_TRUE_HANDLER } from '@taiga-ui/cdk' import { ALWAYS_FALSE_HANDLER, ALWAYS_TRUE_HANDLER } from '@taiga-ui/cdk'
import { TuiDialogService, TuiLinkModule } from '@taiga-ui/core' import { TuiDialogService, TuiLinkModule } from '@taiga-ui/core'
import { TuiButtonModule, TuiIconModule } from '@taiga-ui/experimental' import {
import { TuiCheckboxModule } from '@taiga-ui/kit' TuiButtonModule,
TuiCheckboxModule,
TuiIconModule,
} from '@taiga-ui/experimental'
import { PolymorpheusComponent } from '@tinkoff/ng-polymorpheus' import { PolymorpheusComponent } from '@tinkoff/ng-polymorpheus'
import { BehaviorSubject } from 'rxjs'
import { REPORT } from 'src/app/components/report.component' import { REPORT } from 'src/app/components/report.component'
import { BackupRun } from 'src/app/services/api/api.types' import { BackupRun } from 'src/app/services/api/api.types'
import { ApiService } from 'src/app/services/api/embassy-api.service' import { ApiService } from 'src/app/services/api/embassy-api.service'
@@ -37,7 +39,10 @@ import { HasErrorPipe } from '../pipes/has-error.pipe'
<thead> <thead>
<tr> <tr>
<th> <th>
<tui-checkbox <input
type="checkbox"
size="s"
tuiCheckbox
[disabled]="!selected.length" [disabled]="!selected.length"
[ngModel]="all" [ngModel]="all"
(ngModelChange)="toggle()" (ngModelChange)="toggle()"
@@ -52,9 +57,16 @@ import { HasErrorPipe } from '../pipes/has-error.pipe'
</thead> </thead>
<tbody> <tbody>
@for (run of runs(); track $index) { @for (run of runs(); track $index) {
<tr [style.background]="selected[$index] ? 'var(--tui-clear)' : ''"> <tr>
<td><tui-checkbox [(ngModel)]="selected[$index]" /></td> <td class="checkbox">
<td>{{ run.startedAt | date: 'medium' }}</td> <input
type="checkbox"
tuiCheckbox
size="s"
[(ngModel)]="selected[$index]"
/>
</td>
<td class="date">{{ run.startedAt | date: 'medium' }}</td>
<td class="duration"> <td class="duration">
{{ run.startedAt | duration: run.completedAt }} minutes {{ run.startedAt | duration: run.completedAt }} minutes
</td> </td>
@@ -67,7 +79,7 @@ import { HasErrorPipe } from '../pipes/has-error.pipe'
} }
<button tuiLink (click)="showReport(run)">Report</button> <button tuiLink (click)="showReport(run)">Report</button>
</td> </td>
<td [style.grid-column]="'span 3'"> <td [style.grid-column]="'span 2'">
<tui-icon [icon]="run.job.target.type | getBackupIcon" /> <tui-icon [icon]="run.job.target.type | getBackupIcon" />
{{ run.job.target.name }} {{ run.job.target.name }}
</td> </td>
@@ -87,27 +99,50 @@ import { HasErrorPipe } from '../pipes/has-error.pipe'
</table> </table>
`, `,
styles: ` styles: `
@import '@taiga-ui/core/styles/taiga-ui-local';
tui-icon { tui-icon {
font-size: 1rem; font-size: 1rem;
vertical-align: sub; vertical-align: sub;
margin-inline-end: 0.25rem; margin-inline-end: 0.25rem;
} }
button {
position: relative;
}
[tuiCheckbox] {
display: block;
}
:host-context(tui-root._mobile) { :host-context(tui-root._mobile) {
tr { tr {
grid-template-columns: 1.75rem 1fr 7rem; grid-template-columns: 1fr 7rem;
} }
td:only-child { td:only-child {
grid-column: span 3; grid-column: span 2;
}
.checkbox {
@include fullsize();
[tuiCheckbox] {
@include fullsize();
opacity: 0;
}
} }
.title { .title {
grid-column: span 2;
font-weight: bold; font-weight: bold;
text-transform: uppercase; text-transform: uppercase;
} }
.date,
.duration {
color: var(--tui-text-02);
}
.duration, .duration,
.result { .result {
text-align: right; text-align: right;
@@ -120,12 +155,12 @@ import { HasErrorPipe } from '../pipes/has-error.pipe'
CommonModule, CommonModule,
FormsModule, FormsModule,
TuiButtonModule, TuiButtonModule,
TuiCheckboxModule,
TuiIconModule, TuiIconModule,
TuiLinkModule, TuiLinkModule,
DurationPipe, DurationPipe,
HasErrorPipe, HasErrorPipe,
GetBackupIconPipe, GetBackupIconPipe,
TuiCheckboxModule,
], ],
}) })
export class BackupsHistoryModal { export class BackupsHistoryModal {

View File

@@ -23,7 +23,7 @@ import { toRouterLink } from 'src/app/utils/to-router-link'
template: ` template: `
<td class="checkbox"><ng-content /></td> <td class="checkbox"><ng-content /></td>
<td class="date"> <td class="date">
{{ notificationItem.createdAt | date: 'MMM d, y, h:mm a' }} {{ notificationItem.createdAt | date: 'medium' }}
</td> </td>
<td class="title" [style.color]="color"> <td class="title" [style.color]="color">
<tui-icon [icon]="icon" [style.font-size.rem]="1" /> <tui-icon [icon]="icon" [style.font-size.rem]="1" />
@@ -64,28 +64,36 @@ import { toRouterLink } from 'src/app/utils/to-router-link'
'[class._new]': '!notificationItem.read', '[class._new]': '!notificationItem.read',
}, },
styles: ` styles: `
@import '@taiga-ui/core/styles/taiga-ui-local';
:host { :host {
grid-template-columns: 1.75rem 1fr; grid-template-columns: 1fr;
&._new { &._new {
background: var(--tui-clear) !important; background: var(--tui-clear) !important;
} }
} }
button {
position: relative;
}
td { td {
grid-column: span 2;
padding: 0.25rem; padding: 0.25rem;
vertical-align: top; vertical-align: top;
} }
.checkbox { .checkbox {
grid-column: span 1;
padding-top: 0.4rem; padding-top: 0.4rem;
} }
:host-context(tui-root._mobile) { :host-context(tui-root._mobile) {
.checkbox {
@include fullsize();
}
.date { .date {
grid-column: span 1; order: 1;
color: var(--tui-text-02); color: var(--tui-text-02);
} }

View File

@@ -66,6 +66,14 @@ import { NotificationItemComponent } from './item.component'
} }
</tbody> </tbody>
`, `,
styles: `
@import '@taiga-ui/core/styles/taiga-ui-local';
:host-context(tui-root._mobile) input {
@include fullsize();
opacity: 0;
}
`,
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true, standalone: true,
imports: [ imports: [

View File

@@ -28,7 +28,7 @@ import { Domain } from 'src/app/services/patch-db/data-model'
@for (domain of domains; track $index) { @for (domain of domains; track $index) {
<tr *ngFor="let domain of domains"> <tr *ngFor="let domain of domains">
<td class="title">{{ domain.value }}</td> <td class="title">{{ domain.value }}</td>
<td class="date">{{ domain.createdAt | date: 'short' }}</td> <td class="date">{{ domain.createdAt | date: 'medium' }}</td>
<td class="provider">{{ domain.provider }}</td> <td class="provider">{{ domain.provider }}</td>
<td class="strategy">{{ getStrategy(domain) }}</td> <td class="strategy">{{ getStrategy(domain) }}</td>
<td class="used"> <td class="used">

View File

@@ -44,7 +44,7 @@ import { Proxy } from 'src/app/services/patch-db/data-model'
@for (proxy of proxies; track $index) { @for (proxy of proxies; track $index) {
<tr> <tr>
<td class="title">{{ proxy.name }}</td> <td class="title">{{ proxy.name }}</td>
<td class="date">{{ proxy.createdAt | date: 'short' }}</td> <td class="date">{{ proxy.createdAt | date: 'medium' }}</td>
<td class="type">{{ proxy.type }}</td> <td class="type">{{ proxy.type }}</td>
<td class="used"> <td class="used">
@if (getLength(proxy); as length) { @if (getLength(proxy); as length) {
@@ -110,17 +110,17 @@ import { Proxy } from 'src/app/services/patch-db/data-model'
} }
.date { .date {
order: 3; order: 5;
grid-column: span 2; grid-column: span 2;
color: var(--tui-text-02); color: var(--tui-text-02);
} }
.type { .type {
order: 4; order: 3;
} }
.used { .used {
order: 5; order: 4;
text-align: right; text-align: right;
&:not(:has(button)) { &:not(:has(button)) {

View File

@@ -77,6 +77,8 @@ import { PlatformInfoPipe } from './platform-info.pipe'
`, `,
styles: [ styles: [
` `
@import '@taiga-ui/core/styles/taiga-ui-local';
input { input {
position: absolute; position: absolute;
top: 50%; top: 50%;
@@ -85,6 +87,17 @@ import { PlatformInfoPipe } from './platform-info.pipe'
} }
:host-context(tui-root._mobile) { :host-context(tui-root._mobile) {
input {
@include fullsize();
z-index: 1;
opacity: 0;
transform: none;
}
td:first-child {
padding: 0 0.25rem !important;
}
.agent { .agent {
white-space: nowrap; white-space: nowrap;
display: block; display: block;

View File

@@ -81,18 +81,19 @@ import { ApiService } from 'src/app/services/api/embassy-api.service'
text-align: right; text-align: right;
} }
.date { .fingerprint {
order: 3; order: 3;
grid-column: span 2;
}
.date {
order: 4;
color: var(--tui-text-02);
} }
.algorithm { .algorithm {
order: 4;
text-align: right;
}
.fingerprint {
order: 5; order: 5;
grid-column: span 2; text-align: right;
color: var(--tui-text-02); color: var(--tui-text-02);
} }
} }

View File

@@ -103,6 +103,7 @@ tui-root._mobile .g-table {
} }
tr { tr {
position: relative;
display: grid; display: grid;
border-radius: var(--tui-radius-l); border-radius: var(--tui-radius-l);
padding: 0.75rem 1rem; padding: 0.75rem 1rem;
@@ -110,8 +111,13 @@ tui-root._mobile .g-table {
background: rgba(0, 0, 0, 0.2); background: rgba(0, 0, 0, 0.2);
} }
tr:has(:checked) {
box-shadow: inset 0 0 0 0.125rem var(--tui-primary);
}
td, td,
th { th {
position: static;
height: auto; height: auto;
min-height: 2rem; min-height: 2rem;
align-content: center; align-content: center;