// extensions initialisation

import {registerComponents} from '../common/module-utils';
import {dynamicSections, dynamicSectionsByKind} from "../dynamic-section/dynamic-section-definitions";

import dbChangeInitiativeBrowser from './components/change-initiative/change-initiative-browser/db-change-initiative-browser';
import dbChangeInitiativeSection from './components/change-initiative/change-initiative-section/db-change-initiative-section';

export const init = (module) => {

    registerComponents(module, [
        dbChangeInitiativeBrowser,
        dbChangeInitiativeSection
    ]);

    _overrideChangeInitiativeSection();
};


function _overrideChangeInitiativeSection() {
    dynamicSections.dbChangeInitiativesSection = {
        componentId: 'db-change-initiative-section',
        name: 'Change Initiatives',
        icon: 'paper-plane-o',
        id: 10000
    };

    dynamicSectionsByKind["APPLICATION"] = [
        dynamicSections.measurableRatingAppSection,
        dynamicSections.entityNamedNotesSection,
        dynamicSections.bookmarksSection,
        dynamicSections.involvedPeopleSection,
        dynamicSections.dbChangeInitiativesSection, //overridden
        dynamicSections.flowDiagramsSection,
        dynamicSections.dataFlowSection,
        dynamicSections.technologySection,
        dynamicSections.appCostsSection,
        dynamicSections.entityStatisticSection,
        dynamicSections.surveySection,
        dynamicSections.changeLogSection
    ];
}
@@ -23,16 +23,40 @@
 sation%0A%0A
+import _ from %22lodash%22;%0A
 import %7B
@@ -615,25 +615,24 @@
 );%0A%0A    
-_
 override
 ChangeIn
@@ -623,39 +623,42 @@
 override
-ChangeInitiative
+ApplicationDynamic
 Section
+s
 ();%0A%7D;%0A%0A
@@ -671,17 +671,16 @@
 ion 
-_
 override
 Chan
@@ -675,39 +675,42 @@
 override
-ChangeInitiative
+ApplicationDynamic
 Section
+s
 () %7B%0A   
@@ -950,207 +950,84 @@
 %5D = 
-%5B%0A        dynamicSections.measurableRatingAppSection,%0A        dynamicSections.entityNamedNotesSection,%0A        dynamicSections.bookmarksSection,%0A        dynamicSections.involvedPeopleSection,%0A       
+_.map(%0A        dynamicSectionsByKind%5B%22APPLICATION%22%5D,%0A        ds =%3E ds.id ===
  dyn
@@ -1031,35 +1031,33 @@
 dynamicSections.
-dbC
+c
 hangeInitiatives
@@ -1059,83 +1059,36 @@
 tive
-s
 Section
-, //overridden%0A        dynamicSections.flowDiagramsSection,%0A
+.id%0A         
        
+?
  dyn
@@ -1105,155 +1105,33 @@
 ns.d
-ataFlowSection,%0A        dynamicSections.technologySection,%0A        dynamicSections.appCostsSection,%0A        dynamicSections.entityStatistic
+bChangeInitiatives
 Section
-,
 %0A   
@@ -1139,84 +1139,25 @@
     
-dynamicSections.surveySection,%0A
+ 
        
+:
  d
-ynamicSections.changeLogSection
+s
 %0A    
-%5D
+)
 ;%0A%7D

Fix change initiative section - Override GH section with DB specific one