mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 04:23:40 +00:00
feat: update Taiga UI to 4 release candidate
This commit is contained in:
@@ -2,7 +2,7 @@ import { inject, Injectable } from '@angular/core'
|
||||
import { ErrorService, LoadingService } from '@start9labs/shared'
|
||||
import { T } from '@start9labs/start-sdk'
|
||||
import { TuiDialogOptions, TuiDialogService } from '@taiga-ui/core'
|
||||
import { TUI_PROMPT, TuiPromptData } from '@taiga-ui/kit'
|
||||
import { TuiConfirmData, TUI_CONFIRM } from '@taiga-ui/kit'
|
||||
import { PatchDB } from 'patch-db-client'
|
||||
import { defaultIfEmpty, filter, firstValueFrom } from 'rxjs'
|
||||
import {
|
||||
@@ -54,7 +54,7 @@ export class ActionsService {
|
||||
|
||||
if (content) {
|
||||
this.dialogs
|
||||
.open(TUI_PROMPT, getOptions(content, 'Stop'))
|
||||
.open(TUI_CONFIRM, getOptions(content, 'Stop'))
|
||||
.pipe(filter(Boolean))
|
||||
.subscribe(() => this.doStop(id))
|
||||
} else {
|
||||
@@ -66,7 +66,7 @@ export class ActionsService {
|
||||
if (hasCurrentDeps(id, await getAllPackages(this.patch))) {
|
||||
this.dialogs
|
||||
.open(
|
||||
TUI_PROMPT,
|
||||
TUI_CONFIRM,
|
||||
getOptions(
|
||||
`Services that depend on ${title} may temporarily experiences issues`,
|
||||
'Restart',
|
||||
@@ -118,7 +118,7 @@ export class ActionsService {
|
||||
private alert(content: string): Promise<boolean> {
|
||||
return firstValueFrom(
|
||||
this.dialogs
|
||||
.open<boolean>(TUI_PROMPT, getOptions(content))
|
||||
.open<boolean>(TUI_CONFIRM, getOptions(content))
|
||||
.pipe(defaultIfEmpty(false)),
|
||||
)
|
||||
}
|
||||
@@ -127,7 +127,7 @@ export class ActionsService {
|
||||
function getOptions(
|
||||
content: string,
|
||||
yes = 'Continue',
|
||||
): Partial<TuiDialogOptions<TuiPromptData>> {
|
||||
): Partial<TuiDialogOptions<TuiConfirmData>> {
|
||||
return {
|
||||
label: 'Warning',
|
||||
size: 's',
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { AbstractTuiValueTransformer, TuiDay } from '@taiga-ui/cdk'
|
||||
import { TuiDay, TuiValueTransformer } from '@taiga-ui/cdk'
|
||||
|
||||
type From = TuiDay | null
|
||||
type To = string | null
|
||||
|
||||
@Injectable()
|
||||
export class DateTransformerService extends AbstractTuiValueTransformer<
|
||||
From,
|
||||
To
|
||||
> {
|
||||
export class DateTransformerService extends TuiValueTransformer<From, To> {
|
||||
fromControlValue(controlValue: To): From {
|
||||
return controlValue ? TuiDay.jsonParse(controlValue) : null
|
||||
}
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { AbstractTuiValueTransformer, TuiDay, TuiTime } from '@taiga-ui/cdk'
|
||||
import { TuiDay, TuiTime, TuiValueTransformer } from '@taiga-ui/cdk'
|
||||
|
||||
type From = [TuiDay | null, TuiTime | null] | null
|
||||
type To = string | null
|
||||
|
||||
@Injectable()
|
||||
export class DatetimeTransformerService extends AbstractTuiValueTransformer<
|
||||
From,
|
||||
To
|
||||
> {
|
||||
export class DatetimeTransformerService extends TuiValueTransformer<From, To> {
|
||||
fromControlValue(controlValue: To): From {
|
||||
if (!controlValue) {
|
||||
return null
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { inject, Injectable, Injector, Type } from '@angular/core'
|
||||
import { TuiDialogOptions, TuiDialogService } from '@taiga-ui/core'
|
||||
import { TuiDialogFormService, TuiPromptData } from '@taiga-ui/kit'
|
||||
import { PolymorpheusComponent } from '@tinkoff/ng-polymorpheus'
|
||||
import { TuiConfirmData, TuiConfirmService } from '@taiga-ui/kit'
|
||||
import { PolymorpheusComponent } from '@taiga-ui/polymorpheus'
|
||||
|
||||
const PROMPT: Partial<TuiDialogOptions<TuiPromptData>> = {
|
||||
const PROMPT: Partial<TuiDialogOptions<TuiConfirmData>> = {
|
||||
label: 'Unsaved Changes',
|
||||
data: {
|
||||
content: 'You have unsaved changes. Are you sure you want to leave?',
|
||||
@@ -15,13 +15,13 @@ const PROMPT: Partial<TuiDialogOptions<TuiPromptData>> = {
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class FormDialogService {
|
||||
private readonly dialogs = inject(TuiDialogService)
|
||||
private readonly formService = new TuiDialogFormService(this.dialogs)
|
||||
private readonly prompt = this.formService.withPrompt(PROMPT)
|
||||
private readonly formService = new TuiConfirmService()
|
||||
private readonly prompt = this.formService.withConfirm(PROMPT)
|
||||
private readonly injector = Injector.create({
|
||||
parent: inject(Injector),
|
||||
providers: [
|
||||
{
|
||||
provide: TuiDialogFormService,
|
||||
provide: TuiConfirmService,
|
||||
useValue: this.formService,
|
||||
},
|
||||
],
|
||||
|
||||
@@ -64,13 +64,13 @@ export class NotificationService {
|
||||
getColor(notification: ServerNotification<number>): string {
|
||||
switch (notification.level) {
|
||||
case NotificationLevel.Info:
|
||||
return 'var(--tui-info-fill)'
|
||||
return 'var(--tui-status-info)'
|
||||
case NotificationLevel.Success:
|
||||
return 'var(--tui-success-fill)'
|
||||
return 'var(--tui-status-positive)'
|
||||
case NotificationLevel.Warning:
|
||||
return 'var(--tui-warning-fill)'
|
||||
return 'var(--tui-status-warning)'
|
||||
case NotificationLevel.Error:
|
||||
return 'var(--tui-error-fill)'
|
||||
return 'var(--tui-status-negative)'
|
||||
default:
|
||||
return ''
|
||||
}
|
||||
@@ -79,12 +79,12 @@ export class NotificationService {
|
||||
getIcon(notification: ServerNotification<number>): string {
|
||||
switch (notification.level) {
|
||||
case NotificationLevel.Info:
|
||||
return 'tuiIconInfo'
|
||||
return '@tui.info'
|
||||
case NotificationLevel.Success:
|
||||
return 'tuiIconCheckCircle'
|
||||
return '@tui.circle-check'
|
||||
case NotificationLevel.Warning:
|
||||
case NotificationLevel.Error:
|
||||
return 'tuiIconAlertCircle'
|
||||
return '@tui.circle-alert'
|
||||
default:
|
||||
return ''
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import { ConfigService } from 'src/app/services/config.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy-api.service'
|
||||
import { MarketplaceService } from 'src/app/services/marketplace.service'
|
||||
import { ConnectionService } from 'src/app/services/connection.service'
|
||||
import { PolymorpheusComponent } from '@tinkoff/ng-polymorpheus'
|
||||
import { PolymorpheusComponent } from '@taiga-ui/polymorpheus'
|
||||
|
||||
// Get data from PatchDb after is starts and act upon it
|
||||
@Injectable({
|
||||
|
||||
Reference in New Issue
Block a user