Kavita/UI/Web/src/app/user-settings/manage-devices/manage-devices.component.ts
Joe Milazzo 6dbb1da450
A few bugfixes (#2188)
* Fixed a case where when setting up initial rates for scrobbling, Kavita would log a user without a token set had no rate.

* Migrated the whole app to use just the directive instead of whole transloco module.

* Migrated the whole app to use just the directive instead of whole transloco module. Fixed prod mode breaking localization & fixed broken minification for language files.

* Time Ago pipe will now show Never if there is a null date. Changed the wording of Last Added To -> Last Item Added for volume/series info screen.

* Fixed Tachiyomi DTOs and bumped sonar to use Java 17

* One more GA thing

* GA junk

* Bump versions by dotnet-bump-version.

* Weblate Changes (#2189)

* Added translation using Weblate (Turkish)

* Translated using Weblate (Thai)

Currently translated at 100.0% (158 of 158 strings)

Translation: Kavita/backend
Translate-URL: https://hosted.weblate.org/projects/kavita/backend/th/

* Translated using Weblate (Thai)

Currently translated at 15.2% (218 of 1426 strings)

Translation: Kavita/ui
Translate-URL: https://hosted.weblate.org/projects/kavita/ui/th/

* Translated using Weblate (Turkish)

Currently translated at 7.7% (110 of 1426 strings)

Translation: Kavita/ui
Translate-URL: https://hosted.weblate.org/projects/kavita/ui/tr/

* Translated using Weblate (Portuguese)

Currently translated at 17.5% (250 of 1426 strings)

Translation: Kavita/ui
Translate-URL: https://hosted.weblate.org/projects/kavita/ui/pt/

* Translated using Weblate (Russian)

Currently translated at 1.2% (2 of 158 strings)

Translation: Kavita/backend
Translate-URL: https://hosted.weblate.org/projects/kavita/backend/ru/

* Translated using Weblate (Russian)

Currently translated at 4.9% (71 of 1426 strings)

Translation: Kavita/ui
Translate-URL: https://hosted.weblate.org/projects/kavita/ui/ru/

* Translated using Weblate (Italian)

Currently translated at 6.7% (96 of 1426 strings)

Translation: Kavita/ui
Translate-URL: https://hosted.weblate.org/projects/kavita/ui/it/

* Translated using Weblate (Turkish)

Currently translated at 8.8% (14 of 158 strings)

Translation: Kavita/backend
Translate-URL: https://hosted.weblate.org/projects/kavita/backend/tr/

---------

Co-authored-by: akoray420 <akoray420@gmail.com>
Co-authored-by: AlienHack <the4got10@windowslive.com>
Co-authored-by: Duarte Silva <smallflake@protonmail.com>
Co-authored-by: Blezz Rot <markus.jenya04@yandex.ru>
Co-authored-by: Tomas Battistini <tomas.battistini@gmail.com>

---------

Co-authored-by: Weblate (bot) <hosted@weblate.org>
Co-authored-by: akoray420 <akoray420@gmail.com>
Co-authored-by: AlienHack <the4got10@windowslive.com>
Co-authored-by: Duarte Silva <smallflake@protonmail.com>
Co-authored-by: Blezz Rot <markus.jenya04@yandex.ru>
Co-authored-by: Tomas Battistini <tomas.battistini@gmail.com>
2023-08-08 07:33:12 -07:00

66 lines
2.1 KiB
TypeScript

import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { Subject } from 'rxjs';
import { Device } from 'src/app/_models/device/device';
import { DeviceService } from 'src/app/_services/device.service';
import { DevicePlatformPipe } from '../_pipes/device-platform.pipe';
import { SentenceCasePipe } from '../../pipe/sentence-case.pipe';
import { NgIf, NgFor } from '@angular/common';
import { EditDeviceComponent } from '../edit-device/edit-device.component';
import { NgbCollapse } from '@ng-bootstrap/ng-bootstrap';
import {TranslocoDirective} from "@ngneat/transloco";
@Component({
selector: 'app-manage-devices',
templateUrl: './manage-devices.component.html',
styleUrls: ['./manage-devices.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [NgbCollapse, EditDeviceComponent, NgIf, NgFor, SentenceCasePipe, DevicePlatformPipe, TranslocoDirective]
})
export class ManageDevicesComponent implements OnInit, OnDestroy {
devices: Array<Device> = [];
addDeviceIsCollapsed: boolean = true;
device: Device | undefined;
private readonly onDestroy = new Subject<void>();
constructor(public deviceService: DeviceService, private toastr: ToastrService,
private readonly cdRef: ChangeDetectorRef) { }
ngOnInit(): void {
this.loadDevices();
}
ngOnDestroy(): void {
this.onDestroy.next();
this.onDestroy.complete();
}
loadDevices() {
this.addDeviceIsCollapsed = true;
this.device = undefined;
this.cdRef.markForCheck();
this.deviceService.getDevices().subscribe(devices => {
this.devices = devices;
this.cdRef.markForCheck();
});
}
deleteDevice(device: Device) {
this.deviceService.deleteDevice(device.id).subscribe(() => {
const index = this.devices.indexOf(device);
this.devices.splice(index, 1);
this.cdRef.markForCheck();
});
}
editDevice(device: Device) {
this.device = device;
this.addDeviceIsCollapsed = false;
this.cdRef.markForCheck();
}
}