fix errors in shared and marketplace

This commit is contained in:
Matt Hill
2023-07-11 12:53:42 -06:00
parent b9316a4112
commit 31811eb91e
8 changed files with 77 additions and 38 deletions

View File

@@ -10,17 +10,17 @@ import { AbstractMarketplaceService } from '../../services/marketplace.service'
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ReleaseNotesComponent {
constructor(
private readonly route: ActivatedRoute,
private readonly marketplaceService: AbstractMarketplaceService,
) {}
private readonly pkgId = getPkgId(this.route)
private selected: string | null = null
readonly notes$ = this.marketplaceService.fetchReleaseNotes$(this.pkgId)
constructor(
private readonly route: ActivatedRoute,
private readonly marketplaceService: AbstractMarketplaceService,
) {}
isSelected(key: string): boolean {
return this.selected === key
}

View File

@@ -37,8 +37,6 @@ export class AdditionalComponent {
@Output()
version = new EventEmitter<string>()
readonly url = this.route.snapshot.queryParamMap.get('url') || undefined
readonly displayEmver = displayEmver
constructor(
@@ -50,6 +48,8 @@ export class AdditionalComponent {
private readonly route: ActivatedRoute,
) {}
readonly url = this.route.snapshot.queryParamMap.get('url') || undefined
presentAlertVersions(version: TemplateRef<TuiDialogContext>) {
this.dialogs
.open<string>(version, {

View File

@@ -24,6 +24,7 @@ export * from './pages/show/package/package.module'
export * from './pipes/filter-packages.pipe'
export * from './pipes/mime-type.pipe'
export * from './components/store-icon/store-icon.component'
export * from './components/store-icon/store-icon.component.module'
export * from './services/marketplace.service'

View File

@@ -1,8 +1,8 @@
import { HttpErrorResponse } from '@angular/common/http'
export class HttpError {
constructor(private readonly error: HttpErrorResponse) {}
readonly code = this.error.status
readonly message = this.error.statusText
constructor(private readonly error: HttpErrorResponse) {}
}

View File

@@ -1,11 +1,11 @@
import { RPCErrorDetails } from '../types/rpc.types'
export class RpcError {
constructor(private readonly error: RPCErrorDetails) {}
readonly code = this.error.code
readonly message = this.getMessage()
constructor(private readonly error: RPCErrorDetails) {}
private getMessage(): string {
let message: string

View File

@@ -46,13 +46,6 @@ export class ResponsiveColViewportDirective extends Observable<Step> {
@Input()
responsiveColViewport: Observable<Step> | '' = ''
private readonly stream$ = this.resize$.pipe(
map(() => this.elementRef.nativeElement.clientWidth),
map(width => this.breakpoints.find(([step]) => width >= step)?.[1] || 'xs'),
distinctUntilChanged(),
tuiZonefree(this.zone),
)
constructor(
@Inject(BREAKPOINTS)
private readonly breakpoints: readonly [number, Step][],
@@ -64,4 +57,11 @@ export class ResponsiveColViewportDirective extends Observable<Step> {
(this.responsiveColViewport || this.stream$).subscribe(subscriber),
)
}
private readonly stream$ = this.resize$.pipe(
map(() => this.elementRef.nativeElement.clientWidth),
map(width => this.breakpoints.find(([step]) => width >= step)?.[1] || 'xs'),
distinctUntilChanged(),
tuiZonefree(this.zone),
)
}

View File

@@ -1,25 +1,8 @@
import { Config } from '@start9labs/start-sdk/lib/config/builder/config'
import { Value } from '@start9labs/start-sdk/lib/config/builder/value'
import { Variants } from '@start9labs/start-sdk/lib/config/builder/variants'
export const domainSpec = Config.of({
provider: Value.select({
name: 'Provider',
required: { default: null },
values: {
namecheap: 'Namecheap',
googledomains: 'Google Domains',
duckdns: 'Duck DNS',
changeip: 'ChangeIP',
easydns: 'easyDNS',
zoneedit: 'Zoneedit',
dyn: 'DynDNS',
},
}),
domain: Value.text({
name: 'Domain Name',
required: { default: null },
placeholder: 'yourdomain.com',
}),
const ddnsOptions = {
username: Value.text({
name: 'Username',
required: { default: null },
@@ -29,6 +12,61 @@ export const domainSpec = Config.of({
required: { default: null },
masked: true,
}),
}
const ipv4Option = {
ipv4: Value.toggle({
name: 'Enable IPv4',
default: false,
description:
'Enable IPv4 if: <ol><li>Your ISP or router does not support IPv6</li><li>You want those who lack IPv6 to reach your site</li></ol> <b>Warning!</b> IPv4 addresses are closely correlated with geographic areas. If you are not using a reverse proxy, everyone will be able to determine the general location of your server on Earth.',
}),
}
const options = Config.of(ddnsOptions)
const optionsPlus = Config.of({ ...ddnsOptions, ...ipv4Option })
export const domainSpec = Config.of({
hostname: Value.text({
name: 'Hostname',
required: { default: null },
placeholder: 'yourdomain.com',
}),
provider: Value.union(
{
name: 'Dynamic DNS Provider',
required: { default: 'start9' },
},
Variants.of({
start9: {
name: 'Start9',
spec: Config.of(ipv4Option),
},
duckdns: {
name: 'Duck DNS',
spec: optionsPlus,
},
dyn: {
name: 'DynDNS',
spec: optionsPlus,
},
easydns: {
name: 'easyDNS',
spec: optionsPlus,
},
googledomains: {
name: 'Google Domains',
spec: optionsPlus,
},
namecheap: {
name: 'Namecheap (IPv4 only)',
spec: options,
},
zoneedit: {
name: 'Zoneedit',
spec: optionsPlus,
},
}),
),
})
export type DomainSpec = typeof domainSpec.validator._TYPE

View File

@@ -481,7 +481,7 @@ export class MockApiService extends ApiService {
path: '/server-info/network/domains',
value: [
{
value: params.domain,
value: params.hostname,
provider: params.provider,
createdAt: new Date(),
},