Skip to content

Commit

Permalink
fix: fix resetting config and other minor issues
Browse files Browse the repository at this point in the history
  • Loading branch information
waterplea committed Jan 24, 2025
1 parent e6f02bf commit a1d88fb
Show file tree
Hide file tree
Showing 10 changed files with 194 additions and 156 deletions.
230 changes: 122 additions & 108 deletions web/package-lock.json

Large diffs are not rendered by default.

23 changes: 12 additions & 11 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,19 @@
"@noble/hashes": "^1.4.0",
"@start9labs/argon2": "^0.2.2",
"@start9labs/start-sdk": "file:../sdk/baseDist",
"@taiga-ui/addon-charts": "4.16.0",
"@taiga-ui/addon-commerce": "4.16.0",
"@taiga-ui/addon-mobile": "4.16.0",
"@taiga-ui/cdk": "4.16.0",
"@taiga-ui/core": "4.16.0",
"@taiga-ui/addon-charts": "4.21.0",
"@taiga-ui/addon-commerce": "4.21.0",
"@taiga-ui/addon-mobile": "4.21.0",
"@taiga-ui/addon-table": "4.21.0",
"@taiga-ui/cdk": "4.21.0",
"@taiga-ui/core": "4.21.0",
"@taiga-ui/event-plugins": "4.3.1",
"@taiga-ui/icons": "4.16.0",
"@taiga-ui/kit": "4.16.0",
"@taiga-ui/layout": "4.16.0",
"@taiga-ui/legacy": "4.16.0",
"@taiga-ui/polymorpheus": "4.7.4",
"@taiga-ui/styles": "4.16.0",
"@taiga-ui/icons": "4.21.0",
"@taiga-ui/kit": "4.21.0",
"@taiga-ui/layout": "4.21.0",
"@taiga-ui/legacy": "4.21.0",
"@taiga-ui/polymorpheus": "4.8.0",
"@taiga-ui/styles": "4.21.0",
"@tinkoff/ng-dompurify": "4.0.0",
"ansi-to-html": "^0.7.2",
"base64-js": "^1.5.1",
Expand Down
6 changes: 3 additions & 3 deletions web/projects/ui/src/app/app.providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
} from '@taiga-ui/kit'
import { tuiTextfieldOptionsProvider } from '@taiga-ui/legacy'
import { PatchDB } from 'patch-db-client'
import { filter, pairwise } from 'rxjs'
import { filter, of, pairwise } from 'rxjs'
import {
PATCH_CACHE,
PatchDbSource,
Expand Down Expand Up @@ -52,10 +52,10 @@ export const APP_PROVIDERS: Provider[] = [
tuiDropdownOptionsProvider({ appearance: 'start-os' }),
{
provide: TUI_DATE_FORMAT,
useValue: {
useValue: of({
mode: 'MDY',
separator: '/',
},
}),
},
{
provide: TUI_DATE_VALUE_TRANSFORMER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,7 @@ export class FormComponent<T extends Record<string, any>> implements OnInit {
}

onReset() {
const { value } = this.form

this.form = this.formService.createForm(this.spec)
this.process(compare(this.form.value, value))
tuiMarkControlAsTouchedAndValidate(this.form)
this.markAsDirty()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,24 @@ import { getMenu } from 'src/app/utils/system-utilities'
@import '@taiga-ui/core/styles/taiga-ui-local';
:host {
position: relative;
display: flex;
backdrop-filter: blur(1rem);
border-radius: inherit;
margin-inline-end: 0.875rem;
isolation: isolate;
&::before {
content: '';
position: absolute;
top: 0;
left: -1rem;
right: -0.5rem;
bottom: 0;
transform: skewX(30deg);
border-radius: var(--bumper);
z-index: -1;
backdrop-filter: blur(1rem);
}
}
.link {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,36 @@
import { ChangeDetectionStrategy, Component, inject } from '@angular/core'
import { toSignal } from '@angular/core/rxjs-interop'
import { TuiIcon } from '@taiga-ui/core'
import { TuiComparator, TuiTable } from '@taiga-ui/addon-table'
import { ToManifestPipe } from 'src/app/routes/portal/pipes/to-manifest'
import { DepErrorService } from 'src/app/services/dep-error.service'
import { PackageDataEntry } from 'src/app/services/patch-db/data-model'
import { getInstalledPrimaryStatus } from 'src/app/services/pkg-status-rendering.service'
import { getManifest } from 'src/app/utils/get-package-data'
import { ServiceComponent } from './service.component'
import { ServicesService } from './services.service'

@Component({
standalone: true,
template: `
<table>
<table tuiTable [(sorter)]="sorter">
<thead>
<tr>
<th [style.width.rem]="3"></th>
<th>Name</th>
<th>Version</th>
<th [style.width.rem]="13">Status</th>
<th tuiTh [requiredSort]="true" [sorter]="name">Name</th>
<th tuiTh>Version</th>
<th
tuiTh
[requiredSort]="true"
[sorter]="status"
[style.width.rem]="13"
>
Status
</th>
<th [style.width.rem]="8" [style.text-indent.rem]="1.5">Controls</th>
</tr>
</thead>
<tbody>
@for (pkg of services(); track $index) {
@for (pkg of services() | tuiTableSort; track $index) {
<tr
appService
[pkg]="pkg"
Expand All @@ -39,15 +49,12 @@ import { ServicesService } from './services.service'
styles: `
:host {
position: relative;
max-width: 64rem;
margin: 0 auto;
font-size: 1rem;
overflow: hidden;
}
table {
width: calc(100% - 4rem);
margin: 2rem;
width: 100%;
}
tr:not(:last-child) {
Expand All @@ -57,6 +64,8 @@ import { ServicesService } from './services.service'
th {
text-transform: uppercase;
color: var(--tui-text-secondary);
background: none;
border: none;
font: var(--tui-font-text-s);
font-weight: bold;
text-align: left;
Expand All @@ -69,22 +78,25 @@ import { ServicesService } from './services.service'
}
:host-context(tui-root._mobile) {
height: calc(100vh - 7.375rem);
table {
width: 100%;
margin: 0;
}
thead {
display: none;
}
}
`,
imports: [TuiIcon, ServiceComponent, ToManifestPipe],
imports: [ServiceComponent, ToManifestPipe, TuiTable],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class DashboardComponent {
readonly services = toSignal(inject(ServicesService))
readonly errors = toSignal(inject(DepErrorService).depErrors$)

readonly name: TuiComparator<PackageDataEntry> = (a, b) =>
getManifest(b).title.toLowerCase() > getManifest(a).title.toLowerCase()
? -1
: 1

readonly status: TuiComparator<PackageDataEntry> = (a, b) =>
getInstalledPrimaryStatus(b) > getInstalledPrimaryStatus(a) ? -1 : 1

sorter = this.name
}
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ export class ActionInputModal {

async execute(input: object) {
if (await this.checkConflicts(input)) {
return this.actionService.execute(this.pkgInfo.id, this.actionId, input)
await this.actionService.execute(this.pkgInfo.id, this.actionId, input)
this.context.$implicit.complete()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ import { MarketplaceControlsComponent } from './controls.component'
.preview-wrapper {
overflow-y: auto;
height: 100%;
max-width: 100%;
@media (min-width: 768px) {
Expand Down
19 changes: 9 additions & 10 deletions web/projects/ui/src/app/services/pkg-status-rendering.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,15 @@ export function renderPkgStatus(
return { primary, dependency, health }
}

function getInstalledPrimaryStatus(pkg: T.PackageDataEntry): PrimaryStatus {
if (
Object.values(pkg.requestedActions).some(
r => r.active && r.request.severity === 'critical',
)
) {
return 'actionRequired'
} else {
return pkg.status.main
}
export function getInstalledPrimaryStatus({
requestedActions,
status,
}: T.PackageDataEntry): PrimaryStatus {
return Object.values(requestedActions).some(
r => r.active && r.request.severity === 'critical',
)
? 'actionRequired'
: status.main
}

function getDependencyStatus(depErrors: PkgDependencyErrors): DependencyStatus {
Expand Down
2 changes: 1 addition & 1 deletion web/projects/ui/src/app/utils/dep-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function getDepDetails(
allPkgs: AllPackageData,
depId: string,
) {
const { title, icon, versionRange } = pkg.currentDependencies[depId]
const { title, icon, versionRange } = pkg.currentDependencies[depId] || {}

if (
allPkgs[depId] &&
Expand Down

0 comments on commit a1d88fb

Please sign in to comment.