function PathUtilsService(ArrayUtilsService){
var service = {
+ clearPath: clearPath,
createPathElement: createPathElement,
getModuleNameFromPath: getModuleNameFromPath,
getStorageAndNormalizedPath: getStorageAndNormalizedPath,
});
}
- // TODO: add service's description
+ /**
+ * Service for filling API url object from url string data
+ * @param pathArrayIn
+ * @param pathString
+ */
function fillPath(pathArrayIn, pathString) {
var pathArray = trimPath(pathString).split('/'),
pathPosition = 0;
}
+ /**
+ * Service for clearing api path object
+ * @param pathArrayIn
+ */
+ function clearPath(pathArrayIn){
+ pathArrayIn.forEach(function (pathItem){
+ if ( pathItem.hasIdentifier() ){
+ pathItem.identifiers.forEach(function (identifier){
+ identifier.value = '';
+ });
+ }
+ });
+ }
+
// TODO: add service's description
function getModuleNameFromPath(path){
var pathArray = translate(trimPath(path));
--- /dev/null
+define(['app/yangman/yangman.module'], function (yangman) {
+ 'use strict';
+
+ yangman.register.controller('TypeBooleanCtrl', TypeBooleanCtrl);
+
+ TypeBooleanCtrl.$inject = ['$scope'];
+
+ function TypeBooleanCtrl($scope){
+ var yangTypeBolean = this;
+
+ $scope.$watch('node.value', function(){
+ if ( typeof $scope.node.value !== 'boolean' && $scope.node.value.length) {
+ $scope.node.value = $scope.node.value === 'true';
+ }
+ });
+ }
+});
+
* @param params
*/
function saveBcstedHistoryRequest(broadcastEvent, params) {
-
vm.requestList.addRequestToList(params.params);
vm.requestList.groupListByDate();
vm.requestList.saveToStorage();
* @param reqObj
*/
function executeRequest(reqObj) {
+ $scope.setRightPanelSection('req-data');
$scope.rootBroadcast(
'YANGMAN_HEADER_INIT',
{ path: reqObj.path, method: reqObj.method },
'app/yangman/controllers/form/rpc.controller',
'app/yangman/controllers/form/type.controller',
'app/yangman/controllers/form/type-bit.controller',
+ 'app/yangman/controllers/form/type-boolean.controller',
'app/yangman/controllers/form/type-empty.controller',
'app/yangman/controllers/form/type-enum.controller',
'app/yangman/directives/yang-form-menu.directive',
function setApi(api, subApi, setUrl){
$scope.selectedApi = api;
$scope.selectedSubApi = subApi;
-
+ PathUtilsService.clearPath($scope.selectedSubApi.pathArray);
$scope.$broadcast('SET_SEL_OPERATIONS', subApi ? $scope.selectedSubApi.operations : [], setUrl);
}
default: function (){
var methodType = {
GET: function () {
- node.clear();
+ if ( node ){
+ node.clear();
+ }
return rData;
},
DELETE: function () {
- node.clear();
+ if ( node ) {
+ node.clear();
+ }
return {};
},
PUT: function () {
-<md-switch ng-model="node.value"
- id="{{ node.label + node.id }}"
- aria-label="Boolean"
- ng-disabled="{{ yangOutput.notEditable }}"><!--ng-change="yangType.valueChanged()"-->
-</md-switch>
\ No newline at end of file
+<section ng-controller="TypeBooleanCtrl as yangTypeBolean" flex>
+ <md-switch ng-model="node.value"
+ id="{{ node.label + node.id }}"
+ aria-label="Boolean"
+ ng-disabled="{{ yangOutput.notEditable }}">
+ </md-switch>
+</section>