public toTemplateValue()

in ui/src/app/core-ui/pipeline-element-template-config/pipeline-element-template-generator.ts [38:86]


    public toTemplateValue(): Map<string, any> {
        const map = new Map();
        if (this.sp instanceof FreeTextStaticProperty) {
            map.set(this.sp.internalName, this.sp.value);
        } else if (this.sp instanceof OneOfStaticProperty) {
            const selectedOption = this.sp.options.find(o => o.selected);
            if (selectedOption !== undefined) {
                map.set(this.sp.internalName, selectedOption.name);
            }
        } else if (this.sp instanceof ColorPickerStaticProperty) {
            map.set(this.sp.internalName, this.sp.selectedColor);
        } else if (this.sp instanceof SecretStaticProperty) {
            map.set(this.sp.internalName, this.sp.value);
            map.set('encrypted', this.sp.encrypted);
        } else if (this.sp instanceof AnyStaticProperty) {
            map.set(
                this.sp.internalName,
                this.sp.options.filter(o => o.selected).map(o => o.name),
            );
        } else if (this.sp instanceof CodeInputStaticProperty) {
            map.set(this.sp.internalName, this.sp.value);
        } else if (this.sp instanceof SlideToggleStaticProperty) {
            map.set(this.sp.internalName, this.sp.selected);
        } else if (this.sp instanceof CollectionStaticProperty) {
            map.set(this.sp.internalName, this.addListEntry(this.sp.members));
        } else if (this.sp instanceof FileStaticProperty) {
            map.set(this.sp.internalName, this.sp.locationPath);
        } else if (this.sp instanceof StaticPropertyAlternatives) {
            const selectedAlternative = this.sp.alternatives.find(
                a => a.selected,
            );
            if (selectedAlternative !== undefined) {
                map.set(this.sp.internalName, selectedAlternative.internalName);
                const alternative = new PipelineElementTemplateGenerator(
                    selectedAlternative.staticProperty,
                ).toTemplateValue();
                alternative.forEach((value, key) => {
                    map.set(key, value);
                });
            }
        } else if (this.sp instanceof StaticPropertyGroup) {
            return this.addNestedEntry(this.sp.staticProperties);
        } else if (
            this.sp instanceof RuntimeResolvableTreeInputStaticProperty
        ) {
            map.set(this.sp.internalName, this.sp.selectedNodesInternalNames);
        }
        return map;
    }