mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
0.3.0 refactor
ui: adds overlay layer to patch-db-client ui: getting towards mocks ui: cleans up factory init ui: nice type hack ui: live api for patch ui: api service source + http starts up ui: api source + http ui: rework patchdb config, pass stashTimeout into patchDbModel wires in temp patching into api service ui: example of wiring patchdbmodel into page begin integration remove unnecessary method linting first data rendering rework app initialization http source working for ssh delete call temp patches working entire Embassy tab complete not in kansas anymore ripping, saving progress progress for API request response types and endoint defs Update data-model.ts shambles, but in a good way progress big progress progress installed list working big progress progress progress begin marketplace redesign Update api-types.ts Update api-types.ts marketplace improvements cosmetic dependencies and recommendations begin nym auth approach install wizard restore flow and donations
This commit is contained in:
committed by
Aiden McClelland
parent
fd685ae32c
commit
594d93eb3b
@@ -1,5 +1,5 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core'
|
||||
import { Annotation } from '../app-config/config-utilities'
|
||||
import { Annotation } from '../pkg-config/config-utilities'
|
||||
|
||||
@Pipe({
|
||||
name: 'annotationStatus',
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core'
|
||||
import { AppStatus } from '../models/app-model'
|
||||
import { AppStatusRendering } from '../util/status-rendering'
|
||||
import { PackageDataEntry } from '../models/patch-db/data-model'
|
||||
import { ConnectionState } from '../services/connection.service'
|
||||
import { renderPkgStatus } from '../services/pkg-status-rendering.service'
|
||||
|
||||
@Pipe({
|
||||
name: 'displayBulb',
|
||||
})
|
||||
export class DisplayBulbPipe implements PipeTransform {
|
||||
|
||||
transform (status: AppStatus, d: DisplayBulb): boolean {
|
||||
switch (AppStatusRendering[status].color) {
|
||||
case 'danger': return d === 'red'
|
||||
case 'success': return d === 'green'
|
||||
case 'warning': return d === 'yellow'
|
||||
default: return d === 'off'
|
||||
transform (pkg: PackageDataEntry, bulb: DisplayBulb, connection: ConnectionState): boolean {
|
||||
const { color } = renderPkgStatus(pkg, connection)
|
||||
switch (color) {
|
||||
case 'danger': return bulb === 'red'
|
||||
case 'success': return bulb === 'green'
|
||||
case 'warning': return bulb === 'yellow'
|
||||
default: return bulb === 'off'
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
type DisplayBulb = 'off' | 'red' | 'green' | 'yellow'
|
||||
|
||||
11
ui/src/app/pipes/empty.pipe.ts
Normal file
11
ui/src/app/pipes/empty.pipe.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core'
|
||||
import { isEmptyObject } from '../util/misc.util'
|
||||
|
||||
@Pipe({
|
||||
name: 'empty',
|
||||
})
|
||||
export class EmptyPipe implements PipeTransform {
|
||||
transform (obj: { }): boolean {
|
||||
return isEmptyObject(obj)
|
||||
}
|
||||
}
|
||||
@@ -39,24 +39,6 @@ export class EmverDisplayPipe implements PipeTransform {
|
||||
}
|
||||
}
|
||||
|
||||
@Pipe({
|
||||
name: 'isValidEmver',
|
||||
})
|
||||
export class EmverIsValidPipe implements PipeTransform {
|
||||
constructor () { }
|
||||
|
||||
transform (version: string): boolean {
|
||||
return isValidEmver(version)
|
||||
}
|
||||
}
|
||||
|
||||
export function isValidEmver (version: string): boolean {
|
||||
const vs = version.split('.')
|
||||
if (vs.length < 3 || vs.length > 5) return false
|
||||
if (!vs.every(v => !isNaN(parseFloat(v)))) return false
|
||||
return true
|
||||
}
|
||||
|
||||
export function displayEmver (version: string): string {
|
||||
const vs = version.split('.')
|
||||
if (vs.length === 4) return `${vs[0]}.${vs[1]}.${vs[2]}~${vs[3]}`
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core'
|
||||
|
||||
@Pipe({
|
||||
name: 'iconParse',
|
||||
})
|
||||
export class IconPipe implements PipeTransform {
|
||||
transform (iconUrl: string): string {
|
||||
if (iconUrl.startsWith('/')) return '/api' + iconUrl
|
||||
return iconUrl
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import { Pipe, PipeTransform } from '@angular/core'
|
||||
name: 'includes',
|
||||
})
|
||||
export class IncludesPipe implements PipeTransform {
|
||||
transform<T> (set: T[], val: T): boolean {
|
||||
return set.includes(val)
|
||||
transform<T> (list: T[], val: T): boolean {
|
||||
return list.includes(val)
|
||||
}
|
||||
}
|
||||
@@ -1,46 +1,45 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core'
|
||||
import { combineLatest, Observable } from 'rxjs'
|
||||
import { map } from 'rxjs/operators'
|
||||
import { AppAvailableFull, AppAvailablePreview } from 'src/app/models/app-types'
|
||||
import { Emver } from '../services/emver.service'
|
||||
import { PropertySubject } from '../util/property-subject.util'
|
||||
// import { Pipe, PipeTransform } from '@angular/core'
|
||||
// import { combineLatest, Observable } from 'rxjs'
|
||||
// import { map } from 'rxjs/operators'
|
||||
// import { Emver } from '../services/emver.service'
|
||||
|
||||
@Pipe({
|
||||
name: 'compareInstalledAndLatest',
|
||||
})
|
||||
export class InstalledLatestComparisonPipe implements PipeTransform {
|
||||
constructor (private readonly emver: Emver) { }
|
||||
|
||||
transform (app: PropertySubject<AppAvailablePreview>): Observable<'not-installed' | 'installed-below' | 'installed-above' | 'installed-equal'> {
|
||||
return combineLatest([app.versionInstalled, app.versionLatest]).pipe(
|
||||
map(([i, l]) => {
|
||||
if (!i) return 'not-installed'
|
||||
switch (this.emver.compare(i, l)){
|
||||
case 0: return 'installed-equal'
|
||||
case 1: return 'installed-above'
|
||||
case -1: return 'installed-below'
|
||||
}
|
||||
}),
|
||||
)
|
||||
}
|
||||
}
|
||||
// @Pipe({
|
||||
// name: 'compareInstalledAndLatest',
|
||||
// })
|
||||
// export class InstalledLatestComparisonPipe implements PipeTransform {
|
||||
// constructor (private readonly emver: Emver) { }
|
||||
|
||||
@Pipe({
|
||||
name: 'compareInstalledAndViewing',
|
||||
})
|
||||
export class InstalledViewingComparisonPipe implements PipeTransform {
|
||||
constructor (private readonly emver: Emver) { }
|
||||
// transform (app: PropertySubject<AppAvailablePreview>): Observable<'not-installed' | 'installed-below' | 'installed-above' | 'installed-equal'> {
|
||||
// return combineLatest([app.versionInstalled, app.versionLatest]).pipe(
|
||||
// map(([i, l]) => {
|
||||
// if (!i) return 'not-installed'
|
||||
// switch (this.emver.compare(i, l)){
|
||||
// case 0: return 'installed-equal'
|
||||
// case 1: return 'installed-above'
|
||||
// case -1: return 'installed-below'
|
||||
// }
|
||||
// }),
|
||||
// )
|
||||
// }
|
||||
// }
|
||||
|
||||
transform (app: PropertySubject<AppAvailableFull>): Observable<'not-installed' | 'installed-below' | 'installed-above' | 'installed-equal'> {
|
||||
return combineLatest([app.versionInstalled, app.versionViewing]).pipe(
|
||||
map(([i, l]) => {
|
||||
if (!i) return 'not-installed'
|
||||
switch (this.emver.compare(i, l)){
|
||||
case 0: return 'installed-equal'
|
||||
case 1: return 'installed-above'
|
||||
case -1: return 'installed-below'
|
||||
}
|
||||
}),
|
||||
)
|
||||
}
|
||||
}
|
||||
// @Pipe({
|
||||
// name: 'compareInstalledAndViewing',
|
||||
// })
|
||||
// export class InstalledViewingComparisonPipe implements PipeTransform {
|
||||
// constructor (private readonly emver: Emver) { }
|
||||
|
||||
// transform (app: PropertySubject<AppAvailableFull>): Observable<'not-installed' | 'installed-below' | 'installed-above' | 'installed-equal'> {
|
||||
// return combineLatest([app.versionInstalled, app.versionViewing]).pipe(
|
||||
// map(([i, l]) => {
|
||||
// if (!i) return 'not-installed'
|
||||
// switch (this.emver.compare(i, l)){
|
||||
// case 0: return 'installed-equal'
|
||||
// case 1: return 'installed-above'
|
||||
// case -1: return 'installed-below'
|
||||
// }
|
||||
// }),
|
||||
// )
|
||||
// }
|
||||
// }
|
||||
|
||||
23
ui/src/app/pipes/notification-color.pipe.ts
Normal file
23
ui/src/app/pipes/notification-color.pipe.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core'
|
||||
import { NotificationLevel, ServerNotification } from '../services/api/api-types'
|
||||
|
||||
@Pipe({
|
||||
name: 'notificationColor',
|
||||
})
|
||||
export class NotificationColorPipe implements PipeTransform {
|
||||
transform (notification: ServerNotification<any>): string {
|
||||
const level = notification.level
|
||||
switch (level) {
|
||||
case NotificationLevel.Info:
|
||||
return 'primary'
|
||||
case NotificationLevel.Success:
|
||||
return 'success'
|
||||
case NotificationLevel.Warning:
|
||||
return 'warning'
|
||||
case NotificationLevel.Error:
|
||||
return 'danger'
|
||||
default:
|
||||
return ''
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
import { peekProperties, PropertySubject } from '../util/property-subject.util'
|
||||
|
||||
@Pipe({
|
||||
name: 'peekProperties',
|
||||
})
|
||||
export class PeekPropertiesPipe implements PipeTransform {
|
||||
transform<T> (value: PropertySubject<T>): T {
|
||||
return peekProperties(value)
|
||||
}
|
||||
}
|
||||
13
ui/src/app/pipes/status.pipe.ts
Normal file
13
ui/src/app/pipes/status.pipe.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core'
|
||||
import { PackageDataEntry } from '../models/patch-db/data-model'
|
||||
import { ConnectionState } from '../services/connection.service'
|
||||
import { FEStatus, renderPkgStatus } from '../services/pkg-status-rendering.service'
|
||||
|
||||
@Pipe({
|
||||
name: 'status',
|
||||
})
|
||||
export class StatusPipe implements PipeTransform {
|
||||
transform (pkg: PackageDataEntry, connection: ConnectionState): FEStatus {
|
||||
return renderPkgStatus(pkg, connection).feStatus
|
||||
}
|
||||
}
|
||||
36
ui/src/app/pipes/ui.pipe.ts
Normal file
36
ui/src/app/pipes/ui.pipe.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core'
|
||||
import { PackageDataEntry, Manifest } from '../models/patch-db/data-model'
|
||||
import { ConfigService, getManifest, hasUi } from '../services/config.service'
|
||||
|
||||
@Pipe({
|
||||
name: 'hasUi',
|
||||
})
|
||||
export class HasUiPipe implements PipeTransform {
|
||||
|
||||
transform (pkg: PackageDataEntry): boolean {
|
||||
const interfaces = getManifest(pkg).interfaces
|
||||
return hasUi(interfaces)
|
||||
}
|
||||
}
|
||||
|
||||
@Pipe({
|
||||
name: 'isLaunchable',
|
||||
})
|
||||
export class LaunchablePipe implements PipeTransform {
|
||||
|
||||
constructor (private configService: ConfigService) { }
|
||||
|
||||
transform (pkg: PackageDataEntry): boolean {
|
||||
return this.configService.isLaunchable(pkg)
|
||||
}
|
||||
}
|
||||
|
||||
@Pipe({
|
||||
name: 'manifest',
|
||||
})
|
||||
export class ManifestPipe implements PipeTransform {
|
||||
|
||||
transform (pkg: PackageDataEntry): Manifest {
|
||||
return getManifest(pkg)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user