mirror of
https://github.com/jwetzell/showbridge-webui.git
synced 2026-08-31 10:58:59 +00:00
34 lines
706 B
TypeScript
34 lines
706 B
TypeScript
import { Injectable } from '@angular/core';
|
|
|
|
@Injectable({
|
|
providedIn: 'root',
|
|
})
|
|
export class ListsService {
|
|
public processorListIds: string[] = [];
|
|
|
|
registerProcessorList(path: string | undefined) {
|
|
if (path === undefined) {
|
|
return '';
|
|
}
|
|
|
|
const id = this.pathToId(path);
|
|
if (!this.processorListIds.includes(id)) {
|
|
this.processorListIds.push(id);
|
|
}
|
|
return id;
|
|
}
|
|
|
|
removeProcessorList(path: string | undefined) {
|
|
if (path === undefined) {
|
|
return;
|
|
}
|
|
|
|
const id = this.pathToId(path);
|
|
this.processorListIds = this.processorListIds.filter((listId) => listId !== id);
|
|
}
|
|
|
|
pathToId(path: string) {
|
|
return path.replaceAll('/', '.');
|
|
}
|
|
}
|