Skip to content

Commit

Permalink
Wizard UI. major/minor fixes for NS8 (#186)
Browse files Browse the repository at this point in the history
  • Loading branch information
edospadoni authored Nov 24, 2023
1 parent 7166de0 commit 9cb4def
Show file tree
Hide file tree
Showing 26 changed files with 1,356 additions and 445 deletions.
1 change: 1 addition & 0 deletions wizard/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
/dist
package-lock.json
yarn.lock
app/scripts/custom.js*
3 changes: 0 additions & 3 deletions wizard/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,6 @@
<div ng-if="!wizard.isWizard" class="panel-body adjust-panel-body list-group-item collapse-menu {{resolveActiveTab('cards',2) ? 'active' : ''}}">
<div ng-click="goTo('apps/cards')" class="list-group-item-value menu-item-left no-opacity full-width">{{'Customer cards' | translate | ellipsis:'1200'}}</div>
</div>
<div ng-if="!wizard.isWizard" class="panel-body adjust-panel-body list-group-item collapse-menu {{resolveActiveTab('streaming',2) ? 'active' : ''}}">
<div ng-click="goTo('apps/streaming')" class="list-group-item-value menu-item-left no-opacity full-width">{{'Video sources' | translate | ellipsis:'1200'}}</div>
</div>
<div ng-if="!wizard.isWizard" class="panel-body adjust-panel-body list-group-item collapse-menu {{resolveActiveTab('phonebook',2) ? 'active' : ''}}">
<div ng-click="goTo('apps/phonebook')" class="list-group-item-value menu-item-left no-opacity full-width">{{'Phonebook sources' | translate | ellipsis:'1200'}}</div>
</div>
Expand Down
5 changes: 0 additions & 5 deletions wizard/app/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,6 @@ angular
controller: 'AppsCardsCtrl',
controllerAs: 'apps/cards'
})
.when('/apps/streaming', {
templateUrl: 'views/apps/streaming.html',
controller: 'AppsStreamingCtrl',
controllerAs: 'apps/streaming'
})
.when('/apps/paramurl', {
templateUrl: 'views/apps/paramurl.html',
controller: 'AppsParamurlCtrl',
Expand Down
52 changes: 6 additions & 46 deletions wizard/app/scripts/controllers/admin/languages.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,58 +51,18 @@ angular.module('nethvoiceWizardUiApp')
$scope.onSaveSuccess = false;
$scope.onSaveError = false;
$scope.wizard.nextState = true;
ConfigService.setPBXLang({

// set default language
ConfigService.setDefaultPBXLang({
lang: lang
}).then(function (res) {
$scope.taskPromise = $interval(function () {
UtilService.taskStatus(res.data.result).then(function (res) {
if (res.data.progress < 100) {
$scope.errorCount = 0;
$scope.currentProgress = res.data.progress;
} else if (res.data.progress == 100) {
$scope.errorCount = 0;
$interval.cancel($scope.taskPromise);
$scope.currentProgress = 100;
// set default language
ConfigService.setDefaultPBXLang({
lang: lang
}).then(function (res) {
$scope.currentLanguage = $scope.language;
$scope.onSaveSuccess = true;
$scope.onSaveError = false;
}, function (err) {
console.error(err);
$scope.onSaveSuccess = false;
$scope.onSaveError = true;
});
} else {
console.log(res.error);
if ($scope.errorCount < appConfig.MAX_TRIES) {
$scope.errorCount++;
} else {
$interval.cancel($scope.taskPromise);
$scope.currentProgress = -1;
$scope.onSaveSuccess = false;
$scope.onSaveError = true;
}
}
}, function (err) {
console.log(err);
if ($scope.errorCount < appConfig.MAX_TRIES) {
$scope.errorCount++;
} else {
$interval.cancel($scope.taskPromise);
$scope.currentProgress = -1;
$scope.onSaveSuccess = false;
$scope.onSaveError = true;
}
});
}, 5000);
$scope.currentLanguage = $scope.language;
$scope.onSaveSuccess = true;
$scope.onSaveError = false;
}, function (err) {
console.error(err);
$scope.onSaveSuccess = false;
$scope.onSaveError = true;
$scope.currentProgress = 100;
});
};

Expand Down
30 changes: 0 additions & 30 deletions wizard/app/scripts/controllers/admin/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ angular.module('nethvoiceWizardUiApp')
.controller('AdminSettingsCtrl', function ($scope, UserService, RestService, RestServiceCTI, ConfigService, ModelService) {
$scope.wizard.isEnd = false
$scope.view.changeRoute = false
$scope.conferenceUrl = ""
$scope.conferenceUrlSuccess = false
$scope.conferenceUrlError = false

$scope.create = function () {
if ($scope.admin.password === $scope.admin.confirmPassword) {
Expand All @@ -27,7 +24,6 @@ angular.module('nethvoiceWizardUiApp')
$scope.onSaveError = false;
if ($scope.wizard.isWizard ) {
$scope.wizard.isEnd = true
$scope.passwordSaved = true
}
}, function (err) {
$scope.onSaveSuccess = false;
Expand All @@ -39,33 +35,7 @@ angular.module('nethvoiceWizardUiApp')
}
};

var getConferenceUrl = function () {
ConfigService.getConferenceUrl().then(function (res) {
$scope.conferenceUrl = res.data
}, function (err) {
console.log(err)
})
}

$scope.saveConferenceUrl = function () {
ConfigService.setConferenceUrl($scope.conferenceUrl).then(function () {
$scope.conferenceUrlSuccess = true
$scope.conferenceUrlError = false
if(!$scope.$$phase) {
$scope.$apply()
}
}, function (err) {
$scope.conferenceUrlError = true
$scope.conferenceUrlSuccess = false
if(!$scope.$$phase) {
$scope.$apply()
}
console.log(err)
})
}

var init = function () {
getConferenceUrl()
$("#saveNat").on("hidden.bs.modal", function () {
$scope.loadingNatAction = ""
})
Expand Down
45 changes: 4 additions & 41 deletions wizard/app/scripts/controllers/configurations/devices.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ angular.module('nethvoiceWizardUiApp')
$scope.allModels = {};
$scope.networks = {};
$scope.networkLength = 0;
$scope.tasks = {};
$scope.scanned = false;

$scope.orderByValue = function (value) {
Expand All @@ -33,7 +32,6 @@ angular.module('nethvoiceWizardUiApp')
ConfigService.getNetworks().then(function (res) {
$scope.networks = res.data;
for (var eth in res.data) {
$scope.tasks[eth] = {};
$scope.allDevices[eth] = {};
}
$scope.networkLength = Object.keys(res.data).length;
Expand All @@ -47,59 +45,24 @@ angular.module('nethvoiceWizardUiApp')
$scope.getPhoneList = function (key, network, callback) {
DeviceService.phoneListByNetwork(network).then(function (res) {
$scope.allDevices[key] = res.data;
$scope.tasks[key].currentProgress = 100;
$scope.scanned = true;
callback(null);
}, function (err) {
if (err.status !== 404) {
$scope.tasks[key].currentProgress = -1;
} else {
$scope.tasks[key].currentProgress = 100;
}
callback(err);
});
};

$scope.startScan = function (key, network) {
if ($scope.tasks[key].currentProgress > 0 && $scope.tasks[key].currentProgress < 100) {
return true;
}
$scope.tasks[key].startScan = true;
$scope.tasks[key].currentProgress = Math.floor((Math.random() * 50) + 10);
DeviceService.startScan(network).then(function (res) {
$scope.tasks[key].promise = $interval(function () {
UtilService.taskStatus(res.data.result).then(function (res) {
if (res.data.progress < 100) {
$scope.errorCount = 0;
} else if (res.data.progress == 100) {
$scope.tasks[key].errorCount = 0;
$interval.cancel($scope.tasks[key].promise);
$scope.getPhoneList(key, network, function (err) {
if (err) {
console.log(err);
}
});
} else {
console.log(res.error);
if ($scope.tasks[key].errorCount < appConfig.MAX_TRIES) {
$scope.tasks[key].errorCount++;
} else {
$interval.cancel($scope.tasks[key].promise);
$scope.tasks[key].currentProgress = -1;
}
}
}, function (err) {
$scope.getPhoneList(key, network, function (err) {
if (err) {
console.log(err);
if ($scope.tasks[key].errorCount < appConfig.MAX_TRIES) {
$scope.tasks[key].errorCount++;
} else {
$interval.cancel($scope.tasks[key].promise);
$scope.tasks[key].currentProgress = -1;
}
});
}, appConfig.INTERVAL_POLLING);
}
});
}, function (err) {
$scope.tasks[key].currentProgress = -1;
console.log(err);
});
};
Expand Down
Loading

0 comments on commit 9cb4def

Please sign in to comment.