Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wizard UI. major/minor fixes for NS8 #185

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
668 changes: 661 additions & 7 deletions LICENSE

Large diffs are not rendered by default.

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
1 change: 1 addition & 0 deletions wizard/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ module.exports = function (grunt) {
'!<%= yeoman.dist %>/images/4.jpg',
'!<%= yeoman.dist %>/images/5.jpg',
'!<%= yeoman.dist %>/images/6.jpg',
'!<%= yeoman.dist %>/images/login.png',
'!<%= yeoman.dist %>/scripts/custom.js',
'!<%= yeoman.dist %>/lib/clipboard-copy-element/dist/index.umd.js',
'!<%= yeoman.dist %>/styles/brand.css',
Expand Down
Binary file added wizard/app/images/login.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
208 changes: 3 additions & 205 deletions wizard/app/scripts/controllers/admin/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
angular.module('nethvoiceWizardUiApp')
.controller('AdminSettingsCtrl', function ($scope, UserService, RestService, RestServiceCTI, ConfigService, ModelService) {
$scope.wizard.isEnd = false
$scope.view.changeRoute = true
$scope.externalIp = ""
$scope.localNetworks = []
$scope.localNrFields = 1
$scope.view.changeRoute = false
$scope.conferenceUrl = ""
$scope.conferenceUrlSuccess = false
$scope.conferenceUrlError = false
Expand All @@ -28,12 +25,10 @@ angular.module('nethvoiceWizardUiApp')
RestServiceCTI.setAuthHeader('admin', hash);
$scope.onSaveSuccess = true;
$scope.onSaveError = false;
if ($scope.wizard.isWizard && $scope.natSaved) {
if ($scope.wizard.isWizard ) {
$scope.wizard.isEnd = true
$scope.passwordSaved = true
} else if ($scope.wizard.isWizard) {
$scope.passwordSaved = true
}
}
}, function (err) {
$scope.onSaveSuccess = false;
$scope.onSaveError = true;
Expand All @@ -44,199 +39,6 @@ angular.module('nethvoiceWizardUiApp')
}
};

var getSuggestedIp = function () {
ConfigService.getSuggestedIp().then(function (res) {
$scope.externalIp = res.data
$scope.view.changeRoute = false
$scope.$apply()
}, function (err) {
console.log(err);
$scope.view.changeRoute = false
$scope.$apply()
})
}

var initNat = function () {
ConfigService.getExternalIp().then(function (res) {
if (!res.data) {
if ($scope.wizard.provisioning != "tancredi") {
getSuggestedIp()
} else {
ModelService.getDefaults().then(function (defaultsRes) {
ModelService.checkConnectivity({
"host": defaultsRes.data.hostname,
"scheme": defaultsRes.data.provisioning_url_scheme
}).then(function (res) {
if (res.data.valid_certificate) {
$scope.externalIp = defaultsRes.data.hostname
$scope.view.changeRoute = false
$scope.$apply()
} else {
getSuggestedIp()
}
setTimeout(function () {
$scope.$apply()
}, 100)
}, function (err) {
console.log(err);
})
}, function (err) {
console.log(err)
})
}
} else {
$scope.externalIp = res.data
setTimeout(function () {
$scope.view.changeRoute = false
$scope.$apply()
}, 1000)
}
}, function (err) {
console.log(err)
})
ConfigService.getLocalNetworks().then(function (res) {
if (res.data) {
$scope.localNetworks = res.data
}
if (res.data && parseInt(res.data.length) > 1) {
$scope.localNrFields = res.data.length
}
}, function (err) {
console.log(err)
})
}

var initFirewall = function () {
ConfigService.getExternalSip().then(function (res) {
$scope.sipTlsStatus = res.data == "disabled" ? false : true
}, function (err) {
console.log(err)
})
}

$scope.openSaveNat = function () {
$("#saveNat").modal("show")
}

$scope.saveNat = function () {
for (let index in $scope.localNetworks) {
if ($scope.localNetworks[index] == {} || !$scope.localNetworks[index].net) {
$scope.localNrFields = $scope.localNrFields - 1
$scope.localNetworks.splice( index, 1 );
}
}
$scope.loadingNatAction = true
let p1 = ConfigService.setExternalIp($scope.externalIp)
let p2 = ConfigService.setLocalNetworks($scope.localNetworks)
Promise.all([p1, p2]).then(function (res) {
$scope.loadingNatAction = "ok"
$scope.onSettingsSaveSuccess = true
if ($scope.wizard.isWizard && $scope.passwordSaved) {
$scope.wizard.isEnd = true
$scope.natSaved = true
} else if ($scope.wizard.isWizard) {
$scope.natSaved = true
}
setTimeout(function () {
$("#saveNat").modal("hide")
}, 700)
$scope.$apply()
}, function (err) {
console.log(err)
$scope.loadingNatAction = "err"
setTimeout(function () {
$("#saveNat").modal("hide")
}, 700)
$scope.onSettingsSaveError = true
})
}

var ldapPhoneebookCheck = function () {
ModelService.ldapCheck().then(function (res) {
$scope.phonebookjsStatus = res.data.ldap.enabled
$scope.phonebookjssStatus = res.data.ldaps.enabled
}, function (err) {
console.log(err);
})
}

var getPhonebookSettings = function () {
ConfigService.getPhonebookSettings().then(function (res) {
$scope.rapidCodePbx = res.data.speeddial
$scope.pbxExtensions = res.data.extensions
$scope.publicContactsPbx = res.data.nethcti
}, function (err) {
console.log(err);
})
}

$scope.toggleRapidCode = function () {
let status = $scope.rapidCodePbx ? "enabled" : "disabled"
ConfigService.switchRapidCode(status).then(function (res) {
// toggle success
}, function (err) {
$scope.rapidCodePbx = !$scope.rapidCodePbx
console.log(err)
})
}

$scope.togglePbxExtensions = function () {
let status = $scope.pbxExtensions ? "enabled" : "disabled"
ConfigService.switchPbxExtensions(status).then(function (res) {
// toggle success
}, function (err) {
$scope.pbxExtensions = !$scope.pbxExtensions
console.log(err)
})
}

$scope.togglePublicContacts = function () {
let status = $scope.publicContactsPbx ? "enabled" : "disabled"
ConfigService.switchPublicContacts(status).then(function (res) {
// toggle success
}, function (err) {
$scope.publicContactsPbx = !$scope.publicContactsPbx
console.log(err)
})
}

$scope.togglePhonebookjs = function () {
let status = $scope.phonebookjsStatus ? "enabled" : "disabled"
ConfigService.switchPhonebookJs(status).then(function (res) {
// phonebook js enabled
}, function (err) {
console.log(err)
})
}

$scope.togglePhonebookjss = function () {
let status = $scope.phonebookjssStatus ? "enabled" : "disabled"
ConfigService.switchPhonebookJss(status).then(function (res) {
// phonebook jss enabled
}, function (err) {
console.log(err)
})
}

$scope.deleteField = function () {
$scope.localNrFields = $scope.localNrFields - 1
$scope.localNetworks.pop()
}

$scope.addField = function () {
$scope.localNrFields = $scope.localNrFields + 1
$scope.localNetworks.push({})
}

$scope.toggleSipTls = function () {
let status = $scope.sipTlsStatus === false ? "disabled" : "enabled"
ConfigService.setExternalSip(status).then(function (res) {
// success
}, function (err) {
console.log(err)
})
}

var getConferenceUrl = function () {
ConfigService.getConferenceUrl().then(function (res) {
$scope.conferenceUrl = res.data
Expand All @@ -263,10 +65,6 @@ angular.module('nethvoiceWizardUiApp')
}

var init = function () {
initNat()
initFirewall()
ldapPhoneebookCheck()
getPhonebookSettings()
getConferenceUrl()
$("#saveNat").on("hidden.bs.modal", function () {
$scope.loadingNatAction = ""
Expand Down
20 changes: 18 additions & 2 deletions wizard/app/scripts/controllers/apps/cards.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,19 @@ angular.module('nethvoiceWizardUiApp')
'pink': '#e03997',
'brown': '#a5673f'
};
$scope.mapColors = {
'red': 'red-600',
'orange': 'yellow-600',
'yellow': 'yellow-500',
'olive': 'lime-800',
'green': 'emerald-600',
'teal': 'green-400',
'blue': 'blue-600',
'violet': 'violet-500',
'purple': 'purple-600',
'pink': 'pink-500',
'brown': 'yellow-800'
};

$scope.sourcePortMap = {
"mssql:7_1": '1433',
Expand Down Expand Up @@ -85,7 +98,8 @@ angular.module('nethvoiceWizardUiApp')
};
var replace = oldColor;
var re = new RegExp(RegExp.quote(replace), "g");
g.html = g.html.replace(re, color).replace('<!-- color: ' + oldColor + ' -->\n', '<!-- color: ' + color + ' -->\n');

g.html = g.html.replace('bg-' + $scope.mapColors[oldColor], 'bg-' + $scope.mapColors[color]);
};

$scope.editorOnChange = function (e) {
Expand Down Expand Up @@ -329,6 +343,7 @@ angular.module('nethvoiceWizardUiApp')
};
$scope.switchResultsData = function (t) {
var template = '';
var t = t.split('_')[0];
switch (t) {
case 'table':
template = JSON.stringify([{
Expand Down Expand Up @@ -501,7 +516,8 @@ angular.module('nethvoiceWizardUiApp')
template: g.template,
query: btoa(g.query)
}).then(function (res) {
g.render_html = '<style>body{overflow: auto !important; padding: 5px !important;}</style><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.10/semantic.min.css"/>' + atob(res.data.html);

g.render_html = '<style>body{overflow: auto !important; padding: 5px !important;}</style><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/2.2.19/tailwind.min.css"/>' + atob(res.data.html);
g.isChecking = false;
}, function (err) {
g.isChecking = false;
Expand Down
9 changes: 0 additions & 9 deletions wizard/app/scripts/controllers/devices/models.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ angular.module('nethvoiceWizardUiApp')
for (let model in res.data) {
if (res.data[model].name.split("-").length > 2
&& !$scope.inventoryModels.find(function (el) { return el.name === res.data[model].name; })) {
$scope.inventoryModels.push(res.data[model])
}
}
}, function (err) {
Expand Down Expand Up @@ -133,14 +132,6 @@ angular.module('nethvoiceWizardUiApp')
})
}

$scope.listModels = function () {
ModelService.getUsedModels().then(function (res) {
// get models
}, function (err) {
console.log(err)
})
}

$scope.showNewModelModal = function () {
$("#newModelModal").modal("show")
$scope.newModelShown = true
Expand Down
9 changes: 1 addition & 8 deletions wizard/app/scripts/controllers/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ angular.module('nethvoiceWizardUiApp')
$location.path('/');
$('#loginTpl').show();
$scope.login.isLogged = false;
$scope.setRandomBackground();
};

$scope.copyUrl = function () {
Expand Down Expand Up @@ -97,10 +96,6 @@ angular.module('nethvoiceWizardUiApp')
}
};

$scope.setRandomBackground = function () {
$('body').css('background', 'linear-gradient( rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.95) ), url(images/' + Math.floor(Math.random() * (6 - 1) + 1) + '.jpg)');
};

$scope.toggleNavBar = function () {
if (window.screen.width < 768) {
if ($('#navbar-left').hasClass('show-mobile-nav')) {
Expand Down Expand Up @@ -427,9 +422,7 @@ angular.module('nethvoiceWizardUiApp')
$rootScope.$on('selectpickerRepeatEndRevised', function(event, id) {
$("#" + id).selectpicker().parent().parent().removeClass("hidden")
})

$scope.setRandomBackground();


// provisining build models start

$scope.currentModel = {}
Expand Down
4 changes: 3 additions & 1 deletion wizard/app/scripts/filters/ejsrender.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ angular.module('nethvoiceWizardUiApp')
}
return true;
}
return '<style>body{overflow-x: auto !important; padding: 5px !important;}</style><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.10/semantic.min.css"/>'+ejs.render(input, {
var cssLibrary = '<style>body{overflow-x: auto !important; padding: 5px !important;}</style><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/2.2.19/tailwind.min.css"/>';

return cssLibrary+ejs.render(input, {
results: isJson(data) ? JSON.parse(data) : [{}],
name: name
});
Expand Down
Loading