github.com/justinjmoses/evergreen@v0.0.0-20170530173719-1d50e381ff0d/public/static/js/settings.js (about) 1 mciModule.controller('SettingsCtrl', ['$scope', '$http', '$window', 'notificationService', function($scope, $http, $window, notifier) { 2 $scope.timezones = [ 3 {str: "American Samoa, Niue", value: "Pacific/Niue"}, 4 {str: "Hawaii", value: "Pacific/Tahiti"}, 5 {str: "Marquesas Islands", value: "Pacific/Marquesas"}, 6 {str: "Alaska", value: "America/Anchorage"}, 7 {str: "Pacific Time", value: "America/Vancouver"}, 8 {str: "Mountain Time", value: "America/Denver"}, 9 {str: "Central Time", value: "America/Chicago"}, 10 {str: "Eastern Time", value: "America/New_York"}, 11 {str: "Venezuela", value: "America/Caracas"}, 12 {str: "Atlantic Time", value: "America/Barbados"}, 13 {str: "Newfoundland", value: "America/St_Johns"}, 14 {str: "Argentina, Paraguay", value: "America/Belem"}, 15 {str: "Fernando de Noronha", value: "America/Noronha"}, 16 {str: "Cape Verde", value: "Atlantic/Cape_Verde"}, 17 {str: "Iceland", value: "Atlantic/Reykjavik"}, 18 {str: "Central European Time, Nigeria", value: "Europe/Rome"}, 19 {str: "Egypt, Israel, Romania", value: "Europe/Bucharest"}, 20 {str: "Ethiopia, Iraq, Yemen", value: "Asia/Baghdad"}, 21 {str: "Iran", value: "Asia/Tehran"}, 22 {str: "Dubai, Moscow", value: "Europe/Moscow"}, 23 {str: "Afghanistan", value: "Asia/Kabul"}, 24 {str: "Maldives, Pakistan", value: "Antarctica/Davis"}, 25 {str: "India, Sri Lanka", value: "Asia/Kolkata"}, 26 {str: "Nepal", value: "Asia/Kathmandu"}, 27 {str: "Bangladesh, Bhutan", value: "Asia/Dhaka"}, 28 {str: "Cocos Islands, Myanmar", value: "Asia/Rangoon"}, 29 {str: "Thailand, Vietnam", value: "Asia/Bangkok"}, 30 {str: "China, Hong Kong, Perth", value: "Asia/Hong_Kong"}, 31 {str: "Eucla (Unofficial)", value: "Australia/Eucla"}, 32 {str: "Japan, South Korea", value: "Asia/Seoul"}, 33 {str: "Australia Central Time", value: "Australia/Adelaide"}, 34 {str: "Australia Eastern Time", value: "Australia/Sydney"}, 35 {str: "Lord Howe Island", value: "Australia/Lord_Howe"}, 36 {str: "Russia Vladivostok Time", value: "Asia/Vladivostok"}, 37 {str: "Norfolk Island", value: "Pacific/Norfolk"}, 38 {str: "Fiji, Russia Magadan Time", value: "Asia/Magadan"}, 39 {str: "Chatham Islands", value: "Pacific/Chatham"}, 40 {str: "Tonga", value: "Pacific/Tongatapu"}, 41 {str: "Kiribati Line Islands", value: "Pacific/Kiritimati"}, 42 ]; 43 44 $scope.user_tz = $window.user_tz; 45 $scope.new_tz = $scope.user_tz || "America/New_York"; 46 $scope.new_waterfall = $window.new_waterfall; 47 $scope.userConf = $window.userConf; 48 $scope.binaries = $window.binaries; 49 50 $scope.newKey = function(){ 51 if(!confirm("Generating a new API key will invalidate your current API key. Continue?")) 52 return 53 54 $http.post('/settings/newkey'). 55 success(function(data, status) { 56 $scope.userConf.api_key = data.key 57 $scope.selectConf() 58 }). 59 error(function(data, status, errorThrown) { 60 console.log(data,status); 61 }); 62 } 63 64 $scope.updateUserSettings = function(new_tz, new_waterfall) { 65 data = {timezone: new_tz, new_waterfall: new_waterfall}; 66 $http.put('/settings/', data) 67 .success(function(data, status) { 68 window.location.reload() 69 }) 70 .error(function(jqXHR, status, errorThrown) { 71 notifier.pushNotification("Failed to save changes: " + jqXHR,'errorHeader'); 72 }); 73 }; 74 }]);