Skip to content

Commit

Permalink
wizard. added nethlink configuration button
Browse files Browse the repository at this point in the history
  • Loading branch information
edospadoni committed Mar 11, 2024
1 parent 7c3d14c commit 42d77cf
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 8 deletions.
35 changes: 33 additions & 2 deletions wizard/app/scripts/controllers/configurations/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ angular.module('nethvoiceWizardUiApp')
$scope.availableUserFilters = ['all', 'configured', 'unconfigured']
$scope.availableUserFiltersNumbers = ['username', 'displayname', 'default_extension', 'lname'];
$scope.usersFilterNumbersOrd = false;

$scope.usersFilter = $scope.availableUserFilters[0]
$scope.usersFilterNumbers = $scope.availableUserFiltersNumbers[0]

Expand All @@ -53,7 +53,7 @@ angular.module('nethvoiceWizardUiApp')
return true
}
};

$rootScope.$on('scrollingContainerView', function () {
if($scope.allUsers){
if ($scope.allUsers.length > $scope.usersLimit) {
Expand Down Expand Up @@ -113,6 +113,14 @@ angular.module('nethvoiceWizardUiApp')
}
$scope.currentUser.webRtcState = false
})
UserService.getNethLinkExtension($scope.currentUser.default_extension).then(function (res) {
$scope.currentUser.nethLinkState = true
}, function (err) {
if (err.status != 404) {
console.log(err)
}
$scope.currentUser.nethLinkState = false
})
UserService.getMobileExtension($scope.currentUser.default_extension).then(function (res) {
$scope.currentUser.mobileAppState = true
}, function (err) {
Expand Down Expand Up @@ -572,6 +580,29 @@ angular.module('nethvoiceWizardUiApp')
}
}

$scope.setNethLink = function (event, state) {
$scope.currentUser.setNethLinkInAction = true
if ($scope.currentUser.nethLinkState) {
UserService.createNethLinkExtension({
extension: $scope.currentUser.default_extension
}).then(function (res) {
$scope.currentUser.setNethLinkInAction = false
getAllUsers(false)
}, function (err) {
console.log(err)
$scope.currentUser.setNethLinkInAction = false
})
} else {
UserService.deleteNethLinkExtension($scope.currentUser.default_extension).then(function (res) {
$scope.currentUser.setNethLinkInAction = false
getAllUsers(false)
}, function (err) {
console.log(err)
$scope.currentUser.setNethLinkInAction = false
})
}
}

$scope.setProfile = function () {
ProfileService.setUserProfile($scope.currentUser.id, {
profile_id: $scope.currentUser.profile
Expand Down
30 changes: 30 additions & 0 deletions wizard/app/scripts/services/userservice.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,36 @@ angular.module('nethvoiceWizardUiApp')
});
};

this.getNethLinkExtension = function (mainextension) {
return $q(function (resolve, reject) {
RestService.get('/nethlink/' + mainextension).then(function (res) {
resolve(res);
}, function (err) {
reject(err);
});
});
};

this.createNethLinkExtension = function (obj) {
return $q(function (resolve, reject) {
RestService.post('/nethlink', obj).then(function (res) {
resolve(res);
}, function (err) {
reject(err);
});
});
};

this.deleteNethLinkExtension = function (mainextension) {
return $q(function (resolve, reject) {
RestService.delete('/nethlink/' + mainextension).then(function (res) {
resolve(res);
}, function (err) {
reject(err);
});
});
};

this.retrieveFinalInfo = function () {
return $q(function (resolve, reject) {
RestService.get('/final').then(function (res) {
Expand Down
53 changes: 47 additions & 6 deletions wizard/app/views/configurations/preferences.html
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ <h1 class="control-label centered" for="textInput-markup">{{'Users Configuration
</div>
<div class="modal-body">
<ul class="modalListConfiguration">
<li class="listConfiguration"><b>{{"Indirizzo Centralino" | translate}}:</b> {{hostname}}</li>
<li class="listConfiguration"><b>{{"Indirizzo Centralino" | translate}}:</b> {{hostname}}</li>
<li class="listConfiguration"><b>{{"Configurare porta 5061" | translate}}</b> </li>
<li class="listConfiguration"><b>{{"Abilitare trasporto TLS" | translate}}</b></li>
<li class="listConfiguration"><b>{{"Configurare audio sicuro SRTP" | translate}}</b></li>
Expand All @@ -318,7 +318,7 @@ <h1 class="control-label centered" for="textInput-markup">{{'Users Configuration
<i ng-show="copiedPassword" class="fa fa-check copyedPassword text-color-green absolute-position mt-5 ml-7 fz-15">
</i>
</li>
</ul>
</ul>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{"Close"| translate}}</button>
Expand Down Expand Up @@ -351,7 +351,7 @@ <h1 class="control-label centered" for="textInput-markup">{{'Users Configuration
<i ng-show="copiedPassword" class="fa fa-check copyedPassword text-color-green absolute-position mt-5 ml-7 fz-15">
</i>
</li>
</ul>
</ul>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{"Close"| translate}}</button>
Expand All @@ -363,7 +363,7 @@ <h1 class="control-label centered" for="textInput-markup">{{'Users Configuration
<div
class="col-lg-5 mnw-180 {{!device.mac ? 'eswitch-mt2' : 'eswitch-mt'}}"
ng-if="device.type != 'temporaryphysical'"
>
>
<div class="list-view-pf-additional-info config-info ">
<input
bs-switch
Expand Down Expand Up @@ -424,8 +424,8 @@ <h1 class="control-label centered" for="textInput-markup">{{'Users Configuration
<div class="col-lg-6">
<div class="form-group no-margin-bottom">
<div class="display-flex">
<input
bs-switch
<input
bs-switch
ng-model="currentUser.webRtcState"
ng-change="setWebRTC()"
id="bootstrap-switch-webrtc-{{currentUser.id}}"
Expand Down Expand Up @@ -482,6 +482,47 @@ <h1 class="control-label centered" for="textInput-markup">{{'Users Configuration
</div>
</div>
</div>
<!-- nethlink -->
<div class="list-group-item abstract-item cursor-default ng-scope">
<div class="list-view-pf-actions">
<div class="display-flex">
</div>
</div>
<div class="list-view-pf-main-info">
<div class="list-view-pf-left">
<span class="fa fa-headphones list-view-pf-icon-sm "></span>
</div>
<div class="list-view-pf-body">
<div class="list-view-pf-description">
<div class="list-group-item-heading configDevices-item-heading">
{{"NethLink" | translate}}
<span ng-repeat="device in user.devices" ng-if="device.type == 'nethlink'">
<span>-</span> <span>{{device.extension}}</span>
</span>
</div>
<span class="weight-plus">
</span>
<div class="list-group-item-text">
<div class="col-lg-6">
<div class="form-group no-margin-bottom">
<div class="display-flex">
<input
bs-switch
ng-model="currentUser.nethLinkState"
ng-change="setNethLink()"
id="bootstrap-switch-nethlink-{{currentUser.id}}"
class="bootstrap-switch bootstrap-switch-webrtc col-lg-6 col-md-6 col-sm-12 col-xs-12"
type="checkbox">
</div>
</div>
</div>
</div>
</div>
<div class="list-view-pf-additional-info config-info">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
Expand Down

0 comments on commit 42d77cf

Please sign in to comment.