conjur-asset-ui-beta 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. checksums.yaml +7 -0
  2. data/.git-hooks/pre_commit/trailing_whitespace.rb +26 -0
  3. data/.gitignore +23 -0
  4. data/.project +18 -0
  5. data/CHANGELOG.md +14 -0
  6. data/Gemfile +10 -0
  7. data/LICENSE.txt +22 -0
  8. data/README.md +72 -0
  9. data/Rakefile +76 -0
  10. data/TODO.md +31 -0
  11. data/app/.csscomb.json +304 -0
  12. data/app/.jshintrc +46 -0
  13. data/app/build/css/bootstrap.css +6906 -0
  14. data/app/build/fonts/glyphicons-halflings-regular.eot +0 -0
  15. data/app/build/fonts/glyphicons-halflings-regular.svg +288 -0
  16. data/app/build/fonts/glyphicons-halflings-regular.ttf +0 -0
  17. data/app/build/fonts/glyphicons-halflings-regular.woff +0 -0
  18. data/app/build/fonts/glyphicons-halflings-regular.woff2 +0 -0
  19. data/app/build/images/conjur-logo.svg +26 -0
  20. data/app/build/images/icon-client-pc.svg +12 -0
  21. data/app/build/images/icon-environment.png +0 -0
  22. data/app/build/images/icon-person.svg +12 -0
  23. data/app/build/images/icon-policy.png +0 -0
  24. data/app/build/images/icon-resource.png +0 -0
  25. data/app/build/images/icon-service-dots.svg +13 -0
  26. data/app/build/images/icon-variable.png +0 -0
  27. data/app/build/index.html +26 -0
  28. data/app/build/js/app.js +78070 -0
  29. data/app/build/js/pace.js +2 -0
  30. data/app/config/preprocessor.js +9 -0
  31. data/app/config/webpack.js +84 -0
  32. data/app/gulpfile.js +144 -0
  33. data/app/package.json +83 -0
  34. data/app/src/actions.js +493 -0
  35. data/app/src/app.js +76 -0
  36. data/app/src/clients/audit.js +54 -0
  37. data/app/src/clients/generic.js +87 -0
  38. data/app/src/clients/layer_members.js +36 -0
  39. data/app/src/clients/list.js +82 -0
  40. data/app/src/clients/members.js +37 -0
  41. data/app/src/clients/search.js +19 -0
  42. data/app/src/components/app/__tests__/app-test.js +22 -0
  43. data/app/src/components/app/app.js +66 -0
  44. data/app/src/components/audit/__tests__/table_header-test.js +40 -0
  45. data/app/src/components/audit/box.js +11 -0
  46. data/app/src/components/audit/constants.js +7 -0
  47. data/app/src/components/audit/entry.js +107 -0
  48. data/app/src/components/audit/fields_mixin.js +13 -0
  49. data/app/src/components/audit/humanize_event.js +216 -0
  50. data/app/src/components/audit/table.js +100 -0
  51. data/app/src/components/audit/table_header.js +38 -0
  52. data/app/src/components/audit/timestamp.js +30 -0
  53. data/app/src/components/chart/chart.js +539 -0
  54. data/app/src/components/chart/chart_helper_mixin.js +79 -0
  55. data/app/src/components/custom/list.js +5 -0
  56. data/app/src/components/custom/view.js +71 -0
  57. data/app/src/components/dashboard/activity.js +113 -0
  58. data/app/src/components/dashboard/dashboard.js +47 -0
  59. data/app/src/components/flash/flash.js +17 -0
  60. data/app/src/components/generic/__tests__/time-test.js +43 -0
  61. data/app/src/components/generic/annotations.js +41 -0
  62. data/app/src/components/generic/breadcrumbs.js +59 -0
  63. data/app/src/components/generic/foldable_audit_section.js +252 -0
  64. data/app/src/components/generic/list.js +144 -0
  65. data/app/src/components/generic/list_factory.js +42 -0
  66. data/app/src/components/generic/resource_link.js +65 -0
  67. data/app/src/components/generic/role_link.js +65 -0
  68. data/app/src/components/generic/tab_mixin.js +148 -0
  69. data/app/src/components/generic/time.js +34 -0
  70. data/app/src/components/group/list.js +5 -0
  71. data/app/src/components/group/view.js +137 -0
  72. data/app/src/components/host/activity.js +93 -0
  73. data/app/src/components/host/details.js +30 -0
  74. data/app/src/components/host/host_link.js +20 -0
  75. data/app/src/components/host/list.js +5 -0
  76. data/app/src/components/host/view.js +113 -0
  77. data/app/src/components/layer/list.js +5 -0
  78. data/app/src/components/layer/view.js +180 -0
  79. data/app/src/components/navbar/__tests__/navbar-test.js +21 -0
  80. data/app/src/components/navbar/nav_search_form.js +41 -0
  81. data/app/src/components/navbar/navbar.js +71 -0
  82. data/app/src/components/owned_resources/owned_resources.js +86 -0
  83. data/app/src/components/owned_resources/owned_resources_box.js +106 -0
  84. data/app/src/components/permissions/permissions.js +143 -0
  85. data/app/src/components/permissions/permissions_table.js +104 -0
  86. data/app/src/components/policy/list.js +5 -0
  87. data/app/src/components/policy/view.js +98 -0
  88. data/app/src/components/refresh/refresh.js +30 -0
  89. data/app/src/components/refresh/refresh.less +15 -0
  90. data/app/src/components/search/group.js +45 -0
  91. data/app/src/components/search/group_heading.js +50 -0
  92. data/app/src/components/search/group_title.js +38 -0
  93. data/app/src/components/search/result_item.js +57 -0
  94. data/app/src/components/search/search.js +103 -0
  95. data/app/src/components/user/activity.js +92 -0
  96. data/app/src/components/user/details.js +30 -0
  97. data/app/src/components/user/list.js +5 -0
  98. data/app/src/components/user/pubkeys.js +116 -0
  99. data/app/src/components/user/pubkeys.less +56 -0
  100. data/app/src/components/user/view.js +123 -0
  101. data/app/src/components/variable/activity.js +83 -0
  102. data/app/src/components/variable/details.js +48 -0
  103. data/app/src/components/variable/fetchers.js +83 -0
  104. data/app/src/components/variable/list.js +5 -0
  105. data/app/src/components/variable/updaters.js +83 -0
  106. data/app/src/components/variable/view.js +105 -0
  107. data/app/src/constants.js +35 -0
  108. data/app/src/images/conjur-logo.svg +26 -0
  109. data/app/src/images/icon-client-pc.svg +12 -0
  110. data/app/src/images/icon-environment.png +0 -0
  111. data/app/src/images/icon-person.svg +12 -0
  112. data/app/src/images/icon-policy.png +0 -0
  113. data/app/src/images/icon-resource.png +0 -0
  114. data/app/src/images/icon-service-dots.svg +13 -0
  115. data/app/src/images/icon-variable.png +0 -0
  116. data/app/src/pages/index.html +26 -0
  117. data/app/src/routes.js +57 -0
  118. data/app/src/stores/app_store.js +29 -0
  119. data/app/src/stores/audit_store.js +77 -0
  120. data/app/src/stores/group_store.js +105 -0
  121. data/app/src/stores/host_store.js +98 -0
  122. data/app/src/stores/layer_store.js +115 -0
  123. data/app/src/stores/policy_store.js +89 -0
  124. data/app/src/stores/resources_store.js +118 -0
  125. data/app/src/stores/route_store.js +24 -0
  126. data/app/src/stores/search_store.js +73 -0
  127. data/app/src/stores/user_store.js +111 -0
  128. data/app/src/stores/variable_store.js +94 -0
  129. data/app/src/styles/bootstrap.less +56 -0
  130. data/app/src/styles/styles.less +634 -0
  131. data/app/src/utils.js +43 -0
  132. data/app/src/vendor/pace.js +2 -0
  133. data/conjur-asset-ui.gemspec +36 -0
  134. data/features/navigation_bar.feature +31 -0
  135. data/features/step_definitions/custom_step.rb +32 -0
  136. data/features/support/env.rb +38 -0
  137. data/features/support/hooks.rb +30 -0
  138. data/features/support/world.rb +17 -0
  139. data/lib/conjur-asset-ui-version.rb +7 -0
  140. data/lib/conjur-asset-ui.rb +7 -0
  141. data/lib/conjur/command/ui.rb +54 -0
  142. data/lib/conjur/webserver/api_proxy.rb +94 -0
  143. data/lib/conjur/webserver/authorize.rb +28 -0
  144. data/lib/conjur/webserver/conjur_info.rb +33 -0
  145. data/lib/conjur/webserver/home.rb +42 -0
  146. data/lib/conjur/webserver/login.rb +57 -0
  147. data/lib/conjur/webserver/renderer.rb +34 -0
  148. data/lib/conjur/webserver/server.rb +130 -0
  149. data/public/js/views/roleGraph.js +91 -0
  150. metadata +373 -0
@@ -0,0 +1,2 @@
1
+ /*! pace 1.0.0 */
2
+ (function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X=[].slice,Y={}.hasOwnProperty,Z=function(a,b){function c(){this.constructor=a}for(var d in b)Y.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},$=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1};for(u={catchupTime:100,initialRate:.03,minTime:250,ghostTime:100,maxProgressPerFrame:20,easeFactor:1.25,startOnPageLoad:!0,restartOnPushState:!0,restartOnRequestAfter:500,target:"body",elements:{checkInterval:100,selectors:["body"]},eventLag:{minSamples:10,sampleCount:3,lagThreshold:3},ajax:{trackMethods:["GET"],trackWebSockets:!0,ignoreURLs:[]}},C=function(){var a;return null!=(a="undefined"!=typeof performance&&null!==performance&&"function"==typeof performance.now?performance.now():void 0)?a:+new Date},E=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame,t=window.cancelAnimationFrame||window.mozCancelAnimationFrame,null==E&&(E=function(a){return setTimeout(a,50)},t=function(a){return clearTimeout(a)}),G=function(a){var b,c;return b=C(),(c=function(){var d;return d=C()-b,d>=33?(b=C(),a(d,function(){return E(c)})):setTimeout(c,33-d)})()},F=function(){var a,b,c;return c=arguments[0],b=arguments[1],a=3<=arguments.length?X.call(arguments,2):[],"function"==typeof c[b]?c[b].apply(c,a):c[b]},v=function(){var a,b,c,d,e,f,g;for(b=arguments[0],d=2<=arguments.length?X.call(arguments,1):[],f=0,g=d.length;g>f;f++)if(c=d[f])for(a in c)Y.call(c,a)&&(e=c[a],null!=b[a]&&"object"==typeof b[a]&&null!=e&&"object"==typeof e?v(b[a],e):b[a]=e);return b},q=function(a){var b,c,d,e,f;for(c=b=0,e=0,f=a.length;f>e;e++)d=a[e],c+=Math.abs(d),b++;return c/b},x=function(a,b){var c,d,e;if(null==a&&(a="options"),null==b&&(b=!0),e=document.querySelector("[data-pace-"+a+"]")){if(c=e.getAttribute("data-pace-"+a),!b)return c;try{return JSON.parse(c)}catch(f){return d=f,"undefined"!=typeof console&&null!==console?console.error("Error parsing inline pace options",d):void 0}}},g=function(){function a(){}return a.prototype.on=function(a,b,c,d){var e;return null==d&&(d=!1),null==this.bindings&&(this.bindings={}),null==(e=this.bindings)[a]&&(e[a]=[]),this.bindings[a].push({handler:b,ctx:c,once:d})},a.prototype.once=function(a,b,c){return this.on(a,b,c,!0)},a.prototype.off=function(a,b){var c,d,e;if(null!=(null!=(d=this.bindings)?d[a]:void 0)){if(null==b)return delete this.bindings[a];for(c=0,e=[];c<this.bindings[a].length;)e.push(this.bindings[a][c].handler===b?this.bindings[a].splice(c,1):c++);return e}},a.prototype.trigger=function(){var a,b,c,d,e,f,g,h,i;if(c=arguments[0],a=2<=arguments.length?X.call(arguments,1):[],null!=(g=this.bindings)?g[c]:void 0){for(e=0,i=[];e<this.bindings[c].length;)h=this.bindings[c][e],d=h.handler,b=h.ctx,f=h.once,d.apply(null!=b?b:this,a),i.push(f?this.bindings[c].splice(e,1):e++);return i}},a}(),j=window.Pace||{},window.Pace=j,v(j,g.prototype),D=j.options=v({},u,window.paceOptions,x()),U=["ajax","document","eventLag","elements"],Q=0,S=U.length;S>Q;Q++)K=U[Q],D[K]===!0&&(D[K]=u[K]);i=function(a){function b(){return V=b.__super__.constructor.apply(this,arguments)}return Z(b,a),b}(Error),b=function(){function a(){this.progress=0}return a.prototype.getElement=function(){var a;if(null==this.el){if(a=document.querySelector(D.target),!a)throw new i;this.el=document.createElement("div"),this.el.className="pace pace-active",document.body.className=document.body.className.replace(/pace-done/g,""),document.body.className+=" pace-running",this.el.innerHTML='<div class="pace-progress">\n <div class="pace-progress-inner"></div>\n</div>\n<div class="pace-activity"></div>',null!=a.firstChild?a.insertBefore(this.el,a.firstChild):a.appendChild(this.el)}return this.el},a.prototype.finish=function(){var a;return a=this.getElement(),a.className=a.className.replace("pace-active",""),a.className+=" pace-inactive",document.body.className=document.body.className.replace("pace-running",""),document.body.className+=" pace-done"},a.prototype.update=function(a){return this.progress=a,this.render()},a.prototype.destroy=function(){try{this.getElement().parentNode.removeChild(this.getElement())}catch(a){i=a}return this.el=void 0},a.prototype.render=function(){var a,b,c,d,e,f,g;if(null==document.querySelector(D.target))return!1;for(a=this.getElement(),d="translate3d("+this.progress+"%, 0, 0)",g=["webkitTransform","msTransform","transform"],e=0,f=g.length;f>e;e++)b=g[e],a.children[0].style[b]=d;return(!this.lastRenderedProgress||this.lastRenderedProgress|0!==this.progress|0)&&(a.children[0].setAttribute("data-progress-text",""+(0|this.progress)+"%"),this.progress>=100?c="99":(c=this.progress<10?"0":"",c+=0|this.progress),a.children[0].setAttribute("data-progress",""+c)),this.lastRenderedProgress=this.progress},a.prototype.done=function(){return this.progress>=100},a}(),h=function(){function a(){this.bindings={}}return a.prototype.trigger=function(a,b){var c,d,e,f,g;if(null!=this.bindings[a]){for(f=this.bindings[a],g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(c.call(this,b));return g}},a.prototype.on=function(a,b){var c;return null==(c=this.bindings)[a]&&(c[a]=[]),this.bindings[a].push(b)},a}(),P=window.XMLHttpRequest,O=window.XDomainRequest,N=window.WebSocket,w=function(a,b){var c,d,e,f;f=[];for(d in b.prototype)try{e=b.prototype[d],f.push(null==a[d]&&"function"!=typeof e?a[d]=e:void 0)}catch(g){c=g}return f},A=[],j.ignore=function(){var a,b,c;return b=arguments[0],a=2<=arguments.length?X.call(arguments,1):[],A.unshift("ignore"),c=b.apply(null,a),A.shift(),c},j.track=function(){var a,b,c;return b=arguments[0],a=2<=arguments.length?X.call(arguments,1):[],A.unshift("track"),c=b.apply(null,a),A.shift(),c},J=function(a){var b;if(null==a&&(a="GET"),"track"===A[0])return"force";if(!A.length&&D.ajax){if("socket"===a&&D.ajax.trackWebSockets)return!0;if(b=a.toUpperCase(),$.call(D.ajax.trackMethods,b)>=0)return!0}return!1},k=function(a){function b(){var a,c=this;b.__super__.constructor.apply(this,arguments),a=function(a){var b;return b=a.open,a.open=function(d,e){return J(d)&&c.trigger("request",{type:d,url:e,request:a}),b.apply(a,arguments)}},window.XMLHttpRequest=function(b){var c;return c=new P(b),a(c),c};try{w(window.XMLHttpRequest,P)}catch(d){}if(null!=O){window.XDomainRequest=function(){var b;return b=new O,a(b),b};try{w(window.XDomainRequest,O)}catch(d){}}if(null!=N&&D.ajax.trackWebSockets){window.WebSocket=function(a,b){var d;return d=null!=b?new N(a,b):new N(a),J("socket")&&c.trigger("request",{type:"socket",url:a,protocols:b,request:d}),d};try{w(window.WebSocket,N)}catch(d){}}}return Z(b,a),b}(h),R=null,y=function(){return null==R&&(R=new k),R},I=function(a){var b,c,d,e;for(e=D.ajax.ignoreURLs,c=0,d=e.length;d>c;c++)if(b=e[c],"string"==typeof b){if(-1!==a.indexOf(b))return!0}else if(b.test(a))return!0;return!1},y().on("request",function(b){var c,d,e,f,g;return f=b.type,e=b.request,g=b.url,I(g)?void 0:j.running||D.restartOnRequestAfter===!1&&"force"!==J(f)?void 0:(d=arguments,c=D.restartOnRequestAfter||0,"boolean"==typeof c&&(c=0),setTimeout(function(){var b,c,g,h,i,k;if(b="socket"===f?e.readyState<2:0<(h=e.readyState)&&4>h){for(j.restart(),i=j.sources,k=[],c=0,g=i.length;g>c;c++){if(K=i[c],K instanceof a){K.watch.apply(K,d);break}k.push(void 0)}return k}},c))}),a=function(){function a(){var a=this;this.elements=[],y().on("request",function(){return a.watch.apply(a,arguments)})}return a.prototype.watch=function(a){var b,c,d,e;return d=a.type,b=a.request,e=a.url,I(e)?void 0:(c="socket"===d?new n(b):new o(b),this.elements.push(c))},a}(),o=function(){function a(a){var b,c,d,e,f,g,h=this;if(this.progress=0,null!=window.ProgressEvent)for(c=null,a.addEventListener("progress",function(a){return h.progress=a.lengthComputable?100*a.loaded/a.total:h.progress+(100-h.progress)/2},!1),g=["load","abort","timeout","error"],d=0,e=g.length;e>d;d++)b=g[d],a.addEventListener(b,function(){return h.progress=100},!1);else f=a.onreadystatechange,a.onreadystatechange=function(){var b;return 0===(b=a.readyState)||4===b?h.progress=100:3===a.readyState&&(h.progress=50),"function"==typeof f?f.apply(null,arguments):void 0}}return a}(),n=function(){function a(a){var b,c,d,e,f=this;for(this.progress=0,e=["error","open"],c=0,d=e.length;d>c;c++)b=e[c],a.addEventListener(b,function(){return f.progress=100},!1)}return a}(),d=function(){function a(a){var b,c,d,f;for(null==a&&(a={}),this.elements=[],null==a.selectors&&(a.selectors=[]),f=a.selectors,c=0,d=f.length;d>c;c++)b=f[c],this.elements.push(new e(b))}return a}(),e=function(){function a(a){this.selector=a,this.progress=0,this.check()}return a.prototype.check=function(){var a=this;return document.querySelector(this.selector)?this.done():setTimeout(function(){return a.check()},D.elements.checkInterval)},a.prototype.done=function(){return this.progress=100},a}(),c=function(){function a(){var a,b,c=this;this.progress=null!=(b=this.states[document.readyState])?b:100,a=document.onreadystatechange,document.onreadystatechange=function(){return null!=c.states[document.readyState]&&(c.progress=c.states[document.readyState]),"function"==typeof a?a.apply(null,arguments):void 0}}return a.prototype.states={loading:0,interactive:50,complete:100},a}(),f=function(){function a(){var a,b,c,d,e,f=this;this.progress=0,a=0,e=[],d=0,c=C(),b=setInterval(function(){var g;return g=C()-c-50,c=C(),e.push(g),e.length>D.eventLag.sampleCount&&e.shift(),a=q(e),++d>=D.eventLag.minSamples&&a<D.eventLag.lagThreshold?(f.progress=100,clearInterval(b)):f.progress=100*(3/(a+3))},50)}return a}(),m=function(){function a(a){this.source=a,this.last=this.sinceLastUpdate=0,this.rate=D.initialRate,this.catchup=0,this.progress=this.lastProgress=0,null!=this.source&&(this.progress=F(this.source,"progress"))}return a.prototype.tick=function(a,b){var c;return null==b&&(b=F(this.source,"progress")),b>=100&&(this.done=!0),b===this.last?this.sinceLastUpdate+=a:(this.sinceLastUpdate&&(this.rate=(b-this.last)/this.sinceLastUpdate),this.catchup=(b-this.progress)/D.catchupTime,this.sinceLastUpdate=0,this.last=b),b>this.progress&&(this.progress+=this.catchup*a),c=1-Math.pow(this.progress/100,D.easeFactor),this.progress+=c*this.rate*a,this.progress=Math.min(this.lastProgress+D.maxProgressPerFrame,this.progress),this.progress=Math.max(0,this.progress),this.progress=Math.min(100,this.progress),this.lastProgress=this.progress,this.progress},a}(),L=null,H=null,r=null,M=null,p=null,s=null,j.running=!1,z=function(){return D.restartOnPushState?j.restart():void 0},null!=window.history.pushState&&(T=window.history.pushState,window.history.pushState=function(){return z(),T.apply(window.history,arguments)}),null!=window.history.replaceState&&(W=window.history.replaceState,window.history.replaceState=function(){return z(),W.apply(window.history,arguments)}),l={ajax:a,elements:d,document:c,eventLag:f},(B=function(){var a,c,d,e,f,g,h,i;for(j.sources=L=[],g=["ajax","elements","document","eventLag"],c=0,e=g.length;e>c;c++)a=g[c],D[a]!==!1&&L.push(new l[a](D[a]));for(i=null!=(h=D.extraSources)?h:[],d=0,f=i.length;f>d;d++)K=i[d],L.push(new K(D));return j.bar=r=new b,H=[],M=new m})(),j.stop=function(){return j.trigger("stop"),j.running=!1,r.destroy(),s=!0,null!=p&&("function"==typeof t&&t(p),p=null),B()},j.restart=function(){return j.trigger("restart"),j.stop(),j.start()},j.go=function(){var a;return j.running=!0,r.render(),a=C(),s=!1,p=G(function(b,c){var d,e,f,g,h,i,k,l,n,o,p,q,t,u,v,w;for(l=100-r.progress,e=p=0,f=!0,i=q=0,u=L.length;u>q;i=++q)for(K=L[i],o=null!=H[i]?H[i]:H[i]=[],h=null!=(w=K.elements)?w:[K],k=t=0,v=h.length;v>t;k=++t)g=h[k],n=null!=o[k]?o[k]:o[k]=new m(g),f&=n.done,n.done||(e++,p+=n.tick(b));return d=p/e,r.update(M.tick(b,d)),r.done()||f||s?(r.update(100),j.trigger("done"),setTimeout(function(){return r.finish(),j.running=!1,j.trigger("hide")},Math.max(D.ghostTime,Math.max(D.minTime-(C()-a),0)))):c()})},j.start=function(a){v(D,a),j.running=!0;try{r.render()}catch(b){i=b}return document.querySelector(".pace")?(j.trigger("start"),j.go()):setTimeout(j.start,50)},"function"==typeof define&&define.amd?define(function(){return j}):"object"==typeof exports?module.exports=j:D.startOnPageLoad&&j.start()}).call(this);
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ var ReactTools = require('react-tools');
4
+
5
+ module.exports = {
6
+ process: function(src, path) {
7
+ return ReactTools.transform(src, { harmony: true, stripTypes: true });
8
+ }
9
+ };
@@ -0,0 +1,84 @@
1
+ 'use strict';
2
+
3
+ var webpack = require('webpack');
4
+
5
+ /**
6
+ * Get configuration for Webpack
7
+ *
8
+ * @see http://webpack.github.io/docs/configuration
9
+ * https://github.com/petehunt/webpack-howto
10
+ *
11
+ * @param {boolean} release True if configuration is intended to be used in
12
+ * a release mode, false otherwise
13
+ * @return {object} Webpack configuration
14
+ */
15
+ module.exports = function(release) {
16
+ return {
17
+ entry: './src/app.js',
18
+
19
+ output: {
20
+ filename: 'app.js',
21
+ path: './build/js/',
22
+ publicPath: './build/js/'
23
+ },
24
+
25
+ cache: !release,
26
+ debug: !release,
27
+ devtool: false,
28
+
29
+ stats: {
30
+ colors: true,
31
+ reasons: !release
32
+ },
33
+
34
+ plugins: release ? [
35
+ new webpack.DefinePlugin({
36
+ 'process.env.NODE_ENV': '"production"',
37
+ '__DEV__': false
38
+ }),
39
+ new webpack.optimize.DedupePlugin(),
40
+ new webpack.optimize.UglifyJsPlugin(),
41
+ new webpack.optimize.OccurenceOrderPlugin(),
42
+ new webpack.optimize.AggressiveMergingPlugin()
43
+ ] : [
44
+ new webpack.DefinePlugin({'__DEV__': true})
45
+ ],
46
+
47
+ resolve: {
48
+ extensions: ['', '.webpack.js', '.web.js', '.js']
49
+ },
50
+
51
+ module: {
52
+ loaders: [
53
+ {
54
+ test: /\.css$/,
55
+ loader: 'style-loader!css-loader!autoprefixer-loader?{browsers:[' +
56
+ '"Android 2.3", "Android >= 4", "Chrome >= 20", "Firefox >= 24", ' +
57
+ '"Explorer >= 8", "iOS >= 6", "Opera >= 12", "Safari >= 6"]}'
58
+ },
59
+ {
60
+ test: /\.less$/,
61
+ loader: 'style-loader!css-loader!autoprefixer-loader?{browsers:[' +
62
+ '"Android 2.3", "Android >= 4", "Chrome >= 20", "Firefox >= 24", ' +
63
+ '"Explorer >= 8", "iOS >= 6", "Opera >= 12", "Safari >= 6"]}!less-loader'
64
+ },
65
+ {
66
+ test: /\.gif/,
67
+ loader: 'url-loader?limit=10000&mimetype=image/gif'
68
+ },
69
+ {
70
+ test: /\.jpg/,
71
+ loader: 'url-loader?limit=10000&mimetype=image/jpg'
72
+ },
73
+ {
74
+ test: /\.png/,
75
+ loader: 'url-loader?limit=10000&mimetype=image/png'
76
+ },
77
+ {
78
+ test: /\.js?$/,
79
+ loader: 'jsx-loader?harmony&stripTypes'
80
+ }
81
+ ]
82
+ }
83
+ };
84
+ };
data/app/gulpfile.js ADDED
@@ -0,0 +1,144 @@
1
+ 'use strict';
2
+
3
+ var g = require('gulp'),
4
+ p = require('gulp-load-plugins')(),
5
+ argv = require('minimist')(process.argv.slice(2)),
6
+ webpack = require('webpack'),
7
+ runSequence = require('run-sequence'),
8
+ del = require('del'),
9
+ stylish = require('jshint-stylish');
10
+
11
+ var RELEASE = !!argv.release,
12
+ AUTOPREFIXER_BROWSERS = [
13
+ 'ie >= 10',
14
+ 'ie_mob >= 10',
15
+ 'ff >= 30',
16
+ 'chrome >= 34',
17
+ 'safari >= 7',
18
+ 'opera >= 23',
19
+ 'ios >= 7',
20
+ 'android >= 4.4',
21
+ 'bb >= 10'
22
+ ];
23
+
24
+ var watch = false,
25
+ paths = {
26
+ js: 'src/**/*.js',
27
+ images: 'src/images/*',
28
+ pages: 'src/pages/*.html'
29
+ };
30
+
31
+ var src = {};
32
+
33
+ g.task('clean', function(cb) {
34
+ return del(['build'], cb);
35
+ });
36
+
37
+ g.task('vendor', function() {
38
+ return g
39
+ .src('src/vendor/*.js')
40
+ .pipe(g.dest('build/js'))
41
+ .pipe(p.size({title: 'vendor'}));
42
+ });
43
+
44
+ g.task('vendor-bootstrap', function() {
45
+ return g
46
+ .src('node_modules/bootstrap/dist/fonts/**')
47
+ .pipe(g.dest('build/fonts'))
48
+ .pipe(p.size({title: 'vendor-bootstrap'}));
49
+ });
50
+
51
+ g.task('bundle', function(cb) {
52
+ var started = false,
53
+ config = require('./config/webpack.js')(RELEASE),
54
+ bundler = webpack(config);
55
+
56
+ function bundle(err, stats) {
57
+ if (err) {
58
+ throw new p.util.PluginError('webpack', err);
59
+ }
60
+
61
+ if (argv.verbose) {
62
+ p.util.log('[webpack]', stats.toString({colors: true}));
63
+ }
64
+
65
+ if (!started) {
66
+ started = true;
67
+ return cb();
68
+ }
69
+
70
+ return false;
71
+ }
72
+
73
+ if (watch) {
74
+ bundler.watch(200, bundle);
75
+ } else {
76
+ bundler.run(bundle);
77
+ }
78
+ });
79
+
80
+ g.task('jshint', function() {
81
+ var stream = g
82
+ .src(['./src/**/**/*.js', 'gulpfile.js'])
83
+ .pipe(p.insert.prepend('/** @jsx React.DOM */'))
84
+ .pipe(p.react({harmony: true, stripTypes: true}))
85
+ .pipe(p.jshint())
86
+ .pipe(p.jshint.reporter(stylish));
87
+
88
+ if (process.env.CI) {
89
+ stream = stream.pipe(p.jshint.reporter('fail'));
90
+ }
91
+
92
+ return stream;
93
+ });
94
+
95
+ g.task('styles', function() {
96
+ src.styles = ('src/styles/**/*.{css,less}');
97
+
98
+ return g.src('src/styles/bootstrap.less')
99
+ .pipe(p.plumber())
100
+ .pipe(p.less({
101
+ sourceMap: !RELEASE,
102
+ sourceMapBasepath: __dirname
103
+ }))
104
+ .on('error', console.error.bind(console))
105
+ .pipe(p.autoprefixer({
106
+ browsers: AUTOPREFIXER_BROWSERS
107
+ }))
108
+ .pipe(p.csscomb())
109
+ .pipe(p.if(RELEASE, p.minifyCss()))
110
+ .pipe(g.dest('build/css'))
111
+ .pipe(p.size({title: 'styles'}));
112
+ });
113
+
114
+ g.task('images', function() {
115
+ return g
116
+ .src(paths.images)
117
+ .pipe(g.dest('build/images'))
118
+ .pipe(p.size({title: 'images'}));
119
+ });
120
+
121
+ g.task('pages', function() {
122
+ return g
123
+ .src(paths.pages)
124
+ .pipe(g.dest('build'))
125
+ .pipe(p.size({title: 'pages'}));
126
+ });
127
+
128
+ g.task('watch', function(cb) {
129
+ watch = true;
130
+
131
+ g.watch(paths.styles, ['styles']);
132
+
133
+ runSequence('bundle');
134
+
135
+ cb();
136
+
137
+ console.log('Watching files for changes...');
138
+ });
139
+
140
+ g.task('build', function(cb) {
141
+ runSequence('clean', ['styles', 'bundle', 'vendor', 'vendor-bootstrap', 'images', 'pages'], cb);
142
+ });
143
+
144
+ g.task('default', ['build']);
data/app/package.json ADDED
@@ -0,0 +1,83 @@
1
+ {
2
+ "name": "conjur-asset-ui",
3
+ "private": true,
4
+ "version": "1.5.0",
5
+ "description": "Conjur UI",
6
+ "author": "Nikolai Sevostjanov <nikolai.sevostjanov@gmail.com>",
7
+ "license": "MIT",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git://github.com/conjurinc/conjur-asset-ui.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/conjurinc/conjur-asset-ui/issues"
14
+ },
15
+ "dependencies": {
16
+ "bootstrap": "^3.3.2",
17
+ "collections": "^1.2.2",
18
+ "d3": "^3.5.3",
19
+ "event-source-polyfill": "0.0.1",
20
+ "fluxxor": "^1.5.2",
21
+ "lodash": "^3.6.0",
22
+ "moment": "^2.9.0",
23
+ "react": "~0.12.2",
24
+ "react-bootstrap": "^0.16.1",
25
+ "react-router": "^0.12.4",
26
+ "react-router-bootstrap": "^0.9.1",
27
+ "superagent": "^0.21.0"
28
+ },
29
+ "devDependencies": {
30
+ "autoprefixer-loader": "^1.1.0",
31
+ "css-loader": "^0.9.1",
32
+ "del": "^1.1.1",
33
+ "exports-loader": "^0.6.2",
34
+ "gulp": "^3.8.10",
35
+ "gulp-autoprefixer": "^2.0.0",
36
+ "gulp-changed": "^1.1.1",
37
+ "gulp-concat": "^2.4.1",
38
+ "gulp-csscomb": "^3.0.3",
39
+ "gulp-filter": "^1.0.2",
40
+ "gulp-flatten": "^0.0.3",
41
+ "gulp-if": "^1.2.5",
42
+ "gulp-insert": "^0.4.0",
43
+ "gulp-jshint": "^1.9.0",
44
+ "gulp-less": "^2.0.1",
45
+ "gulp-load-plugins": "^0.8.0",
46
+ "gulp-minify-css": "^0.3.11",
47
+ "gulp-plumber": "^0.6.6",
48
+ "gulp-react": "^1.0.2",
49
+ "gulp-size": "^1.2.1",
50
+ "gulp-sourcemaps": "^1.2.2",
51
+ "gulp-uglify": "^1.0.2",
52
+ "gulp-util": "^3.0.2",
53
+ "jest-cli": "^0.2.1",
54
+ "jshint": "^2.5.11",
55
+ "jshint-loader": "^0.8.0",
56
+ "jshint-stylish": "^1.0.0",
57
+ "jsx-loader": "^0.12.2",
58
+ "less": "^2.2.0",
59
+ "less-loader": "^2.0.0",
60
+ "merge-stream": "^0.1.7",
61
+ "minimist": "^1.1.0",
62
+ "protractor": "^1.6.0",
63
+ "psi": "^1.0.4",
64
+ "react-tools": "~0.12.2",
65
+ "run-sequence": "^1.0.2",
66
+ "style-loader": "^0.8.2",
67
+ "url-loader": "^0.5.5",
68
+ "webpack": "^1.4.15",
69
+ "webpack-dev-server": "^1.7.0"
70
+ },
71
+ "main": "",
72
+ "jest": {
73
+ "rootDir": "src",
74
+ "scriptPreprocessor": "../config/preprocessor.js",
75
+ "unmockedModulePathPatterns": [
76
+ "react",
77
+ "lodash"
78
+ ]
79
+ },
80
+ "scripts": {
81
+ "test": "jest"
82
+ }
83
+ }
@@ -0,0 +1,493 @@
1
+ 'use strict';
2
+
3
+ var ClientAudit = require('./clients/audit'),
4
+ ClientGeneric = require('./clients/generic'),
5
+ ClientList = require('./clients/list'),
6
+ ClientSearch = require('./clients/search'),
7
+ ClientMembers = require('./clients/members'),
8
+ ClientLayerMembers = require('./clients/layer_members');
9
+
10
+ var constants = require('./constants');
11
+
12
+ module.exports = {
13
+ flashMessage(msg, status) {
14
+ this.dispatch(constants.FLASH_MESSAGE, {msg: msg, status: status});
15
+ },
16
+
17
+ routes: {
18
+ transition(path, params) {
19
+ this.dispatch(constants.ROUTES.TRANSITION, {path: path, params: params});
20
+ }
21
+ },
22
+
23
+ search(query) {
24
+ this.dispatch(constants.SEARCH.LOAD, {id: query});
25
+
26
+ ClientSearch(
27
+ query,
28
+ (res) => {
29
+ var payload = {id: query, type: 'SEARCH_RESULT', res: res};
30
+
31
+ this.dispatch(
32
+ constants.SEARCH.LOAD_SUCCESS,
33
+ payload
34
+ );
35
+ },
36
+ (res) => {
37
+ this.dispatch(constants.SEARCH.LOAD_FAIL, {id: query, type: 'SEARCH_RESULT'});
38
+ this.flux.actions.flashMessage(res.error.message);
39
+ }
40
+ );
41
+ },
42
+
43
+ audit: {
44
+ loadAll(startFlow) {
45
+ this.dispatch(constants.AUDIT.LOAD);
46
+
47
+ ClientAudit.fetch(
48
+ ClientAudit.c.AUDIT_ALL,
49
+ null,
50
+ null,
51
+ (res) => {
52
+ var payload = {res: res, startFlow: startFlow};
53
+
54
+ this.dispatch(
55
+ constants.AUDIT.LOAD_SUCCESS,
56
+ payload
57
+ );
58
+ },
59
+ (res) => {
60
+ this.dispatch(constants.AUDIT.LOAD_FAIL);
61
+ this.flux.actions.flashMessage(res.error.message);
62
+ }
63
+ );
64
+ },
65
+
66
+ loadFlow(lastEventId) {
67
+ ClientAudit.fetch(
68
+ ClientAudit.c.AUDIT_FLOW,
69
+ null,
70
+ null,
71
+ (res) => {
72
+ var event = JSON.parse(res.data);
73
+
74
+ if (event.id > lastEventId) {
75
+ var payload = {event: event};
76
+
77
+ this.dispatch(
78
+ constants.AUDIT.LOAD_SUCCESS,
79
+ payload
80
+ );
81
+ }
82
+ },
83
+ (res) => {
84
+ // this.dispatch(constants.AUDIT.LOAD_FAIL);
85
+ // this.flux.actions.flashMessage(res.error.message);
86
+ }
87
+ );
88
+ },
89
+
90
+ loadForRole(kind, id) {
91
+ this.dispatch(constants.AUDIT.LOAD);
92
+
93
+ ClientAudit.fetch(
94
+ ClientAudit.c.AUDIT_ROLE,
95
+ kind,
96
+ id,
97
+ (res) => {
98
+ var payload = {res: res};
99
+
100
+ this.dispatch(
101
+ constants.AUDIT.LOAD_SUCCESS,
102
+ payload
103
+ );
104
+ },
105
+ (res) => {
106
+ this.dispatch(constants.AUDIT.LOAD_FAIL, {kind: kind, id: id});
107
+ this.flux.actions.flashMessage(res.error.message);
108
+ });
109
+ },
110
+
111
+ loadForResource(kind, id) {
112
+ this.dispatch(constants.AUDIT.LOAD);
113
+
114
+ ClientAudit.fetch(
115
+ ClientAudit.c.AUDIT_RESOURCE,
116
+ kind,
117
+ id,
118
+ (res) => {
119
+ var payload = {res: res};
120
+
121
+ this.dispatch(
122
+ constants.AUDIT.LOAD_SUCCESS,
123
+ payload
124
+ );
125
+ },
126
+ (res) => {
127
+ this.dispatch(constants.AUDIT.LOAD_FAIL, {kind: kind, id: id});
128
+ this.flux.actions.flashMessage(res.error.message);
129
+ });
130
+ }
131
+ },
132
+
133
+ resources: {
134
+ load(kind) {
135
+ this.dispatch(constants.RESOURCES.LOAD);
136
+
137
+ ClientList.fetch(kind, (res) => {
138
+ this.dispatch(constants.RESOURCES.LOAD_SUCCESS, {res: res});
139
+ }, (err) => {
140
+ this.dispatch(constants.RESOURCES.LOAD_FAIL, {id: kind});
141
+ this.flux.actions.flashMessage(err.error.message);
142
+ });
143
+ },
144
+
145
+ loadOne(kind, id) {
146
+ this.dispatch(constants.RESOURCE.LOAD);
147
+
148
+ ClientList.fetchOne(kind, id, (res) => {
149
+ this.dispatch(constants.RESOURCE.LOAD_SUCCESS, {kind: kind, id: id, res: res});
150
+ }, (err) => {
151
+ this.dispatch(constants.RESOURCE.LOAD_FAIL, {kind: kind, id: id});
152
+ this.flux.actions.flashMessage(err.error.message);
153
+ });
154
+ }
155
+ },
156
+
157
+ user: {
158
+ load(id) {
159
+ this.dispatch(constants.USER.LOAD, {id: id});
160
+
161
+ [
162
+ ClientGeneric.c.ATTRIBUTES,
163
+ ClientGeneric.c.OWNED_RESOURCES,
164
+ ClientGeneric.c.ALL_ROLES,
165
+ ClientGeneric.c.PUBLIC_KEYS
166
+ ].forEach((type) => {
167
+ this.dispatch(constants.USER.LOAD, {id: id, type: type});
168
+
169
+ ClientGeneric.fetch(
170
+ type,
171
+ 'user',
172
+ id,
173
+ (res) => {
174
+ var payload = {id: id, type: type, res: res};
175
+
176
+ this.dispatch(
177
+ constants.USER.LOAD_SUCCESS,
178
+ payload
179
+ );
180
+ },
181
+ (res) => {
182
+ this.dispatch(constants.USER.LOAD_FAIL, {type: type});
183
+ this.flux.actions.flashMessage(res.error.message);
184
+ });
185
+ });
186
+
187
+ this.dispatch(constants.USER.LOAD, {id: id, type: 'RESOURCES'});
188
+
189
+ ClientList.fetchResources(
190
+ 'user',
191
+ id,
192
+ (res) => {
193
+ var payload = {id: id, type: 'RESOURCES', res: res};
194
+
195
+ this.dispatch(
196
+ constants.USER.LOAD_SUCCESS,
197
+ payload
198
+ );
199
+ },
200
+ (res) => {
201
+ this.dispatch(constants.USER.LOAD_FAIL, {type: 'RESOURCES'});
202
+ this.flux.actions.flashMessage(res.error.message);
203
+ });
204
+ }
205
+ },
206
+
207
+ group: {
208
+ load(id) {
209
+ this.dispatch(constants.GROUP.LOAD, {id: id});
210
+
211
+ [
212
+ ClientGeneric.c.ATTRIBUTES,
213
+ ClientGeneric.c.OWNED_RESOURCES,
214
+ ClientGeneric.c.ALL_ROLES
215
+ ].forEach((type) => {
216
+ this.dispatch(constants.GROUP.LOAD, {id: id, type: type});
217
+
218
+ ClientGeneric.fetch(
219
+ type,
220
+ 'group',
221
+ id,
222
+ (res) => {
223
+ var payload = {id: id, type: type, res: res};
224
+
225
+ this.dispatch(
226
+ constants.GROUP.LOAD_SUCCESS,
227
+ payload
228
+ );
229
+ },
230
+ (res) => {
231
+ this.dispatch(constants.GROUP.LOAD_FAIL, {type: type});
232
+ this.flux.actions.flashMessage(res.error.message);
233
+ });
234
+ });
235
+
236
+ this.dispatch(constants.GROUP.LOAD, {id: id, type: 'GROUP_ROLES'});
237
+
238
+ ClientList.fetchGroupRoles(
239
+ id,
240
+ (res) => {
241
+ var payload = {id: id, type: 'GROUP_ROLES', res: res};
242
+
243
+ this.dispatch(
244
+ constants.GROUP.LOAD_SUCCESS,
245
+ payload
246
+ );
247
+ },
248
+ (res) => {
249
+ this.dispatch(constants.GROUP.LOAD_FAIL, {type: 'GROUP_ROLES'});
250
+ this.flux.actions.flashMessage(res.error.message);
251
+ });
252
+
253
+ this.dispatch(constants.GROUP.LOAD, {id: id, type: 'RESOURCES'});
254
+
255
+ ClientList.fetchResources(
256
+ 'group',
257
+ id,
258
+ (res) => {
259
+ var payload = {id: id, type: 'RESOURCES', res: res};
260
+
261
+ this.dispatch(
262
+ constants.GROUP.LOAD_SUCCESS,
263
+ payload
264
+ );
265
+ },
266
+ (res) => {
267
+ this.dispatch(constants.GROUP.LOAD_FAIL, {type: 'RESOURCES'});
268
+ this.flux.actions.flashMessage(res.error.message);
269
+ });
270
+ }
271
+ },
272
+
273
+ host: {
274
+ load(id) {
275
+ this.dispatch(constants.HOST.LOAD, {id: id});
276
+
277
+ [
278
+ ClientGeneric.c.ATTRIBUTES,
279
+ ClientGeneric.c.OWNED_RESOURCES,
280
+ ClientGeneric.c.ALL_ROLES
281
+ ].forEach((type) => {
282
+ this.dispatch(constants.HOST.LOAD, {id: id, type: type});
283
+
284
+ ClientGeneric.fetch(
285
+ type,
286
+ 'host',
287
+ id,
288
+ (res) => {
289
+ var payload = {id: id, type: type, res: res};
290
+
291
+ this.dispatch(
292
+ constants.HOST.LOAD_SUCCESS,
293
+ payload
294
+ );
295
+ },
296
+ (res) => {
297
+ this.dispatch(constants.HOST.LOAD_FAIL, {type: type});
298
+ this.flux.actions.flashMessage(res.error.message);
299
+ });
300
+ });
301
+
302
+ this.dispatch(constants.HOST.LOAD, {id: id, type: 'RESOURCES'});
303
+
304
+ ClientList.fetchResources(
305
+ 'host',
306
+ id,
307
+ (res) => {
308
+ var payload = {id: id, type: 'RESOURCES', res: res};
309
+
310
+ this.dispatch(
311
+ constants.HOST.LOAD_SUCCESS,
312
+ payload
313
+ );
314
+ },
315
+ (res) => {
316
+ this.dispatch(constants.HOST.LOAD_FAIL, {type: 'RESOURCES'});
317
+ this.flux.actions.flashMessage(res.error.message);
318
+ });
319
+ }
320
+ },
321
+
322
+ layer: {
323
+ load(id) {
324
+ this.dispatch(constants.LAYER.LOAD, {id: id});
325
+
326
+ [
327
+ ClientGeneric.c.ATTRIBUTES,
328
+ ClientGeneric.c.OWNED_RESOURCES,
329
+ ClientGeneric.c.ALL_ROLES
330
+ ].forEach((type) => {
331
+ this.dispatch(constants.LAYER.LOAD, {id: id, type: type});
332
+
333
+ ClientGeneric.fetch(
334
+ type,
335
+ 'layer',
336
+ id,
337
+ (res) => {
338
+ var payload = {id: id, type: type, res: res};
339
+
340
+ this.dispatch(
341
+ constants.LAYER.LOAD_SUCCESS,
342
+ payload
343
+ );
344
+ },
345
+ (res) => {
346
+ this.dispatch(constants.LAYER.LOAD_FAIL, {type: type});
347
+ this.flux.actions.flashMessage(res.error.message);
348
+ });
349
+ });
350
+
351
+ [
352
+ ClientLayerMembers.c.LAYER_MEMBERS_USE,
353
+ ClientLayerMembers.c.LAYER_MEMBERS_ADMIN
354
+ ].forEach((type) => {
355
+ this.dispatch(constants.LAYER.LOAD, {id: id, type: type});
356
+
357
+ ClientLayerMembers.fetch(
358
+ type,
359
+ id,
360
+ (res) => {
361
+ var payload = {id: id, type: type, res: res};
362
+
363
+ this.dispatch(
364
+ constants.LAYER.LOAD_SUCCESS,
365
+ payload
366
+ );
367
+ },
368
+ (res) => {
369
+ this.dispatch(constants.LAYER.LOAD_FAIL, {type: type});
370
+ this.flux.actions.flashMessage(res.error.message);
371
+ });
372
+ });
373
+
374
+ this.dispatch(constants.LAYER.LOAD, {id: id, type: 'RESOURCES'});
375
+
376
+ ClientList.fetchResources(
377
+ 'layer',
378
+ id,
379
+ (res) => {
380
+ var payload = {id: id, type: 'RESOURCES', res: res};
381
+
382
+ this.dispatch(
383
+ constants.LAYER.LOAD_SUCCESS,
384
+ payload
385
+ );
386
+ },
387
+ (res) => {
388
+ this.dispatch(constants.LAYER.LOAD_FAIL, {type: 'RESOURCES'});
389
+ this.flux.actions.flashMessage(res.error.message);
390
+ });
391
+ }
392
+ },
393
+
394
+ variable: {
395
+ load(id) {
396
+ this.dispatch(constants.VARIABLE.LOAD, {id: id});
397
+
398
+ [
399
+ ClientGeneric.c.ATTRIBUTES
400
+ ].forEach((type) => {
401
+ this.dispatch(constants.VARIABLE.LOAD, {id: id, type: type});
402
+
403
+ ClientGeneric.fetch(
404
+ type,
405
+ 'variable',
406
+ id,
407
+ (res) => {
408
+ var payload = {id: id, type: type, res: res};
409
+
410
+ this.dispatch(
411
+ constants.VARIABLE.LOAD_SUCCESS,
412
+ payload
413
+ );
414
+ },
415
+ (res) => {
416
+ this.dispatch(constants.VARIABLE.LOAD_FAIL, {type: type});
417
+ this.flux.actions.flashMessage(res.error.message);
418
+ });
419
+ });
420
+
421
+ [
422
+ ClientMembers.c.MEMBERS_EXECUTE,
423
+ ClientMembers.c.MEMBERS_UPDATE
424
+ ].forEach((type) => {
425
+ this.dispatch(constants.VARIABLE.LOAD, {id: id, type: type});
426
+
427
+ ClientMembers.fetch(
428
+ type,
429
+ id,
430
+ (res) => {
431
+ var payload = {id: id, type: type, res: res};
432
+
433
+ this.dispatch(
434
+ constants.VARIABLE.LOAD_SUCCESS,
435
+ payload
436
+ );
437
+ },
438
+ (res) => {
439
+ this.dispatch(constants.VARIABLE.LOAD_FAIL, {type: type});
440
+ this.flux.actions.flashMessage(res.error.message);
441
+ });
442
+ });
443
+ }
444
+ },
445
+
446
+ policy: {
447
+ load(id) {
448
+ this.dispatch(constants.POLICY.LOAD, {id: id});
449
+
450
+ [
451
+ ClientGeneric.c.OWNED_RESOURCES,
452
+ ClientGeneric.c.ALL_ROLES
453
+ ].forEach((type) => {
454
+ this.dispatch(constants.POLICY.LOAD, {id: id, type: type});
455
+
456
+ ClientGeneric.fetch(
457
+ type,
458
+ 'policy',
459
+ id,
460
+ (res) => {
461
+ var payload = {id: id, type: type, res: res};
462
+
463
+ this.dispatch(
464
+ constants.POLICY.LOAD_SUCCESS,
465
+ payload
466
+ );
467
+ },
468
+ (res) => {
469
+ this.dispatch(constants.POLICY.LOAD_FAIL, {type: type});
470
+ this.flux.actions.flashMessage(res.error.message);
471
+ });
472
+ });
473
+
474
+ this.dispatch(constants.POLICY.LOAD, {id: id, type: 'RESOURCES'});
475
+
476
+ ClientList.fetchResources(
477
+ 'policy',
478
+ id,
479
+ (res) => {
480
+ var payload = {id: id, type: 'RESOURCES', res: res};
481
+
482
+ this.dispatch(
483
+ constants.POLICY.LOAD_SUCCESS,
484
+ payload
485
+ );
486
+ },
487
+ (res) => {
488
+ this.dispatch(constants.POLICY.LOAD_FAIL, {type: 'RESOURCES'});
489
+ this.flux.actions.flashMessage(res.error.message);
490
+ });
491
+ }
492
+ }
493
+ };