From 45ea6e48272abf9f0a13321e1f81470f127d6af0 Mon Sep 17 00:00:00 2001 From: Stanislav Jamrich Date: Tue, 11 Oct 2016 15:39:41 +0200 Subject: [PATCH] Yangman - make elements accessible via ids - part1 - add id attributes to dom elements to be simply accessible for automatic testing Change-Id: I8ee7ccd65067fae3e682456983982575a3fe45fc Signed-off-by: Stanislav Jamrich --- .../controllers/yang-form.controller.js | 16 +++++++--- .../yangman/directives/abn-tree.directive.js | 1 + .../yangman/services/parameters.services.js | 4 ++- .../views/directives/abn-tree.tpl.html | 5 ++-- .../resources/yangman/views/index.tpl.html | 7 +++-- .../views/leftpanel/collections-tab.tpl.html | 29 ++++++++++++++----- .../views/leftpanel/history-tab.tpl.html | 16 ++++++++-- .../views/leftpanel/module-detail.tpl.html | 5 ++-- .../views/leftpanel/modules-tab.tpl.html | 8 +++-- .../views/leftpanel/request-item.tpl.html | 15 ++++++---- .../yangman/views/rightpanel/detail.tpl.html | 11 +------ .../views/rightpanel/request-data.tpl.html | 1 + .../views/rightpanel/request-header.tpl.html | 25 ++++++++++------ 13 files changed, 94 insertions(+), 49 deletions(-) diff --git a/modules/yangman-resources/src/main/resources/yangman/controllers/yang-form.controller.js b/modules/yangman-resources/src/main/resources/yangman/controllers/yang-form.controller.js index f312608f..7a82ef85 100644 --- a/modules/yangman-resources/src/main/resources/yangman/controllers/yang-form.controller.js +++ b/modules/yangman-resources/src/main/resources/yangman/controllers/yang-form.controller.js @@ -28,15 +28,23 @@ define([ yangForm.viewPath = $scope.globalViewPath + 'rightpanel/form'; yangForm.errorMsg = ''; + yangForm.inputIndex = 0; $scope.constants = constants; - // methods + yangForm.getNodeName = getNodeName; - // watchers - $scope.$on(constants.YANGMAN_SET_ERROR_DATA, setRcvdErrorData); + init(); + + + + + function init() { + $scope.$on(constants.YANGMAN_SET_ERROR_DATA, setRcvdErrorData); + $scope.$on(constants.YANGMAN_SET_ERROR_MESSAGE, setErrorMessage); + } + - $scope.$on(constants.YANGMAN_SET_ERROR_MESSAGE, setErrorMessage); /** * Method for set error message in form diff --git a/modules/yangman-resources/src/main/resources/yangman/directives/abn-tree.directive.js b/modules/yangman-resources/src/main/resources/yangman/directives/abn-tree.directive.js index 06358536..810ab18b 100644 --- a/modules/yangman-resources/src/main/resources/yangman/directives/abn-tree.directive.js +++ b/modules/yangman-resources/src/main/resources/yangman/directives/abn-tree.directive.js @@ -288,6 +288,7 @@ define(['angular'], function (angular) { } } scope.tree_rows.push({ + index: scope.tree_rows.length, // in template tracking by branch.uid, integer needed level: level, branch: branch, label: branch.label, diff --git a/modules/yangman-resources/src/main/resources/yangman/services/parameters.services.js b/modules/yangman-resources/src/main/resources/yangman/services/parameters.services.js index 7c7d3fd0..55bd0ce9 100644 --- a/modules/yangman-resources/src/main/resources/yangman/services/parameters.services.js +++ b/modules/yangman-resources/src/main/resources/yangman/services/parameters.services.js @@ -17,6 +17,9 @@ define([ service.createParameter = createParameter; service.validateFile = validateFile; + return service; + + /** * Validating collection import file * @param data @@ -62,7 +65,6 @@ define([ } - return service; } diff --git a/modules/yangman-resources/src/main/resources/yangman/views/directives/abn-tree.tpl.html b/modules/yangman-resources/src/main/resources/yangman/views/directives/abn-tree.tpl.html index 257206f2..1b5aa5c8 100644 --- a/modules/yangman-resources/src/main/resources/yangman/views/directives/abn-tree.tpl.html +++ b/modules/yangman-resources/src/main/resources/yangman/views/directives/abn-tree.tpl.html @@ -2,9 +2,10 @@ + id="branch-{{row.index}}" + ng-init="(_dataCollection = []).length = row.level; idIndex = idIndex + 1;"> - {{row.tree_icon}} + {{row.tree_icon}} {{ row.label }} {{ row.branch.identifier }} diff --git a/modules/yangman-resources/src/main/resources/yangman/views/index.tpl.html b/modules/yangman-resources/src/main/resources/yangman/views/index.tpl.html index ab6be169..8fea0ff6 100644 --- a/modules/yangman-resources/src/main/resources/yangman/views/index.tpl.html +++ b/modules/yangman-resources/src/main/resources/yangman/views/index.tpl.html @@ -5,6 +5,7 @@ play_arrow @@ -17,15 +18,15 @@ - +
- +
- +
diff --git a/modules/yangman-resources/src/main/resources/yangman/views/leftpanel/collections-tab.tpl.html b/modules/yangman-resources/src/main/resources/yangman/views/leftpanel/collections-tab.tpl.html index b8d7a9e9..870f43d3 100644 --- a/modules/yangman-resources/src/main/resources/yangman/views/leftpanel/collections-tab.tpl.html +++ b/modules/yangman-resources/src/main/resources/yangman/views/leftpanel/collections-tab.tpl.html @@ -11,12 +11,14 @@ search close @@ -29,6 +31,7 @@ sort @@ -41,6 +44,7 @@ save @@ -53,7 +57,7 @@ - +