$scope.init = function() {\r
siteDataService.getAllSiteData()\r
.then(function (data) {\r
- $scope.data = data;\r
+ $scope.data = data.sites;\r
console.log("Data: ");\r
$log.info(data);\r
loadButtons();\r
\r
\r
$scope.siteTableParams = new NgTableParams({count: 5, sorting: {name: 'asc'} //{page: 1,count: 10,filter: {name: 'M'},sorting: {name: 'desc'}\r
- }, { counts:[5, 10, 20, 50], dataset: $scope.data.siteData});\r
+ }, { counts:[5, 10, 20, 50], dataset: $scope.data});\r
\r
$scope.$watch('checkboxes.checked', function(value) {\r
- angular.forEach($scope.data.siteData, function(item) {\r
+ angular.forEach($scope.data, function(item) {\r
console.log(item.id);\r
if (angular.isDefined(item.id)) {\r
$scope.checkboxes.items[item.id] = value;\r
var siteName = {"ErrMsg" : {"errmsg" : "Name is required.", "modalVar":"site.name", "errtag":"textboxErrName", "errfunc":"validatetextboxName", "required":true}};\r
$('#myModal #name').append($compile(Mustache.to_html(text, siteName.ErrMsg))($scope));\r
\r
- var dropSimple_data = {\r
+//TODO check for the dropdown if possible based on static Site types\r
+ /*var dropSimple_data = {\r
"modalVar" : "site.type",\r
"labelField" : "itemLabel",\r
- "optionsValue" : $scope.data ? JSON.stringify($scope.data.dropdownsiteData.item): ""\r
+ "optionsValue" : "$scope.data ? JSON.stringify($scope.data.dropdownsiteData.item)"\r
};\r
\r
- $('#myModal #type').append($compile(Mustache.to_html(dropDown, dropSimple_data))($scope));\r
+ $('#myModal #type').append($compile(Mustache.to_html(dropDown, dropSimple_data))($scope));*/\r
\r
- var siteTenantName = {"ErrMsg" : {"errmsg" : "The name is required.", "modalVar":"site.tenatname"}};\r
- $('#myModal #tenantname').append($compile(Mustache.to_html(text, siteTenantName.ErrMsg))($scope));\r
+ var siteType = {"ErrMsg" : {"errmsg" : "The name is required.", "modalVar":"site.type"}};\r
+ $('#myModal #type').append($compile(Mustache.to_html(text, siteType.ErrMsg))($scope));\r
\r
- var siteTenantType = {"ErrMsg" : {"errmsg" : "The tenanttype is required.", "modalVar":"site.tenanttype"}};\r
- $('#myModal #tenanttype').append($compile(Mustache.to_html(text, siteTenantType.ErrMsg))($scope));\r
+ var siteTenantName = {"ErrMsg" : {"errmsg" : "The name is required.", "modalVar":"site.tenantID"}};\r
+ $('#myModal #tenantID').append($compile(Mustache.to_html(text, siteTenantName.ErrMsg))($scope));\r
+\r
+ /*var siteTenantType = {"ErrMsg" : {"errmsg" : "The tenanttype is required.", "modalVar":"site.tenanttype"}};\r
+ $('#myModal #tenanttype').append($compile(Mustache.to_html(text, siteTenantType.ErrMsg))($scope));*/\r
\r
var siteLocation = {"ErrMsg" : {"errmsg" : "Location is required.", "modalVar":"site.location", "placeholder":"Location"}};\r
$('#myModal #location').append($compile(Mustache.to_html(text, siteLocation.ErrMsg))($scope));\r
$scope.showAddModal = function() {\r
console.log("Showing Modal to Add data");\r
$scope.site = {};\r
- //$("#myModal").modal();\r
- $("#myModal").modal({}).draggable();\r
+ $("#myModal").modal();\r
+ //$("#myModal").modal({}).draggable();\r
$scope.textboxErrName = false;\r
}\r
$scope.saveData = function(id) {\r
$scope.editData = function(id) {\r
console.log("To be edited : " + id);\r
var dataFound = false;\r
- angular.forEach($scope.data.siteData, function(data) {\r
+ angular.forEach($scope.data, function(data) {\r
if(!dataFound) {\r
if (data.id == id) {\r
console.log("Found : " + data.name);\r
+++ /dev/null
-<!--\r
-\r
- Copyright 2016-2017, Huawei Technologies Co., Ltd.\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-\r
--->\r
-\r
-<!-- Default Buttons <button class="btnDefault" ng-click="{{clickAction}}">{{title}}</button>-->\r
-<script id="defaultButtons" type="text/html">\r
- <input type="button" class="btnDefault btnmrg" ng-click="{{clickAction}}" value="{{title}}"/>\r
-</script>\r
-\r
-<script id="defaultIconButtons" type="text/html">\r
- <button id="iconBtn" type="button" class="btnDefault btnmrg {{type}}" ng-click="{{clickAction}}">{{title}}\r
- <span class="glyphicon {{gType}} pull-{{iconPosition}}"></span>\r
- </button>\r
-</script>\r
-\r
-<!-- Visual Buttons -->\r
-<script id="visualButtons" type="text/html">\r
- <button type="button" class="btn btn-{{type}}">{{title}}</button>\r
-</script>\r
-\r
-<!-- Different sized Buttons -->\r
-<script id="sizeButtons" type="text/html">\r
- <button type="button" class="btn btn-{{type}} {{size}}">{{title}}</button>\r
-</script>\r
-\r
-<!-- Icon Buttons -->\r
-<script id="iconButtons" type="text/html">\r
- <button type="button" class="btn btn-{{type}}">{{title}}\r
- <span class="glyphicon {{gType}}"></span>\r
- </button>\r
-</script>\r
-\r
-<!--Dropdown template-->\r
-<script id="dropDown" type="text/html">\r
- <div class="drop{{position}}">\r
- <button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">{{title}}\r
- <span class="caret"></span>\r
- </button>\r
- <ul class="dropdown-menu">\r
- {{#items}}<li><a href="#">{{itemLabel}}</a></li>{{/items}}\r
- </ul>\r
- </div>\r
-</script>\r
-\r
-<script id="dropDownHeader" type="text/html">\r
- <button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">{{title}}\r
- <span class="caret"></span>\r
- </button>\r
- <ul class="dropdown-menu">\r
- {{#items}}\r
- {{#isheader}}<li class="divider"></li><li class="dropdown-header">{{itemLabel}}</li><li class="divider"></li>{{/isheader}}\r
- {{^isheader}}<li><a href="#">{{itemLabel}}</a></li>{{/isheader}}\r
- {{/items}}\r
- </ul>\r
-</script>\r
-\r
-<script id="simpleDropdownTmpl" type="text/html">\r
- <div class="dropdownplain">\r
- <ul class="nav navbar-nav">\r
- <li>\r
- <a class="dropdown-toggle" data-toggle="dropdown">{{title}} <span class="glyphicon glyphicon-chevron-down pull-right"></span></a>\r
- <ul class="dropdown-menu">\r
- {{#items}}<li><a target="_blank">{{itemLabel}}</a></li>{{/items}}\r
- </ul>\r
- </li>\r
- </ul>\r
- </div>\r
-</script>\r
-\r
-\r
-<!--Radio Buttons-->\r
-<script id="radioButtons" type="text/html">\r
- <div>\r
- <input class="magic-radio" type="radio" name="radio" id="radio{{id}}"/>\r
- <label for="radio{{id}}">{{label}}</label></br>\r
- </div>\r
-</script>\r
-\r
-<!--Check boxes template-->\r
-<script id="checkBoxes" type="text/html">\r
- <div class="funkyradio-{{type}}">\r
- <input type="checkbox" name="check" id="checkbox{{id}}" {{#checked}}checked{{/checked}} />\r
- <label for="checkbox{{id}}">{{label}}</label>\r
- </div>\r
-</script>\r
-\r
-<!--text-->\r
-<script id="textfield" type="text/html">\r
- <div class="css-form">\r
- <input id ="textbox" name="textbox" class="form-control inputfield" placeholder="{{placeholder}}" ng-model="{{modalVar}}" type="text" ng-blur="{{errfunc}}({{modalVar}})" {{#required}}required{{/required}}> {{#required}}<span class="staricon">*</span>{{/required}}\r
- <span class="errMsg" ng-show="{{errtag}}">{{errmsg}}</span>\r
- </div>\r
-</script>\r
-\r
-<!--email-->\r
-<script id="email" type="text/html">\r
- <div class="css-form">\r
- <input class="form-control inputfield" placeholder="{{placeholder}}" ng-model="{{modalVar}}" type="email" ng-blur="{{errfunc}}({{modalVar}})" {{#required}}required{{/required}}>{{#required}}<span class="staricon">*</span>{{/required}}\r
- <span class="errMsg" ng-show="{{errtag}}">{{errmsg}}</span>\r
- </div>\r
-</script>\r
-\r
-<!--url-->\r
-<script id="url" type="text/html">\r
- <div class="css-form">\r
- <input class="form-control inputfield" placeholder="{{placeholder}}" ng-model="{{modalVar}}" type="url" ng-blur="{{errfunc}}({{modalVar}})" {{#required}}required{{/required}}>{{#required}}<span class="staricon">*</span>{{/required}}\r
- <span class="errMsg" ng-show="{{errtag}}">{{errmsg}}</span>\r
- </div>\r
-</script>\r
-\r
-<!--password-->\r
-<script id="password" type="text/html">\r
- <div class="css-form">\r
-\r
-\r
- <input class="form-control inputfield" placeholder="{{placeholder}}" ng-model="{{modalVar}}" type="password" pattern=".{3,}" maxlength="{{#maxLength}}{{maxLength}}{{/maxLength}}{{^maxLength}}9{{/maxLength}}" ng-blur="{{errfunc}}({{modalVar}})" {{#required}}required{{/required}}>{{#required}}<span class="staricon">*</span>{{/required}}\r
- <span class="errMsg" ng-show="{{errtag}}">{{errmsg}}</span>\r
- </div>\r
-</script>\r
-\r
-<!--numeric-->\r
-<script id="numeric" type="text/html">\r
- <div class="css-form">\r
- <input class="form-control inputfield" placeholder="{{placeholder}}" ng-model="{{modalVar}}" type="number" ng-blur="{{errfunc}}({{modalVar}})" {{#required}}required{{/required}}/>{{#required}}<span class="staricon">*</span>{{/required}}\r
- <span class="errMsg" ng-show="{{errtag}}">{{errmsg}}</span>\r
- </div>\r
-</script>\r
-\r
-<!--dot-->\r
-<script id="dot" type="text/html">\r
- <div class="css-form">\r
- <input class="form-control inputfield" placeholder="{{placeholder}}" ng-model="{{modalVar}}" type="datetime-local" ng-blur="{{errfunc}}({{modalVar}})" {{#required}}required{{/required}}>{{#required}}<span class="staricon">*</span>{{/required}}\r
- <span class="errMsg" ng-show="{{errtag}}">{{errmsg}}</span>\r
- </div>\r
-</script>\r
-\r
-<!--date-->\r
-<script id="dateinput" type="text/html">\r
- <div class="css-form">\r
- <input class="form-control inputfield" placeholder="{{placeholder}}" ng-model="{{modalVar}}" type="date" ng-blur="{{errfunc}}({{modalVar}})" {{#required}}required{{/required}}>{{#required}}<span class="staricon">*</span>{{/required}}\r
- <span class="errMsg" ng-show="{{errtag}}">{{errmsg}}</span>\r
- </div>\r
-</script>\r
-\r
-<!--Month-->\r
-<script id="monthinput" type="text/html">\r
- <div class="css-form">\r
- <input class="form-control inputfield" placeholder="{{placeholder}}" ng-model="{{modalVar}}" type="month" ng-blur="{{errfunc}}({{modalVar}})" {{#required}}required{{/required}}>{{#required}}<span class="staricon">*</span>{{/required}}\r
- <span class="errMsg" ng-show="{{errtag}}">{{errmsg}}</span>\r
- </div>\r
-</script>\r
-\r
-\r
-<!--Week-->\r
-<script id="weekinput" type="text/html">\r
- <div class="css-form">\r
- <input class="form-control inputfield" placeholder="{{placeholder}}" ng-model="{{modalVar}}" type="week" ng-blur="{{errfunc}}({{modalVar}})" {{#required}}required{{/required}}>{{#required}}<span class="staricon">*</span>{{/required}}\r
- <span class="errMsg" ng-show="{{errtag}}">{{errmsg}}</span>\r
- </div>\r
-</script>\r
-\r
-<!--time-->\r
-<script id="timeinput" type="text/html">\r
- <div class="css-form">\r
- <input class="form-control inputfield" placeholder="{{placeholder}}" ng-model="{{modalVar}}" type="time" ng-blur="{{errfunc}}({{modalVar}})" {{#required}}required{{/required}}>{{#required}}<span class="staricon">*</span>{{/required}}\r
- <span class="errMsg" ng-show="{{errtag}}">{{errmsg}}</span>\r
- </div>\r
-</script>\r
-\r
-<!--ipv4-->\r
-<script id="ipv4" type="text/html">\r
- <div class="css-form">\r
- <input class="form-control inputfield" type="ipv4" placeholder="{{placeholder}}" ng-model="{{modalVar}}" pattern="((^|\.)((25[0-5])|(2[0-4]\d)|(1\d\d)|([1-9]?\d))){4}$" ng-blur="{{errfunc}}({{modalVar}})" {{#required}}required{{/required}}>{{#required}}<span class="staricon">*</span>{{/required}}\r
- <span class="errMsg" ng-show="{{errtag}}">{{errmsg}}</span>\r
- </div>\r
-</script>\r
-\r
-<!--ipv6-->\r
-<script id="ipv6" type="text/html">\r
- <div class="css-form">\r
- <input class="form-control inputfield" placeholder="{{placeholder}}" ng-model="{{modalVar}}" type="ipv6" pattern="^([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])" ng-blur="{{errfunc}}({{modalVar}})" {{#required}}required{{/required}}>{{#required}}<span class="staricon">*</span>{{/required}}\r
- <span class="errMsg" ng-show="{{errtag}}">{{errmsg}}</span>\r
- </div>\r
-</script>\r
-\r
-<!--textarea-->\r
-<script id="textarea" type="text/html">\r
- <div class="css-form">\r
- <textarea class="form-control inputfield" rows="4" cols="50" placeholder="{{placeholder}}" ng-model="{{modalVar}}" ng-blur="{{errfunc}}({{modalVar}})" {{#required}}required{{/required}}></textarea>{{#required}}<span class="staricon">*</span>{{/required}}\r
- <span class="errMsg" ng-show="{{errtag}}">{{errmsg}}</span>\r
- </div>\r
-</script>\r
-\r
-<!--note-->\r
-<script id="note" type="text/html">\r
-\r
- <a id="noteanchor" href="#/home/textarea" title="Note" data-toggle="popover" data-trigger="focus" data-placement="{{placement}}">\r
- <span class="glyphicon glyphicon-info-sign "></span></a>\r
-</script>\r
-\r
-<!-- list -->\r
-<script id="list" type="text/html">\r
-\r
- {{#items}}\r
-\r
- <div>\r
- <button type="button" class="btn btn-primary btn-block" ng-click="loadSubMenuPage('{{id}}', '{{level}}', '{{row}}')">{{title}}</button>\r
- </div>\r
-\r
- {{/items}}\r
-\r
-</script>\r