From 746696894180526f8358e483f150affaaaac8079 Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Thu, 7 Aug 2014 13:44:56 -0400 Subject: [PATCH] added an about dialog that give copyright information about Tower --- awx/ui/static/js/app.js | 12 +++-- awx/ui/static/js/helpers/AboutAnsible.js | 64 ++++++++++++++++++++++++ awx/ui/static/less/ansible-ui.less | 11 ++++ awx/ui/static/partials/about.html | 14 ++++++ awx/ui/templates/ui/index.html | 6 +++ 5 files changed, 104 insertions(+), 3 deletions(-) create mode 100644 awx/ui/static/js/helpers/AboutAnsible.js create mode 100644 awx/ui/static/partials/about.html diff --git a/awx/ui/static/js/app.js b/awx/ui/static/js/app.js index 798fd7605a..0fd5283f62 100644 --- a/awx/ui/static/js/app.js +++ b/awx/ui/static/js/app.js @@ -113,7 +113,8 @@ angular.module('Tower', [ 'SocketIO', 'lrInfiniteScroll', 'LoadConfigHelper', - 'SocketHelper' + 'SocketHelper', + 'AboutAnsibleHelpModal' ]) .constant('AngularScheduler.partials', urlPrefix + 'lib/angular-scheduler/lib/') @@ -421,9 +422,10 @@ angular.module('Tower', [ }]) .run(['$compile', '$cookieStore', '$rootScope', '$log', 'CheckLicense', '$location', 'Authorization', 'LoadBasePaths', 'Timer', 'ClearScope', 'HideStream', 'Socket', - 'LoadConfig', 'Store', 'ShowSocketHelp', 'LicenseViewer', + 'LoadConfig', 'Store', 'ShowSocketHelp', 'LicenseViewer', 'AboutAnsibleHelp', function ($compile, $cookieStore, $rootScope, $log, CheckLicense, $location, Authorization, LoadBasePaths, Timer, ClearScope, HideStream, Socket, - LoadConfig, Store, ShowSocketHelp, LicenseViewer) { + LoadConfig, Store, ShowSocketHelp, LicenseViewer, AboutAnsibleHelp) { + var e, html, sock, checkCount = 0; @@ -542,6 +544,10 @@ angular.module('Tower', [ activateTab(); + $rootScope.viewAboutTower = function(){ + AboutAnsibleHelp(); + }; + $rootScope.viewCurrentUser = function () { $location.path('/users/' + $rootScope.current_user.id); }; diff --git a/awx/ui/static/js/helpers/AboutAnsible.js b/awx/ui/static/js/helpers/AboutAnsible.js new file mode 100644 index 0000000000..65d55db71f --- /dev/null +++ b/awx/ui/static/js/helpers/AboutAnsible.js @@ -0,0 +1,64 @@ +/********************************************* + * Copyright (c) 2014 AnsibleWorks, Inc. + * + * Dashboard.js + * + * The new dashboard + * + */ + +'use strict'; + +angular.module('AboutAnsibleHelpModal', ['RestServices', 'Utilities','ModalDialog']) + .factory('AboutAnsibleHelp', ['$rootScope', '$compile', '$location' , 'Rest', 'GetBasePath', 'ProcessErrors', 'Wait', 'CreateDialog', + function ($rootScope, $compile , $location, Rest, GetBasePath, ProcessErrors, Wait, CreateDialog) { + return function () { + + var scope= $rootScope.$new(), + url; + + url = GetBasePath('config'); + Rest.setUrl(url); + Rest.get() + .success(function (data){ + scope.$emit('BuildAboutDialog', data); + }) + .error(function (data, status) { + ProcessErrors(scope, data, status, null, { hdr: 'Error!', + msg: 'Failed to get: ' + url + ' GET returned: ' + status }); + }); + + + if (scope.removeDialogReady) { + scope.removeDialogReady(); + } + scope.removeDialogReady = scope.$on('DialogReady', function() { + // element = angular.element(document.getElementById('about-modal-dialog')); + // $compile(element)(scope); + $('#about-modal-dialog').dialog('open'); + }); + + if (scope.removeBuildAboutDialog) { + scope.removeBuildAboutDialog(); + } + scope.removeBuildAboutDialog = scope.$on('BuildAboutDialog', function(e, data) { + var str = data.version; + if(str.search('-')){ + str = str.substr(0,str.search('-')); + } + $('#about-modal-version').html(str); + CreateDialog({ + id: 'about-modal-dialog', + scope: scope, + buttons: [], + width: 600, + height: 300, + minWidth: 300, + // title: , //'' ,//'About Ansible', + callback: 'DialogReady' + }); + }); + + }; + } +]); \ No newline at end of file diff --git a/awx/ui/static/less/ansible-ui.less b/awx/ui/static/less/ansible-ui.less index 8046e7710d..0078e5382b 100644 --- a/awx/ui/static/less/ansible-ui.less +++ b/awx/ui/static/less/ansible-ui.less @@ -128,6 +128,17 @@ a:focus { background-color: #FFF; } +#about-modal-logo{ + width: 150px; + height: 150px; + margin-left: 10px; + margin-top: 10px; +} +#about-modal-titlelogo{ + margin-bottom: 10px; + +} + /* Make buttons appear to be disabled, but allow mouse events */ .btn-disabled { opacity: 0.35; diff --git a/awx/ui/static/partials/about.html b/awx/ui/static/partials/about.html new file mode 100644 index 0000000000..c23e76d526 --- /dev/null +++ b/awx/ui/static/partials/about.html @@ -0,0 +1,14 @@ +
+
+ + +
+
+
+

Tower Version

+ +
+

Visit Ansible.com for more information!

+
+
+ diff --git a/awx/ui/templates/ui/index.html b/awx/ui/templates/ui/index.html index bda08a056e..03fe42fa3a 100644 --- a/awx/ui/templates/ui/index.html +++ b/awx/ui/templates/ui/index.html @@ -157,6 +157,7 @@ + @@ -184,6 +185,7 @@ Inventories Job Templates Jobs + About Tower Account Settings View License Contact Support @@ -220,6 +222,7 @@
  • Hello,