sw2at-ui 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/app/assets/javascripts/swat/app/app.coffee +9 -0
- data/app/assets/javascripts/swat/app/controllers/global_nav.coffee +2 -0
- data/app/assets/javascripts/swat/app/controllers/management/configuration.coffee +13 -0
- data/app/assets/javascripts/swat/app/controllers/revision.coffee +3 -2
- data/app/assets/javascripts/swat/app/controllers/revisions.coffee +5 -1
- data/app/assets/javascripts/swat/app/controllers/root.coffee +3 -1
- data/app/assets/javascripts/swat/app/controllers/summary.coffee +5 -36
- data/app/assets/javascripts/swat/app/factories/global_control.coffee +23 -0
- data/app/assets/javascripts/swat/app/factories/summary/exception_groups.coffee +17 -0
- data/app/assets/javascripts/swat/app/factories/{fails_graph.coffee → summary/fails_graph.coffee} +0 -0
- data/app/assets/javascripts/swat/app/factories/summary/revision_metrics.coffee +26 -0
- data/app/assets/javascripts/swat/app/services/configuration.coffee +4 -0
- data/app/assets/javascripts/swat/bower_components.coffee +1 -0
- data/app/assets/javascripts/swat/lib/angular-cookies.js +321 -0
- data/app/assets/stylesheets/swat/application.scss +22 -6
- data/app/assets/stylesheets/swat/configuration.scss +35 -0
- data/app/assets/stylesheets/swat/header.scss +35 -1
- data/app/assets/stylesheets/swat/nav.scss +85 -0
- data/app/assets/stylesheets/swat/swat_theme.scss +60 -67
- data/app/assets/stylesheets/swat/vars.scss +54 -0
- data/app/controllers/swat/api/configuration_controller.rb +12 -0
- data/app/controllers/swat/api/revisions_controller.rb +1 -0
- data/app/controllers/swat/pages/management_controller.rb +6 -0
- data/app/views/layouts/swat/application.slim +6 -3
- data/app/views/swat/pages/management/configuration.slim +28 -0
- data/app/views/swat/pages/revisions/index.slim +4 -3
- data/app/views/swat/pages/revisions/partials/_revision_header.slim +13 -0
- data/app/views/swat/pages/revisions/show.slim +1 -13
- data/app/views/swat/pages/revisions/summary.slim +4 -17
- data/app/views/swat/shared/_header.slim +2 -0
- data/app/views/swat/shared/_nav.slim +22 -0
- data/config/routes.rb +10 -0
- data/sw2at-ui.gemspec +19 -5
- metadata +18 -4
- data/app/controllers/swat/revisions_controller.rb +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 655fd2fafeee27655f4b5b13af4683bd405ebfce
|
4
|
+
data.tar.gz: 15deb9efdec3e938c4cd6ffb58b0da29783b1150
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2784cbbeb343c6dd4c048ba9d639672ab99ccffc8d98615506960801d4b6ceff41e42ccc551bc0f6c07919e1701ac854dc45ad2ed7140d068ab7739edd50791a
|
7
|
+
data.tar.gz: b58bc99d1850bd960d8c9798e02607b2609ad9cb72940018a83dc5cd30ab763f2b2bf0e8a37bd7ad2f7f4f02cf02f4ad43a35cc457302f2b2a374fb0e82d4fce
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.13
|
@@ -19,6 +19,7 @@ App = angular.module 'SWAT', [
|
|
19
19
|
'ngClipboard'
|
20
20
|
'highcharts-ng'
|
21
21
|
'ngtimeago'
|
22
|
+
'ngCookies'
|
22
23
|
]
|
23
24
|
|
24
25
|
App.config ($urlRouterProvider, $stateProvider) ->
|
@@ -44,6 +45,14 @@ App.config ($urlRouterProvider, $stateProvider) ->
|
|
44
45
|
templateUrl: "/swat/pages/revisions/summary.html"
|
45
46
|
controller: 'SummaryCtrl'
|
46
47
|
)
|
48
|
+
.state("configuration",
|
49
|
+
url: "/swat/configuration"
|
50
|
+
views:
|
51
|
+
content:
|
52
|
+
templateUrl: "/swat/pages/management/configuration.html"
|
53
|
+
controller: 'ConfigurationCtrl'
|
54
|
+
|
55
|
+
)
|
47
56
|
App.config(['ngClipProvider', (ngClipProvider)->
|
48
57
|
ngClipProvider.setPath("/assets/swat/bower_components/zeroclipboard/dist/ZeroClipboard.swf")
|
49
58
|
])
|
@@ -0,0 +1,13 @@
|
|
1
|
+
angular.module("SWAT").controller "ConfigurationCtrl", ($rootScope, $scope, $state, $stateParams
|
2
|
+
ConfigurationService) ->
|
3
|
+
$scope.init = ->
|
4
|
+
setTimeout($scope.reloadConfig, 1000);
|
5
|
+
$rootScope.globalControl.setReloader($scope.reloadConfig)
|
6
|
+
|
7
|
+
$scope.reloadConfig = ->
|
8
|
+
$scope.configPromise = ConfigurationService.get()
|
9
|
+
$scope.configPromise.$promise.then((resp)->
|
10
|
+
$scope.config = resp
|
11
|
+
)
|
12
|
+
|
13
|
+
$scope.init()
|
@@ -2,12 +2,13 @@ angular.module("SWAT").controller "RevisionCtrl", ($rootScope, $scope, $state, $
|
|
2
2
|
RevisionService) ->
|
3
3
|
|
4
4
|
$scope.init = ->
|
5
|
+
$scope.currentState = $state.current.name
|
5
6
|
$scope.reloadData()
|
6
|
-
|
7
|
+
$rootScope.globalControl.setReloader($scope.reloadData)
|
7
8
|
|
8
9
|
$scope.reloadData = ->
|
9
10
|
return if $scope.revisionPromise && !$scope.revisionPromise.$resolved
|
10
|
-
params = { branch: $stateParams.branch, user: $stateParams.user, time: $stateParams.time }
|
11
|
+
params = { branch: decodeURI($stateParams.branch), user: $stateParams.user, time: $stateParams.time }
|
11
12
|
$scope.revisionPromise = RevisionService.get(params)
|
12
13
|
$scope.revisionPromise.$promise.then($scope.initTabs)
|
13
14
|
|
@@ -3,9 +3,13 @@ angular.module("SWAT").controller "RevisionsCtrl", ($rootScope, $scope, $state,
|
|
3
3
|
$scope.init = ->
|
4
4
|
window.Swat.log('Revisions Controller initalized!')
|
5
5
|
$scope.initRevisions()
|
6
|
+
$rootScope.globalControl.setReloader($scope.initRevisions)
|
6
7
|
|
7
8
|
$scope.initRevisions = ->
|
8
|
-
$scope.
|
9
|
+
$scope.revisionsPromise = RevisionService.query()
|
10
|
+
$scope.revisionsPromise.$promise.then((resp)->
|
11
|
+
$scope.revisions = resp
|
12
|
+
)
|
9
13
|
|
10
14
|
$scope.testsProgress = (revision)->
|
11
15
|
|
@@ -1,9 +1,11 @@
|
|
1
|
-
angular.module("SWAT").controller "RootCtrl", ($rootScope, $scope, $state, SwatHelpers) ->
|
1
|
+
angular.module("SWAT").controller "RootCtrl", ($rootScope, $scope, $state, SwatHelpers, GlobalControl) ->
|
2
2
|
|
3
3
|
$scope.init = ->
|
4
4
|
$scope.helpers = SwatHelpers
|
5
5
|
window.Swat.log 'Swat Root initialized.'
|
6
6
|
|
7
|
+
$rootScope.globalControl = new GlobalControl()
|
8
|
+
|
7
9
|
$scope.init()
|
8
10
|
|
9
11
|
|
@@ -1,9 +1,11 @@
|
|
1
1
|
angular.module("SWAT").controller "SummaryCtrl", ($rootScope, $scope, $state, $stateParams
|
2
|
-
RevisionService, FailsGraph,
|
2
|
+
RevisionService, FailsGraph, RevisionMetrics, ExceptionGroups) ->
|
3
3
|
|
4
4
|
$scope.init = ->
|
5
|
+
$scope.currentState = $state.current.name
|
5
6
|
$scope.summary = {}
|
6
7
|
$scope.reloadData()
|
8
|
+
$rootScope.globalControl.setReloader($scope.reloadData)
|
7
9
|
|
8
10
|
$scope.reloadData = ->
|
9
11
|
return if $scope.revisionPromise && !$scope.revisionPromise.$resolved
|
@@ -24,46 +26,13 @@ angular.module("SWAT").controller "SummaryCtrl", ($rootScope, $scope, $state, $s
|
|
24
26
|
$scope.summary.fails = _.select($scope.tests, (t)->(t.exception) )
|
25
27
|
|
26
28
|
$scope.initExceptions = ->
|
27
|
-
|
28
|
-
window.Swat.log(groups)
|
29
|
-
|
30
|
-
result = []
|
31
|
-
for exMessage in _.keys(groups)
|
32
|
-
exception =
|
33
|
-
message: exMessage
|
34
|
-
backtrace: groups[exMessage][0].exception.backtrace
|
35
|
-
tests: groups[exMessage]
|
36
|
-
result.push(exception)
|
37
|
-
|
38
|
-
window.Swat.log(result)
|
39
|
-
$scope.summary.exceptions = result
|
29
|
+
$scope.summary.exceptions = new ExceptionGroups($scope.summary.fails).data()
|
40
30
|
|
41
31
|
$scope.initFailsStatsGraph = ->
|
42
32
|
$scope.failsStats = new FailsGraph($scope.tests, $scope.summary.fails)
|
43
33
|
|
44
34
|
$scope.initMetrics = ->
|
45
|
-
|
46
|
-
totalTests = $scope.tests.length
|
47
|
-
totalFailedTests = $scope.summary.fails.length
|
48
|
-
totalDuration = _.sum($scope.tests, 'run_time')
|
49
|
-
totalThreadDuration = _.sum($scope.revision.data.threads, 'total_runtime')
|
50
|
-
successPercentage = (($scope.tests.length - $scope.summary.fails.length) / $scope.tests.length*100)
|
51
|
-
|
52
|
-
result.push({ name: 'Revision Name', value: $scope.revision.data.name })
|
53
|
-
result.push({ name: 'Revision Status', value: $scope.revision.data.status.name })
|
54
|
-
result.push({ name: 'Revision Branch', value: $scope.revision.data.branch })
|
55
|
-
result.push({ name: 'Revisor', value: $scope.revision.data.user })
|
56
|
-
result.push({ name: 'Threads Count', value: $scope.revision.data.threads_count })
|
57
|
-
|
58
|
-
result.push({ name: 'Total Tests', value: totalTests })
|
59
|
-
result.push({ name: 'Total Failed Tests', value: totalFailedTests })
|
60
|
-
|
61
|
-
result.push({ name: 'Total Tests Duration', value: SwatHelpers.formatTime(totalDuration) })
|
62
|
-
result.push({ name: 'Total Threads Duration', value: SwatHelpers.formatTime(totalThreadDuration) })
|
63
|
-
|
64
|
-
result.push({ name: 'Success Percentage', value: (successPercentage.toFixed(2)+'%') })
|
65
|
-
|
66
|
-
$scope.summary.metrics = result
|
35
|
+
$scope.summary.metrics = new RevisionMetrics($scope.revision, $scope.tests, $scope.summary.fails).data()
|
67
36
|
|
68
37
|
$scope.init()
|
69
38
|
|
@@ -0,0 +1,23 @@
|
|
1
|
+
angular.module("SWAT").factory "GlobalControl", ($cookies)->
|
2
|
+
class GlobalControl
|
3
|
+
constructor: ->
|
4
|
+
@initStatus()
|
5
|
+
@setReloader(->{})
|
6
|
+
|
7
|
+
initStatus: ->
|
8
|
+
status = $cookies.get('MainMenuStatus') || 'closed';
|
9
|
+
@setStatus(status)
|
10
|
+
|
11
|
+
toggle: ->
|
12
|
+
@setStatus(if @status == 'closed' then 'opened' else 'closed')
|
13
|
+
|
14
|
+
setStatus: (value)->
|
15
|
+
$cookies.put('MainMenuStatus', value);
|
16
|
+
@status = value
|
17
|
+
|
18
|
+
setReloader: (func)->
|
19
|
+
@reloader = func
|
20
|
+
|
21
|
+
reload: ->
|
22
|
+
@reloader()
|
23
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
angular.module("SWAT").factory "ExceptionGroups", ->
|
2
|
+
class ExceptionGroups
|
3
|
+
constructor: (@fails)->
|
4
|
+
|
5
|
+
data: ->
|
6
|
+
groups = _.groupBy(@fails, (f)->(f.exception.message) )
|
7
|
+
window.Swat.log(groups)
|
8
|
+
|
9
|
+
result = []
|
10
|
+
for exMessage in _.keys(groups)
|
11
|
+
exception =
|
12
|
+
message: exMessage
|
13
|
+
backtrace: groups[exMessage][0].exception.backtrace
|
14
|
+
tests: groups[exMessage]
|
15
|
+
result.push(exception)
|
16
|
+
window.Swat.log(result)
|
17
|
+
result
|
data/app/assets/javascripts/swat/app/factories/{fails_graph.coffee → summary/fails_graph.coffee}
RENAMED
File without changes
|
@@ -0,0 +1,26 @@
|
|
1
|
+
angular.module("SWAT").factory "RevisionMetrics", (SwatHelpers)->
|
2
|
+
class RevisionMetrics
|
3
|
+
constructor: (@revision, @tests, @fails)->
|
4
|
+
|
5
|
+
data: ->
|
6
|
+
result = []
|
7
|
+
totalTests = @tests.length
|
8
|
+
totalFailedTests = @fails.length
|
9
|
+
totalDuration = _.sum(@tests, 'run_time')
|
10
|
+
totalThreadDuration = _.sum(@revision.data.threads, 'total_runtime')
|
11
|
+
successPercentage = ((@tests.length - @fails.length) / @tests.length*100)
|
12
|
+
|
13
|
+
result.push({ name: 'Revision Name', value: @revision.data.name })
|
14
|
+
result.push({ name: 'Revision Status', value: @revision.data.status.name })
|
15
|
+
result.push({ name: 'Revision Branch', value: @revision.data.branch })
|
16
|
+
result.push({ name: 'Revisor', value: @revision.data.user })
|
17
|
+
result.push({ name: 'Threads Count', value: @revision.data.threads_count })
|
18
|
+
|
19
|
+
result.push({ name: 'Total Tests', value: totalTests })
|
20
|
+
result.push({ name: 'Total Failed Tests', value: totalFailedTests })
|
21
|
+
|
22
|
+
result.push({ name: 'Total Tests Duration', value: SwatHelpers.formatTime(totalDuration) })
|
23
|
+
result.push({ name: 'Total Threads Duration', value: SwatHelpers.formatTime(totalThreadDuration) })
|
24
|
+
|
25
|
+
result.push({ name: 'Success Percentage', value: (successPercentage.toFixed(2)+'%') })
|
26
|
+
result
|
@@ -0,0 +1,321 @@
|
|
1
|
+
/**
|
2
|
+
* @license AngularJS v1.4.2-build.4091+sha.fe0af2c
|
3
|
+
* (c) 2010-2015 Google, Inc. http://angularjs.org
|
4
|
+
* License: MIT
|
5
|
+
*/
|
6
|
+
(function(window, angular, undefined) {'use strict';
|
7
|
+
|
8
|
+
/**
|
9
|
+
* @ngdoc module
|
10
|
+
* @name ngCookies
|
11
|
+
* @description
|
12
|
+
*
|
13
|
+
* # ngCookies
|
14
|
+
*
|
15
|
+
* The `ngCookies` module provides a convenient wrapper for reading and writing browser cookies.
|
16
|
+
*
|
17
|
+
*
|
18
|
+
* <div doc-module-components="ngCookies"></div>
|
19
|
+
*
|
20
|
+
* See {@link ngCookies.$cookies `$cookies`} for usage.
|
21
|
+
*/
|
22
|
+
|
23
|
+
|
24
|
+
angular.module('ngCookies', ['ng']).
|
25
|
+
/**
|
26
|
+
* @ngdoc provider
|
27
|
+
* @name $cookiesProvider
|
28
|
+
* @description
|
29
|
+
* Use `$cookiesProvider` to change the default behavior of the {@link ngCookies.$cookies $cookies} service.
|
30
|
+
* */
|
31
|
+
provider('$cookies', [function $CookiesProvider() {
|
32
|
+
/**
|
33
|
+
* @ngdoc property
|
34
|
+
* @name $cookiesProvider#defaults
|
35
|
+
* @description
|
36
|
+
*
|
37
|
+
* Object containing default options to pass when setting cookies.
|
38
|
+
*
|
39
|
+
* The object may have following properties:
|
40
|
+
*
|
41
|
+
* - **path** - `{string}` - The cookie will be available only for this path and its
|
42
|
+
* sub-paths. By default, this would be the URL that appears in your base tag.
|
43
|
+
* - **domain** - `{string}` - The cookie will be available only for this domain and
|
44
|
+
* its sub-domains. For obvious security reasons the user agent will not accept the
|
45
|
+
* cookie if the current domain is not a sub domain or equals to the requested domain.
|
46
|
+
* - **expires** - `{string|Date}` - String of the form "Wdy, DD Mon YYYY HH:MM:SS GMT"
|
47
|
+
* or a Date object indicating the exact date/time this cookie will expire.
|
48
|
+
* - **secure** - `{boolean}` - The cookie will be available only in secured connection.
|
49
|
+
*
|
50
|
+
* Note: by default the address that appears in your `<base>` tag will be used as path.
|
51
|
+
* This is import so that cookies will be visible for all routes in case html5mode is enabled
|
52
|
+
*
|
53
|
+
**/
|
54
|
+
var defaults = this.defaults = {};
|
55
|
+
|
56
|
+
function calcOptions(options) {
|
57
|
+
return options ? angular.extend({}, defaults, options) : defaults;
|
58
|
+
}
|
59
|
+
|
60
|
+
/**
|
61
|
+
* @ngdoc service
|
62
|
+
* @name $cookies
|
63
|
+
*
|
64
|
+
* @description
|
65
|
+
* Provides read/write access to browser's cookies.
|
66
|
+
*
|
67
|
+
* <div class="alert alert-info">
|
68
|
+
* Up until Angular 1.3, `$cookies` exposed properties that represented the
|
69
|
+
* current browser cookie values. In version 1.4, this behavior has changed, and
|
70
|
+
* `$cookies` now provides a standard api of getters, setters etc.
|
71
|
+
* </div>
|
72
|
+
*
|
73
|
+
* Requires the {@link ngCookies `ngCookies`} module to be installed.
|
74
|
+
*
|
75
|
+
* @example
|
76
|
+
*
|
77
|
+
* ```js
|
78
|
+
* angular.module('cookiesExample', ['ngCookies'])
|
79
|
+
* .controller('ExampleController', ['$cookies', function($cookies) {
|
80
|
+
* // Retrieving a cookie
|
81
|
+
* var favoriteCookie = $cookies.get('myFavorite');
|
82
|
+
* // Setting a cookie
|
83
|
+
* $cookies.put('myFavorite', 'oatmeal');
|
84
|
+
* }]);
|
85
|
+
* ```
|
86
|
+
*/
|
87
|
+
this.$get = ['$$cookieReader', '$$cookieWriter', function($$cookieReader, $$cookieWriter) {
|
88
|
+
return {
|
89
|
+
/**
|
90
|
+
* @ngdoc method
|
91
|
+
* @name $cookies#get
|
92
|
+
*
|
93
|
+
* @description
|
94
|
+
* Returns the value of given cookie key
|
95
|
+
*
|
96
|
+
* @param {string} key Id to use for lookup.
|
97
|
+
* @returns {string} Raw cookie value.
|
98
|
+
*/
|
99
|
+
get: function(key) {
|
100
|
+
return $$cookieReader()[key];
|
101
|
+
},
|
102
|
+
|
103
|
+
/**
|
104
|
+
* @ngdoc method
|
105
|
+
* @name $cookies#getObject
|
106
|
+
*
|
107
|
+
* @description
|
108
|
+
* Returns the deserialized value of given cookie key
|
109
|
+
*
|
110
|
+
* @param {string} key Id to use for lookup.
|
111
|
+
* @returns {Object} Deserialized cookie value.
|
112
|
+
*/
|
113
|
+
getObject: function(key) {
|
114
|
+
var value = this.get(key);
|
115
|
+
return value ? angular.fromJson(value) : value;
|
116
|
+
},
|
117
|
+
|
118
|
+
/**
|
119
|
+
* @ngdoc method
|
120
|
+
* @name $cookies#getAll
|
121
|
+
*
|
122
|
+
* @description
|
123
|
+
* Returns a key value object with all the cookies
|
124
|
+
*
|
125
|
+
* @returns {Object} All cookies
|
126
|
+
*/
|
127
|
+
getAll: function() {
|
128
|
+
return $$cookieReader();
|
129
|
+
},
|
130
|
+
|
131
|
+
/**
|
132
|
+
* @ngdoc method
|
133
|
+
* @name $cookies#put
|
134
|
+
*
|
135
|
+
* @description
|
136
|
+
* Sets a value for given cookie key
|
137
|
+
*
|
138
|
+
* @param {string} key Id for the `value`.
|
139
|
+
* @param {string} value Raw value to be stored.
|
140
|
+
* @param {Object=} options Options object.
|
141
|
+
* See {@link ngCookies.$cookiesProvider#defaults $cookiesProvider.defaults}
|
142
|
+
*/
|
143
|
+
put: function(key, value, options) {
|
144
|
+
$$cookieWriter(key, value, calcOptions(options));
|
145
|
+
},
|
146
|
+
|
147
|
+
/**
|
148
|
+
* @ngdoc method
|
149
|
+
* @name $cookies#putObject
|
150
|
+
*
|
151
|
+
* @description
|
152
|
+
* Serializes and sets a value for given cookie key
|
153
|
+
*
|
154
|
+
* @param {string} key Id for the `value`.
|
155
|
+
* @param {Object} value Value to be stored.
|
156
|
+
* @param {Object=} options Options object.
|
157
|
+
* See {@link ngCookies.$cookiesProvider#defaults $cookiesProvider.defaults}
|
158
|
+
*/
|
159
|
+
putObject: function(key, value, options) {
|
160
|
+
this.put(key, angular.toJson(value), options);
|
161
|
+
},
|
162
|
+
|
163
|
+
/**
|
164
|
+
* @ngdoc method
|
165
|
+
* @name $cookies#remove
|
166
|
+
*
|
167
|
+
* @description
|
168
|
+
* Remove given cookie
|
169
|
+
*
|
170
|
+
* @param {string} key Id of the key-value pair to delete.
|
171
|
+
* @param {Object=} options Options object.
|
172
|
+
* See {@link ngCookies.$cookiesProvider#defaults $cookiesProvider.defaults}
|
173
|
+
*/
|
174
|
+
remove: function(key, options) {
|
175
|
+
$$cookieWriter(key, undefined, calcOptions(options));
|
176
|
+
}
|
177
|
+
};
|
178
|
+
}];
|
179
|
+
}]);
|
180
|
+
|
181
|
+
angular.module('ngCookies').
|
182
|
+
/**
|
183
|
+
* @ngdoc service
|
184
|
+
* @name $cookieStore
|
185
|
+
* @deprecated
|
186
|
+
* @requires $cookies
|
187
|
+
*
|
188
|
+
* @description
|
189
|
+
* Provides a key-value (string-object) storage, that is backed by session cookies.
|
190
|
+
* Objects put or retrieved from this storage are automatically serialized or
|
191
|
+
* deserialized by angular's toJson/fromJson.
|
192
|
+
*
|
193
|
+
* Requires the {@link ngCookies `ngCookies`} module to be installed.
|
194
|
+
*
|
195
|
+
* <div class="alert alert-danger">
|
196
|
+
* **Note:** The $cookieStore service is **deprecated**.
|
197
|
+
* Please use the {@link ngCookies.$cookies `$cookies`} service instead.
|
198
|
+
* </div>
|
199
|
+
*
|
200
|
+
* @example
|
201
|
+
*
|
202
|
+
* ```js
|
203
|
+
* angular.module('cookieStoreExample', ['ngCookies'])
|
204
|
+
* .controller('ExampleController', ['$cookieStore', function($cookieStore) {
|
205
|
+
* // Put cookie
|
206
|
+
* $cookieStore.put('myFavorite','oatmeal');
|
207
|
+
* // Get cookie
|
208
|
+
* var favoriteCookie = $cookieStore.get('myFavorite');
|
209
|
+
* // Removing a cookie
|
210
|
+
* $cookieStore.remove('myFavorite');
|
211
|
+
* }]);
|
212
|
+
* ```
|
213
|
+
*/
|
214
|
+
factory('$cookieStore', ['$cookies', function($cookies) {
|
215
|
+
|
216
|
+
return {
|
217
|
+
/**
|
218
|
+
* @ngdoc method
|
219
|
+
* @name $cookieStore#get
|
220
|
+
*
|
221
|
+
* @description
|
222
|
+
* Returns the value of given cookie key
|
223
|
+
*
|
224
|
+
* @param {string} key Id to use for lookup.
|
225
|
+
* @returns {Object} Deserialized cookie value, undefined if the cookie does not exist.
|
226
|
+
*/
|
227
|
+
get: function(key) {
|
228
|
+
return $cookies.getObject(key);
|
229
|
+
},
|
230
|
+
|
231
|
+
/**
|
232
|
+
* @ngdoc method
|
233
|
+
* @name $cookieStore#put
|
234
|
+
*
|
235
|
+
* @description
|
236
|
+
* Sets a value for given cookie key
|
237
|
+
*
|
238
|
+
* @param {string} key Id for the `value`.
|
239
|
+
* @param {Object} value Value to be stored.
|
240
|
+
*/
|
241
|
+
put: function(key, value) {
|
242
|
+
$cookies.putObject(key, value);
|
243
|
+
},
|
244
|
+
|
245
|
+
/**
|
246
|
+
* @ngdoc method
|
247
|
+
* @name $cookieStore#remove
|
248
|
+
*
|
249
|
+
* @description
|
250
|
+
* Remove given cookie
|
251
|
+
*
|
252
|
+
* @param {string} key Id of the key-value pair to delete.
|
253
|
+
*/
|
254
|
+
remove: function(key) {
|
255
|
+
$cookies.remove(key);
|
256
|
+
}
|
257
|
+
};
|
258
|
+
|
259
|
+
}]);
|
260
|
+
|
261
|
+
/**
|
262
|
+
* @name $$cookieWriter
|
263
|
+
* @requires $document
|
264
|
+
*
|
265
|
+
* @description
|
266
|
+
* This is a private service for writing cookies
|
267
|
+
*
|
268
|
+
* @param {string} name Cookie name
|
269
|
+
* @param {string=} value Cookie value (if undefined, cookie will be deleted)
|
270
|
+
* @param {Object=} options Object with options that need to be stored for the cookie.
|
271
|
+
*/
|
272
|
+
function $$CookieWriter($document, $log, $browser) {
|
273
|
+
var cookiePath = $browser.baseHref();
|
274
|
+
var rawDocument = $document[0];
|
275
|
+
|
276
|
+
function buildCookieString(name, value, options) {
|
277
|
+
var path, expires;
|
278
|
+
options = options || {};
|
279
|
+
expires = options.expires;
|
280
|
+
path = angular.isDefined(options.path) ? options.path : cookiePath;
|
281
|
+
if (value === undefined) {
|
282
|
+
expires = 'Thu, 01 Jan 1970 00:00:00 GMT';
|
283
|
+
value = '';
|
284
|
+
}
|
285
|
+
if (angular.isString(expires)) {
|
286
|
+
expires = new Date(expires);
|
287
|
+
}
|
288
|
+
|
289
|
+
var str = encodeURIComponent(name) + '=' + encodeURIComponent(value);
|
290
|
+
str += path ? ';path=' + path : '';
|
291
|
+
str += options.domain ? ';domain=' + options.domain : '';
|
292
|
+
str += expires ? ';expires=' + expires.toUTCString() : '';
|
293
|
+
str += options.secure ? ';secure' : '';
|
294
|
+
|
295
|
+
// per http://www.ietf.org/rfc/rfc2109.txt browser must allow at minimum:
|
296
|
+
// - 300 cookies
|
297
|
+
// - 20 cookies per unique domain
|
298
|
+
// - 4096 bytes per cookie
|
299
|
+
var cookieLength = str.length + 1;
|
300
|
+
if (cookieLength > 4096) {
|
301
|
+
$log.warn("Cookie '" + name +
|
302
|
+
"' possibly not set or overflowed because it was too large (" +
|
303
|
+
cookieLength + " > 4096 bytes)!");
|
304
|
+
}
|
305
|
+
|
306
|
+
return str;
|
307
|
+
}
|
308
|
+
|
309
|
+
return function(name, value, options) {
|
310
|
+
rawDocument.cookie = buildCookieString(name, value, options);
|
311
|
+
};
|
312
|
+
}
|
313
|
+
|
314
|
+
$$CookieWriter.$inject = ['$document', '$log', '$browser'];
|
315
|
+
|
316
|
+
angular.module('ngCookies').provider('$$cookieWriter', function $$CookieWriterProvider() {
|
317
|
+
this.$get = $$CookieWriter;
|
318
|
+
});
|
319
|
+
|
320
|
+
|
321
|
+
})(window, window.angular);
|
@@ -2,9 +2,7 @@
|
|
2
2
|
//= require_self
|
3
3
|
|
4
4
|
@import "bootstrap";
|
5
|
-
|
6
|
-
$greyBg: #9f9f9f;
|
7
|
-
$greenMain: greenyellow;
|
5
|
+
@import "vars";
|
8
6
|
|
9
7
|
#swat {
|
10
8
|
font-size: 13px;
|
@@ -20,9 +18,27 @@ $greenMain: greenyellow;
|
|
20
18
|
}
|
21
19
|
}
|
22
20
|
#content {
|
23
|
-
|
21
|
+
|
24
22
|
}
|
25
|
-
|
26
|
-
|
23
|
+
|
24
|
+
|
25
|
+
table.info {
|
26
|
+
font-size: 14px;
|
27
|
+
background: $greyBg;
|
28
|
+
width: 100%;
|
29
|
+
tr {
|
30
|
+
border-bottom: 1px solid $whiteColor;
|
31
|
+
td {
|
32
|
+
padding: 12px;
|
33
|
+
&.name {
|
34
|
+
width: 200px;
|
35
|
+
padding-left: 21px;
|
36
|
+
color: $lightBlueColor;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
27
40
|
}
|
41
|
+
|
28
42
|
}
|
43
|
+
|
44
|
+
|
@@ -0,0 +1,35 @@
|
|
1
|
+
@import "vars";
|
2
|
+
|
3
|
+
#swat {
|
4
|
+
|
5
|
+
#configuration {
|
6
|
+
|
7
|
+
.title {
|
8
|
+
|
9
|
+
}
|
10
|
+
.configuration-info-container {
|
11
|
+
display: block;
|
12
|
+
width: 100%;
|
13
|
+
}
|
14
|
+
#configuration-info {
|
15
|
+
background: $whiteColor;
|
16
|
+
border: 1px solid $containerBorder;
|
17
|
+
margin: 20px;
|
18
|
+
padding: 28px 38px;
|
19
|
+
width: 800px;
|
20
|
+
margin: auto;
|
21
|
+
|
22
|
+
.heading {
|
23
|
+
text-align: left;
|
24
|
+
margin: 0;
|
25
|
+
color: rgba(60, 56, 55, 0.68);
|
26
|
+
}
|
27
|
+
|
28
|
+
table {
|
29
|
+
margin-bottom: 18px;
|
30
|
+
}
|
31
|
+
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
}
|