public initialize()

in src/wsjfSettings.tsx [83:163]


    public initialize() {
        let hubContent = $(".hub-content");
        let uri = VSS.getWebContext().collection.uri + "_admin/_process";
        
        let descriptionText = "{0} is a concept of {1} used for weighing the cost of delay with job size.";
        let header = $("<div />").addClass("description-text bowtie").appendTo(hubContent);
        header = $("<div />").addClass("description-text bowtie").appendTo(hubContent);
        header.html(Utils_string.format(descriptionText));

        $("<img src='https://www.scaledagileframework.com/wp-content/uploads/2014/07/Figure-2.-A-formula-for-calculating-WSJF.png' />").addClass("description-image").appendTo(hubContent);
        
        descriptionText = "You must add a custom decimal field from the {0} to each work item type you wish to compute WSJF.";
        header = $("<div />").addClass("description-text bowtie").appendTo(hubContent);
        header.html(Utils_string.format(descriptionText, "<a target='_blank' href='" + uri +"'>process hub</a>"));

        let container = $("<div />").addClass("wsjf-settings-container").appendTo(hubContent);

        var menubarOptions = {
            items: [
                { id: "save", icon: "icon-save", title: "Save the selected field" }   
            ],
            executeAction:(args) => {
                var command = args.get_commandName();
                switch (command) {
                    case "save":
                        this.save();
                        break;
                    default:
                        console.log("Unhandled action: " + command);
                        break;
                }
            }
        };
        this._menuBar = Controls.create<Menus.MenuBar, any>(Menus.MenuBar, container, menubarOptions);

        let bvContainer = $("<div />").addClass("settings-control").appendTo(container);
        $("<label />").text("Business Value Field").appendTo(bvContainer);

        let tcContainer = $("<div />").addClass("settings-control").appendTo(container);
        $("<label />").text("Time Criticality Field").appendTo(tcContainer);

        let rvContainer = $("<div />").addClass("settings-control").appendTo(container);
        $("<label />").text("RR-OE Values Field").appendTo(rvContainer);

        let effortContainer = $("<div />").addClass("settings-control").appendTo(container);
        $("<label />").text("Effort Field").appendTo(effortContainer);

        let wsjfContainer = $("<div />").addClass("settings-control").appendTo(container);
        $("<label />").text("WSJF Field").appendTo(wsjfContainer);            

        VSS.getService<IExtensionDataService>(VSS.ServiceIds.ExtensionData).then((dataService: IExtensionDataService) => {
            dataService.getValue<StoredFieldReferences>("storedFields").then((storedFields:StoredFieldReferences) => {
                if (storedFields) {
                    console.log("Retrieved fields from storage");
                    this._selectedFields = storedFields;
                }
                else {
                    console.log("Failed to retrieve fields from storage, defaulting values")
					//Enter in your config referenceName for "rvField" and "wsjfField"
                    this._selectedFields = {
                        bvField: "Microsoft.VSTS.Common.BusinessValue",
                        tcField: "Microsoft.VSTS.Common.TimeCriticality",
                        rvField: null,
                        effortField: "Microsoft.VSTS.Scheduling.Effort",
                        wsjfField: null
                    };
                }

                this.getSortedFieldsList().then((fieldList) => {
                    Controls.create(Combo, bvContainer, this.getComboOptions("businessValue", fieldList, this._selectedFields.bvField));
                    Controls.create(Combo, tcContainer, this.getComboOptions("timeCriticality", fieldList, this._selectedFields.tcField));
                    Controls.create(Combo, rvContainer, this.getComboOptions("rroevalue", fieldList, this._selectedFields.rvField));
                    Controls.create(Combo, effortContainer, this.getComboOptions("effort", fieldList, this._selectedFields.effortField));
                    Controls.create(Combo, wsjfContainer, this.getComboOptions("wsjf", fieldList, this._selectedFields.wsjfField));
                    this.updateSaveButton();

                    VSS.notifyLoadSucceeded();
                });
            });
        });  
    }