mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-14 13:16:16 -08:00
feat(settings): warn that delete-all clears the server
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
fa79c3eb6d
commit
932971d498
3 files changed
+34
No files matched your search
@@ -9,6 +9,14 @@
|
||||
| translate: { count: dialogData.summary.total }
|
||||
}}
|
||||
</p>
|
||||
@if (clearsServer()) {
|
||||
<p
|
||||
class="settings-delete-dialog__lead"
|
||||
data-test-id="delete-all-server-warning"
|
||||
>
|
||||
{{ 'SERVER_STORAGE.DELETE_ALL_WARNING' | translate }}
|
||||
</p>
|
||||
}
|
||||
|
||||
<section class="settings-delete-dialog__section">
|
||||
<h3 class="settings-delete-dialog__section-title">
|
||||
|
||||
@@ -2,6 +2,7 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
||||
import { ServerStorageStatusService } from '@iptvnator/services';
|
||||
import { SettingsDeleteAllPlaylistsDialogComponent } from './settings-delete-all-playlists-dialog.component';
|
||||
|
||||
describe('SettingsDeleteAllPlaylistsDialogComponent', () => {
|
||||
@@ -93,4 +94,26 @@ describe('SettingsDeleteAllPlaylistsDialogComponent', () => {
|
||||
|
||||
expect(buttons).toEqual(['Cancel', 'Delete everything']);
|
||||
});
|
||||
|
||||
it('warns about every device only with server storage', () => {
|
||||
const warning = () =>
|
||||
fixture.nativeElement.querySelector(
|
||||
'[data-test-id="delete-all-server-warning"]'
|
||||
);
|
||||
expect(warning()).toBeNull();
|
||||
|
||||
TestBed.inject(ServerStorageStatusService).activate(
|
||||
{
|
||||
service: 'iptvnator',
|
||||
apiVersion: 1,
|
||||
instanceId: 'i',
|
||||
storage: 'server',
|
||||
auth: 'none',
|
||||
},
|
||||
() => undefined
|
||||
);
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(warning()).not.toBeNull();
|
||||
});
|
||||
});
|
||||
@@ -9,6 +9,7 @@ import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatDialogModule, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { ServerStorageStatusService } from '@iptvnator/services';
|
||||
import { SOURCE_TYPE_ICONS } from '@iptvnator/shared/interfaces';
|
||||
|
||||
export interface SettingsDeleteAllPlaylistsDialogData {
|
||||
@@ -43,6 +44,8 @@ type SettingsDeleteSummaryItem = {
|
||||
export class SettingsDeleteAllPlaylistsDialogComponent {
|
||||
readonly dialogData =
|
||||
inject<SettingsDeleteAllPlaylistsDialogData>(MAT_DIALOG_DATA);
|
||||
/** Self-hosted server storage: the playlists go for every device. */
|
||||
readonly clearsServer = inject(ServerStorageStatusService).isActive;
|
||||
|
||||
readonly summaryItems = computed<SettingsDeleteSummaryItem[]>(() => [
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user