summaryrefslogtreecommitdiffstats
path: root/testapi/opnfv_testapi
diff options
context:
space:
mode:
Diffstat (limited to 'testapi/opnfv_testapi')
-rw-r--r--testapi/opnfv_testapi/tests/UI/e2e/authenticateFalseSpec.js385
-rw-r--r--testapi/opnfv_testapi/tests/UI/e2e/scenarioControllerSpec.js5
-rw-r--r--testapi/opnfv_testapi/ui/Gruntfile.js3
-rw-r--r--testapi/opnfv_testapi/ui/app.js30
-rw-r--r--testapi/opnfv_testapi/ui/components/deploy-results/deploy-result/deployResult.html4
-rw-r--r--testapi/opnfv_testapi/ui/components/deploy-results/deployResults.html2
-rw-r--r--testapi/opnfv_testapi/ui/components/pods/podsController.js29
-rw-r--r--testapi/opnfv_testapi/ui/components/projects/projects.html9
-rw-r--r--testapi/opnfv_testapi/ui/components/projects/projectsController.js11
-rw-r--r--testapi/opnfv_testapi/ui/components/results/results.html4
-rw-r--r--testapi/opnfv_testapi/ui/components/scenarios/modals/customModal.html16
-rw-r--r--testapi/opnfv_testapi/ui/components/scenarios/modals/projectModal.html2
-rw-r--r--testapi/opnfv_testapi/ui/components/scenarios/scenario/scenario.html23
-rw-r--r--testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js28
-rw-r--r--testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js15
-rw-r--r--testapi/opnfv_testapi/ui/config.json6
16 files changed, 476 insertions, 96 deletions
diff --git a/testapi/opnfv_testapi/tests/UI/e2e/authenticateFalseSpec.js b/testapi/opnfv_testapi/tests/UI/e2e/authenticateFalseSpec.js
new file mode 100644
index 0000000..3212b86
--- /dev/null
+++ b/testapi/opnfv_testapi/tests/UI/e2e/authenticateFalseSpec.js
@@ -0,0 +1,385 @@
+
+var mock = require('protractor-http-mock');
+var baseURL = "http://localhost:8000/";
+
+
+describe('testing the pods page for anonymous user', function () {
+ beforeEach(function(){
+ mock([{
+ request: {
+ path: '/api/v1/pods',
+ method: 'GET'
+ },
+ response: {
+ data: {
+ pods: [{role: "community-ci", name: "test", owner: "testUser",
+ details: "DemoDetails", mode: "metal", _id: "59f02f099a07c84bfc5c7aed",
+ creation_date: "2017-10-25 11:58:25.926168"}]
+ }
+ }
+ }
+ ]);
+ });
+
+ afterEach(function(){
+ mock.teardown();
+ });
+
+ it('Delete button is visible for anonymous user', function () {
+ var fs = require('fs')
+ var m = JSON.parse(fs.readFileSync('testapi-ui/config.json').toString());
+ m.authenticate = false;
+ fs.writeFile('testapi-ui/config.json', JSON.stringify(m, null, 2))
+ browser.restart();
+ browser.get(baseURL+'#/pods');
+ var buttonDelete = element(by.buttonText('Delete'));
+ expect(buttonDelete.isDisplayed()).toBe(true)
+ });
+
+ it('Delete button is visible for anonymous user', function () {
+ var buttonDelete = element(by.buttonText('Delete'));
+ expect(buttonDelete.isDisplayed()).toBe(true)
+ });
+
+ it('delete Operation is visible for user ', function () {
+ var deleteOperation = element(by.css('a[title=Delete]'));
+ expect(deleteOperation.isDisplayed()).toBe(true);
+ });
+});
+
+describe('testing the pods page for anonymous user', function () {
+ beforeEach(function(){
+ mock([
+ {
+ request: {
+ path: '/api/v1/projects',
+ method: 'GET'
+ },
+ response: {
+ data: {
+ "projects": [
+ {
+ "owner": "thuva4",
+ "_id": "5a0c022f9a07c846d3c2cc94",
+ "creation_date": "2017-11-15 14:30:31.200259",
+ "description": "dsfsd",
+ "name": "testproject"
+ }
+ ]
+ }
+ }
+ }
+ ]);
+ });
+
+ afterEach(function(){
+ mock.teardown();
+ });
+
+ it('create button is visible for user', function () {
+ browser.get(baseURL+'#/projects');
+ var buttonCreate = element(by.buttonText('Create'));
+ expect(buttonCreate.isDisplayed()).toBe(true);
+ });
+
+ it('delete Operation is visible for user ', function () {
+ browser.get(baseURL+'#/projects');
+ var deleteOperation = element(by.css('a[title=Delete]'));
+ expect(deleteOperation.isDisplayed()).toBe(true);
+ });
+
+ it('Edit Operation is visible for user ', function () {
+ browser.get(baseURL+'#/projects');
+ var editOperation = element(by.css('a[title=Edit]'));
+ expect(editOperation.isDisplayed()).toBe(true);
+ });
+});
+
+
+describe('testing the scenarios page for anonymous user', function () {
+ beforeEach(function(){
+ mock([
+ {
+ request: {
+ path: '/api/v1/scenarios',
+ method: 'GET'
+ },
+ response: {
+ data: {
+ "scenarios": [
+ {
+ "installers": [
+ {
+ "installer": "fuel",
+ "versions": [
+ {
+ "owner": "testUser",
+ "version": "colorado",
+ "projects": [
+ {
+ "project": "yardstick",
+ "customs": [
+ "dvs"
+ ],
+ "scores": [
+ {
+ "date": "2016-12-11 01:45",
+ "score": "14/24"
+ }
+ ],
+ "trust_indicators": [
+ {
+ "date": "2016-12-09 11:38",
+ "status": "silver"
+ }
+ ]
+ },
+ {
+ "project": "functest",
+ "customs": [
+ "vping_ssh",
+ "vping_userdata",
+ ],
+ "scores": [
+ {
+ "date": "2016-12-09 11:28",
+ "score": "6/8"
+ }
+ ],
+ "trust_indicators": [
+ {
+ "date": "2016-12-09 11:38",
+ "status": "silver"
+ }
+ ]
+ },
+ {
+ "project": "sla",
+ "customs": [],
+ "scores": [
+ {
+ "date": "2018-01-16T18:30:00.000Z",
+ "score": "sdS"
+ }
+ ],
+ "trust_indicators": []
+ },
+ {
+ "project": "dvsd",
+ "customs": [],
+ "scores": [],
+ "trust_indicators": []
+ }
+ ]
+ },
+ {
+ "owner": "dfgvds",
+ "version": "df",
+ "projects": []
+ }
+ ]
+ },
+ {
+ "installer": "fuel2",
+ "versions": [
+ {
+ "owner": "testUser",
+ "version": "colorado",
+ "projects": [
+ {
+ "project": "yardstick",
+ "customs": [
+ "tc002",
+ "tc005",
+ "tc010",
+ "tc011"
+ ],
+ "scores": [
+ {
+ "date": "2016-12-11 01:45",
+ "score": "14/24"
+ }
+ ],
+ "trust_indicators": [
+ {
+ "date": "2016-12-09 11:38",
+ "status": "silver"
+ }
+ ]
+ },
+ {
+ "project": "functest",
+ "customs": [
+ "vping_ssh",
+ "vping_userdata"
+ ],
+ "scores": [
+ {
+ "date": "2016-12-09 11:28",
+ "score": "6/8"
+ }
+ ],
+ "trust_indicators": [
+ {
+ "date": "2016-12-09 11:38",
+ "status": "silver"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "_id": "5a50fcacsdgdsgdasgfvb861c",
+ "name": "test-scenario",
+ "creation_date": "2018-01-06 22:13:24.160407"
+ }
+ ]
+ }
+ }
+ }
+ ])
+ });
+
+ afterEach(function(){
+ mock.teardown();
+ });
+
+ it( 'should show the add installer option for anonymous user', function() {
+ browser.get(baseURL+"#/scenarios/test-scenario");
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.urlContains(baseURL+ '#/scenarios/test-scenario'), 10000);
+ var buttonAdd = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[2]/button'))
+ expect(buttonAdd.isDisplayed()).toBe(true);
+ });
+
+ it( 'should show the delete installer option for user', function() {
+ browser.get(baseURL+"#/scenarios/test-scenario");
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.urlContains(baseURL+ '#/scenarios/test-scenario'), 10000);
+ var installersShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[1]/a/p'))
+ installersShow.click();
+ var installerDelete = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[3]/button'))
+ expect(installerDelete.isDisplayed()).toBe(true);
+ });
+
+ it( 'should show the add version option for user', function() {
+ browser.get(baseURL+"#/scenarios/test-scenario");
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.urlContains(baseURL+ '#/scenarios/test-scenario'), 10000);
+ var installersShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[1]/a/p'))
+ installersShow.click();
+ var installerShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
+ installerShow.click();
+ var versionAdd = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[2]/button'))
+ versionAdd.click()
+ expect(versionAdd.isDisplayed()).toBe(true);
+ });
+
+ it( 'should show the delete version option for user', function() {
+ browser.get(baseURL+"#/scenarios/test-scenario");
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.urlContains(baseURL+ '#/scenarios/test-scenario'), 10000);
+ var installersShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[1]/a/p'))
+ installersShow.click();
+ var installerShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
+ installerShow.click();
+ var versionsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p'))
+ versionsShow.click();
+ var versionShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
+ versionShow.click()
+ var versionDelete = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody[1]/tr[1]/td[3]/button'))
+ expect(versionDelete.isDisplayed()).toBe(true);
+ });
+
+ it( 'should show the add project option for user', function() {
+ browser.get(baseURL+"#/scenarios/test-scenario");
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.urlContains(baseURL+ '#/scenarios/test-scenario'), 10000);
+ var installersShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[1]/a/p'))
+ installersShow.click();
+ var installerShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
+ installerShow.click();
+ var versionsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p'))
+ versionsShow.click();
+ var versionShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
+ versionShow.click()
+ var projectAdd = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[2]/button'))
+ projectAdd.click()
+ expect(projectAdd.isDisplayed()).toBe(true);
+ });
+
+ it( 'should show the delete project option for user', function() {
+ browser.get(baseURL+"#/scenarios/test-scenario");
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.urlContains(baseURL+ '#/scenarios/test-scenario'), 10000);
+ var installersShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[1]/a/p'))
+ installersShow.click();
+ var installerShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
+ installerShow.click();
+ var versionsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p'))
+ versionsShow.click();
+ var versionShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
+ versionShow.click()
+ var projectsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[1]/a'))
+ projectsShow.click();
+ var projectDelete = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[3]/div/table/tbody[1]/tr[1]/td[3]/button'))
+ projectDelete.click()
+ expect(projectDelete.isDisplayed()).toBe(true);
+ });
+
+ it( 'should show the add customs option for user', function() {
+ browser.get(baseURL+"#/scenarios/test-scenario");
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.urlContains(baseURL+ '#/scenarios/test-scenario'), 10000);
+ var installersShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[1]/a/p'))
+ installersShow.click();
+ var installerShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
+ installerShow.click();
+ var versionsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p'))
+ versionsShow.click();
+ var versionShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
+ versionShow.click()
+ var projectsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[1]/a'))
+ projectsShow.click();
+ var projectShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
+ projectShow.click();
+ var customsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[3]/div/table/tbody[1]/tr[4]/td[2]/a/p'))
+ customsShow.click();
+ var row = element.all(by.repeater('(indexCU, custom) in project.customs')).first();
+ var cells = row.all(by.tagName('td'));
+ expect(cells.get(0).getText()).toContain("dvs");
+ var buttonAdd = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[3]/div/table/tbody[1]/tr[4]/td[2]/button'))
+ buttonAdd.click()
+ expect(buttonAdd.isDisplayed()).toBe(true);
+ });
+
+ it( 'should show the delete customs option for user', function() {
+ browser.get(baseURL+"#/scenarios/test-scenario");
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.urlContains(baseURL+ '#/scenarios/test-scenario'), 10000);
+ var installersShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[1]/a/p'))
+ installersShow.click();
+ var installerShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
+ installerShow.click();
+ var versionsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p'))
+ versionsShow.click();
+ var versionShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
+ versionShow.click()
+ var projectsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[1]/a'))
+ projectsShow.click();
+ var projectShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
+ projectShow.click();
+ var customsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[3]/div/table/tbody[1]/tr[4]/td[2]/a/p'))
+ customsShow.click();
+ var row = element.all(by.repeater('(indexCU, custom) in project.customs')).first();
+ var cells = row.all(by.tagName('td'));
+ expect(cells.get(0).getText()).toContain("dvs");
+ var buttonDelete = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[3]/div/table/tbody[1]/tr[4]/td[2]/table/tbody/tr[1]/td[2]/button'))
+ buttonDelete.click()
+ expect(buttonDelete.isDisplayed()).toBe(true);
+ });
+});
+
+
diff --git a/testapi/opnfv_testapi/tests/UI/e2e/scenarioControllerSpec.js b/testapi/opnfv_testapi/tests/UI/e2e/scenarioControllerSpec.js
index 14f3089..7777721 100644
--- a/testapi/opnfv_testapi/tests/UI/e2e/scenarioControllerSpec.js
+++ b/testapi/opnfv_testapi/tests/UI/e2e/scenarioControllerSpec.js
@@ -1040,10 +1040,7 @@ describe('testing the scenarios page for user', function () {
buttonAdd.click()
var custom = element(by.model('customModalCtrl.custom'));
browser.wait(EC.visibilityOf(custom), 5000);
- custom.sendKeys('testC');
- var buttonAddCustom = element(by.xpath('//*[@id="ng-app"]/body/div[3]/div/div/div/div[1]/div/fieldset/div/div/div/table/tfoot/tr/td[2]/input'))
- buttonAddCustom.click();
- custom.sendKeys('testB');
+ custom.sendKeys('testC,testD,');
var buttonOk = element(by.xpath('//*[@id="ng-app"]/body/div[3]/div/div/div/div[2]/button[1]'))
buttonOk.click()
expect(element(by.cssContainingText(".alert","Customs are successfully updated."))
diff --git a/testapi/opnfv_testapi/ui/Gruntfile.js b/testapi/opnfv_testapi/ui/Gruntfile.js
index 41a2ec5..805ad9f 100644
--- a/testapi/opnfv_testapi/ui/Gruntfile.js
+++ b/testapi/opnfv_testapi/ui/Gruntfile.js
@@ -123,7 +123,8 @@ module.exports = function (grunt) {
'../tests/UI/e2e/resultsControllerSpec.js',
'../tests/UI/e2e/scenariosControllerSpec.js',
'../tests/UI/e2e/scenarioControllerSpec.js',
- '../tests/UI/e2e/deployResultsControllerSpec.js'
+ '../tests/UI/e2e/deployResultsControllerSpec.js',
+ '../tests/UI/e2e/authenticateFalseSpec.js'
]
}
},
diff --git a/testapi/opnfv_testapi/ui/app.js b/testapi/opnfv_testapi/ui/app.js
index a64bfcc..ada7577 100644
--- a/testapi/opnfv_testapi/ui/app.js
+++ b/testapi/opnfv_testapi/ui/app.js
@@ -34,6 +34,36 @@
angular
.module('testapiApp')
+ .service('sortService', function(){
+
+ this.sortFunction = function(data, field, ascending){
+ if(ascending){
+ data.sort(function(a,b) {
+ if (a[field].toLowerCase() > b[field].toLowerCase()) {
+ return -1;
+ }
+ if (a[field].toLowerCase() < b[field].toLowerCase()) {
+ return 1;
+ }
+ return 0;
+ });
+ }else{
+ data.sort(function(a,b) {
+ if (a[field].toLowerCase() < b[field].toLowerCase()) {
+ return -1;
+ }
+ if (a[field].toLowerCase() > b[field].toLowerCase()) {
+ return 1;
+ }
+ return 0;
+ });
+ }
+ return data
+ }
+ });
+
+ angular
+ .module('testapiApp')
.directive('dynamicModel', ['$compile', '$parse', function ($compile, $parse) {
return {
restrict: 'A',
diff --git a/testapi/opnfv_testapi/ui/components/deploy-results/deploy-result/deployResult.html b/testapi/opnfv_testapi/ui/components/deploy-results/deploy-result/deployResult.html
index 2eba504..82a0780 100644
--- a/testapi/opnfv_testapi/ui/components/deploy-results/deploy-result/deployResult.html
+++ b/testapi/opnfv_testapi/ui/components/deploy-results/deploy-result/deployResult.html
@@ -12,6 +12,10 @@
<td width="90%" class="podsTableLeftTd">{{ctrl.data.installer}}</td>
</tr>
<tr style="padding:9px">
+ <td class="podsTableTd">Version&nbsp;:</td>
+ <td width="90%" class="podsTableLeftTd">{{ctrl.data.version}}</td>
+ </tr>
+ <tr style="padding:9px">
<td class="podsTableTd">Scenario&nbsp;:</td>
<td width="90%" class="podsTableLeftTd">{{ctrl.data.scenario}}</td>
</tr>
diff --git a/testapi/opnfv_testapi/ui/components/deploy-results/deployResults.html b/testapi/opnfv_testapi/ui/components/deploy-results/deployResults.html
index 380416f..7998f3c 100644
--- a/testapi/opnfv_testapi/ui/components/deploy-results/deployResults.html
+++ b/testapi/opnfv_testapi/ui/components/deploy-results/deployResults.html
@@ -83,6 +83,7 @@
<tr>
<th>ID</th>
<th>Installer</th>
+ <th>Version</th>
<th>Scenario</th>
<th>Pod</th>
<th>Criteria</th>
@@ -95,6 +96,7 @@
<tr ng-repeat-start="(index, result) in ctrl.data.deployresults">
<td><a ng-click="ctrl.viewDeployResult(result._id)">{{ result._id.substr(-8) }}</a></td>
<td>{{ result.installer }}</td>
+ <td>{{ result.version }}</td>
<td>{{ result.scenario }}</td>
<td>{{ result.pod_name }}</td>
<td>{{ result.criteria }}</td>
diff --git a/testapi/opnfv_testapi/ui/components/pods/podsController.js b/testapi/opnfv_testapi/ui/components/pods/podsController.js
index 95e970d..f405ecb 100644
--- a/testapi/opnfv_testapi/ui/components/pods/podsController.js
+++ b/testapi/opnfv_testapi/ui/components/pods/podsController.js
@@ -21,7 +21,7 @@
PodsController.$inject = [
'$scope', '$http', '$filter', '$state', '$window', '$uibModal', 'testapiApiUrl','raiseAlert',
- 'confirmModal', 'keepState'
+ 'confirmModal', 'keepState', 'sortService'
];
/**
@@ -30,7 +30,7 @@
* through pods declared in TestAPI.
*/
function PodsController($scope, $http, $filter, $state, $window, $uibModal, testapiApiUrl,
- raiseAlert, confirmModal, keepState) {
+ raiseAlert, confirmModal, keepState, sortService) {
var ctrl = this;
ctrl.url = testapiApiUrl + '/pods';
ctrl.checkBox = []
@@ -50,29 +50,8 @@
ctrl.sortBy = sortBy
function sortBy(field){
- if(ctrl.sorting[field]){
- ctrl.data.pods.sort(function(a,b) {
- if (a[field].toLowerCase() > b[field].toLowerCase()) {
- return -1;
- }
- if (a[field].toLowerCase() < b[field].toLowerCase()) {
- return 1;
- }
- return 0;
- });
- ctrl.sorting[field] = false
- }else{
- ctrl.data.pods.sort(function(a,b) {
- if (a[field].toLowerCase() < b[field].toLowerCase()) {
- return -1;
- }
- if (a[field].toLowerCase() > b[field].toLowerCase()) {
- return 1;
- }
- return 0;
- });
- ctrl.sorting[field] = true
- }
+ ctrl.data.pods = sortService.sortFunction(ctrl.data.pods, field , ctrl.sorting[field] )
+ ctrl.sorting[field]=!ctrl.sorting[field]
}
/**
diff --git a/testapi/opnfv_testapi/ui/components/projects/projects.html b/testapi/opnfv_testapi/ui/components/projects/projects.html
index 84902f8..5d514d1 100644
--- a/testapi/opnfv_testapi/ui/components/projects/projects.html
+++ b/testapi/opnfv_testapi/ui/components/projects/projects.html
@@ -38,7 +38,14 @@
<tr style="
text-align: center;">
<th style="width: 1%;">Bulk Select</th>
- <th style="width: 19%;">Name</th>
+ <th style="width: 19%;">Name
+ <a class="text-danger" ng-click="ctrl.sortByName()" ng-class="{ 'hidden': !ctrl.sortName }" >
+ <span class="glyphicon glyphicon-sort-by-alphabet pull-right" aria-hidden="true"></span>
+ </a>
+ <a class="text-danger" ng-click="ctrl.sortByName()" ng-class="{ 'hidden': ctrl.sortName }" >
+ <span class="glyphicon glyphicon-sort-by-alphabet-alt pull-right" aria-hidden="true"></span>
+ </a>
+ </th>
<th style="width: 70%;">Description</th>
<th style="width: 10%;" ng-class="{'hidden': ! ((auth.projectNames.length>0) && auth.isAuthenticated) && authenticate}">Operations</th>
</tr>
diff --git a/testapi/opnfv_testapi/ui/components/projects/projectsController.js b/testapi/opnfv_testapi/ui/components/projects/projectsController.js
index d4fa962..07a58fe 100644
--- a/testapi/opnfv_testapi/ui/components/projects/projectsController.js
+++ b/testapi/opnfv_testapi/ui/components/projects/projectsController.js
@@ -21,7 +21,7 @@
ProjectsController.$inject = [
'$scope', '$http', '$filter', '$state', '$window', '$uibModal', 'testapiApiUrl',
- 'raiseAlert', 'confirmModal', 'authenticate', 'keepState'
+ 'raiseAlert', 'confirmModal', 'authenticate', 'keepState', 'sortService'
];
/**
@@ -30,7 +30,7 @@
* through projects declared in TestAPI.
*/
function ProjectsController($scope, $http, $filter, $state, $window, $uibModal, testapiApiUrl,
- raiseAlert, confirmModal, authenticate, keepState) {
+ raiseAlert, confirmModal, authenticate, keepState, sortService) {
var ctrl = this;
ctrl.url = testapiApiUrl + '/projects';
@@ -44,11 +44,13 @@
ctrl.openBatchDeleteModal = openBatchDeleteModal;
ctrl.projectDelete = projectDelete;
ctrl.batchDelete = batchDelete;
+ ctrl.sortByName = sortByName
ctrl.checkBox = [];
ctrl.checkBoxList = [];
ctrl.name = '';
ctrl.details = '';
+ ctrl.ascending = false;
/**
* This will contact the TestAPI to create a new project.
@@ -72,6 +74,11 @@
});
}
+ function sortByName(){
+ ctrl.data.projects = sortService.sortFunction(ctrl.data.projects, 'name', ctrl.ascending)
+ ctrl.ascending = !ctrl.ascending
+ }
+
/**
* This will open the modal that will show the create
* project view
diff --git a/testapi/opnfv_testapi/ui/components/results/results.html b/testapi/opnfv_testapi/ui/components/results/results.html
index e1413d5..a433525 100644
--- a/testapi/opnfv_testapi/ui/components/results/results.html
+++ b/testapi/opnfv_testapi/ui/components/results/results.html
@@ -91,7 +91,7 @@
<th>Version</th>
<th>Scenario</th>
<th>Criteria</th>
- <th>Build&nbsp;tag</th>
+ <th>Start Date</th>
</tr>
</thead>
@@ -105,7 +105,7 @@
<td>{{ result.version }}</td>
<td>{{ result.scenario }}</td>
<td>{{ result.criteria }}</td>
- <td>{{ result["build_tag"]}}</td>
+ <td>{{ result.start_date}}</td>
</tr>
<tr ng-repeat-end=>
</tr>
diff --git a/testapi/opnfv_testapi/ui/components/scenarios/modals/customModal.html b/testapi/opnfv_testapi/ui/components/scenarios/modals/customModal.html
index 90e4544..0cd2663 100644
--- a/testapi/opnfv_testapi/ui/components/scenarios/modals/customModal.html
+++ b/testapi/opnfv_testapi/ui/components/scenarios/modals/customModal.html
@@ -8,18 +8,7 @@
<div class="update-project">
<label for="cpid" class="control-label col-sm-4">Custom: </label>
<table cellpadding="0" cellspacing="0">
- <tbody ng-repeat="custom in customModalCtrl.customs">
- <tr>
- <td>
- <div class="col-sm-12">
- <input type="text" class="form-control" value="{{custom}}" disabled/>
- <p class="help-block"></p>
- </div>
- </td>
- <td><input type="button" class="btn btn-danger" ng-click="customModalCtrl.remove($index)" value="Remove" /></td>
- </tr>
- </tbody>
- <tfoot>
+ <tbody>
<tr>
<td>
<div class="col-sm-12">
@@ -27,9 +16,8 @@
<p class="help-block"></p>
</div>
</td>
- <td><input type="button" class="btn btn-primary" ng-click="customModalCtrl.add()" value="Add" /></td>
</tr>
- </tfoot>
+ </tbody>
</table>
</div>
</div>
diff --git a/testapi/opnfv_testapi/ui/components/scenarios/modals/projectModal.html b/testapi/opnfv_testapi/ui/components/scenarios/modals/projectModal.html
index 0a14be9..171cc33 100644
--- a/testapi/opnfv_testapi/ui/components/scenarios/modals/projectModal.html
+++ b/testapi/opnfv_testapi/ui/components/scenarios/modals/projectModal.html
@@ -38,7 +38,7 @@
</tr>
</thead>
<tbody>
- <tr ng-repeat-start="(index, custom) in projectModalCtrl.project.customs" style="padding:9px">
+ <tr ng-repeat-start="custom in projectModalCtrl.project.customs" style="padding:9px">
<td>{{custom}}</td>
</tr>
<tr ng-repeat-end=>
diff --git a/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenario.html b/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenario.html
index 14ba42d..4f0a580 100644
--- a/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenario.html
+++ b/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenario.html
@@ -28,7 +28,7 @@
<p ng-if="!ctrl.collapeInstallers">Show</p>
</a>
</div>
- <div class="col-md-1" style="padding:0px" ng-class="{'hidden' : !ctrl.buttonInstaller || !auth.isAuthenticated}">
+ <div class="col-md-1" style="padding:0px" ng-class="{'hidden' : !ctrl.buttonInstaller || (!auth.isAuthenticated && authenticate)}">
<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 } ">
@@ -43,7 +43,7 @@
<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>
+ <button type="button" ng-class="{'hidden' : !auth.isAuthenticated && authenticate}" 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] }">
@@ -58,7 +58,7 @@
</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>
+ <button type="button" class="btn btn-success btn-xs" ng-class="{'hidden' : !auth.isAuthenticated && authenticate}" 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">
@@ -72,7 +72,7 @@
<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>
+ <button type="button" class="btn btn-danger btn-xs" ng-class="{'hidden' : !auth.isAuthenticated && authenticate}" 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] } ">
@@ -93,7 +93,7 @@
</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>
+ <button type="button" ng-class="{'hidden' : !auth.isAuthenticated && authenticate}" 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">
@@ -107,7 +107,7 @@
<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>
+ <button type="button" class="btn btn-danger btn-xs" ng-class="{'hidden' : !auth.isAuthenticated && authenticate}" 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] }">
@@ -138,10 +138,6 @@
</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>
@@ -173,9 +169,6 @@
</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>
@@ -195,13 +188,13 @@
{{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>
+ <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 && authenticate}" ><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>
+ <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 && authenticate)}"><i class="fa fa-plus"></i>Add</button>
</tr>
</tbody>
</table>
diff --git a/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js b/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js
index 36e54f5..a0cd5eb 100644
--- a/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js
+++ b/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js
@@ -21,7 +21,7 @@
ScenarioController.$inject = [
'$scope', '$http', '$filter', '$state', '$window', '$uibModal', 'testapiApiUrl','raiseAlert',
- 'confirmModal'
+ 'confirmModal', 'authenticate'
];
/**
@@ -30,7 +30,7 @@
* through Scenario declared in TestAPI.
*/
function ScenarioController($scope, $http, $filter, $state, $window, $uibModal, testapiApiUrl,
- raiseAlert, confirmModal) {
+ raiseAlert, confirmModal, authenticate) {
var ctrl = this;
ctrl.name = $state.params['name'];
ctrl.url = testapiApiUrl + '/scenarios?name=' + ctrl.name;
@@ -434,35 +434,15 @@
ctrl.confirm = confirm;
ctrl.cancel = cancel;
ctrl.data = angular.copy(data);
- ctrl.open = open;
- ctrl.add = add;
- ctrl.remove = remove;
ctrl.customs = [];
- function add() {
- var custom = ctrl.custom;
- if(custom!="" && custom!=undefined ){
- ctrl.customs.push(custom);
- ctrl.custom = "";
- }
- };
-
- function remove(index) {
- // var name = ctrl.customs[index].Name;
- ctrl.customs.splice(index, 1);
-
- }
-
- /**
- * Initiate confirmation and call the success handler with the
- * inputs.
- */
function confirm() {
var custom = ctrl.custom;
if(custom!="" && custom!=undefined ){
- ctrl.customs.push(custom);
+ ctrl.customs = custom.split(/[ ,]+/).filter(Boolean);
}
+ console.log(ctrl.customs)
ctrl.data.successHandler(ctrl.customs,ctrl.data.project,ctrl.data.version,ctrl.data.installer);
$uibModalInstance.dismiss('cancel');
diff --git a/testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js b/testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js
index dff9f26..98e4089 100644
--- a/testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js
+++ b/testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js
@@ -127,7 +127,6 @@
}
function createScenario(scenario) {
- console.log(scenario)
ctrl.scenarioRequest =
$http.post(ctrl.url, scenario).success(function (data){
ctrl.showCreateSuccess = true;
@@ -270,7 +269,6 @@
}
function openVersionModal(){
- console.log("Hello");
$uibModal.open({
templateUrl: 'testapi-ui/components/scenarios/modals/versionModal.html',
controller: 'versionModalCtrl as versionModalCtrl',
@@ -383,8 +381,10 @@
$uibModalInstance.dismiss('cancel');
}
- function handleModalCustom(custom){
- ctrl.project.customs.push(custom);
+ function handleModalCustom(customs){
+ for (var custom in customs){
+ ctrl.project.customs.push(customs[custom]);
+ }
}
function openCustomModal(){
@@ -418,6 +418,7 @@
ctrl.cancel = cancel;
ctrl.data = angular.copy(data);
ctrl.open = open;
+ ctrl.customs = []
/**
@@ -425,7 +426,11 @@
* inputs.
*/
function confirm() {
- ctrl.data.successHandler(ctrl.custom);
+ var custom = ctrl.custom;
+ if(custom!="" && custom!=undefined ){
+ ctrl.customs = custom.split(/[ ,]+/).filter(Boolean);
+ }
+ ctrl.data.successHandler(ctrl.customs);
$uibModalInstance.dismiss('cancel');
}
diff --git a/testapi/opnfv_testapi/ui/config.json b/testapi/opnfv_testapi/ui/config.json
index 26dfd08..63e1e97 100644
--- a/testapi/opnfv_testapi/ui/config.json
+++ b/testapi/opnfv_testapi/ui/config.json
@@ -1,2 +1,4 @@
-{"testapiApiUrl": "http://localhost:8000/api/v1",
-"authenticate": true}
+{
+ "testapiApiUrl": "http://localhost:8000/api/v1",
+ "authenticate": true
+} \ No newline at end of file