#!/bin/bash

source /var/onap/functions

# clone_all_portal_repos() - Function that clones Portal source repo.
function clone_all_portal_repos {
    for repo in ${repos[portal]}; do
        if [[ "$repo" == "ui/dmaapbc" ]];then
            prefix="ui"
        else
            prefix="portal"
        fi
        clone_repo $repo ${src_folders[portal]}/${repo#*$prefix}
    done
}

# compile_all_portal_repos() - Function that compiles Portal source repo.
function compile_all_portal_repos {
    for repo in ${repos[portal]}; do
        if [[ "$repo" == "ui/dmaapbc" ]];then
            prefix="ui"
        else
            prefix="portal"
        fi
        compile_src ${src_folders[portal]}/${repo#*$prefix}
    done
}

# _build_portal_images() - Function that builds Portal Docker images from source code
function _build_portal_images {
    install_maven

    pushd ${src_folders[portal]}/deliveries
    chmod +x *.sh
    export MVN=$(which mvn)
    export GLOBAL_SETTINGS_FILE=/usr/share/maven3/conf/settings.xml
    export SETTINGS_FILE=$HOME/.m2/settings.xml
    bash build_portalapps_dockers.sh
    popd
}

# get_portal_images() - Function to get Portal images.
function get_portal_images {
    if [[ "$build_image" == "True" ]]; then
        _build_portal_images
    else
        pull_openecomp_image portaldb ecompdb:portal
        pull_openecomp_image portalapps ep:1610-1
    fi
    pull_docker_image mariadb
}

# _install_mariadb() - Pull and create a MariaDB container
function _install_mariadb {
    docker create --name data_vol_portal -v /var/lib/mysql mariadb
}

# install_portal() - Function that installs the source code of Portal
function install_portal {
    install_docker
    docker rm -f ecompdb_portal
    docker rm -f 1610-1

    pushd ${src_folders[portal]}/deliveries
    mkdir -p /PROJECT/OpenSource/UbuntuEP/logs
    install_package unzip
    unzip -o etc.zip -d /PROJECT/OpenSource/UbuntuEP/

    _install_mariadb
    install_docker_compose
    bash portal_vm_init.sh

    sleep 180

    if [ ! -e /opt/config/boot.txt ]; then
        install_package mysql-client
        mysql -u root -p'Aa123456' -h $IP_ADDRESS < Apps_Users_OnBoarding_Script.sql
        echo "yes" > /opt/config/boot.txt
    fi
    popd
}

# init_portal() - Function that initialize Portal services
function init_portal {
    if [[ "$clone_repo" == "True" ]]; then
        clone_all_portal_repos
        if [[ "$compile_repo" == "True" ]]; then
            compile_all_portal_repos
        fi
    fi

    if [[ "$skip_get_images" == "False" ]]; then
        get_portal_images
        if [[ "$skip_install" == "False" ]]; then
            install_portal
        fi
    fi
}
