mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
chore: fix issues from dev channel (#2968)
This commit is contained in:
@@ -9,18 +9,6 @@ export class FormDialogService {
|
||||
private readonly dialog = inject(DialogService)
|
||||
private readonly i18n = inject(i18nPipe)
|
||||
private readonly formService = new TuiConfirmService()
|
||||
private readonly PROMPT: Partial<TuiDialogOptions<TuiConfirmData>> = {
|
||||
label: this.i18n.transform('Unsaved changes'),
|
||||
data: {
|
||||
content: this.i18n.transform(
|
||||
'You have unsaved changes. Are you sure you want to leave?',
|
||||
),
|
||||
yes: this.i18n.transform('Leave'),
|
||||
no: this.i18n.transform('Cancel'),
|
||||
},
|
||||
}
|
||||
|
||||
private readonly prompt = this.formService.withConfirm(this.PROMPT)
|
||||
private readonly injector = Injector.create({
|
||||
parent: inject(Injector),
|
||||
providers: [
|
||||
@@ -37,10 +25,23 @@ export class FormDialogService {
|
||||
label?: i18nKey
|
||||
} = {},
|
||||
) {
|
||||
const PROMPT: Partial<TuiDialogOptions<TuiConfirmData>> = {
|
||||
label: this.i18n.transform('Unsaved changes'),
|
||||
data: {
|
||||
content: this.i18n.transform(
|
||||
'You have unsaved changes. Are you sure you want to leave?',
|
||||
),
|
||||
yes: this.i18n.transform('Leave'),
|
||||
no: this.i18n.transform('Cancel'),
|
||||
},
|
||||
}
|
||||
|
||||
const closeable = this.formService.withConfirm(PROMPT)
|
||||
|
||||
this.dialog
|
||||
.openComponent(new PolymorpheusComponent(component, this.injector), {
|
||||
closeable: this.prompt,
|
||||
dismissible: this.prompt,
|
||||
dismissible: closeable,
|
||||
closeable,
|
||||
...options,
|
||||
})
|
||||
.subscribe({
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import { inject, Injectable } from '@angular/core'
|
||||
import { ErrorService, MARKDOWN } from '@start9labs/shared'
|
||||
import { TuiResponsiveDialogService } from '@taiga-ui/addon-mobile'
|
||||
import {
|
||||
DialogService,
|
||||
ErrorService,
|
||||
i18nKey,
|
||||
MARKDOWN,
|
||||
} from '@start9labs/shared'
|
||||
import { PatchDB } from 'patch-db-client'
|
||||
import { firstValueFrom, merge, of, shareReplay, Subject } from 'rxjs'
|
||||
import { REPORT } from 'src/app/components/backup-report.component'
|
||||
@@ -16,7 +20,7 @@ export class NotificationService {
|
||||
private readonly patch = inject<PatchDB<DataModel>>(PatchDB)
|
||||
private readonly errorService = inject(ErrorService)
|
||||
private readonly api = inject(ApiService)
|
||||
private readonly dialogs = inject(TuiResponsiveDialogService)
|
||||
private readonly dialogs = inject(DialogService)
|
||||
private readonly localUnreadCount$ = new Subject<number>()
|
||||
|
||||
readonly unreadCount$ = merge(
|
||||
@@ -93,12 +97,12 @@ export class NotificationService {
|
||||
{ data, createdAt, code, title, message }: ServerNotification<number>,
|
||||
full = false,
|
||||
) {
|
||||
const label = code === 1 ? 'Backup Report' : title
|
||||
const label = code === 1 ? 'Backup Report' : (title as i18nKey)
|
||||
const component = code === 1 ? REPORT : MARKDOWN
|
||||
const content = code === 1 ? data : of(data)
|
||||
|
||||
this.dialogs
|
||||
.open(full ? message : component, {
|
||||
.openComponent(full ? message : component, {
|
||||
label,
|
||||
data: {
|
||||
content,
|
||||
|
||||
Reference in New Issue
Block a user