sw2at-ui 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/VERSION +1 -1
  4. data/app/assets/javascripts/swat/app/app.coffee +8 -1
  5. data/app/assets/javascripts/swat/app/controllers/management/configuration.coffee +2 -2
  6. data/app/assets/javascripts/swat/app/controllers/management/confirmation.coffee +21 -0
  7. data/app/assets/javascripts/swat/app/controllers/management/console.coffee +33 -0
  8. data/app/assets/javascripts/swat/app/directives/components/custom-dropdown.coffee +35 -0
  9. data/app/assets/javascripts/swat/app/directives/components.coffee +1 -0
  10. data/app/assets/javascripts/swat/app/factories/configuration/confirmation_dialog.coffee +10 -0
  11. data/app/assets/javascripts/swat/app/factories/helpers.coffee +9 -2
  12. data/app/assets/javascripts/swat/app/factories/summary/fails_graph.coffee +1 -0
  13. data/app/assets/javascripts/swat/app/services/configuration.coffee +1 -0
  14. data/app/assets/javascripts/swat/app/services/console.coffee +8 -0
  15. data/app/assets/javascripts/swat/bower_components.coffee +1 -0
  16. data/app/assets/javascripts/swat/lib/highcharts-exporting.js +23 -0
  17. data/app/assets/javascripts/swat/lib/highcharts.src.js +324 -18634
  18. data/app/assets/stylesheets/swat/application.scss +29 -3
  19. data/app/assets/stylesheets/swat/boostrap_vars.scss +872 -0
  20. data/app/assets/stylesheets/swat/components/dropdown.scss +124 -0
  21. data/app/assets/stylesheets/swat/configuration.scss +3 -23
  22. data/app/assets/stylesheets/swat/confirmation.scss +60 -0
  23. data/app/assets/stylesheets/swat/console.scss +68 -0
  24. data/app/assets/stylesheets/swat/header.scss +1 -0
  25. data/app/assets/stylesheets/swat/swat_theme.scss +5 -7
  26. data/app/assets/stylesheets/swat/vars.scss +21 -11
  27. data/app/controllers/swat/api/console_controller.rb +17 -0
  28. data/app/controllers/swat/pages/components_controller.rb +6 -0
  29. data/app/models/concerns/root_revision_ext.rb +31 -0
  30. data/app/models/revision_cleaner.rb +57 -0
  31. data/app/views/swat/pages/components/custom_dropdown.slim +16 -0
  32. data/app/views/swat/pages/management/configuration.slim +3 -3
  33. data/app/views/swat/pages/management/confirmation.slim +13 -0
  34. data/app/views/swat/pages/management/console.slim +6 -0
  35. data/app/views/swat/pages/management/partials/_action_bar.slim +26 -0
  36. data/app/views/swat/pages/management/partials/_stats.slim +4 -0
  37. data/app/views/swat/shared/_nav.slim +6 -6
  38. data/config/routes.rb +14 -13
  39. data/lib/swat/engine.rb +2 -0
  40. data/lib/swat/ui/rspec_commands.rb +3 -2
  41. data/spec/models/calculator_spec.rb +1 -1
  42. data/spec/models/full_revision_spec.rb +14 -0
  43. data/spec/models/revision_cleaner_spec.rb +27 -0
  44. data/spec/models/revision_stats_spec.rb +0 -0
  45. data/spec/spec_helper.rb +1 -0
  46. data/sw2at-ui.gemspec +27 -6
  47. metadata +27 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 655fd2fafeee27655f4b5b13af4683bd405ebfce
4
- data.tar.gz: 15deb9efdec3e938c4cd6ffb58b0da29783b1150
3
+ metadata.gz: a521e7106db4371edd442ed6cdaeac92593bddd0
4
+ data.tar.gz: 27b261b4316c5827f566fefe3cbe4ee3bb5728c8
5
5
  SHA512:
6
- metadata.gz: 2784cbbeb343c6dd4c048ba9d639672ab99ccffc8d98615506960801d4b6ceff41e42ccc551bc0f6c07919e1701ac854dc45ad2ed7140d068ab7739edd50791a
7
- data.tar.gz: b58bc99d1850bd960d8c9798e02607b2609ad9cb72940018a83dc5cd30ab763f2b2bf0e8a37bd7ad2f7f4f02cf02f4ad43a35cc457302f2b2a374fb0e82d4fce
6
+ metadata.gz: a1045965a0bc19f739f1dcc325da72d78a3f0f21dd9937bb0ac5096ab8cb78a569203fd7c13308fd6ada6e48711f5d7b6deeebf0d75bb31a363012485d001aff
7
+ data.tar.gz: 1c7cd5184fb233916c52c85809ac2da1325868c4f8b603d6b7ac41afc761352bbb079bb01c905c0934c0f21aa27028b95a0b269f1fa4d763ded8b1717529bfeb
data/Gemfile CHANGED
@@ -7,7 +7,7 @@ gem 'slim-rails'
7
7
  gem 'sass-rails'
8
8
  gem 'coffee-rails'
9
9
  gem 'bootstrap-sass'
10
- gem 'tarvit-helpers'
10
+ gem 'tarvit-helpers', '~> 0.0.9'
11
11
  gem 'time_difference'
12
12
 
13
13
  group :development do
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.13
1
+ 0.0.14
@@ -20,6 +20,7 @@ App = angular.module 'SWAT', [
20
20
  'highcharts-ng'
21
21
  'ngtimeago'
22
22
  'ngCookies'
23
+ 'SWAT.components'
23
24
  ]
24
25
 
25
26
  App.config ($urlRouterProvider, $stateProvider) ->
@@ -51,7 +52,13 @@ App.config ($urlRouterProvider, $stateProvider) ->
51
52
  content:
52
53
  templateUrl: "/swat/pages/management/configuration.html"
53
54
  controller: 'ConfigurationCtrl'
54
-
55
+ )
56
+ .state("console",
57
+ url: "/swat/console"
58
+ views:
59
+ content:
60
+ templateUrl: "/swat/pages/management/console.html"
61
+ controller: 'ConsoleCtrl'
55
62
  )
56
63
  App.config(['ngClipProvider', (ngClipProvider)->
57
64
  ngClipProvider.setPath("/assets/swat/bower_components/zeroclipboard/dist/ZeroClipboard.swf")
@@ -1,7 +1,7 @@
1
- angular.module("SWAT").controller "ConfigurationCtrl", ($rootScope, $scope, $state, $stateParams
1
+ angular.module("SWAT").controller "ConfigurationCtrl", ($rootScope, $scope, $state, $stateParams, $timeout
2
2
  ConfigurationService) ->
3
3
  $scope.init = ->
4
- setTimeout($scope.reloadConfig, 1000);
4
+ $timeout($scope.reloadConfig, 1000)
5
5
  $rootScope.globalControl.setReloader($scope.reloadConfig)
6
6
 
7
7
  $scope.reloadConfig = ->
@@ -0,0 +1,21 @@
1
+ angular.module("SWAT").controller "ConfirmationCtrl", ($rootScope, $scope, $modalInstance, action, message, SwatHelpers)->
2
+ $scope.init = ->
3
+ $scope.action = action
4
+ $scope.message = message
5
+ $scope.helpers = SwatHelpers
6
+
7
+ $scope.ok = ->
8
+ result = $scope.action()
9
+ unless result.$promise
10
+ $modalInstance.close()
11
+ else
12
+ $scope.waitingAction = true
13
+ result.$promise.then(->
14
+ $scope.waitingAction = false
15
+ $modalInstance.close()
16
+ )
17
+
18
+ $scope.cancel = ->
19
+ $modalInstance.dismiss('cancel')
20
+
21
+ $scope.init()
@@ -0,0 +1,33 @@
1
+ angular.module("SWAT").controller "ConsoleCtrl", ($rootScope, $scope, $state, $stateParams,
2
+ ConfirmationDialog, ConsoleService) ->
3
+
4
+ $scope.init = ->
5
+ $scope.clean =
6
+ branch: { name: '' }
7
+ user: { name: '' }
8
+ period: { name: '' }
9
+ revision: { name: '' }
10
+
11
+ $scope.loadConsoleData()
12
+ $rootScope.globalControl.setReloader($scope.loadConsoleData)
13
+
14
+
15
+ $scope.loadConsoleData = ->
16
+ $scope.consoleDataPromise = ConsoleService.data()
17
+ $scope.consoleDataPromise.$promise.then((resp)->
18
+ $scope.consoleData = resp
19
+ )
20
+
21
+ $scope.sum = (data)->
22
+ _.sum(_.values(data))
23
+
24
+ $scope.remove = (attribute)->
25
+ message = 'Are you sure you want to remove revisions of ' + attribute + ' <strong>' + $scope.clean[attribute].name + '<strong>?'
26
+ action = ->
27
+ promise = ConsoleService.clean(attribute: attribute, value: $scope.clean[attribute].name)
28
+ promise.$promise.then($scope.loadConsoleData)
29
+ promise
30
+
31
+ new ConfirmationDialog(message, action)
32
+
33
+ $scope.init()
@@ -0,0 +1,35 @@
1
+ angular.module("SWAT.components").directive "customDropdown", ($document)->
2
+ restrict: 'AE'
3
+ replace: true
4
+ templateUrl: '/swat/pages/components/custom_dropdown.html'
5
+ scope:
6
+ model: '='
7
+ options: '='
8
+ modelAttr: '='
9
+ emptyOption: '='
10
+ placeholder: '='
11
+ glTabIndex: '='
12
+ afterUpdate: '&'
13
+ glDisabled: '='
14
+
15
+ controller: ($scope, $attrs, $timeout)->
16
+ $scope.init = ->
17
+ $scope.id = Math.random()*1000
18
+ $scope.decorateOptions()
19
+ $scope.$watch('options', $scope.decorateOptions)
20
+ if $scope.placeholder && !$scope.model
21
+ $scope.model = $scope.placeholder
22
+
23
+ $scope.selectOption = (option)->
24
+ $scope.reprocess = true
25
+ $timeout(->
26
+ $scope.afterUpdate() if $scope.afterUpdate
27
+ $scope.reprocess = false
28
+ , 0)
29
+
30
+ $scope.decorateOptions = ->
31
+ $scope.selectOptions = _.map($scope.options, (el)-> if $scope.modelAttr then el[$scope.modelAttr] else el )
32
+ if $scope.placeholder
33
+ $scope.selectOptions.unshift $scope.placeholder
34
+
35
+ $scope.init()
@@ -0,0 +1 @@
1
+ angular.module("SWAT.components", ['ui.bootstrap'])
@@ -0,0 +1,10 @@
1
+ angular.module("SWAT").factory "ConfirmationDialog", ($modal)->
2
+ (message, action)->
3
+ $modal.open(
4
+ size: 'sm',
5
+ templateUrl: '/swat/pages/management/confirmation.html',
6
+ controller: 'ConfirmationCtrl',
7
+ resolve:
8
+ action: -> action
9
+ message: -> message
10
+ )
@@ -1,4 +1,4 @@
1
- angular.module("SWAT").factory "SwatHelpers", ->
1
+ angular.module("SWAT").factory "SwatHelpers", ($sce)->
2
2
  Helpers =
3
3
  formatTime: (seconds) ->
4
4
  hh = Math.floor(seconds / 3600)
@@ -7,5 +7,12 @@ angular.module("SWAT").factory "SwatHelpers", ->
7
7
  (if hh then (if hh < 10 then '0' else '') + hh + ':' else '') + (if mm < 10 and hh then '0' else '') + mm + ':' + (if ss < 10 then '0' else '') + ss
8
8
 
9
9
  isSpecTraceLine: (line)->
10
- _.include(line, 'spec')
10
+ _.include(line, '/spec/')
11
+
12
+ isEmpty: (string)->
13
+ _.isEmpty(string)
14
+
15
+ renderHtml: (htmlCode)->
16
+ $sce.trustAsHtml(htmlCode)
17
+
11
18
 
@@ -9,6 +9,7 @@ class FailsGraph
9
9
  plotBorderWidth: null
10
10
  plotShadow: false
11
11
  type: 'pie'
12
+ credits: enabled: 'true'
12
13
  title:
13
14
  text: 'Fail Rate'
14
15
 
@@ -2,3 +2,4 @@ angular.module("SWAT").factory "ConfigurationService", ($resource, GlResponse) -
2
2
  $resource "/swat/api/configuration", {},
3
3
  get:
4
4
  method: 'GET'
5
+ transformResponse: GlResponse
@@ -0,0 +1,8 @@
1
+ angular.module("SWAT").factory "ConsoleService", ($resource, GlResponse) ->
2
+ $resource "/swat/api/console", { attribute: '@attribute', value: '@value' },
3
+ data:
4
+ method: 'GET'
5
+
6
+ clean:
7
+ url: '/swat/api/console/clean/:attribute/:value'
8
+ method: 'DELETE'
@@ -15,6 +15,7 @@
15
15
  #= require swat/bower_components/zeroclipboard/dist/ZeroClipboard.js
16
16
 
17
17
  #= require swat/lib/highcharts.src.js
18
+ # require swat/lib/highcharts-exporting.js
18
19
  #= require swat/lib/highcharts-ng.js
19
20
  #= require swat/lib/ngtimeago.js
20
21
  #= require swat/lib/angular-cookies.js
@@ -0,0 +1,23 @@
1
+ /*
2
+ Highcharts JS v4.1.7 (2015-06-26)
3
+ Exporting module
4
+
5
+ (c) 2010-2014 Torstein Honsi
6
+
7
+ License: www.highcharts.com/license
8
+ */
9
+ (function(f){var z=f.Chart,s=f.addEvent,A=f.removeEvent,B=HighchartsAdapter.fireEvent,j=f.createElement,p=f.discardElement,u=f.css,l=f.merge,m=f.each,q=f.extend,E=f.splat,F=Math.max,k=document,C=window,G=f.isTouchDevice,H=f.Renderer.prototype.symbols,r=f.getOptions(),x;q(r.lang,{printChart:"Print chart",downloadPNG:"Download PNG image",downloadJPEG:"Download JPEG image",downloadPDF:"Download PDF document",downloadSVG:"Download SVG vector image",contextButtonTitle:"Chart context menu"});r.navigation=
10
+ {menuStyle:{border:"1px solid #A0A0A0",background:"#FFFFFF",padding:"5px 0"},menuItemStyle:{padding:"0 10px",background:"none",color:"#303030",fontSize:G?"14px":"11px"},menuItemHoverStyle:{background:"#4572A5",color:"#FFFFFF"},buttonOptions:{symbolFill:"#E0E0E0",symbolSize:14,symbolStroke:"#666",symbolStrokeWidth:3,symbolX:12.5,symbolY:10.5,align:"right",buttonSpacing:3,height:22,theme:{fill:"white",stroke:"none"},verticalAlign:"top",width:24}};r.exporting={type:"image/png",url:"http://export.highcharts.com/",
11
+ buttons:{contextButton:{menuClassName:"highcharts-contextmenu",symbol:"menu",_titleKey:"contextButtonTitle",menuItems:[{textKey:"printChart",onclick:function(){this.print()}},{separator:!0},{textKey:"downloadPNG",onclick:function(){this.exportChart()}},{textKey:"downloadJPEG",onclick:function(){this.exportChart({type:"image/jpeg"})}},{textKey:"downloadPDF",onclick:function(){this.exportChart({type:"application/pdf"})}},{textKey:"downloadSVG",onclick:function(){this.exportChart({type:"image/svg+xml"})}}]}}};
12
+ f.post=function(b,a,e){var c,b=j("form",l({method:"post",action:b,enctype:"multipart/form-data"},e),{display:"none"},k.body);for(c in a)j("input",{type:"hidden",name:c,value:a[c]},null,b);b.submit();p(b)};q(z.prototype,{sanitizeSVG:function(b){return b.replace(/zIndex="[^"]+"/g,"").replace(/isShadow="[^"]+"/g,"").replace(/symbolName="[^"]+"/g,"").replace(/jQuery[0-9]+="[^"]+"/g,"").replace(/url\([^#]+#/g,"url(#").replace(/<svg /,'<svg xmlns:xlink="http://www.w3.org/1999/xlink" ').replace(/ (NS[0-9]+\:)?href=/g,
13
+ " xlink:href=").replace(/\n/," ").replace(/<\/svg>.*?$/,"</svg>").replace(/(fill|stroke)="rgba\(([ 0-9]+,[ 0-9]+,[ 0-9]+),([ 0-9\.]+)\)"/g,'$1="rgb($2)" $1-opacity="$3"').replace(/&nbsp;/g,"В ").replace(/&shy;/g,"В­").replace(/<IMG /g,"<image ").replace(/<(\/?)TITLE>/g,"<$1title>").replace(/height=([^" ]+)/g,'height="$1"').replace(/width=([^" ]+)/g,'width="$1"').replace(/hc-svg-href="([^"]+)">/g,'xlink:href="$1"/>').replace(/ id=([^" >]+)/g,' id="$1"').replace(/class=([^" >]+)/g,'class="$1"').replace(/ transform /g,
14
+ " ").replace(/:(path|rect)/g,"$1").replace(/style="([^"]+)"/g,function(a){return a.toLowerCase()})},getSVG:function(b){var a=this,e,c,g,y,h,d=l(a.options,b);if(!k.createElementNS)k.createElementNS=function(a,b){return k.createElement(b)};c=j("div",null,{position:"absolute",top:"-9999em",width:a.chartWidth+"px",height:a.chartHeight+"px"},k.body);g=a.renderTo.style.width;h=a.renderTo.style.height;g=d.exporting.sourceWidth||d.chart.width||/px$/.test(g)&&parseInt(g,10)||600;h=d.exporting.sourceHeight||
15
+ d.chart.height||/px$/.test(h)&&parseInt(h,10)||400;q(d.chart,{animation:!1,renderTo:c,forExport:!0,width:g,height:h});d.exporting.enabled=!1;delete d.data;d.series=[];m(a.series,function(a){y=l(a.options,{animation:!1,enableMouseTracking:!1,showCheckbox:!1,visible:a.visible});y.isInternal||d.series.push(y)});b&&m(["xAxis","yAxis"],function(a){m(E(b[a]),function(b,c){d[a][c]=l(d[a][c],b)})});e=new f.Chart(d,a.callback);m(["xAxis","yAxis"],function(b){m(a[b],function(a,d){var c=e[b][d],g=a.getExtremes(),
16
+ h=g.userMin,g=g.userMax;c&&(h!==void 0||g!==void 0)&&c.setExtremes(h,g,!0,!1)})});g=e.container.innerHTML;d=null;e.destroy();p(c);g=this.sanitizeSVG(g);return g=g.replace(/(url\(#highcharts-[0-9]+)&quot;/g,"$1").replace(/&quot;/g,"'")},getSVGForExport:function(b,a){var e=this.options.exporting;return this.getSVG(l({chart:{borderRadius:0}},e.chartOptions,a,{exporting:{sourceWidth:b&&b.sourceWidth||e.sourceWidth,sourceHeight:b&&b.sourceHeight||e.sourceHeight}}))},exportChart:function(b,a){var e=this.getSVGForExport(b,
17
+ a),b=l(this.options.exporting,b);f.post(b.url,{filename:b.filename||"chart",type:b.type,width:b.width||0,scale:b.scale||2,svg:e},b.formAttributes)},print:function(){var b=this,a=b.container,e=[],c=a.parentNode,g=k.body,f=g.childNodes;if(!b.isPrinting)b.isPrinting=!0,B(b,"beforePrint"),m(f,function(a,b){if(a.nodeType===1)e[b]=a.style.display,a.style.display="none"}),g.appendChild(a),C.focus(),C.print(),setTimeout(function(){c.appendChild(a);m(f,function(a,b){if(a.nodeType===1)a.style.display=e[b]});
18
+ b.isPrinting=!1;B(b,"afterPrint")},1E3)},contextMenu:function(b,a,e,c,g,f,h){var d=this,l=d.options.navigation,D=l.menuItemStyle,n=d.chartWidth,o=d.chartHeight,k="cache-"+b,i=d[k],t=F(g,f),v,w,p,r=function(a){d.pointer.inClass(a.target,b)||w()};if(!i)d[k]=i=j("div",{className:b},{position:"absolute",zIndex:1E3,padding:t+"px"},d.container),v=j("div",null,q({MozBoxShadow:"3px 3px 10px #888",WebkitBoxShadow:"3px 3px 10px #888",boxShadow:"3px 3px 10px #888"},l.menuStyle),i),w=function(){u(i,{display:"none"});
19
+ h&&h.setState(0);d.openMenu=!1},s(i,"mouseleave",function(){p=setTimeout(w,500)}),s(i,"mouseenter",function(){clearTimeout(p)}),s(document,"mouseup",r),s(d,"destroy",function(){A(document,"mouseup",r)}),m(a,function(a){if(a){var b=a.separator?j("hr",null,null,v):j("div",{onmouseover:function(){u(this,l.menuItemHoverStyle)},onmouseout:function(){u(this,D)},onclick:function(){w();a.onclick&&a.onclick.apply(d,arguments)},innerHTML:a.text||d.options.lang[a.textKey]},q({cursor:"pointer"},D),v);d.exportDivElements.push(b)}}),
20
+ d.exportDivElements.push(v,i),d.exportMenuWidth=i.offsetWidth,d.exportMenuHeight=i.offsetHeight;a={display:"block"};e+d.exportMenuWidth>n?a.right=n-e-g-t+"px":a.left=e-t+"px";c+f+d.exportMenuHeight>o&&h.alignOptions.verticalAlign!=="top"?a.bottom=o-c-t+"px":a.top=c+f-t+"px";u(i,a);d.openMenu=!0},addButton:function(b){var a=this,e=a.renderer,c=l(a.options.navigation.buttonOptions,b),g=c.onclick,k=c.menuItems,h,d,m={stroke:c.symbolStroke,fill:c.symbolFill},j=c.symbolSize||12;if(!a.btnCount)a.btnCount=
21
+ 0;if(!a.exportDivElements)a.exportDivElements=[],a.exportSVGElements=[];if(c.enabled!==!1){var n=c.theme,o=n.states,p=o&&o.hover,o=o&&o.select,i;delete n.states;g?i=function(){g.apply(a,arguments)}:k&&(i=function(){a.contextMenu(d.menuClassName,k,d.translateX,d.translateY,d.width,d.height,d);d.setState(2)});c.text&&c.symbol?n.paddingLeft=f.pick(n.paddingLeft,25):c.text||q(n,{width:c.width,height:c.height,padding:0});d=e.button(c.text,0,0,i,n,p,o).attr({title:a.options.lang[c._titleKey],"stroke-linecap":"round"});
22
+ d.menuClassName=b.menuClassName||"highcharts-menu-"+a.btnCount++;c.symbol&&(h=e.symbol(c.symbol,c.symbolX-j/2,c.symbolY-j/2,j,j).attr(q(m,{"stroke-width":c.symbolStrokeWidth||1,zIndex:1})).add(d));d.add().align(q(c,{width:d.width,x:f.pick(c.x,x)}),!0,"spacingBox");x+=(d.width+c.buttonSpacing)*(c.align==="right"?-1:1);a.exportSVGElements.push(d,h)}},destroyExport:function(b){var b=b.target,a,e;for(a=0;a<b.exportSVGElements.length;a++)if(e=b.exportSVGElements[a])e.onclick=e.ontouchstart=null,b.exportSVGElements[a]=
23
+ e.destroy();for(a=0;a<b.exportDivElements.length;a++)e=b.exportDivElements[a],A(e,"mouseleave"),b.exportDivElements[a]=e.onmouseout=e.onmouseover=e.ontouchstart=e.onclick=null,p(e)}});H.menu=function(b,a,e,c){return["M",b,a+2.5,"L",b+e,a+2.5,"M",b,a+c/2+0.5,"L",b+e,a+c/2+0.5,"M",b,a+c-1.5,"L",b+e,a+c-1.5]};z.prototype.callbacks.push(function(b){var a,e=b.options.exporting,c=e.buttons;x=0;if(e.enabled!==!1){for(a in c)b.addButton(c[a]);s(b,"destroy",b.destroyExport)}})})(Highcharts);