Skip to content

Commit

Permalink
step 5 & 6. physical trunks: show config immediately
Browse files Browse the repository at this point in the history
  • Loading branch information
edospadoni committed Nov 23, 2023
1 parent 7df12cc commit fc7723c
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 73 deletions.
31 changes: 4 additions & 27 deletions wizard/app/scripts/controllers/trunks/physical.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@ angular.module('nethvoiceWizardUiApp')
$scope.allDevices = {};
$scope.allVendors = {};
$scope.allModels = {};
$scope.networks = {};
$scope.networkLength = 0;
$scope.sipTrunks = {};
$scope.selectedDevice = {};
$scope.newGateway = {};
$scope.onSave = false;
$scope.scanned = false;
$scope.users = [];
$scope.physicalLimit = {};
$scope.stringToCheckGrandstream = "grandstream";
Expand Down Expand Up @@ -95,25 +92,16 @@ angular.module('nethvoiceWizardUiApp')

$scope.getNetworkList = function (reload) {
$scope.view.changeRoute = reload;
ConfigService.getNetworks().then(function (res) {
$scope.networks = res.data;
for (var eth in res.data) {
$scope.allDevices[eth] = [];
}
$scope.networkLength = Object.keys(res.data).length;
$scope.view.changeRoute = false;
}, function (err) {
console.log(err);
$scope.view.changeRoute = false;
});
$scope.getGatewayList('eth-fake', 'fake-network');
$scope.view.changeRoute = false;
};

$scope.getGatewayList = function (key, network) {
DeviceService.gatewayListByNetwork(network).then(function (res) {
$scope.allDevices[key] = res.data;
$scope.pushKey(key);
$scope.selectedDevice = res.data[0];
$scope.onSave = false;
$scope.scanned = true;
}, function (err) {
console.log(err);
});
Expand All @@ -131,14 +119,6 @@ angular.module('nethvoiceWizardUiApp')
}
}

$scope.startScan = function (key, network) {
DeviceService.startScan(network).then(function (res) {
$scope.getGatewayList(key, network);
}, function (err) {
console.log(err);
});
};

$scope.updateExtraFields = function (device) {
var tempArr = $scope.allModels[device.manufacturer];
var base_num = device.manufacturer === 'Patton' ? 0 : 1;
Expand Down Expand Up @@ -285,10 +265,7 @@ angular.module('nethvoiceWizardUiApp')
device.onDeleteSuccess = true;
device.onPushSuccess = false;
$scope.selectedDevice = {};
$scope.getGatewayList(device.network_name, {
netmask: device.netmask_green,
ip: device.ipv4_green
});
$scope.getGatewayList('eth-fake', 'fake-network');
//trunks
TrunkService.count().then(function (res) {
$scope.menuCount.trunks = res.data;
Expand Down
5 changes: 4 additions & 1 deletion wizard/app/scripts/i18n/locale-it.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
"Status": "Stato",
"Add user": "Aggiungi utente",
"Add gateway": "Aggiungi gateway",
"Main network": "Rete principale",
"Create user": "Crea utente",
"Go": "Vai",
"Netmask": "Maschera di rete",
Expand Down Expand Up @@ -1061,5 +1062,7 @@
"Google STT official page": "Pagina ufficiale di Google SST",
"Google STT official documentation": "Documentazione ufficiale di Google SST",
"Google Speec-to-text": "Google Speech-to-Text",
"Token description": "Per accedere ai servizi di Google Cloud, è necessario fornire un token di autorizzazione valido. Puoi caricare il file JSON contenente le credenziali necessarie tramite il pulsante 'Upload'. Una volta caricato il file, il sistema utilizzerà le credenziali contenute nel JSON per autenticare le tue richieste ai servizi di Google Cloud."
"Token description": "Per accedere ai servizi di Google Cloud, è necessario fornire un token di autorizzazione valido. Puoi caricare il file JSON contenente le credenziali necessarie tramite il pulsante 'Upload'. Una volta caricato il file, il sistema utilizzerà le credenziali contenute nel JSON per autenticare le tue richieste ai servizi di Google Cloud.",
"No gateways configured": "Nessun gateway configurato",
"Click on the button below to add you first gateway": "Clicca sul pulsante qui sotto per aggiungere il tuo primo gateway"
}
4 changes: 4 additions & 0 deletions wizard/app/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -3686,3 +3686,7 @@ a.black:active {
.adjust-search-button {
height: 33px;
}

.adjust-center {
text-align: center !important;
}
64 changes: 19 additions & 45 deletions wizard/app/views/trunks/physical.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,13 @@

<div class="wizard-pf-contents adjust-size">
<h1 class="control-label centered" for="textInput-markup">{{'Physical lines configuration' | translate}}</h1>
<div ng-if="!(networks | isEmpty)" class="container-fluid">
<div class="col-xs-12 col-sm-6 col-md-{{12/networkLength}} col-lg-{{12/networkLength}} physical-margin-top" ng-repeat="(key, network) in networks">
<div class="card-pf card-pf-view adjust-card">
<div class="card-pf-body">
<div class="card-pf-top-element">
<span class="pficon pficon-network card-pf-icon-circle"></span>
</div>
<h2 class="card-pf-title text-center">
{{key}} | <span class="weight">{{network.network}}</span>
</h2>
<div class="card-pf-items text-center">
<div class="card-pf-item">
<span class="pficon pficon-screen"></span>
<span class="card-pf-item-text"><b>{{network.ip}}</b> / </span>
<span class="inline-display" popover-placement="top" popover-trigger="'mouseenter'" popover-animation="true" uib-popover="{{'Netmask' | translate}}: {{network.netmask}}"><input ng-model="network.netmask" type="text" class="form-control config-form"></span>
</div>
</div>
</div>
</div>
</div>
</div>

<div ng-if="!(allDevices | isEmpty: true)" class="container-fluid scanned-lists col-lg-6 col-md-12 col-sm-12 col-xs-12">
<div ng-if="allDevices['eth-fake'].length > 0" class="container-fluid scanned-lists col-lg-6 col-md-12 col-sm-12 col-xs-12">
<div id="#{{networkName}}" class="list-group list-view-pf list-view-pf-view list-gateway max-containers-height resizePhysical" ng-repeat="(networkName, devices) in allDevices" ng-if="!(devices | isEmpty)" >
<div>
<div class="row">
<h1 class="col-lg-6 col-md-6 col-sm-12 col-xs-12 adjust-header">
<span class="pficon pficon-network card-pf-icon-circle config-title-icon"></span>{{networkName}} <span class="weight weight-gateway">{{networks[networkName].network}}</span>
<span class="pficon pficon-network card-pf-icon-circle config-title-icon"></span>{{'Main network' | translate}}
</h1>
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12 adjust-search adjust-search-gateway">
<form role="form" class="search-pf has-button" id="form-lg-domains-details">
Expand All @@ -51,7 +30,7 @@ <h1 class="col-lg-6 col-md-6 col-sm-12 col-xs-12 adjust-header">
</div>
</div>
<div class="form-group">
<button class="btn btn-default btn-lg" type="submit">
<button class="btn btn-default btn-lg adjust-search-button" type="submit">
<span class="fa fa-search"></span>
</button>
</div>
Expand Down Expand Up @@ -102,6 +81,8 @@ <h1 class="col-lg-6 col-md-6 col-sm-12 col-xs-12 adjust-header">
<div class="config-button-list">
</div>
</div>
<button class="btn btn-primary"
data-toggle="modal" data-target="#newGwDialog">{{'Add gateway' | translate}}</button>
</div>
<div class="col-lg-6 col-md-12 col-sm-12 col-xs-12 config-adjust-size-gateway" ng-if="!(selectedDevice | isEmpty)">
<div ng-if="selectedDevice.onSaveSuccess" class="alert alert-success alert-dismissable adjust-alert-gateway">
Expand Down Expand Up @@ -214,36 +195,29 @@ <h1 class="control-label config-title-user" for="textInput-markup">
<div class="col-sm-12">
<div ng-show="selectedDevice.onSave" class="spinner spinner-sm adjust-margin loader-modal-gateway-not-form"></div>
<button data-toggle="modal" data-target="#confirmDeleteModal" ng-show="selectedDevice.isConfigured" type="button" ng-disabled="selectedDevice.onSave" class="btn btn-danger col-md-1 right-align">{{'Delete' | translate}}</button>
<button data-toggle="modal" data-target="#confirmPushModal" ng-show="selectedDevice.isConfigured && selectedDevice.isConnected && !selectedDevice.isGrandStream" type="button" ng-disabled="selectedDevice.onSave" class="btn btn-warning col-md-1 left-align">{{'Push' | translate}}</button>
<button data-toggle="modal" data-target="#confirmPushModal" ng-show="selectedDevice.isConfigured && selectedDevice.isConnected && !selectedDevice.isGrandStream" type="button" ng-disabled="selectedDevice.onSave" class="btn btn-warning col-md-1 left-align adjust-center">{{'Push' | translate}}</button>
<button ng-show="!selectedDevice.isConfigured" ng-disabled="selectedDevice.onSave" type="submit" class="btn btn-primary col-md-1 right-align">{{'Save' | translate}}</button>
</div>
</div>
</form>
</div>

<div ng-if="networks | isEmpty" class="blank-slate-pf ">
<div class="blank-slate-pf-icon">
<span class="pficon pficon-network"></span>
</div>
<h1>
{{'No networks found' | translate}}
</h1>
<p>
{{'There are problems to get networks configurations' | translate}}
</p>
</div>

<div ng-if="!(networks | isEmpty) && (allDevices | isEmpty: true) && scanned == true" class="blank-slate-pf ">
<div class="blank-slate-pf-icon">
<div ng-show="allDevices['eth-fake'].length == 0" class="blank-slate-pf">
<div class="blank-slate-pf-icon mtn-30">
<span class="pficon pficon-container-node"></span>
</div>
<h1>
{{ 'No devices found' | translate }}
<h1 class="mb-25 mt-25">
{{'No gateways configured' | translate}}
</h1>
<p>
{{'Check if the devices are connected in your network' | translate}}
</p>
</div>
<div class="mb-25">
<p>
{{"Click on the button below to add you first gateway" | translate}}
</p>
</div>
<div class="blank-slate-pf-main-action mb-30 mt-15">
<button class="btn btn-lgg btn-primary"
data-toggle="modal" data-target="#newGwDialog">{{'Add gateway' | translate}}</button>
</div>
</div>

<div class="modal fade" id="newGwDialog" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
Expand Down

0 comments on commit fc7723c

Please sign in to comment.