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.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/VERSION +1 -1
- data/app/assets/javascripts/swat/app/app.coffee +8 -1
- data/app/assets/javascripts/swat/app/controllers/management/configuration.coffee +2 -2
- data/app/assets/javascripts/swat/app/controllers/management/confirmation.coffee +21 -0
- data/app/assets/javascripts/swat/app/controllers/management/console.coffee +33 -0
- data/app/assets/javascripts/swat/app/directives/components/custom-dropdown.coffee +35 -0
- data/app/assets/javascripts/swat/app/directives/components.coffee +1 -0
- data/app/assets/javascripts/swat/app/factories/configuration/confirmation_dialog.coffee +10 -0
- data/app/assets/javascripts/swat/app/factories/helpers.coffee +9 -2
- data/app/assets/javascripts/swat/app/factories/summary/fails_graph.coffee +1 -0
- data/app/assets/javascripts/swat/app/services/configuration.coffee +1 -0
- data/app/assets/javascripts/swat/app/services/console.coffee +8 -0
- data/app/assets/javascripts/swat/bower_components.coffee +1 -0
- data/app/assets/javascripts/swat/lib/highcharts-exporting.js +23 -0
- data/app/assets/javascripts/swat/lib/highcharts.src.js +324 -18634
- data/app/assets/stylesheets/swat/application.scss +29 -3
- data/app/assets/stylesheets/swat/boostrap_vars.scss +872 -0
- data/app/assets/stylesheets/swat/components/dropdown.scss +124 -0
- data/app/assets/stylesheets/swat/configuration.scss +3 -23
- data/app/assets/stylesheets/swat/confirmation.scss +60 -0
- data/app/assets/stylesheets/swat/console.scss +68 -0
- data/app/assets/stylesheets/swat/header.scss +1 -0
- data/app/assets/stylesheets/swat/swat_theme.scss +5 -7
- data/app/assets/stylesheets/swat/vars.scss +21 -11
- data/app/controllers/swat/api/console_controller.rb +17 -0
- data/app/controllers/swat/pages/components_controller.rb +6 -0
- data/app/models/concerns/root_revision_ext.rb +31 -0
- data/app/models/revision_cleaner.rb +57 -0
- data/app/views/swat/pages/components/custom_dropdown.slim +16 -0
- data/app/views/swat/pages/management/configuration.slim +3 -3
- data/app/views/swat/pages/management/confirmation.slim +13 -0
- data/app/views/swat/pages/management/console.slim +6 -0
- data/app/views/swat/pages/management/partials/_action_bar.slim +26 -0
- data/app/views/swat/pages/management/partials/_stats.slim +4 -0
- data/app/views/swat/shared/_nav.slim +6 -6
- data/config/routes.rb +14 -13
- data/lib/swat/engine.rb +2 -0
- data/lib/swat/ui/rspec_commands.rb +3 -2
- data/spec/models/calculator_spec.rb +1 -1
- data/spec/models/full_revision_spec.rb +14 -0
- data/spec/models/revision_cleaner_spec.rb +27 -0
- data/spec/models/revision_stats_spec.rb +0 -0
- data/spec/spec_helper.rb +1 -0
- data/sw2at-ui.gemspec +27 -6
- metadata +27 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a521e7106db4371edd442ed6cdaeac92593bddd0
|
4
|
+
data.tar.gz: 27b261b4316c5827f566fefe3cbe4ee3bb5728c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1045965a0bc19f739f1dcc325da72d78a3f0f21dd9937bb0ac5096ab8cb78a569203fd7c13308fd6ada6e48711f5d7b6deeebf0d75bb31a363012485d001aff
|
7
|
+
data.tar.gz: 1c7cd5184fb233916c52c85809ac2da1325868c4f8b603d6b7ac41afc761352bbb079bb01c905c0934c0f21aa27028b95a0b269f1fa4d763ded8b1717529bfeb
|
data/Gemfile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
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
|
-
|
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
|
|
@@ -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(/ /g,"В ").replace(/­/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]+)"/g,"$1").replace(/"/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);
|