blob: 7f2a061b36f4157c0d37e2b8ed8824a215c4a260 [file] [log] [blame]
Adrià Vilanova Martínez18d03c42024-04-21 16:43:01 +02001import Feature from '../common/architecture/features/Feature';
Adrià Vilanova Martínez2ba5d8d2024-05-04 21:17:16 +02002import ScriptFilterListProvider from '../common/architecture/scripts/ScriptFilterListProvider';
Adrià Vilanova Martínez66836fd2024-05-04 22:43:06 +02003import ExtraInfoFeature from './extraInfo/extraInfo.feature';
Adrià Vilanova Martínezc78c3ad2024-05-18 00:35:51 +02004import WorkflowsFeature from './workflows/workflows.feature';
Adrià Vilanova Martínez18d03c42024-04-21 16:43:01 +02005
6export type ConcreteFeatureClass = { new (): Feature };
7
Adrià Vilanova Martínez2ba5d8d2024-05-04 21:17:16 +02008export default class Features extends ScriptFilterListProvider {
Adrià Vilanova Martínez58cc67c2024-04-21 16:43:01 +02009 private features: ConcreteFeatureClass[] = [
Adrià Vilanova Martínez66836fd2024-05-04 22:43:06 +020010 ExtraInfoFeature,
Adrià Vilanova Martínezc78c3ad2024-05-18 00:35:51 +020011 WorkflowsFeature,
Adrià Vilanova Martínez58cc67c2024-04-21 16:43:01 +020012 ];
Adrià Vilanova Martínez18d03c42024-04-21 16:43:01 +020013 private initializedFeatures: Feature[];
14
Adrià Vilanova Martínez2ba5d8d2024-05-04 21:17:16 +020015 protected getUnfilteredScriptsList() {
Adrià Vilanova Martínez18d03c42024-04-21 16:43:01 +020016 const features = this.getFeatures();
Adrià Vilanova Martínez2ba5d8d2024-05-04 21:17:16 +020017 return features.map((feature) => feature.getScripts()).flat(1);
Adrià Vilanova Martínez18d03c42024-04-21 16:43:01 +020018 }
19
20 private getFeatures() {
21 if (this.initializedFeatures === undefined) {
22 this.initializedFeatures = this.features.map((feature) => new feature());
23 }
24 return this.initializedFeatures;
25 }
26}