Merge "Reporting docker deployment improvement"
authorMorgan Richomme <morgan.richomme@orange.com>
Thu, 6 Jul 2017 09:44:05 +0000 (09:44 +0000)
committerGerrit Code Review <gerrit@opnfv.org>
Thu, 6 Jul 2017 09:44:05 +0000 (09:44 +0000)
utils/test/reporting/docker/reporting.sh
utils/test/reporting/docker/supervisor.conf
utils/test/reporting/pages/angular.sh
utils/test/reporting/pages/app/index.html
utils/test/reporting/pages/app/scripts/app.config.js [deleted file]
utils/test/reporting/pages/app/scripts/controllers/table.controller.js
utils/test/reporting/pages/app/scripts/controllers/testvisual.controller.js
utils/test/reporting/pages/app/scripts/factory/table.factory.js
utils/test/reporting/pages/config.sh [new file with mode: 0755]

index 49f4517..7fe97a8 100755 (executable)
@@ -98,3 +98,5 @@ echo "daemon off;" >> /etc/nginx/nginx.conf
 cp /home/opnfv/utils/test/reporting/docker/supervisor.conf /etc/supervisor/conf.d/
 
 ln -s /usr/bin/nodejs /usr/bin/node
+
+cd pages && /bin/bash angular.sh
index 5e315ba..b323dd0 100644 (file)
@@ -1,22 +1,19 @@
 [supervisord]
 nodaemon = true
 
-[program:reporting_tornado]
+[program:tornado]
 user = root
 directory = /home/opnfv/utils/test/reporting/api/api
 command = python server.py --port=800%(process_num)d
 process_name=%(program_name)s%(process_num)d
 numprocs=4
 numprocs_start=1
-autorestart = true
 
-[program:reporting_nginx]
+[program:nginx]
 user = root
 command = service nginx restart
-autorestart = true
 
-[program:reporting_angular]
+[program:configuration]
 user = root
 directory = /home/opnfv/utils/test/reporting/pages
-command = bash angular.sh
-autorestart = true
+command = bash config.sh
index 080f27b..0e00ea6 100755 (executable)
@@ -1,8 +1,3 @@
-: ${SERVER_URL:='http://testresults.opnfv.org/reporting/api'}
-
-echo "var BASE_URL = 'http://${SERVER_URL}/landing-page'" >> app/scripts/app.config.js
-echo "var PROJECT_URL = 'http://${SERVER_URL}'" >> app/scripts/app.config.js
-
 apt-get install -y nodejs
 apt-get install -y npm
 npm install
index f4eb65a..843a623 100644 (file)
     <script src="scripts/controllers/auth.controller.js"></script>
     <script src="scripts/controllers/admin.controller.js"></script>
     <script src="scripts/controllers/main.controller.js"></script>
-    <script src="scripts/app.config.js"></script>
     <script src="scripts/controllers/testvisual.controller.js"></script>
 
     <!-- endbuild -->
 </body>
 
-</html>
\ No newline at end of file
+</html>
diff --git a/utils/test/reporting/pages/app/scripts/app.config.js b/utils/test/reporting/pages/app/scripts/app.config.js
deleted file mode 100644 (file)
index e69de29..0000000
index 0f3a17a..44d9441 100644 (file)
  * Controller of the opnfvdashBoardAngularApp
  */
 angular.module('opnfvApp')
-    .controller('TableController', ['$scope', '$state', '$stateParams', '$http', 'TableFactory', function($scope, $state, $stateParams, $http, TableFactory) {
-
-        $scope.filterlist = [];
-        $scope.selection = [];
-        $scope.statusList = [];
-        $scope.projectList = [];
-        $scope.installerList = [];
-        $scope.versionlist = [];
-        $scope.loopci = [];
-        $scope.time = [];
-        $scope.tableDataAll = {};
-        $scope.tableInfoAll = {};
-        $scope.scenario = {};
-
-        $scope.VersionConfig = {
-            create: true,
-            valueField: 'title',
-            labelField: 'title',
-            delimiter: '|',
-            maxItems: 1,
-            placeholder: 'Version',
-            onChange: function(value) {
-                checkElementArrayValue($scope.selection, $scope.VersionOption);
-                $scope.selection.push(value);
-                // console.log($scope.selection);
-                getScenarioData();
+    .controller('TableController', ['$scope', '$state', '$stateParams', '$http', 'TableFactory', '$timeout',
+        function($scope, $state, $stateParams, $http, TableFactory, $timeout) {
+
+            $scope.filterlist = [];
+            $scope.selection = [];
+            $scope.statusList = [];
+            $scope.projectList = [];
+            $scope.installerList = [];
+            $scope.versionlist = [];
+            $scope.loopci = [];
+            $scope.time = [];
+            $scope.tableDataAll = {};
+            $scope.tableInfoAll = {};
+            $scope.scenario = {};
+            // $scope.selectProjects = [];
+
+
+            $scope.VersionConfig = {
+                create: true,
+                valueField: 'title',
+                labelField: 'title',
+                delimiter: '|',
+                maxItems: 1,
+                placeholder: 'Version',
+                onChange: function(value) {
+                    checkElementArrayValue($scope.selection, $scope.VersionOption);
+                    $scope.selection.push(value);
+                    // console.log($scope.selection);
+                    getScenarioData();
 
+                }
             }
-        }
 
-        $scope.LoopConfig = {
-            create: true,
-            valueField: 'title',
-            labelField: 'title',
-            delimiter: '|',
-            maxItems: 1,
-            placeholder: 'Loop',
-            onChange: function(value) {
-                checkElementArrayValue($scope.selection, $scope.LoopOption);
-                $scope.selection.push(value);
-                // console.log($scope.selection);
-                getScenarioData();
+            $scope.LoopConfig = {
+                create: true,
+                valueField: 'title',
+                labelField: 'title',
+                delimiter: '|',
+                maxItems: 1,
+                placeholder: 'Loop',
+                onChange: function(value) {
+                    checkElementArrayValue($scope.selection, $scope.LoopOption);
+                    $scope.selection.push(value);
+                    // console.log($scope.selection);
+                    getScenarioData();
 
+                }
             }
-        }
 
-        $scope.TimeConfig = {
-            create: true,
-            valueField: 'title',
-            labelField: 'title',
-            delimiter: '|',
-            maxItems: 1,
-            placeholder: 'Time',
-            onChange: function(value) {
-                checkElementArrayValue($scope.selection, $scope.TimeOption);
-                $scope.selection.push(value);
-                // console.log($scope.selection)
-                getScenarioData();
+            $scope.TimeConfig = {
+                create: true,
+                valueField: 'title',
+                labelField: 'title',
+                delimiter: '|',
+                maxItems: 1,
+                placeholder: 'Time',
+                onChange: function(value) {
+                    checkElementArrayValue($scope.selection, $scope.TimeOption);
+                    $scope.selection.push(value);
+                    // console.log($scope.selection)
+                    getScenarioData();
 
 
+                }
             }
-        }
 
 
-        init();
+            init();
 
-        function init() {
-            $scope.toggleSelection = toggleSelection;
-            getScenarioData();
-            // radioSetting();
-            getFilters();
-        }
+            function init() {
+                $scope.toggleSelection = toggleSelection;
+                getScenarioData();
+                getFilters();
+            }
 
-        function getFilters() {
-            TableFactory.getFilter().get({
+            function getFilters() {
+                TableFactory.getFilter().get({
+
+                }).$promise.then(function(response) {
+                    if (response != null) {
+                        $scope.statusList = response.filters.status;
+                        $scope.projectList = response.filters.projects;
+                        $scope.installerList = response.filters.installers;
+                        $scope.versionlist = response.filters.version;
+                        $scope.loopci = response.filters.loops;
+                        $scope.time = response.filters.time;
+
+                        $scope.statusListString = $scope.statusList.toString();
+                        $scope.projectListString = $scope.projectList.toString();
+                        $scope.installerListString = $scope.installerList.toString();
+                        $scope.VersionSelected = $scope.versionlist[1];
+                        $scope.LoopCiSelected = $scope.loopci[0];
+                        $scope.TimeSelected = $scope.time[0];
+                        radioSetting($scope.versionlist, $scope.loopci, $scope.time);
+
+                    } else {
+                        alert("网络错误");
+                    }
+                })
+            }
 
+            function getScenarioData() {
 
-            }).$promise.then(function(response) {
-                if (response != null) {
-                    $scope.statusList = response.filters.status;
-                    $scope.projectList = response.filters.projects;
-                    $scope.installerList = response.filters.installers;
-                    $scope.versionlist = response.filters.version;
-                    $scope.loopci = response.filters.loops;
-                    $scope.time = response.filters.time;
+                // var utl = BASE_URL + '/scenarios';
+                var data = {
+                    'status': ['success', 'danger', 'warning'],
+                    'projects': ['functest', 'yardstick'],
+                    'installers': ['apex', 'compass', 'fuel', 'joid'],
+                    'version': $scope.VersionSelected,
+                    'loops': $scope.LoopCiSelected,
+                    'time': $scope.TimeSelected
+                };
 
-                    $scope.statusListString = $scope.statusList.toString();
-                    $scope.projectListString = $scope.projectList.toString();
-                    $scope.installerListString = $scope.installerList.toString();
-                    $scope.VersionSelected = $scope.versionlist[1];
-                    $scope.LoopCiSelected = $scope.loopci[0];
-                    $scope.TimeSelected = $scope.time[0];
-                    radioSetting($scope.versionlist, $scope.loopci, $scope.time);
+                TableFactory.getScenario(data).then(function(response) {
+                    if (response.status == 200) {
+                        $scope.scenario = response.data;
 
-                } else {
-                    alert("网络错误");
-                }
-            })
-        }
+                        reSettingcolspan();
+                    }
+
+                }, function(error) {
+
+                })
 
-        function getScenarioData() {
-
-            var utl = BASE_URL + '/scenarios';
-            var data = {
-                'status': ['success', 'danger', 'warning'],
-                'projects': ['functest', 'yardstick'],
-                'installers': ['apex', 'compass', 'fuel', 'joid'],
-                'version': $scope.VersionSelected,
-                'loops': $scope.LoopCiSelected,
-                'time': $scope.TimeSelected
-            };
-            var config = {
-                headers: {
-                    'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
-                }
             }
-            $http.post(utl, data, config).then(function(response) {
-                if (response.status == 200) {
-                    $scope.scenario = response.data;
+
+            function reSettingcolspan() {
+                if ($scope.selectProjects == undefined || $scope.selectProjects == null) {
                     constructJson();
-                }
-            })
-        }
+                    $scope.colspan = $scope.tableDataAll.colspan;
 
-        //construct json 
-        function constructJson() {
+                } else {
+                    constructJson();
+                    $scope.colspan = $scope.tempColspan;
+                }
+                // console.log("test")
+            }
 
-            var colspan;
-            var InstallerData;
-            var projectsInfo;
-            $scope.tableDataAll["scenario"] = [];
+            //construct json 
+            function constructJson(selectProject) {
 
+                var colspan;
+                var InstallerData;
+                var projectsInfo;
+                $scope.tableDataAll["scenario"] = [];
 
-            for (var item in $scope.scenario.scenarios) {
 
-                var headData = Object.keys($scope.scenario.scenarios[item].installers).sort();
-                var scenarioStatus = $scope.scenario.scenarios[item].status;
-                var scenarioStatusDisplay;
-                if (scenarioStatus == "success") {
-                    scenarioStatusDisplay = "navy";
-                } else if (scenarioStatus == "danger") {
-                    scenarioStatusDisplay = "danger";
-                } else if (scenarioStatus == "warning") {
-                    scenarioStatusDisplay = "warning";
-                }
+                for (var item in $scope.scenario.scenarios) {
 
-                InstallerData = headData;
-                var projectData = [];
-                var datadisplay = [];
-                var projects = [];
+                    var headData = Object.keys($scope.scenario.scenarios[item].installers).sort();
+                    var scenarioStatus = $scope.scenario.scenarios[item].status;
+                    var scenarioStatusDisplay;
+                    if (scenarioStatus == "success") {
+                        scenarioStatusDisplay = "navy";
+                    } else if (scenarioStatus == "danger") {
+                        scenarioStatusDisplay = "danger";
+                    } else if (scenarioStatus == "warning") {
+                        scenarioStatusDisplay = "warning";
+                    }
 
-                for (var j = 0; j < headData.length; j++) {
+                    InstallerData = headData;
+                    var projectData = [];
+                    var datadisplay = [];
+                    var projects = [];
 
-                    projectData.push($scope.scenario.scenarios[item].installers[headData[j]]);
-                }
-                for (var j = 0; j < projectData.length; j++) {
-
-                    for (var k = 0; k < projectData[j].length; k++) {
-                        projects.push(projectData[j][k].project);
-                        var temArray = [];
-                        if (projectData[j][k].score == null) {
-                            temArray.push("null");
-                            temArray.push(projectData[j][k].project);
-                            temArray.push(headData[j]);
-                        } else {
-                            temArray.push(projectData[j][k].score);
-                            temArray.push(projectData[j][k].project);
-                            temArray.push(headData[j]);
-                        }
+                    for (var j = 0; j < headData.length; j++) {
 
+                        projectData.push($scope.scenario.scenarios[item].installers[headData[j]]);
+                    }
+                    for (var j = 0; j < projectData.length; j++) {
+
+                        for (var k = 0; k < projectData[j].length; k++) {
+                            projects.push(projectData[j][k].project);
+                            var temArray = [];
+                            if (projectData[j][k].score == null) {
+                                temArray.push("null");
+                                temArray.push(projectData[j][k].project);
+                                temArray.push(headData[j]);
+                            } else {
+                                temArray.push(projectData[j][k].score);
+                                temArray.push(projectData[j][k].project);
+                                temArray.push(headData[j]);
+                            }
+
+
+                            if (projectData[j][k].status == "platinium") {
+                                temArray.push("primary");
+                                temArray.push("P");
+                            } else if (projectData[j][k].status == "gold") {
+                                temArray.push("danger");
+                                temArray.push("G");
+                            } else if (projectData[j][k].status == "silver") {
+                                temArray.push("warning");
+                                temArray.push("S");
+                            } else if (projectData[j][k].status == null) {
+                                temArray.push("null");
+                            }
+
+                            datadisplay.push(temArray);
 
-                        if (projectData[j][k].status == "platinium") {
-                            temArray.push("primary");
-                            temArray.push("P");
-                        } else if (projectData[j][k].status == "gold") {
-                            temArray.push("danger");
-                            temArray.push("G");
-                        } else if (projectData[j][k].status == "silver") {
-                            temArray.push("warning");
-                            temArray.push("S");
-                        } else if (projectData[j][k].status == null) {
-                            temArray.push("null");
                         }
 
-                        datadisplay.push(temArray);
-
                     }
 
-                }
+                    colspan = projects.length / headData.length;
 
-                colspan = projects.length / headData.length;
-
-                var tabledata = {
-                    scenarioName: item,
-                    Installer: InstallerData,
-                    projectData: projectData,
-                    projects: projects,
-                    datadisplay: datadisplay,
-                    colspan: colspan,
-                    status: scenarioStatus,
-                    statusDisplay: scenarioStatusDisplay
-                };
+                    var tabledata = {
+                        scenarioName: item,
+                        Installer: InstallerData,
+                        projectData: projectData,
+                        projects: projects,
+                        datadisplay: datadisplay,
+                        colspan: colspan,
+                        status: scenarioStatus,
+                        statusDisplay: scenarioStatusDisplay
+                    };
 
-                JSON.stringify(tabledata);
-                $scope.tableDataAll.scenario.push(tabledata);
+                    JSON.stringify(tabledata);
+                    $scope.tableDataAll.scenario.push(tabledata);
 
-                // console.log(tabledata);
 
-            }
+                    // console.log(tabledata);
+
+                }
 
 
-            projectsInfo = $scope.tableDataAll.scenario[0].projects;
+                projectsInfo = $scope.tableDataAll.scenario[0].projects;
 
-            var tempHeadData = [];
+                var tempHeadData = [];
 
-            for (var i = 0; i < InstallerData.length; i++) {
-                for (var j = 0; j < colspan; j++) {
-                    tempHeadData.push(InstallerData[i]);
+                for (var i = 0; i < InstallerData.length; i++) {
+                    for (var j = 0; j < colspan; j++) {
+                        tempHeadData.push(InstallerData[i]);
+                    }
                 }
-            }
 
-            //console.log(tempHeadData);
+                //console.log(tempHeadData);
 
-            var projectsInfoAll = [];
+                var projectsInfoAll = [];
 
-            for (var i = 0; i < projectsInfo.length; i++) {
-                var tempA = [];
-                tempA.push(projectsInfo[i]);
-                tempA.push(tempHeadData[i]);
-                projectsInfoAll.push(tempA);
+                for (var i = 0; i < projectsInfo.length; i++) {
+                    var tempA = [];
+                    tempA.push(projectsInfo[i]);
+                    tempA.push(tempHeadData[i]);
+                    projectsInfoAll.push(tempA);
 
-            }
-            //console.log(projectsInfoAll);
+                }
+                //console.log(projectsInfoAll);
 
-            $scope.tableDataAll["colspan"] = colspan;
-            $scope.tableDataAll["Installer"] = InstallerData;
-            $scope.tableDataAll["Projects"] = projectsInfoAll;
+                $scope.tableDataAll["colspan"] = colspan;
+                $scope.tableDataAll["Installer"] = InstallerData;
+                $scope.tableDataAll["Projects"] = projectsInfoAll;
 
-            // console.log($scope.tableDataAll);
-            $scope.colspan = $scope.tableDataAll.colspan;
+                // console.log($scope.tableDataAll);
+                $scope.colspan = $scope.tableDataAll.colspan;
+                console.log($scope.tableDataAll);
 
-        }
+            }
 
-        //get json element size
-        function getSize(jsondata) {
-            var size = 0;
-            for (var item in jsondata) {
-                size++;
+            //get json element size
+            function getSize(jsondata) {
+                var size = 0;
+                for (var item in jsondata) {
+                    size++;
+                }
+                return size;
             }
-            return size;
-        }
 
-        $scope.colspan = $scope.tableDataAll.colspan;
-        // console.log($scope.colspan);
 
+            // console.log($scope.colspan);
 
-        //find all same element index 
-        function getSameElementIndex(array, element) {
-            var indices = [];
-            var idx = array.indexOf(element);
-            while (idx != -1) {
-                indices.push(idx);
-                idx = array.indexOf(element, idx + 1);
-            }
-            //return indices;
-            var result = { element: element, index: indices };
-            JSON.stringify(result);
-            return result;
-        }
 
-        //delete element in array
-        function deletElement(array, index) {
-            array.splice(index, 1);
+            //find all same element index 
+            function getSameElementIndex(array, element) {
+                var indices = [];
+                var idx = array.indexOf(element);
+                while (idx != -1) {
+                    indices.push(idx);
+                    idx = array.indexOf(element, idx + 1);
+                }
+                //return indices;
+                var result = { element: element, index: indices };
+                JSON.stringify(result);
+                return result;
+            }
 
-        }
+            //delete element in array
+            function deletElement(array, index) {
+                array.splice(index, 1);
 
-        function radioSetting(array1, array2, array3) {
-            var tempVersion = [];
-            var tempLoop = [];
-            var tempTime = [];
-            for (var i = 0; i < array1.length; i++) {
-                var temp = {
-                    title: array1[i]
-                };
-                tempVersion.push(temp);
-            }
-            for (var i = 0; i < array2.length; i++) {
-                var temp = {
-                    title: array2[i]
-                };
-                tempLoop.push(temp);
             }
-            for (var i = 0; i < array3.length; i++) {
-                var temp = {
-                    title: array3[i]
-                };
-                tempTime.push(temp);
+
+            function radioSetting(array1, array2, array3) {
+                var tempVersion = [];
+                var tempLoop = [];
+                var tempTime = [];
+                for (var i = 0; i < array1.length; i++) {
+                    var temp = {
+                        title: array1[i]
+                    };
+                    tempVersion.push(temp);
+                }
+                for (var i = 0; i < array2.length; i++) {
+                    var temp = {
+                        title: array2[i]
+                    };
+                    tempLoop.push(temp);
+                }
+                for (var i = 0; i < array3.length; i++) {
+                    var temp = {
+                        title: array3[i]
+                    };
+                    tempTime.push(temp);
+                }
+                $scope.VersionOption = tempVersion;
+                $scope.LoopOption = tempLoop;
+                $scope.TimeOption = tempTime;
             }
-            $scope.VersionOption = tempVersion;
-            $scope.LoopOption = tempLoop;
-            $scope.TimeOption = tempTime;
-        }
 
-        //remove element in the array
-        function removeArrayValue(arr, value) {
-            for (var i = 0; i < arr.length; i++) {
-                if (arr[i] == value) {
-                    arr.splice(i, 1);
-                    break;
+            //remove element in the array
+            function removeArrayValue(arr, value) {
+                for (var i = 0; i < arr.length; i++) {
+                    if (arr[i] == value) {
+                        arr.splice(i, 1);
+                        break;
+                    }
                 }
             }
-        }
 
-        //check if exist element
-        function checkElementArrayValue(arrayA, arrayB) {
-            for (var i = 0; i < arrayB.length; i++) {
-                if (arrayA.indexOf(arrayB[i].title) > -1) {
-                    removeArrayValue(arrayA, arrayB[i].title);
+            //check if exist element
+            function checkElementArrayValue(arrayA, arrayB) {
+                for (var i = 0; i < arrayB.length; i++) {
+                    if (arrayA.indexOf(arrayB[i].title) > -1) {
+                        removeArrayValue(arrayA, arrayB[i].title);
+                    }
                 }
             }
-        }
 
-        function toggleSelection(status) {
-            var idx = $scope.selection.indexOf(status);
+            function toggleSelection(status) {
+                var idx = $scope.selection.indexOf(status);
+
+                if (idx > -1) {
+                    $scope.selection.splice(idx, 1);
+                    filterData($scope.selection)
+                } else {
+                    $scope.selection.push(status);
+                    filterData($scope.selection)
+                }
+                // console.log($scope.selection);
 
-            if (idx > -1) {
-                $scope.selection.splice(idx, 1);
-                filterData($scope.selection)
-            } else {
-                $scope.selection.push(status);
-                filterData($scope.selection)
             }
-            // console.log($scope.selection);
 
-        }
+            //filter function
+            function filterData(selection) {
 
-        //filter function
-        function filterData(selection) {
+                $scope.selectInstallers = [];
+                $scope.selectProjects = [];
+                $scope.selectStatus = [];
+                for (var i = 0; i < selection.length; i++) {
+                    if ($scope.statusListString.indexOf(selection[i]) > -1) {
+                        $scope.selectStatus.push(selection[i]);
+                    }
+                    if ($scope.projectListString.indexOf(selection[i]) > -1) {
+                        $scope.selectProjects.push(selection[i]);
+                    }
+                    if ($scope.installerListString.indexOf(selection[i]) > -1) {
+                        $scope.selectInstallers.push(selection[i]);
+                    }
+                }
+
+
+                // $scope.colspan = $scope.selectProjects.length;
+                //when some selection is empty, we set it full
+                if ($scope.selectInstallers.length == 0) {
+                    $scope.selectInstallers = $scope.installerList;
 
-            $scope.selectInstallers = [];
-            $scope.selectProjects = [];
-            $scope.selectStatus = [];
-            for (var i = 0; i < selection.length; i++) {
-                if ($scope.statusListString.indexOf(selection[i]) > -1) {
-                    $scope.selectStatus.push(selection[i]);
                 }
-                if ($scope.projectListString.indexOf(selection[i]) > -1) {
-                    $scope.selectProjects.push(selection[i]);
+                if ($scope.selectProjects.length == 0) {
+                    $scope.selectProjects = $scope.projectList;
+                    $scope.colspan = $scope.tableDataAll.colspan;
+                } else {
+                    $scope.colspan = $scope.selectProjects.length;
+                    $scope.tempColspan = $scope.colspan;
                 }
-                if ($scope.installerListString.indexOf(selection[i]) > -1) {
-                    $scope.selectInstallers.push(selection[i]);
+                if ($scope.selectStatus.length == 0) {
+                    $scope.selectStatus = $scope.statusList
                 }
-            }
 
-            $scope.colspan = $scope.selectProjects.length;
-            //when some selection is empty, we set it full
-            if ($scope.selectInstallers.length == 0) {
-                $scope.selectInstallers = $scope.installerList;
+                // console.log($scope.selectStatus);
+                // console.log($scope.selectProjects);
 
             }
-            if ($scope.selectProjects.length == 0) {
-                $scope.selectProjects = $scope.projectList;
-                $scope.colspan = $scope.tableDataAll.colspan;
-            }
-            if ($scope.selectStatus.length == 0) {
-                $scope.selectStatus = $scope.statusList
-            }
 
-            // console.log($scope.selectStatus);
-            // console.log($scope.selectProjects);
 
         }
-
-
-    }]);
\ No newline at end of file
+    ]);
\ No newline at end of file
index ae51e4a..894e10f 100644 (file)
@@ -41,25 +41,18 @@ angular.module('opnfvApp')
                 $scope.tableData = null;
                 $scope.modalName = name;
 
-                var url = PROJECT_URL + '/projects/' + name + '/cases';
-
-                var config = {
-                    headers: {
-                        'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
-                    }
-                }
-                $http.get(url, config).then(function(response) {
+                TableFactory.getProjectTestCases(name).then(function(response) {
                     if (response.status == 200) {
                         $scope.tableData = response.data;
 
                         $scope.tableData = constructObjectArray($scope.tableData);
                         console.log($scope.tableData);
                         $loading.finish('Key');
-
-
-
                     }
+                }, function(error) {
+
                 })
+
             }
 
             //construct key value for tableData
index 2a8cbd0..f0af34f 100644 (file)
@@ -4,11 +4,24 @@
  * get data factory
  */
 angular.module('opnfvApp')
-    .factory('TableFactory', function($resource, $rootScope) {
+    .factory('TableFactory', function($resource, $rootScope, $http) {
+
+        var BASE_URL = 'http://testresults.opnfv.org/reporting2';
+        $.ajax({
+          url: 'config.json',
+          async: false,
+          dataType: 'json',
+          success: function (response) {
+              BASE_URL = response.url;
+          },
+          error: function (response){
+              alert('fail to get api url, using default: http://testresults.opnfv.org/reporting2')
+          }
+        });
 
         return {
             getFilter: function() {
-                return $resource(BASE_URL + '/filters', {}, {
+                return $resource(BASE_URL + '/landing-page/filters', {}, {
                     'get': {
                         method: 'GET',
 
@@ -16,33 +29,42 @@ angular.module('opnfvApp')
                 });
             },
             getScenario: function() {
-                return $resource(BASE_URL + '/scenarios', {}, {
-                    'post': {
-                        method: 'POST',
+
+                var config = {
+                    headers: {
+                        'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
                     }
-                })
+                }
+
+                return $http.post(BASE_URL + '/landing-page/scenarios', {}, config);
             },
+
+
             getProjectUrl: function() {
-                return $resource(PROJECT_URL + '/projects-page/projects', {}, {
+                return $resource(BASE_URL + '/projects-page/projects', {}, {
                     'get': {
                         method: 'GET'
                     }
                 })
             },
-            getProjectTestCases: function() {
-                return $resource(PROJECT_URL + '/projects/:project/cases', { project: '@project' }, {
-                    'get': {
-                        method: 'GET'
+            getProjectTestCases: function(name) {
+                var config = {
+                    headers: {
+                        'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
                     }
-                })
+                };
+                return $http.get(BASE_URL + '/projects/' + name + '/cases', {}, config)
+
+
             },
             getProjectTestCaseDetail: function() {
-                return $resource(PROJECT_URL + '/projects/:project/cases/:testcase', { project: '@project', testcase: '@testcase' }, {
+                return $resource(BASE_URL + '/projects/:project/cases/:testcase', { project: '@project', testcase: '@testcase' }, {
                     'get': {
 
                         method: 'GET'
                     }
                 })
             }
+
         };
-    });
\ No newline at end of file
+    });
diff --git a/utils/test/reporting/pages/config.sh b/utils/test/reporting/pages/config.sh
new file mode 100755 (executable)
index 0000000..f9bb89a
--- /dev/null
@@ -0,0 +1,3 @@
+: ${SERVER_URL:='testresults.opnfv.org/reporting2'}
+
+echo "{\"url\": \"http://${SERVER_URL}\"}" > dist/config.json