diff options
author | thuva4 <tharma.thuva@gmail.com> | 2018-01-16 00:09:51 +0530 |
---|---|---|
committer | thuva4 <tharma.thuva@gmail.com> | 2018-01-16 09:13:07 +0530 |
commit | 86db2b6832d51f8cd4d428bc431aca9daa99c4e0 (patch) | |
tree | a834b06487cef796afa67f484005b09a8a81c3bd /testapi/opnfv_testapi/ui/components/scenarios | |
parent | 62fb9a03e047d70bb15c67d2748ffe377273d0b6 (diff) |
Design the scenario create method
design scenario create method in modal way.
design scenario page.
Add,delete for installers,versions, projects and customs
are implemented.
tests are added.
1. Pods page
2. project page
3. Scenarios
4. Scenario
Change-Id: Ice26af77ec3d5fe874cf5c2062f208072dea289f
Signed-off-by: thuva4 <tharma.thuva@gmail.com>
Diffstat (limited to 'testapi/opnfv_testapi/ui/components/scenarios')
5 files changed, 325 insertions, 665 deletions
diff --git a/testapi/opnfv_testapi/ui/components/scenarios/modals/projectModal.html b/testapi/opnfv_testapi/ui/components/scenarios/modals/projectModal.html index 5885a61..0a14be9 100644 --- a/testapi/opnfv_testapi/ui/components/scenarios/modals/projectModal.html +++ b/testapi/opnfv_testapi/ui/components/scenarios/modals/projectModal.html @@ -16,24 +16,6 @@ </div> <div class="update-project"> <div class="col-sm-4"> - <label for="cpid" class="control-label"> Trust Indicator: </label> - </div> - <div class="col-sm-6"> - <button class="btn btn-primary" ng-click="projectModalCtrl.openTrustIndicatorModal()">Add Trust Indicator</button> - <p class="help-block"></p> - </div> - </div> - <div class="update-project"> - <div class="col-sm-4"> - <label for="cpid" class="control-label"> Score: </label> - </div> - <div class="col-sm-6"> - <button class="btn btn-primary" ng-click="projectModalCtrl.openScoreModal()">Add Score</button> - <p class="help-block"></p> - </div> - </div> - <div class="update-project"> - <div class="col-sm-4"> <label for="cpid" class="control-label"> Custom: </label> </div> <div class="col-sm-6"> @@ -46,50 +28,6 @@ </fieldset> </div> <div class='clo-md-12' style="padding-right:0px"> - <h3>Scores</h3> - <div class="table-responsive"> - <table class="table table-bordered table-hover" ng-data="projectModalCtrl.project.scores"> - <thead> - <tr style=" - text-align: center;"> - <th style="width: 1%;">Score</th> - <th style="width: 19%;">Date</th> - </tr> - </thead> - <tbody> - <tr ng-repeat-start="(index, score) in projectModalCtrl.project.scores" style="padding:9px"> - <td>{{score.score}}</td> - <td>{{score.date}}</td> - </tr> - <tr ng-repeat-end=> - </tr> - </tbody> - </table> - </div> - </div> - <div class='clo-md-12' style="padding-right:0px"> - <h3>Trust Indicator</h3> - <div class="table-responsive"> - <table class="table table-bordered table-hover" ng-data="projectModalCtrl.project.trust_indicators"> - <thead> - <tr style=" - text-align: center;"> - <th style="width: 1%;">Status</th> - <th style="width: 19%;">Date</th> - </tr> - </thead> - <tbody> - <tr ng-repeat-start="(index, trustIndicator) in projectModalCtrl.project.trust_indicators" style="padding:9px"> - <td>{{trustIndicator.status}}</td> - <td>{{trustIndicator.date}}</td> - </tr> - <tr ng-repeat-end=> - </tr> - </tbody> - </table> - </div> - </div> - <div class='clo-md-12' style="padding-right:0px"> <h3>Customs</h3> <div class="table-responsive"> <table class="table table-bordered table-hover" ng-data="projectModalCtrl.project.customs"> diff --git a/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenario.html b/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenario.html index d96986e..328a5e6 100644 --- a/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenario.html +++ b/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenario.html @@ -1,234 +1,241 @@ <legend>Scenario</legend> -<div style="padding-right:0px"> - <div class="table-responsive"> - <table class="table" ng-data="ctrl.data"> - <tbody> - <tr style="padding:9px"> - <td class="podsTableTd">Id :</td> - <td class="podsTableLeftTd">{{ctrl.data.scenarios[0]._id}}</td> - </tr> - <tr style="padding:9px"> - <td class="podsTableTd">Name :</td> - <td width="90%" class="podsTableLeftTd">{{ctrl.data.scenarios[0].name}}</td> - </tr> - <tr style="padding:9px"> - <td class="podsTableTd">Created at :</td> - <td width="90%" class="podsTableLeftTd">{{ctrl.data.scenarios[0].creation_date}}</td> - </tr> - <tr style="padding:9px"> - <td class="podsTableTd">Installers</td> - <td width="90%" class="podsTableLeftTd"> - <div class="col-md-1" style="padding:0px"> - <a ng-click="ctrl.expandInstallers()"> - <p ng-if="ctrl.collapeInstallers">Hide</p> - <p ng-if="!ctrl.collapeInstallers">Show</p> - </a> - </div> - <div class="col-md-1" style="padding:0px"> - <button type="button" class="btn btn-success btn-xs" ng-click="ctrl.openAddInstaller()" ><i class="fa fa-plus"></i>Add</button> - </div> - <div ng-class="{ 'hidden' : ! ctrl.collapeInstallers } "> - <div class="table-responsive"> - <table class="table " ng-data="ctrl.data.scenarios[0].installers"> - <tbody ng-repeat="(index, installer) in ctrl.data.scenarios[0].installers"> - <tr style="padding:9px"> - <td class="podsTableTd"> - {{index+1}}. Installer: - </td> - <td class="podsTableLeftTd" style="width:10%;padding-top: 7px;"> - <a ng-click="ctrl.expandInstaller(index)">{{installer.installer}}</a> - </td> - <td style="width:80%;border: none; padding: 0px;"> - <button type="button" class="btn btn-danger btn-xs" ng-click="ctrl.openDeleteInstallerModal(installer.installer)" ><i class="fa fa-minus"></i>Delete</button> - </td> - </tr> - <tr ng-class="{ 'hidden' : ! ctrl.collapeInstaller[index] }"> - <td class="podsTableTd"> - Versions: - </td> - <td width="90%" class="podsTableLeftTd"> - <div class="col-md-1" style="padding:0px"> - <a ng-click="ctrl.expandVersions(index)"> - <p ng-if="ctrl.collapeVersions[index]">Hide</p> - <p ng-if="!ctrl.collapeVersions[index]">Show</p> - </a> +<div style="padding-right:0px" class="col-md-12"> + <div class="table-responsive"> + <table class="table" ng-data="ctrl.data"> + <tbody> + <tr style="padding:9px"> + <td class="podsTableTd">Id :</td> + <td class="podsTableLeftTd">{{ctrl.data.scenarios[0]._id}}</td> + </tr> + <tr style="padding:9px"> + <td class="podsTableTd">Name :</td> + <td width="90%" class="podsTableLeftTd">{{ctrl.data.scenarios[0].name}}</td> + </tr> + <tr style="padding:9px"> + <td class="podsTableTd">Created at :</td> + <td width="90%" class="podsTableLeftTd">{{ctrl.data.scenarios[0].creation_date}}</td> + </tr> + <tr style="padding:9px"> + <td class="podsTableTd">Installers</td> + <td width="90%" class="podsTableLeftTd"> + <div class="col-md-1" style="padding:0px"> + <a ng-click="ctrl.expandInstallers()"> + <p ng-if="ctrl.collapeInstallers">Hide</p> + <p ng-if="!ctrl.collapeInstallers">Show</p> + </a> + </div> + <div class="col-md-1" style="padding:0px" ng-class="{'hidden' : !ctrl.buttonInstaller || !auth.isAuthenticated}"> + <button type="button" class="btn btn-success btn-xs" ng-click="ctrl.openAddInstaller()" ><i class="fa fa-plus"></i>Add</button> + </div> + <div ng-class="{ 'hidden' : ! ctrl.collapeInstallers } "> + <div class="table-responsive"> + <table class="table " ng-data="ctrl.data.scenarios[0].installers"> + <tbody ng-repeat="(indexI, installer) in ctrl.data.scenarios[0].installers"> + <tr style="padding:9px"> + <td class="podsTableTd"> + {{indexI+1}}. Installer: + </td> + <td class="podsTableLeftTd" style="width:10%;padding-top: 7px;"> + <a ng-click="ctrl.expandInstaller(indexI)">{{installer.installer}}</a> + </td> + <td style="width:80%;border: none; padding: 0px;" ng-class="{'hidden' : !ctrl.buttonInstaller}"> + <button type="button" ng-class="{'hidden' : !auth.isAuthenticated}" class="btn btn-danger btn-xs" ng-click="ctrl.openDeleteInstallerModal(installer.installer)" ><i class="fa fa-minus"></i>Delete</button> + </td> + </tr> + <tr ng-class="{ 'hidden' : ! ctrl.collapeInstaller[indexI] }"> + <td class="podsTableTd"> + Versions: + </td> + <td width="90%" class="podsTableLeftTd"> + <div class="col-md-1" style="padding:0px"> + <a ng-click="ctrl.expandVersions(indexI)"> + <p ng-if="ctrl.collapeVersions[indexI]">Hide</p> + <p ng-if="!ctrl.collapeVersions[indexI]">Show</p> + </a> + </div> + <div class="col-md-1" style="padding:0px" ng-class="{'hidden' : !ctrl.buttonVersion}"> + <button type="button" class="btn btn-success btn-xs" ng-class="{'hidden' : !auth.isAuthenticated}" ng-click="ctrl.openAddVersionModal(installer.installer)" ><i class="fa fa-plus"></i>Add</button> + </div> + <div ng-class="{ 'hidden' : ! ctrl.collapeVersions[indexI] } " class="col-md-12"> + <div class="table-responsive"> + <table class="table " ng-data="inctrl.data.scenarios[0].installers"> + <tbody ng-repeat="(indexV, version) in installer.versions"> + <tr style="padding:9px"> + <td class="podsTableTd"> + {{indexV+1}}. Version: + </td> + <td class="podsTableLeftTd" style="width:10%;padding-top: 7px;"> + <a ng-click="ctrl.expandVersion(indexI,indexV)">{{version.version}}</a> + </td> + <td style="width:80%;border: none; padding: 0px;" ng-class="{'hidden' : !ctrl.buttonVersion}"> + <button type="button" class="btn btn-danger btn-xs" ng-class="{'hidden' : !auth.isAuthenticated}" ng-click="ctrl.openDeleteVersionModal(version.version, installer.installer)" ><i class="fa fa-minus"></i>Delete</button> + </td> + </tr> + <tr style="padding:9px" ng-class="{ 'hidden' : ! ctrl.collapeVersion[indexI][indexV] } "> + <td class="podsTableTd"> + Owner: + </td> + <td class="podsTableLeftTd" style="width:90%">{{version.owner}}</td> + </tr> + <tr style="padding:9px" ng-class="{ 'hidden' : ! ctrl.collapeVersion[indexI][indexV] }"> + <td class="podsTableTd"> + Projects: + </td> + <td width="90%" class="podsTableLeftTd"> + <div class="col-md-1" style="padding:0px"> + <a ng-click="ctrl.expandProjects(indexI,indexV)"> + <p style="width:50%" ng-if="ctrl.collapeProjects[indexI][indexV]">Hide</p> + <p style="width:50%" ng-if="!ctrl.collapeProjects[indexI][indexV]">Show</p> + </a> + </div> + <div class="col-md-1" style="padding:0px" ng-class="{'hidden' : !ctrl.buttonProject }"> + <button type="button" ng-class="{'hidden' : !auth.isAuthenticated}" class="btn btn-success btn-xs" ng-click="ctrl.openAddProjectModal(version.version,installer.installer)" ><i class="fa fa-plus"></i>Add</button> + </div> + <div ng-class="{ 'hidden' : ! ctrl.collapeProjects[indexI][indexV] } " class="col-md-12"> + <div class="table-responsive"> + <table class="table " ng-data="version.projects"> + <tbody ng-repeat="(indexP, project) in version.projects" > + <tr style="padding:9px"> + <td class="podsTableTd"> + {{indexP+1}}. Project: + </td> + <td class="podsTableLeftTd" style="width:10%;padding-top: 7px;"> + <a ng-click="ctrl.expandProject(indexI, indexV, indexP)">{{project.project}}</a> + </td> + <td style="width:80%;border: none; padding: 0px;" ng-class="{'hidden' : !ctrl.buttonProject}"> + <button type="button" class="btn btn-danger btn-xs" ng-class="{'hidden' : !auth.isAuthenticated}" ng-click="ctrl.openDeleteProjectModal(project,version.version, installer.installer)" ><i class="fa fa-minus"></i>Delete</button> + </td> + </tr> + <tr ng-class="{ 'hidden' : ! ctrl.collapeProject[indexI][indexV][indexP] }"> + <td class="podsTableTd"> + Trust Indicators: + </td> + <td class="podsTableLeftTd" style="width:90%"> + <a ng-click="ctrl.expandTrustIndicator(indexI, indexV, indexP)"> + <p ng-if="ctrl.collapeTrustIndicator[indexI][indexV][indexP]">Hide</p> + <p ng-if="!ctrl.collapeTrustIndicator[indexI][indexV][indexP]">Show</p> + </a> + <table class="table " ng-class="{ 'hidden' : ! ctrl.collapeTrustIndicator[indexI][indexV][indexP] } " ng-data="project.trust_indicators"> + <tbody ng-repeat="(indexTI, trust_indicator) in project.trust_indicators" > + <tr style="padding:9px"> + <td class="podsTableTd"> + Status: + </td> + <td width="90%" class="podsTableLeftTd"> + {{trust_indicator.status}} + </td> + </tr> + <tr style="padding:9px"> + <td class="podsTableTd"> + Date: + </td> + <td width="90%" class="podsTableLeftTd"> + {{trust_indicator.date}} + </td> + </tr> + </tbody> + <tr> + <button type="button" class="btn btn-success btn-xs" ng-click="ctrl.openAddTrustIndicatorModal(project.project,version.version,installer.installer)" ng-class="{ 'hidden' : !ctrl.collapeTrustIndicator[index] || !auth.isAuthenticated}"> + <i class="fa fa-plus"></i>Add</button> + </tr> + </table> + </td> + </tr> + <tr ng-class="{ 'hidden' : ! ctrl.collapeProject[indexI][indexV][indexP] }"> + <td class="podsTableTd"> + Scores: + </td> + <td class="podsTableLeftTd" style="width:90%"> + <a ng-click="ctrl.expandScore(indexI, indexV, indexP)"> + <p ng-if="ctrl.collapeScore[indexI][indexV][indexP]">Hide</p> + <p ng-if="!ctrl.collapeScore[indexI][indexV][indexP]">Show</p> + </a> + <table class="table" ng-class="{ 'hidden' : ! ctrl.collapeScore[indexI][indexV][indexP] } " ng-data="project.scores"> + <tbody ng-repeat="(indexSC, score) in project.scores" > + <tr style="padding:9px"> + <td class="podsTableTd"> + Score: + </td> + <td width="90%" class="podsTableLeftTd"> + {{score.score}} + </td> + </tr> + <tr style="padding:9px"> + <td class="podsTableTd"> + Date: + </td> + <td width="90%" class="podsTableLeftTd"> + {{score.date}} + </td> + </tr> + </tbody> + <tr> + <button type="button" class="btn btn-success btn-xs" ng-click="ctrl.openAddScoreModal(project.project,version.version,installer.installer)" ng-class="{ 'hidden' : !ctrl.collapeScore[index] || !auth.isAuthenticated}"><i class="fa fa-plus"></i>Add</button> + </tr> + </table> + </td> + </tr> + <tr ng-class="{ 'hidden' : ! ctrl.collapeProject[indexI][indexV][indexP] }"> + <td class="podsTableTd"> + Customs: + </td> + <td class="podsTableLeftTd" style="width:90%"> + <a ng-click="ctrl.expandCustom(indexI, indexV, indexP)"> + <p ng-if="ctrl.collapeCustom[indexI][indexV][indexP]">Hide</p> + <p ng-if="!ctrl.collapeCustom[indexI][indexV][indexP]">Show</p> + </a> + <table class="table" ng-class="{ 'hidden' : ! ctrl.collapeCustom[indexI][indexV][indexP] } " ng-data="project.customs"> + <tbody> + <tr ng-repeat-start="(indexCU, custom) in project.customs" style="padding:9px"> + <td class="podsTableTd" style="float: none!important;"> + {{custom}} + </td> + <td width="90%" class="podsTableLeftTd"> + <button type="button" class="btn btn-danger btn-xs" ng-click="ctrl.openDeleteCustomModal(custom,project.project,version.version,installer.installer)" ng-class="{'hidden' : !auth.isAuthenticated}" ><i class="fa fa-minus"></i>Delete</button> + </td> + </tr> + <tr ng-repeat-end=> + </tr> + <tr> + <button type="button" class="btn btn-success btn-xs" ng-click="ctrl.openAddCustomModal(project.project,version.version,installer.installer)" ng-class="{ 'hidden' : !ctrl.collapeCustom[indexI][indexV][indexP] || !auth.isAuthenticated}"><i class="fa fa-plus"></i>Add</button> + </tr> + </tbody> + </table> + </td> + </tr> + <tr ng-repeat-end=> + </tr> + </tbody> + </table> + </div> + </div> + </td> + </tr> + </tbody> + </table> </div> - <div class="col-md-1" style="padding:0px"> - <button type="button" class="btn btn-success btn-xs" ng-click="ctrl.openAddVersionModal(installer.installer)" ><i class="fa fa-plus"></i>Add</button> - </div> - <div ng-class="{ 'hidden' : ! ctrl.collapeVersions[index] } " class="col-md-12"> - <div class="table-responsive"> - <table class="table " ng-data="inctrl.data.scenarios[0].installers"> - <tbody ng-repeat="(index, version) in installer.versions"> - <tr style="padding:9px"> - <td class="podsTableTd"> - {{index+1}}. Version: - </td> - <td class="podsTableLeftTd" style="width:10%;padding-top: 7px;"> - <a ng-click="ctrl.expandVersion(index)">{{version.version}}</a> - </td> - <td style="width:80%;border: none; padding: 0px;"> - <button type="button" class="btn btn-danger btn-xs" ng-click="ctrl.openDeleteVersionModal(version.version, installer.installer)" ><i class="fa fa-minus"></i>Delete</button> - </td> - </tr> - <tr style="padding:9px" ng-class="{ 'hidden' : ! ctrl.collapeVersion[index] } "> - <td class="podsTableTd"> - Owner: - </td> - <td class="podsTableLeftTd" style="width:90%">{{version.owner}}</td> - </tr> - <tr style="padding:9px" ng-class="{ 'hidden' : ! ctrl.collapeVersion[index] }"> - <td class="podsTableTd"> - Projects: - </td> - <td width="90%" class="podsTableLeftTd"> - <div class="col-md-1" style="padding:0px"> - <a ng-click="ctrl.expandProjects(index)"> - <p style="width:50%" ng-if="ctrl.collapeProjects[index]">Hide</p> - <p style="width:50%" ng-if="!ctrl.collapeProjects[index]">Show</p> - </a> - </div> - <div class="col-md-1" style="padding:0px"> - <button type="button" class="btn btn-success btn-xs" ng-click="ctrl.openAddProjectModal(version.version,installer.installer)" ><i class="fa fa-plus"></i>Add</button> - </div> - <div ng-class="{ 'hidden' : ! ctrl.collapeProjects[index] } " class="col-md-12"> - <div class="table-responsive"> - <table class="table " ng-data="version.projects"> - <tbody ng-repeat="(index, project) in version.projects" > - <tr style="padding:9px"> - <td class="podsTableTd"> - {{index+1}}. Project: - </td> - <td class="podsTableLeftTd" style="width:90%"> - <a ng-click="ctrl.expandProject(index)">{{project.project}}</a> - </td> - </tr> - <tr ng-class="{ 'hidden' : ! ctrl.collapeProject[index] }"> - <td class="podsTableTd"> - Trust Indicators: - </td> - <td class="podsTableLeftTd" style="width:90%"> - <a ng-click="ctrl.expandTrustIndicator(index)"> - <p ng-if="ctrl.collapeTrustIndicator[index]">Hide</p> - <p ng-if="!ctrl.collapeTrustIndicator[index]">Show</p> - </a> - <table class="table " ng-class="{ 'hidden' : ! ctrl.collapeTrustIndicator[index] } " ng-data="project.trust_indicators"> - <tbody ng-repeat="(index, trust_indicator) in project.trust_indicators" > - <tr style="padding:9px"> - <td class="podsTableTd"> - Status: - </td> - <td width="90%" class="podsTableLeftTd"> - {{trust_indicator.status}} - </td> - </tr> - <tr style="padding:9px"> - <td class="podsTableTd"> - Date: - </td> - <td width="90%" class="podsTableLeftTd"> - {{trust_indicator.date}} - </td> - </tr> - </tbody> - <tr> - <button type="button" class="btn btn-success btn-xs" ng-click="ctrl.openAddTrustIndicatorModal(project.project,version.version,installer.installer)" ng-class="{ 'hidden' : !ctrl.collapeTrustIndicator[index]}"> - <i class="fa fa-plus"></i>Add</button> - </tr> - </table> - </td> - </tr> - <tr ng-class="{ 'hidden' : ! ctrl.collapeProject[index] }"> - <td class="podsTableTd"> - Scores: - </td> - <td class="podsTableLeftTd" style="width:90%"> - <a ng-click="ctrl.expandScore(index)"> - <p ng-if="ctrl.collapeScore[index]">Hide</p> - <p ng-if="!ctrl.collapeScore[index]">Show</p> - </a> - <table class="table" ng-class="{ 'hidden' : ! ctrl.collapeScore[index] } " ng-data="project.scores"> - <tbody ng-repeat="(index, score) in project.scores" > - <tr style="padding:9px"> - <td class="podsTableTd"> - Score: - </td> - <td width="90%" class="podsTableLeftTd"> - {{score.score}} - </td> - </tr> - <tr style="padding:9px"> - <td class="podsTableTd"> - Date: - </td> - <td width="90%" class="podsTableLeftTd"> - {{score.date}} - </td> - </tr> - </tbody> - <tr> - <button type="button" class="btn btn-success btn-xs" ng-click="ctrl.openAddScoreModal(project.project,version.version,installer.installer)" ng-class="{ 'hidden' : !ctrl.collapeScore[index]}"><i class="fa fa-plus"></i>Add</button> - </tr> - </table> - </td> - </tr> - <tr ng-class="{ 'hidden' : ! ctrl.collapeProject[index] }"> - <td class="podsTableTd"> - Customs: - </td> - <td class="podsTableLeftTd" style="width:90%"> - <a ng-click="ctrl.expandCustom(index)"> - <p ng-if="ctrl.collapeCustom[index]">Hide</p> - <p ng-if="!ctrl.collapeCustom[index]">Show</p> - </a> - <table class="table" ng-class="{ 'hidden' : ! ctrl.collapeCustom[index] } " ng-data="project.customs"> - <tbody> - <tr ng-repeat-start="(index, custom) in project.customs" style="padding:9px"> - <td class="podsTableTd" style="float: none!important;"> - {{custom}} - </td> - <td width="90%" class="podsTableLeftTd"> - <button type="button" class="btn btn-danger btn-xs" ng-click="ctrl.openDeleteCustomModal(custom,project.project,version.version,installer.installer)" ><i class="fa fa-minus"></i>Delete</button> - </td> - </tr> - <tr ng-repeat-end=> - </tr> - <tr> - <button type="button" class="btn btn-success btn-xs" ng-click="ctrl.openAddCustomModal(project.project,version.version,installer.installer)" ng-class="{ 'hidden' : !ctrl.collapeCustom[index]}"><i class="fa fa-plus"></i>Add</button> - </tr> - </tbody> - </table> - </td> - </tr> - <!-- </div> --> - <tr ng-repeat-end=> - </tr> - </tbody> - </table> - </div> - </div> - </td> - </tr> - </tbody> - </table> - </div> - </div> - </td> - </tr> - </tbody> - </table> - </div> - </div> - </td> - </tr> - </tbody> - </table> - </div> + </div> + </td> + </tr> + </tbody> + </table> + </div> + </div> + </td> + </tr> + </tbody> + </table> </div> +</div> <div class="row" style="margin-bottom:24px;"></div> -<div ng-show="ctrl.showError" class="alert alert-danger col-md-8" role="alert" style="margin-top:0px"> - <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> - <span class="sr-only">Error:</span> - {{ctrl.error}} +<div class='clo-md-12'> + <div ng-show="ctrl.showError" class="alert alert-danger" role="alert"> + <span class="pull-right"> {{ctrl.error}}</span> + <span class="glyphicon glyphicon-exclamation-sign pull-right" aria-hidden="true" >Error:</span> + </div> + <div ng-show="ctrl.showSuccess" class="alert alert-success" role="alert"> + <span class="pull-right"> {{ctrl.success}}</span> + <span class="glyphicon glyphicon-ok pull-right" aria-hidden="true"></span> + </div> </div> <div class="row" style="margin-bottom:24px;"></div>
\ No newline at end of file diff --git a/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js b/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js index eff1930..53eb13a 100644 --- a/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js +++ b/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js @@ -45,20 +45,16 @@ ctrl.expandTrustIndicator = expandTrustIndicator; ctrl.expandScore = expandScore; ctrl.expandCustom = expandCustom; - ctrl.collapeVersion = {}; - ctrl.collapeVersions = {}; - ctrl.collapeProjects = {}; - ctrl.collapeProject = {}; - ctrl.collapeTrustIndicator = {}; - ctrl.collapeScore = {}; - ctrl.collapeCustom = {}; - ctrl.collapeInstaller = {}; + ctrl.collapeVersion = []; + ctrl.collapeVersions = []; + ctrl.collapeProjects = []; + ctrl.collapeProject = []; + ctrl.collapeTrustIndicator = []; + ctrl.collapeScore = []; + ctrl.collapeCustom = []; + ctrl.collapeInstaller = []; ctrl.addCustom = addCustom; ctrl.openAddCustomModal = openAddCustomModal; - ctrl.openAddTrustIndicatorModal = openAddTrustIndicatorModal; - ctrl.addTrustindicator = addTrustindicator; - ctrl.addScore = addScore; - ctrl.openAddScoreModal = openAddScoreModal; ctrl.openDeleteCustomModal = openDeleteCustomModal; ctrl.deleteCustom = deleteCustom; ctrl.addProject = addProject @@ -71,6 +67,12 @@ ctrl.addInstaller = addInstaller ctrl.openDeleteInstallerModal = openDeleteInstallerModal ctrl.deleteInstaller = deleteInstaller + ctrl.openDeleteProjectModal = openDeleteProjectModal + ctrl.deleteProject = deleteProject + + ctrl.buttonInstaller = true + ctrl.buttonVersion = true + ctrl.buttonProject = true /** * This will contact the TestAPI to get a listing of declared projects. @@ -87,61 +89,97 @@ }); } - function expandTrustIndicator(index){ - if(ctrl.collapeTrustIndicator[index]){ - ctrl.collapeTrustIndicator[index] = false; + function expandTrustIndicator(indexI, indexV, indexP){ + if(ctrl.collapeTrustIndicator[indexI]==undefined){ + ctrl.collapeTrustIndicator[indexI] = [] + if(ctrl.collapeTrustIndicator[indexI][indexV]==undefined){ + ctrl.collapeTrustIndicator[indexI][indexV] = [] + } + } + if(ctrl.collapeTrustIndicator[indexI][indexV][indexP]){ + ctrl.collapeTrustIndicator[indexI][indexV][indexP] = false; }else{ - ctrl.collapeTrustIndicator[index] = true; + ctrl.collapeTrustIndicator[indexI][indexV][indexP] = true; } } - function expandScore(index){ - if(ctrl.collapeScore[index]){ - ctrl.collapeScore[index] = false; + function expandScore(indexI, indexV, indexP){ + if(ctrl.collapeScore[indexI]==undefined){ + ctrl.collapeScore[indexI] = [] + if(ctrl.collapeScore[indexI][indexV]==undefined){ + ctrl.collapeScore[indexI][indexV] = [] + } + } + if(ctrl.collapeScore[indexI][indexV][indexP]){ + ctrl.collapeScore[indexI][indexV][indexP] = false; }else{ - ctrl.collapeScore[index] = true; + ctrl.collapeScore[indexI][indexV][indexP] = true; } } - function expandCustom(index){ - if(ctrl.collapeCustom[index]){ - ctrl.collapeCustom[index] = false; + function expandCustom(indexI, indexV, indexP){ + if(ctrl.collapeCustom[indexI]==undefined){ + ctrl.collapeCustom[indexI] = [] + if(ctrl.collapeCustom[indexI][indexV]==undefined){ + ctrl.collapeCustom[indexI][indexV] = [] + } + } + if(ctrl.collapeCustom[indexI][indexV][indexP]){ + ctrl.collapeCustom[indexI][indexV][indexP] = false; + ctrl.buttonProject = true }else{ - ctrl.collapeCustom[index] = true; + ctrl.collapeCustom[indexI][indexV][indexP] = true; + ctrl.buttonProject = false } } - function expandVersion(index){ - if(ctrl.collapeVersion[index]){ - ctrl.collapeVersion[index] = false; + function expandVersion(indexI, indexV){ + if(ctrl.collapeVersion[indexI]==undefined){ + ctrl.collapeVersion[indexI] = [] + } + if(ctrl.collapeVersion[indexI][indexV]){ + ctrl.collapeVersion[indexI][indexV] = false; }else{ - ctrl.collapeVersion[index] = true; + ctrl.collapeVersion[indexI][indexV] = true; } } function expandVersions(index){ if(ctrl.collapeVersions[index]){ ctrl.collapeVersions[index] = false; + ctrl.buttonInstaller = true }else{ ctrl.collapeVersions[index] = true; + ctrl.buttonInstaller = false } } - function expandProjects(index){ - if(ctrl.collapeProjects[index]){ - ctrl.collapeProjects[index] = false; + function expandProjects(indexI, indexV){ + if(ctrl.collapeProjects[indexI]==undefined){ + ctrl.collapeProjects[indexI] = [] + } + if(ctrl.collapeProjects[indexI][indexV]){ + ctrl.collapeProjects[indexI][indexV] = false; + ctrl.buttonVersion = true } else{ - ctrl.collapeProjects[index]= true; + ctrl.collapeProjects[indexI][indexV]= true; + ctrl.buttonVersion = false } } - function expandProject(index){ - if(ctrl.collapeProject[index]){ - ctrl.collapeProject[index] = false; + function expandProject(indexI, indexV, indexP){ + if(ctrl.collapeProject[indexI]==undefined){ + ctrl.collapeProject[indexI] = [] + if(ctrl.collapeProject[indexI][indexV]==undefined){ + ctrl.collapeProject[indexI][indexV] = [] + } + } + if(ctrl.collapeProject[indexI][indexV][indexP]){ + ctrl.collapeProject[indexI][indexV][indexP] = false; } else{ - ctrl.collapeProject[index]= true; + ctrl.collapeProject[indexI][indexV][indexP]= true; } } @@ -356,62 +394,22 @@ }); } - function openAddTrustIndicatorModal(project, version, installer){ - $uibModal.open({ - templateUrl: 'testapi-ui/components/scenarios/modals/trustIndicatorModal.html', - controller: 'trustIndicatorAddModalCtrl as trustIndicatorModalCtrl', - size: 'md', - resolve: { - data: function () { - return { - text: "Add Trust Indicator", - successHandler: ctrl.addTrustindicator, - project: project, - version: version, - installer: installer - }; - } - } - }); - } - - function openAddScoreModal(project, version, installer){ - $uibModal.open({ - templateUrl: 'testapi-ui/components/scenarios/modals/scoreModal.html', - controller: 'scoreAddModalCtrl as scoreModalCtrl', - size: 'md', - resolve: { - data: function () { - return { - text: "Add Score", - successHandler: ctrl.addScore, - project: project, - version: version, - installer: installer - }; - } - } - }); - } - - function addTrustindicator(trust_indicator, project, version, installer){ - ctrl.customReqest = testapiApiUrl+ "/scenarios/"+ ctrl.name + "/trust_indicators?installer="+installer+"&version="+version+"&project="+ project - $http.post(ctrl.customReqest,trust_indicator ).success(function (data){ - ctrl.showSuccess = true ; - ctrl.success = "Trust indicators are successfully updated." - ctrl.loadDetails(); - }) - .catch(function (data) { - ctrl.showError = true; - ctrl.error = data.statusText; - }); + function openDeleteProjectModal(project, version, installer){ + var projects = [] + projects.push(project.project) + var data = { + "projects": projects, + "version": version, + "installer": installer + } + confirmModal("Delete",ctrl.deleteProject,data); } - function addScore(score, project, version, installer){ - ctrl.customReqest = testapiApiUrl+ "/scenarios/"+ ctrl.name + "/scores?installer="+installer+"&version="+version+"&project="+ project - $http.post(ctrl.customReqest,score ).success(function (data){ + function deleteProject(data){ + ctrl.projectReqest = testapiApiUrl+ "/scenarios/"+ ctrl.name + "/projects?installer="+data.installer+"&version="+data.version + $http.delete(ctrl.projectReqest, {data: data.projects, headers: {'Content-Type': 'application/json'}}).success(function (data){ ctrl.showSuccess = true ; - ctrl.success = "Scores are successfully updated." + ctrl.success = "Projects are successfully Deleted." ctrl.loadDetails(); }) .catch(function (data) { @@ -459,107 +457,8 @@ } } - /** - * TestAPI Project Modal Controller - * This controller is for the create modal where a user can create - * the project information and for the edit modal where user can - * edit the project's details - */ - angular.module('testapiApp').controller('trustIndicatorAddModalCtrl', trustIndicatorAddModalCtrl); - trustIndicatorAddModalCtrl.$inject = ['$scope', '$uibModalInstance', 'data']; - function trustIndicatorAddModalCtrl($scope, $uibModalInstance, data) { - var ctrl = this; - ctrl.confirm = confirm; - ctrl.cancel = cancel; - ctrl.data = angular.copy(data); - ctrl.open = open; - - - /** - * Initiate confirmation and call the success handler with the - * inputs. - */ - function confirm() { - ctrl.data.successHandler(ctrl.ti, ctrl.data.project, ctrl.data.version, ctrl.data.installer); - $uibModalInstance.dismiss('cancel'); - } - - /** - * Close the confirm modal without initiating changes. - */ - function cancel() { - $uibModalInstance.dismiss('cancel'); - } - - function handleModalData(){ - - } - - /** - * This is called when the date filter calendar is opened. It - * does some event handling, and sets a scope variable so the UI - * knows which calendar was opened. - * @param {Object} $event - The Event object - * @param {String} openVar - Tells which calendar was opened - */ - function open($event, openVar) { - $event.preventDefault(); - $event.stopPropagation(); - ctrl[openVar] = true; - } - } - - /** - * TestAPI Project Modal Controller - * This controller is for the create modal where a user can create - * the project information and for the edit modal where user can - * edit the project's details - */ - angular.module('testapiApp').controller('scoreAddModalCtrl', scoreAddModalCtrl); - scoreAddModalCtrl.$inject = ['$scope', '$uibModalInstance', 'data']; - function scoreAddModalCtrl($scope, $uibModalInstance, data) { - var ctrl = this; - ctrl.confirm = confirm; - ctrl.cancel = cancel; - ctrl.data = angular.copy(data); - ctrl.open = open; - - /** - * Initiate confirmation and call the success handler with the - * inputs. - */ - function confirm() { - ctrl.data.successHandler(ctrl.score, ctrl.data.project, ctrl.data.version, ctrl.data.installer); - $uibModalInstance.dismiss('cancel'); - } - - /** - * Close the confirm modal without initiating changes. - */ - function cancel() { - $uibModalInstance.dismiss('cancel'); - } - - function handleModalData(){ - - } - - /** - * This is called when the date filter calendar is opened. It - * does some event handling, and sets a scope variable so the UI - * knows which calendar was opened. - * @param {Object} $event - The Event object - * @param {String} openVar - Tells which calendar was opened - */ - function open($event, openVar) { - $event.preventDefault(); - $event.stopPropagation(); - ctrl[openVar] = true; - } - } - - /** + /** * TestAPI Project Modal Controller * This controller is for the create modal where a user can create * the project information and for the edit modal where user can @@ -572,11 +471,7 @@ ctrl.confirm = confirm; ctrl.cancel = cancel; ctrl.data = angular.copy(data); - ctrl.openScoreModal = openScoreModal; - ctrl.openTrustIndicatorModal = openTrustIndicatorModal; ctrl.openCustomModal = openCustomModal; - ctrl.handleScore = handleScore; - ctrl.handleModalTrustIndicator = handleModalTrustIndicator; ctrl.handleModalCustom = handleModalCustom; ctrl.projects = [] ctrl.project = { @@ -604,48 +499,10 @@ $uibModalInstance.dismiss('cancel'); } - function handleModalTrustIndicator(trustIndicator){ - ctrl.project.trust_indicators.push(trustIndicator) - } - - function handleScore(score){ - ctrl.project.scores.push(score); - } - function handleModalCustom(custom){ ctrl.project.customs.push(custom); } - function openScoreModal(){ - $uibModal.open({ - templateUrl: 'testapi-ui/components/scenarios/modals/scoreModal.html', - controller: 'scoreModalCtrl as scoreModalCtrl', - size: 'md', - resolve: { - data: function () { - return { - text: "Score", - successHandler: ctrl.handleScore, - }; - } - } - }); - } - function openTrustIndicatorModal(){ - $uibModal.open({ - templateUrl: 'testapi-ui/components/scenarios/modals/trustIndicatorModal.html', - controller: 'trustIndicatorModalCtrl as trustIndicatorModalCtrl', - size: 'md', - resolve: { - data: function () { - return { - text: "Trust Indicator", - successHandler: ctrl.handleModalTrustIndicator - }; - } - } - }); - } function openCustomModal(){ $uibModal.open({ templateUrl: 'testapi-ui/components/scenarios/modals/customModal.html', diff --git a/testapi/opnfv_testapi/ui/components/scenarios/scenarios.html b/testapi/opnfv_testapi/ui/components/scenarios/scenarios.html index 75a21b7..9057b0f 100644 --- a/testapi/opnfv_testapi/ui/components/scenarios/scenarios.html +++ b/testapi/opnfv_testapi/ui/components/scenarios/scenarios.html @@ -7,7 +7,7 @@ </div> <div class="col-sm-2 pull-right" ng-class="{ 'hidden': !auth.isAuthenticated}"> <button type="button" class="btn btn-success" ng-click="ctrl.openScenarioModal()"> - <i class="fa fa-plus"></i>Create Scenario</button> + <i class="fa fa-plus"></i>Create</button> </div> </div> <div class='clo-md-12'> @@ -45,7 +45,7 @@ </td> <td ng-class="{'hidden': !auth.isAuthenticated}"> <span class="podsTable-col"> - <a class="text-warning" ng-click="ctrl.openUpdateModal(scenario.name)" title="Edit Name"> + <a class="text-warning" ng-click="ctrl.openUpdateModal(scenario.name)" title="Edit"> <i class="fa fa-pencil-square-o"></i></a> <a class="text-danger" ng-click="ctrl.openDeleteModal(scenario.name)" title="Delete"> <i class="fa fa-trash-o"></i></a> diff --git a/testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js b/testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js index 4243e21..fd137e5 100644 --- a/testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js +++ b/testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js @@ -348,11 +348,7 @@ ctrl.confirm = confirm; ctrl.cancel = cancel; ctrl.data = angular.copy(data); - ctrl.openScoreModal = openScoreModal; - ctrl.openTrustIndicatorModal = openTrustIndicatorModal; ctrl.openCustomModal = openCustomModal; - ctrl.handleScore = handleScore; - ctrl.handleModalTrustIndicator = handleModalTrustIndicator; ctrl.handleModalCustom = handleModalCustom; ctrl.project = { "scores": [], @@ -379,48 +375,10 @@ $uibModalInstance.dismiss('cancel'); } - function handleModalTrustIndicator(trustIndicator){ - ctrl.project.trust_indicators.push(trustIndicator) - } - - function handleScore(score){ - ctrl.project.scores.push(score); - } - function handleModalCustom(custom){ ctrl.project.customs.push(custom); } - function openScoreModal(){ - $uibModal.open({ - templateUrl: 'testapi-ui/components/scenarios/modals/scoreModal.html', - controller: 'scoreModalCtrl as scoreModalCtrl', - size: 'md', - resolve: { - data: function () { - return { - text: "Score", - successHandler: ctrl.handleScore, - }; - } - } - }); - } - function openTrustIndicatorModal(){ - $uibModal.open({ - templateUrl: 'testapi-ui/components/scenarios/modals/trustIndicatorModal.html', - controller: 'trustIndicatorModalCtrl as trustIndicatorModalCtrl', - size: 'md', - resolve: { - data: function () { - return { - text: "Trust Indicator", - successHandler: ctrl.handleModalTrustIndicator - }; - } - } - }); - } function openCustomModal(){ $uibModal.open({ templateUrl: 'testapi-ui/components/scenarios/modals/customModal.html', @@ -444,106 +402,6 @@ * the project information and for the edit modal where user can * edit the project's details */ - angular.module('testapiApp').controller('scoreModalCtrl', scoreModalCtrl); - scoreModalCtrl.$inject = ['$scope', '$uibModalInstance', 'data']; - function scoreModalCtrl($scope, $uibModalInstance, data) { - var ctrl = this; - ctrl.confirm = confirm; - ctrl.cancel = cancel; - ctrl.data = angular.copy(data); - ctrl.open = open; - - /** - * Initiate confirmation and call the success handler with the - * inputs. - */ - function confirm() { - ctrl.data.successHandler(ctrl.score); - $uibModalInstance.dismiss('cancel'); - } - - /** - * Close the confirm modal without initiating changes. - */ - function cancel() { - $uibModalInstance.dismiss('cancel'); - } - - function handleModalData(){ - - } - - /** - * This is called when the date filter calendar is opened. It - * does some event handling, and sets a scope variable so the UI - * knows which calendar was opened. - * @param {Object} $event - The Event object - * @param {String} openVar - Tells which calendar was opened - */ - function open($event, openVar) { - $event.preventDefault(); - $event.stopPropagation(); - ctrl[openVar] = true; - } - } - - /** - * TestAPI Project Modal Controller - * This controller is for the create modal where a user can create - * the project information and for the edit modal where user can - * edit the project's details - */ - angular.module('testapiApp').controller('trustIndicatorModalCtrl', trustIndicatorModalCtrl); - trustIndicatorModalCtrl.$inject = ['$scope', '$uibModalInstance', 'data']; - function trustIndicatorModalCtrl($scope, $uibModalInstance, data) { - var ctrl = this; - ctrl.confirm = confirm; - ctrl.cancel = cancel; - ctrl.data = angular.copy(data); - ctrl.open = open; - - - /** - * Initiate confirmation and call the success handler with the - * inputs. - */ - function confirm() { - ctrl.data.successHandler(ctrl.ti); - $uibModalInstance.dismiss('cancel'); - - } - - /** - * Close the confirm modal without initiating changes. - */ - function cancel() { - $uibModalInstance.dismiss('cancel'); - } - - function handleModalData(){ - - } - - /** - * This is called when the date filter calendar is opened. It - * does some event handling, and sets a scope variable so the UI - * knows which calendar was opened. - * @param {Object} $event - The Event object - * @param {String} openVar - Tells which calendar was opened - */ - function open($event, openVar) { - $event.preventDefault(); - $event.stopPropagation(); - ctrl[openVar] = true; - } - } - - /** - * TestAPI Project Modal Controller - * This controller is for the create modal where a user can create - * the project information and for the edit modal where user can - * edit the project's details - */ angular.module('testapiApp').controller('customModalCtrl', customModalCtrl); customModalCtrl.$inject = ['$scope', '$uibModalInstance', 'data']; function customModalCtrl($scope, $uibModalInstance, data) { |