conjur-asset-ui 1.3.2 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -1
  3. data/.jshintrc +41 -0
  4. data/CHANGELOG.md +7 -0
  5. data/Gemfile +3 -1
  6. data/README.md +38 -4
  7. data/Rakefile +69 -1
  8. data/TODO.md +31 -0
  9. data/bower.json +98 -0
  10. data/conjur-asset-ui.gemspec +3 -3
  11. data/features/navigation_bar.feature +31 -0
  12. data/features/step_definitions/custom_step.rb +32 -0
  13. data/features/support/env.rb +38 -0
  14. data/features/support/hooks.rb +30 -0
  15. data/features/support/world.rb +17 -0
  16. data/gulpfile.js +139 -0
  17. data/lib/conjur/command/ui.rb +1 -1
  18. data/lib/conjur/webserver/server.rb +14 -8
  19. data/lib/conjur-asset-ui-version.rb +1 -1
  20. data/package.json +47 -0
  21. data/preprocessor.js +7 -0
  22. data/public/_client_libs.html +1 -16
  23. data/public/build/css/styles.css +87 -0
  24. data/public/build/css/vendor.css +5 -0
  25. data/public/build/fonts/glyphicons-halflings-regular.eot +0 -0
  26. data/public/{fonts → build/fonts}/glyphicons-halflings-regular.svg +47 -47
  27. data/public/{fonts → build/fonts}/glyphicons-halflings-regular.ttf +0 -0
  28. data/public/build/fonts/glyphicons-halflings-regular.woff +0 -0
  29. data/public/build/js/app.min.js +4 -0
  30. data/public/build/js/vendor.min.js +23 -0
  31. data/public/build/maps/app.min.js.map +1 -0
  32. data/public/build/maps/vendor.min.js.map +1 -0
  33. data/public/css/styles.less +246 -17
  34. data/public/index.html.erb +11 -10
  35. data/public/js/init.js +186 -97
  36. data/public/js/lib/sorted-set.no-require.js +3 -28
  37. data/public/js/models/groupRecord.js +14 -12
  38. data/public/js/models/hostRecord.js +13 -8
  39. data/public/js/models/layerRecord.js +14 -12
  40. data/public/js/models/namespace.js +2 -0
  41. data/public/js/models/policyList.js +3 -1
  42. data/public/js/models/policyRecord.js +8 -8
  43. data/public/js/models/record.js +59 -27
  44. data/public/js/models/resourceList.js +28 -10
  45. data/public/js/models/userList.js +7 -2
  46. data/public/js/models/userRecord.js +14 -9
  47. data/public/js/models/variableList.js +18 -7
  48. data/public/js/models/variableRecord.js +18 -14
  49. data/public/js/routers.js +74 -37
  50. data/public/js/views/annotations.js +39 -28
  51. data/public/js/views/audit.js +31 -25
  52. data/public/js/views/breadcrumbs.js +62 -0
  53. data/public/js/views/chart.js +617 -0
  54. data/public/js/views/dashboard.js +144 -65
  55. data/public/js/views/generic.js +16 -9
  56. data/public/js/views/group.js +103 -55
  57. data/public/js/views/groups.js +3 -7
  58. data/public/js/views/host.js +192 -56
  59. data/public/js/views/hosts.js +2 -6
  60. data/public/js/views/layer.js +136 -82
  61. data/public/js/views/layers.js +2 -6
  62. data/public/js/views/mixins/search.js +12 -5
  63. data/public/js/views/mixins/tabs.js +95 -55
  64. data/public/js/views/navSearch.js +16 -5
  65. data/public/js/views/owned.js +14 -8
  66. data/public/js/views/permissions.js +244 -178
  67. data/public/js/views/policies.js +2 -4
  68. data/public/js/views/policy.js +65 -38
  69. data/public/js/views/resource.js +54 -34
  70. data/public/js/views/role.js +59 -37
  71. data/public/js/views/searchResults.js +205 -138
  72. data/public/js/views/sections.js +226 -0
  73. data/public/js/views/time.js +38 -13
  74. data/public/js/views/user.js +288 -59
  75. data/public/js/views/users.js +2 -7
  76. data/public/js/views/variable.js +293 -53
  77. data/public/js/views/variables.js +4 -8
  78. metadata +34 -56
  79. data/.git-hooks/pre_commit/ensure_livescript_compiled.rb +0 -31
  80. data/.overcommit.yml +0 -5
  81. data/compile_ls +0 -6
  82. data/livescript/views/audit.ls +0 -136
  83. data/public/_client_code.html +0 -42
  84. data/public/css/bootstrap.css +0 -7
  85. data/public/fonts/glyphicons-halflings-regular.eot +0 -0
  86. data/public/fonts/glyphicons-halflings-regular.woff +0 -0
  87. data/public/js/lib/JSXTransformer.js +0 -10862
  88. data/public/js/lib/async.js +0 -958
  89. data/public/js/lib/backbone.js +0 -2
  90. data/public/js/lib/bootstrap.js +0 -6
  91. data/public/js/lib/date.extensions.js +0 -141
  92. data/public/js/lib/less.js +0 -16
  93. data/public/js/lib/moment.js +0 -7768
  94. data/public/js/lib/prelude-browser-min.js +0 -1
  95. data/public/js/lib/react-bootstrap.js +0 -5346
  96. data/public/js/lib/react-bootstrap.min.js +0 -4
  97. data/public/js/lib/underscore-min.js +0 -6
  98. data/public/js/lib/underscore.string.min.js +0 -1
  99. data/public/js/main.js +0 -57
  100. data/vendor/prelude-ls/.gitignore +0 -2
  101. data/vendor/prelude-ls/.travis.yml +0 -3
  102. data/vendor/prelude-ls/CHANGELOG.md +0 -81
  103. data/vendor/prelude-ls/LICENSE +0 -22
  104. data/vendor/prelude-ls/Makefile +0 -50
  105. data/vendor/prelude-ls/README.md +0 -15
  106. data/vendor/prelude-ls/browser/prelude-browser-min.js +0 -1
  107. data/vendor/prelude-ls/browser/prelude-browser.js +0 -1172
  108. data/vendor/prelude-ls/lib/Func.js +0 -40
  109. data/vendor/prelude-ls/lib/List.js +0 -602
  110. data/vendor/prelude-ls/lib/Num.js +0 -129
  111. data/vendor/prelude-ls/lib/Obj.js +0 -153
  112. data/vendor/prelude-ls/lib/Str.js +0 -68
  113. data/vendor/prelude-ls/lib/index.js +0 -164
  114. data/vendor/prelude-ls/package.json +0 -50
  115. data/vendor/prelude-ls/package.ls +0 -46
  116. data/vendor/prelude-ls/src/Func.ls +0 -17
  117. data/vendor/prelude-ls/src/List.ls +0 -299
  118. data/vendor/prelude-ls/src/Num.ls +0 -83
  119. data/vendor/prelude-ls/src/Obj.ls +0 -61
  120. data/vendor/prelude-ls/src/Str.ls +0 -32
  121. data/vendor/prelude-ls/src/index.ls +0 -56
  122. data/vendor/prelude-ls/test/Func.ls +0 -36
  123. data/vendor/prelude-ls/test/List.ls +0 -751
  124. data/vendor/prelude-ls/test/Num.ls +0 -258
  125. data/vendor/prelude-ls/test/Obj.ls +0 -145
  126. data/vendor/prelude-ls/test/Prelude.ls +0 -49
  127. data/vendor/prelude-ls/test/Str.ls +0 -208
  128. data/vendor/prelude-ls/test/browser.html +0 -5
@@ -1,64 +1,200 @@
1
1
  /** @jsx React.DOM */
2
+ /* global conjur, React, ReactBootstrap, _ */
2
3
 
3
- var HostLink = React.createClass({
4
- hostId : function() {
5
- return this.props.data.split(':')[2];
6
- },
7
-
8
- hostUrl: function() {
9
- return "/ui/hosts/" + encodeURIComponent(this.hostId());
10
- },
11
-
12
- render: function() {
13
- return (
14
- <a href={this.hostUrl()}>
15
- {this.hostId()}
16
- </a>
17
- );
18
- }
19
- });
20
-
21
- var Host = React.createClass({
22
- mixins: [conjur.views.mixins.Tab],
23
- render: function(){
24
- var host = this.props.data.host;
25
-
26
- // TODO: control for 'enroll'
27
- var overview_tab =
28
- <TabPane key="overview" tab="Overview">
4
+ (function(conjur, React, ReactBootstrap, _) {
5
+ 'use strict';
6
+
7
+ var TabbedArea = ReactBootstrap.TabbedArea,
8
+ TabPane = ReactBootstrap.TabPane,
9
+ Tab = conjur.views.mixins.Tab,
10
+ AuditBox = window.AuditBox,
11
+ AnnotationsBox = conjur.views.AnnotationsBox,
12
+ Breadcrumbs = conjur.views.Breadcrumbs,
13
+ RoleLink = conjur.views.RoleLink,
14
+ Time = conjur.views.Time,
15
+ Chart = conjur.views.Chart,
16
+ ChartHelperMixin = conjur.views.ChartHelperMixin,
17
+ FoldableAuditSection = conjur.views.FoldableAuditSection;
18
+
19
+ this.HostLink = React.createClass({
20
+ hostId : function() {
21
+ return this.props.data.split(':')[2];
22
+ },
23
+
24
+ hostUrl: function() {
25
+ return '/ui/hosts/' + window.encodeURIComponent(this.hostId());
26
+ },
27
+
28
+ render: function() {
29
+ return (
30
+ <a href={this.hostUrl()}>
31
+ {this.hostId()}
32
+ </a>
33
+ );
34
+ }
35
+ });
36
+
37
+ var Activity = React.createClass({
38
+ mixins: [ChartHelperMixin],
39
+
40
+ getDefaultProps: function() {
41
+ return {
42
+ options: {
43
+ legend: {
44
+ logins: 'Logins to host',
45
+ sudo: 'Sudo calls on host',
46
+ reads: 'Secret reads by host',
47
+ updates: 'Secret updates by host',
48
+ warnings: 'Warnings'
49
+ },
50
+ axis: {
51
+ y: {
52
+ label: 'Value'
53
+ }
54
+ }
55
+ }
56
+ };
57
+ },
58
+
59
+ getDefaultItem: function() {
60
+ return {
61
+ logins: 0,
62
+ sudo: 0,
63
+ reads: 0,
64
+ updates: 0,
65
+ warnings: 0
66
+ };
67
+ },
68
+
69
+ getEventType: function(e) {
70
+ if (e.hasOwnProperty('facility') && e.facility === 'ssh') {
71
+ if (e.action === 'sudo' && e.allowed === true) {
72
+ return 'sudo';
73
+ }
74
+
75
+ if (e.action === 'login' && e.allowed === true) {
76
+ return 'logins';
77
+ }
78
+ }
79
+
80
+ if (e.hasOwnProperty('error') || e.allowed === false) {
81
+ return 'warnings';
82
+ }
83
+
84
+ if (e.action === 'check' &&
85
+ e.hasOwnProperty('allowed') &&
86
+ e.allowed === true) {
87
+
88
+ if (e.hasOwnProperty('role') && e.role === this.props.roleid) {
89
+ if (e.hasOwnProperty('resource') &&
90
+ e.resource.split(':')[1] === 'variable') {
91
+
92
+ if (e.privilege === 'update') {
93
+ return 'updates';
94
+ }
95
+
96
+ if (e.privilege === 'execute') {
97
+ return 'reads';
98
+ }
99
+ }
100
+ }
101
+ }
102
+
103
+ return null;
104
+ },
105
+
106
+ render: function() {
107
+ var data = this.getData(this.props.audit);
108
+
109
+ return (
110
+ <div className="b-host-activity">
111
+ <h2>Activity</h2>
112
+ <div className="b-host-activity__graph">
113
+ <Chart options={this.props.options}
114
+ data={data} />
115
+ </div>
116
+ </div>
117
+ );
118
+ }
119
+ });
120
+
121
+ var Details = React.createClass({
122
+ render: function() {
123
+ // TODO: control for 'enroll'
124
+ return (
125
+ <div className="b-host-details">
126
+ <h2>Details</h2>
29
127
  <dl className="dl-horizontal">
30
- <dt> Owner </dt>
31
- <dd> <RoleLink id={host.ownerid}/> </dd>
128
+ <dt>Owner</dt>
129
+ <dd><RoleLink id={this.props.owner}/></dd>
130
+
32
131
  <dt>Created by</dt>
33
- <dd><RoleLink id={host.userid}/></dd>
34
- <dt> Created At </dt>
35
- <dd> <Time timestamp={host.created_at}/> </dd>
132
+ <dd><RoleLink id={this.props.host.userid}/></dd>
133
+
134
+ <dt>Created At</dt>
135
+ <dd><Time timestamp={this.props.host.created_at}/></dd>
36
136
  </dl>
37
- </TabPane>;
137
+ </div>
138
+ );
139
+ }
140
+ });
141
+
142
+ this.Host = React.createClass({
143
+ mixins: [Tab],
38
144
 
39
- var permissions_tab = this.permissions_tab(host.roleid);
40
- var memberships_tab = this.memberships_tab(host.roleid);
41
- var annotations_tab = this.annotations_tab();
42
- var owned_tab = this.owned_tab();
145
+ render: function() {
146
+ var host = this.props.data.host,
147
+ permissionsTab = this.permissionsTab(host.roleid),
148
+ membershipsTab = this.membershipsTab(host.roleid),
149
+ ownedTab = this.ownedTab();
43
150
 
44
- var audit_tab =
45
- <TabPane key="audit" tab="Recent Activity">
46
- <div className="audit auditHost">
47
- <AuditBox roles={[host.roleid]} resources={[host.resource_identifier]} tabview={true}/>
151
+ var tabs = _.compact([
152
+ membershipsTab,
153
+ ownedTab,
154
+ permissionsTab
155
+ ]);
156
+
157
+ var elems = [
158
+ {url: '/ui/hosts', text: 'Hosts'},
159
+ {url: '', text: this.props.data.host.id},
160
+ {url: '', text: '(owned by ' + this.props.data.host.ownerid + ')'}
161
+ ];
162
+
163
+ return (
164
+ <div className="b-host">
165
+ <Breadcrumbs elems={elems} />
166
+ <hr />
167
+ <Activity audit={this.props.data.audit} roleid={host.roleid}/>
168
+ <hr />
169
+ {FoldableAuditSection.warnings(this.props.data.audit)}
170
+ <hr />
171
+ <div className="row">
172
+ <div className="col-md-6">
173
+ <Details owner={this.props.data.owner}
174
+ host={host} />
175
+ </div>
176
+ <div className="col-md-6">
177
+ <h2>Annotations</h2>
178
+ <AnnotationsBox annotations={this.props.data.annotations} />
179
+ </div>
48
180
  </div>
49
- </TabPane>;
50
-
51
- var tabs = _.compact([ overview_tab, owned_tab, memberships_tab,
52
- permissions_tab, annotations_tab, audit_tab
53
- ]);
54
-
55
- return (
56
- <div className="host">
57
- <h2> Host {host.id} </h2>
58
- <TabbedArea defaultActiveKey="overview">
59
- {tabs}
60
- </TabbedArea>
61
- </div>
62
- );
63
- }
64
- })
181
+ <hr/>
182
+ <h2>Other</h2>
183
+ <TabbedArea>
184
+ {tabs}
185
+ </TabbedArea>
186
+ <hr />
187
+ <AuditBox roles={[host.roleid]}
188
+ resources={[host.resource_identifier]} />
189
+ </div>
190
+ );
191
+ }
192
+ });
193
+
194
+ }).bind(conjur.views)
195
+ (
196
+ conjur,
197
+ React,
198
+ ReactBootstrap,
199
+ _
200
+ );
@@ -1,17 +1,13 @@
1
1
  /** @jsx React.DOM */
2
+ /* global conjur, React */
2
3
 
3
4
  (function(conjur, React) {
4
5
  'use strict';
5
6
 
6
7
  var GenericList = conjur.views.GenericList;
7
8
 
8
- var HostBox = this.HostBox = React.createClass({
9
- /*getInitialState: function() {
10
- return { currentNamespace: "", members: [] };
11
- },*/
9
+ this.HostBox = React.createClass({
12
10
  render: function() {
13
- //<NamespaceFilter currentNamespace={this.props.currentNamespace}
14
- //namespaces={this.props.data.namespaces} />
15
11
  return (
16
12
  <div className="hostBox">
17
13
  <div className="hostList">
@@ -1,92 +1,146 @@
1
1
  /** @jsx React.DOM */
2
+ /* global conjur, React, ReactBootstrap, _ */
2
3
 
3
- var Layer = React.createClass({
4
- mixins: [conjur.views.mixins.Tab],
5
- render: function() {
6
- function abstractRole(expected) {
7
- return function(role) {
8
- var tokens = role.split(':');
9
- var kind = tokens[1];
10
- var abstractKinds = [ '@', 'layer' ];
11
- var isAbstract = abstractKinds.indexOf(kind) !== -1;
12
- return isAbstract === expected;
13
- }
14
- }
15
-
16
- var layer = this.props.data.layer;
17
-
18
- var hosts = layer.hosts.map(function (host) {
19
- return <li className="list-group-item list-group-item-noborder">
20
- <HostLink data={host} />
21
- </li>
22
- }.bind(this));
23
- var admins = this.props.data.admins.filter(abstractRole(false)).map(function (role) {
24
- return <li className="list-group-item list-group-item-noborder">
25
- <RoleLink id={role}/>
26
- </li>;
27
- }.bind(this));
28
- var users = this.props.data.users.filter(abstractRole(false)).map(function (role) {
29
- return <li className="list-group-item list-group-item-noborder">
30
- <RoleLink id={role}/>
31
- </li>;
32
- }.bind(this));
33
-
34
-
35
- // TODO: controls to add/remove admins/users/hosts
36
- var overview_tab =
37
- <TabPane key="overview" tab="Overview">
38
- <dl className="dl-horizontal">
39
- <dt>Owner</dt>
40
- <dd><RoleLink id={layer.ownerid}/></dd>
41
- <dt>Created by</dt>
42
- <dd><RoleLink id={layer.userid}/></dd>
43
- </dl>
44
- </TabPane>;
45
- var admins_tab =
46
- <TabPane key="admins" tab={get_tabname("Admins",admins)}>
47
- <ul className="list-group">
48
- {admins}
49
- </ul>
50
- </TabPane> ;
51
- var users_tab =
52
- <TabPane key="users" tab={ get_tabname("Users", users) } >
4
+ (function(conjur, React, ReactBootstrap, _) {
5
+ 'use strict';
6
+
7
+ var TabbedArea = ReactBootstrap.TabbedArea,
8
+ TabPane = ReactBootstrap.TabPane,
9
+ Tab = conjur.views.mixins.Tab,
10
+ AuditBox = window.AuditBox,
11
+ Breadcrumbs = conjur.views.Breadcrumbs,
12
+ RoleLink = conjur.views.RoleLink,
13
+ HostLink = conjur.views.HostLink;
14
+
15
+ var abstractRole = function(expected) {
16
+ return function(role) {
17
+ var tokens = role.split(':'),
18
+ kind = tokens[1],
19
+ abstractKinds = ['@', 'layer'],
20
+ isAbstract = abstractKinds.indexOf(kind) !== -1;
21
+
22
+ return isAbstract === expected;
23
+ };
24
+ };
25
+
26
+ this.Layer = React.createClass({
27
+ mixins: [Tab],
28
+
29
+ render: function() {
30
+ var data = this.props.data;
31
+
32
+ var hosts = data.layer.hosts.map(function(host) {
33
+ return (
34
+ <li className="list-group-item list-group-item-noborder">
35
+ <HostLink data={host} />
36
+ </li>
37
+ );
38
+ });
39
+
40
+ var admins = data.admins.filter(abstractRole(false)).map(function(role) {
41
+ return (
42
+ <li className="list-group-item list-group-item-noborder">
43
+ <RoleLink id={role}/>
44
+ </li>
45
+ );
46
+ });
47
+
48
+ var users = data.users.filter(abstractRole(false)).map(function(role) {
49
+ return (
50
+ <li className="list-group-item list-group-item-noborder">
51
+ <RoleLink id={role}/>
52
+ </li>
53
+ );
54
+ });
55
+
56
+ // TODO: controls to add/remove admins/users/hosts
57
+ var overviewTab = (
58
+ <TabPane key="overview" tab="Overview">
59
+ <dl className="dl-horizontal">
60
+ <dt>Owner</dt>
61
+ <dd><RoleLink id={data.owner} /></dd>
62
+
63
+ <dt>Created by</dt>
64
+ <dd><RoleLink id={data.layer.userid} /></dd>
65
+ </dl>
66
+ </TabPane>
67
+ );
68
+
69
+ var adminsTab = (
70
+ <TabPane key="admins" tab={conjur.utils.getTabname('Admins', admins)}>
71
+ <ul className="list-group">
72
+ {admins}
73
+ </ul>
74
+ </TabPane>
75
+ );
76
+
77
+ var usersTab = (
78
+ <TabPane key="users" tab={conjur.utils.getTabname('Users', users)}>
53
79
  <ul className="list-group">
54
80
  {users}
55
81
  </ul>
56
- </TabPane>;
57
- var hosts_tab =
58
- <TabPane key="hosts" tab={ get_tabname("Hosts", hosts) } >
82
+ </TabPane>
83
+ );
84
+
85
+ var hostsTab = (
86
+ <TabPane key="hosts" tab={conjur.utils.getTabname('Hosts', hosts)}>
59
87
  <ul className="list-group">
60
88
  {hosts}
61
89
  </ul>
62
- </TabPane>;
63
- var audit_tab=
64
- <TabPane key="audit" tab="Recent Activity">
90
+ </TabPane>
91
+ );
92
+
93
+ var auditTab = (
94
+ <TabPane key="audit" tab="Recent Activity">
65
95
  <div className="audit auditGroup">
66
- <AuditBox roles={[layer.roleid]} resources={[layer.resource_identifier]} tabview={true} />
96
+ <AuditBox roles={[data.layer.roleid]}
97
+ resources={[data.layer.resource_identifier]}
98
+ tabview={true} />
67
99
  </div>
68
- </TabPane>;
69
-
70
-
71
- var permissions_tab = this.permissions_tab(layer.roleid);
72
- var memberships_tab = this.memberships_tab(layer.roleid);
73
- var annotations_tab = this.annotations_tab();
74
- var owned_tab = this.owned_tab();
75
-
76
- var tabs = _.compact( [overview_tab, admins_tab, users_tab, hosts_tab,
77
- owned_tab, memberships_tab, permissions_tab,
78
- annotations_tab,
79
- audit_tab
80
- ] );
81
-
82
- return (
83
- <div className="layer">
84
- <h2>Layer {layer.id}</h2>
85
-
86
- <TabbedArea defaultActiveKey="overview">
87
- {tabs}
88
- </TabbedArea>
89
- </div>
90
- );
91
- }
92
- });
100
+ </TabPane>
101
+ );
102
+
103
+
104
+ var permissionsTab = this.permissionsTab(data.layer.roleid),
105
+ membershipsTab = this.membershipsTab(data.layer.roleid),
106
+ annotationsTab = this.annotationsTab(),
107
+ ownedTab = this.ownedTab();
108
+
109
+ var tabs = _.compact([
110
+ overviewTab,
111
+ adminsTab,
112
+ usersTab,
113
+ hostsTab,
114
+ ownedTab,
115
+ membershipsTab,
116
+ permissionsTab,
117
+ annotationsTab,
118
+ auditTab
119
+ ]);
120
+
121
+ var elems = [
122
+ {url: '/ui/layers', text: 'Layers'},
123
+ {url: '', text: this.props.data.layer.id},
124
+ {url: '', text: '(owned by ' + this.props.data.layer.ownerid + ')'}
125
+ ];
126
+
127
+ return (
128
+ <div className="b-layer">
129
+ <Breadcrumbs elems={elems} />
130
+ <hr />
131
+ <h2>Layer {data.layer.id}</h2>
132
+ <TabbedArea defaultActiveKey="overview">
133
+ {tabs}
134
+ </TabbedArea>
135
+ </div>
136
+ );
137
+ }
138
+ });
139
+
140
+ }).bind(conjur.views)
141
+ (
142
+ conjur,
143
+ React,
144
+ ReactBootstrap,
145
+ _
146
+ );