blob: a93f8a33a0047e19b7e887853f980b4d84809b0d [file] [log] [blame]
Adrià Vilanova Martínez18d03c42024-04-21 16:43:01 +02001import Feature from '../common/architecture/features/Feature';
Adrià Vilanova Martínez58cc67c2024-04-21 16:43:01 +02002import AutoRefreshFeature from './autoRefresh/autoRefresh.feature';
Adrià Vilanova Martínez18d03c42024-04-21 16:43:01 +02003import InfiniteScrollFeature from './infiniteScroll/infiniteScroll.feature';
Adrià Vilanova Martínez2ba5d8d2024-05-04 21:17:16 +02004import ScriptFilterListProvider from '../common/architecture/scripts/ScriptFilterListProvider';
Adrià Vilanova Martínez66836fd2024-05-04 22:43:06 +02005import ExtraInfoFeature from './extraInfo/extraInfo.feature';
Adrià Vilanova Martínezc78c3ad2024-05-18 00:35:51 +02006import WorkflowsFeature from './workflows/workflows.feature';
Adrià Vilanova Martínez18d03c42024-04-21 16:43:01 +02007
8export type ConcreteFeatureClass = { new (): Feature };
9
Adrià Vilanova Martínez2ba5d8d2024-05-04 21:17:16 +020010export default class Features extends ScriptFilterListProvider {
Adrià Vilanova Martínez58cc67c2024-04-21 16:43:01 +020011 private features: ConcreteFeatureClass[] = [
12 AutoRefreshFeature,
Adrià Vilanova Martínez66836fd2024-05-04 22:43:06 +020013 ExtraInfoFeature,
Adrià Vilanova Martínez58cc67c2024-04-21 16:43:01 +020014 InfiniteScrollFeature,
Adrià Vilanova Martínezc78c3ad2024-05-18 00:35:51 +020015 WorkflowsFeature,
Adrià Vilanova Martínez58cc67c2024-04-21 16:43:01 +020016 ];
Adrià Vilanova Martínez18d03c42024-04-21 16:43:01 +020017 private initializedFeatures: Feature[];
18
Adrià Vilanova Martínez2ba5d8d2024-05-04 21:17:16 +020019 protected getUnfilteredScriptsList() {
Adrià Vilanova Martínez18d03c42024-04-21 16:43:01 +020020 const features = this.getFeatures();
Adrià Vilanova Martínez2ba5d8d2024-05-04 21:17:16 +020021 return features.map((feature) => feature.getScripts()).flat(1);
Adrià Vilanova Martínez18d03c42024-04-21 16:43:01 +020022 }
23
24 private getFeatures() {
25 if (this.initializedFeatures === undefined) {
26 this.initializedFeatures = this.features.map((feature) => new feature());
27 }
28 return this.initializedFeatures;
29 }
30}