conjur-asset-ui-beta 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.git-hooks/pre_commit/trailing_whitespace.rb +26 -0
- data/.gitignore +23 -0
- data/.project +18 -0
- data/CHANGELOG.md +14 -0
- data/Gemfile +10 -0
- data/LICENSE.txt +22 -0
- data/README.md +72 -0
- data/Rakefile +76 -0
- data/TODO.md +31 -0
- data/app/.csscomb.json +304 -0
- data/app/.jshintrc +46 -0
- data/app/build/css/bootstrap.css +6906 -0
- data/app/build/fonts/glyphicons-halflings-regular.eot +0 -0
- data/app/build/fonts/glyphicons-halflings-regular.svg +288 -0
- data/app/build/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/app/build/fonts/glyphicons-halflings-regular.woff +0 -0
- data/app/build/fonts/glyphicons-halflings-regular.woff2 +0 -0
- data/app/build/images/conjur-logo.svg +26 -0
- data/app/build/images/icon-client-pc.svg +12 -0
- data/app/build/images/icon-environment.png +0 -0
- data/app/build/images/icon-person.svg +12 -0
- data/app/build/images/icon-policy.png +0 -0
- data/app/build/images/icon-resource.png +0 -0
- data/app/build/images/icon-service-dots.svg +13 -0
- data/app/build/images/icon-variable.png +0 -0
- data/app/build/index.html +26 -0
- data/app/build/js/app.js +78070 -0
- data/app/build/js/pace.js +2 -0
- data/app/config/preprocessor.js +9 -0
- data/app/config/webpack.js +84 -0
- data/app/gulpfile.js +144 -0
- data/app/package.json +83 -0
- data/app/src/actions.js +493 -0
- data/app/src/app.js +76 -0
- data/app/src/clients/audit.js +54 -0
- data/app/src/clients/generic.js +87 -0
- data/app/src/clients/layer_members.js +36 -0
- data/app/src/clients/list.js +82 -0
- data/app/src/clients/members.js +37 -0
- data/app/src/clients/search.js +19 -0
- data/app/src/components/app/__tests__/app-test.js +22 -0
- data/app/src/components/app/app.js +66 -0
- data/app/src/components/audit/__tests__/table_header-test.js +40 -0
- data/app/src/components/audit/box.js +11 -0
- data/app/src/components/audit/constants.js +7 -0
- data/app/src/components/audit/entry.js +107 -0
- data/app/src/components/audit/fields_mixin.js +13 -0
- data/app/src/components/audit/humanize_event.js +216 -0
- data/app/src/components/audit/table.js +100 -0
- data/app/src/components/audit/table_header.js +38 -0
- data/app/src/components/audit/timestamp.js +30 -0
- data/app/src/components/chart/chart.js +539 -0
- data/app/src/components/chart/chart_helper_mixin.js +79 -0
- data/app/src/components/custom/list.js +5 -0
- data/app/src/components/custom/view.js +71 -0
- data/app/src/components/dashboard/activity.js +113 -0
- data/app/src/components/dashboard/dashboard.js +47 -0
- data/app/src/components/flash/flash.js +17 -0
- data/app/src/components/generic/__tests__/time-test.js +43 -0
- data/app/src/components/generic/annotations.js +41 -0
- data/app/src/components/generic/breadcrumbs.js +59 -0
- data/app/src/components/generic/foldable_audit_section.js +252 -0
- data/app/src/components/generic/list.js +144 -0
- data/app/src/components/generic/list_factory.js +42 -0
- data/app/src/components/generic/resource_link.js +65 -0
- data/app/src/components/generic/role_link.js +65 -0
- data/app/src/components/generic/tab_mixin.js +148 -0
- data/app/src/components/generic/time.js +34 -0
- data/app/src/components/group/list.js +5 -0
- data/app/src/components/group/view.js +137 -0
- data/app/src/components/host/activity.js +93 -0
- data/app/src/components/host/details.js +30 -0
- data/app/src/components/host/host_link.js +20 -0
- data/app/src/components/host/list.js +5 -0
- data/app/src/components/host/view.js +113 -0
- data/app/src/components/layer/list.js +5 -0
- data/app/src/components/layer/view.js +180 -0
- data/app/src/components/navbar/__tests__/navbar-test.js +21 -0
- data/app/src/components/navbar/nav_search_form.js +41 -0
- data/app/src/components/navbar/navbar.js +71 -0
- data/app/src/components/owned_resources/owned_resources.js +86 -0
- data/app/src/components/owned_resources/owned_resources_box.js +106 -0
- data/app/src/components/permissions/permissions.js +143 -0
- data/app/src/components/permissions/permissions_table.js +104 -0
- data/app/src/components/policy/list.js +5 -0
- data/app/src/components/policy/view.js +98 -0
- data/app/src/components/refresh/refresh.js +30 -0
- data/app/src/components/refresh/refresh.less +15 -0
- data/app/src/components/search/group.js +45 -0
- data/app/src/components/search/group_heading.js +50 -0
- data/app/src/components/search/group_title.js +38 -0
- data/app/src/components/search/result_item.js +57 -0
- data/app/src/components/search/search.js +103 -0
- data/app/src/components/user/activity.js +92 -0
- data/app/src/components/user/details.js +30 -0
- data/app/src/components/user/list.js +5 -0
- data/app/src/components/user/pubkeys.js +116 -0
- data/app/src/components/user/pubkeys.less +56 -0
- data/app/src/components/user/view.js +123 -0
- data/app/src/components/variable/activity.js +83 -0
- data/app/src/components/variable/details.js +48 -0
- data/app/src/components/variable/fetchers.js +83 -0
- data/app/src/components/variable/list.js +5 -0
- data/app/src/components/variable/updaters.js +83 -0
- data/app/src/components/variable/view.js +105 -0
- data/app/src/constants.js +35 -0
- data/app/src/images/conjur-logo.svg +26 -0
- data/app/src/images/icon-client-pc.svg +12 -0
- data/app/src/images/icon-environment.png +0 -0
- data/app/src/images/icon-person.svg +12 -0
- data/app/src/images/icon-policy.png +0 -0
- data/app/src/images/icon-resource.png +0 -0
- data/app/src/images/icon-service-dots.svg +13 -0
- data/app/src/images/icon-variable.png +0 -0
- data/app/src/pages/index.html +26 -0
- data/app/src/routes.js +57 -0
- data/app/src/stores/app_store.js +29 -0
- data/app/src/stores/audit_store.js +77 -0
- data/app/src/stores/group_store.js +105 -0
- data/app/src/stores/host_store.js +98 -0
- data/app/src/stores/layer_store.js +115 -0
- data/app/src/stores/policy_store.js +89 -0
- data/app/src/stores/resources_store.js +118 -0
- data/app/src/stores/route_store.js +24 -0
- data/app/src/stores/search_store.js +73 -0
- data/app/src/stores/user_store.js +111 -0
- data/app/src/stores/variable_store.js +94 -0
- data/app/src/styles/bootstrap.less +56 -0
- data/app/src/styles/styles.less +634 -0
- data/app/src/utils.js +43 -0
- data/app/src/vendor/pace.js +2 -0
- data/conjur-asset-ui.gemspec +36 -0
- data/features/navigation_bar.feature +31 -0
- data/features/step_definitions/custom_step.rb +32 -0
- data/features/support/env.rb +38 -0
- data/features/support/hooks.rb +30 -0
- data/features/support/world.rb +17 -0
- data/lib/conjur-asset-ui-version.rb +7 -0
- data/lib/conjur-asset-ui.rb +7 -0
- data/lib/conjur/command/ui.rb +54 -0
- data/lib/conjur/webserver/api_proxy.rb +94 -0
- data/lib/conjur/webserver/authorize.rb +28 -0
- data/lib/conjur/webserver/conjur_info.rb +33 -0
- data/lib/conjur/webserver/home.rb +42 -0
- data/lib/conjur/webserver/login.rb +57 -0
- data/lib/conjur/webserver/renderer.rb +34 -0
- data/lib/conjur/webserver/server.rb +130 -0
- data/public/js/views/roleGraph.js +91 -0
- metadata +373 -0
data/app/src/app.js
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var utils = require('./utils');
|
4
|
+
|
5
|
+
var conjur = window.conjur = {
|
6
|
+
app: {
|
7
|
+
configuration: undefined,
|
8
|
+
userId: undefined
|
9
|
+
}
|
10
|
+
};
|
11
|
+
|
12
|
+
var cookie = utils.readCookie('conjur_configuration');
|
13
|
+
|
14
|
+
conjur.app.configuration = JSON.parse(decodeURIComponent(cookie).replace(/\+/g, ' '));
|
15
|
+
conjur.app.userId = window.decodeURIComponent(utils.readCookie('conjur_userid'));
|
16
|
+
|
17
|
+
var React = require('react'),
|
18
|
+
Router = require('react-router'),
|
19
|
+
Fluxxor = require('fluxxor');
|
20
|
+
|
21
|
+
var actions = require('./actions'),
|
22
|
+
routes = require('./routes');
|
23
|
+
|
24
|
+
var AppStore = require('./stores/app_store'),
|
25
|
+
RouteStore = require('./stores/route_store'),
|
26
|
+
SearchStore = require('./stores/search_store'),
|
27
|
+
AuditStore = require('./stores/audit_store'),
|
28
|
+
ResourcesStore = require('./stores/resources_store');
|
29
|
+
|
30
|
+
var UserStore = require('./stores/user_store'),
|
31
|
+
GroupStore = require('./stores/group_store'),
|
32
|
+
HostStore = require('./stores/host_store'),
|
33
|
+
LayerStore = require('./stores/layer_store'),
|
34
|
+
VariableStore = require('./stores/variable_store'),
|
35
|
+
PolicyStore = require('./stores/policy_store');
|
36
|
+
|
37
|
+
var router = Router.create({routes: routes, location: Router.HistoryLocation});
|
38
|
+
|
39
|
+
var stores = {
|
40
|
+
AppStore: new AppStore(),
|
41
|
+
RouteStore: new RouteStore({router: router}),
|
42
|
+
search: new SearchStore(),
|
43
|
+
audit: new AuditStore(),
|
44
|
+
resources: new ResourcesStore(),
|
45
|
+
user: new UserStore(),
|
46
|
+
group: new GroupStore(),
|
47
|
+
host: new HostStore(),
|
48
|
+
layer: new LayerStore(),
|
49
|
+
variable: new VariableStore(),
|
50
|
+
policy: new PolicyStore()
|
51
|
+
};
|
52
|
+
|
53
|
+
var flux = new Fluxxor.Flux(stores, actions);
|
54
|
+
|
55
|
+
flux.on('dispatch', function(type, payload) {
|
56
|
+
if (console && console.log) {
|
57
|
+
console.log('[Dispatch]', type, payload);
|
58
|
+
}
|
59
|
+
});
|
60
|
+
|
61
|
+
Promise.all([
|
62
|
+
new Promise((resolve) => {
|
63
|
+
if (window.addEventListener) {
|
64
|
+
window.addEventListener('DOMContentLoaded', resolve);
|
65
|
+
} else {
|
66
|
+
window.attachEvent('onload', resolve);
|
67
|
+
}
|
68
|
+
})
|
69
|
+
]).then(() => {
|
70
|
+
router.run(function(Handler) {
|
71
|
+
React.render(
|
72
|
+
<Handler flux={flux} />,
|
73
|
+
document.getElementById('wrapper')
|
74
|
+
);
|
75
|
+
});
|
76
|
+
});
|
@@ -0,0 +1,54 @@
|
|
1
|
+
/* global conjur */
|
2
|
+
|
3
|
+
'use strict';
|
4
|
+
|
5
|
+
var polyfill = require('event-source-polyfill'),
|
6
|
+
request = require('superagent');
|
7
|
+
|
8
|
+
var c = module.exports.c = {
|
9
|
+
AUDIT_ALL: 'AUDIT_ALL',
|
10
|
+
AUDIT_FLOW: 'AUDIT_FLOW',
|
11
|
+
AUDIT_ROLE: 'AUDIT_ROLE',
|
12
|
+
AUDIT_RESOURCE: 'AUDIT_RESOURCE'
|
13
|
+
};
|
14
|
+
|
15
|
+
module.exports.fetch = function(type, kind, id, callback, errCallback) {
|
16
|
+
var defaultCallback = function(res) {
|
17
|
+
if (res.error) {
|
18
|
+
errCallback(res);
|
19
|
+
} else {
|
20
|
+
callback(res);
|
21
|
+
}
|
22
|
+
};
|
23
|
+
|
24
|
+
var fullId = window.encodeURIComponent(conjur.app.configuration.account +
|
25
|
+
':' + kind + ':' + id);
|
26
|
+
|
27
|
+
switch (type) {
|
28
|
+
case c.AUDIT_ALL:
|
29
|
+
request
|
30
|
+
.get('/api/audit/all')
|
31
|
+
.end(defaultCallback);
|
32
|
+
break;
|
33
|
+
|
34
|
+
case c.AUDIT_FLOW:
|
35
|
+
var e = new EventSource('/api/audit/all');
|
36
|
+
e.onmessage = callback;
|
37
|
+
e.onerror = errCallback;
|
38
|
+
return e;
|
39
|
+
|
40
|
+
break;
|
41
|
+
|
42
|
+
case c.AUDIT_ROLE:
|
43
|
+
request
|
44
|
+
.get('/api/audit/roles/' + fullId)
|
45
|
+
.end(defaultCallback);
|
46
|
+
break;
|
47
|
+
|
48
|
+
case c.AUDIT_RESOURCE:
|
49
|
+
request
|
50
|
+
.get('/api/audit/resources/' + fullId)
|
51
|
+
.end(defaultCallback);
|
52
|
+
break;
|
53
|
+
};
|
54
|
+
};
|
@@ -0,0 +1,87 @@
|
|
1
|
+
/* global conjur */
|
2
|
+
|
3
|
+
'use strict';
|
4
|
+
|
5
|
+
var request = require('superagent');
|
6
|
+
|
7
|
+
var utils = require('../utils');
|
8
|
+
|
9
|
+
var c = module.exports.c = {
|
10
|
+
ATTRIBUTES: 'ATTRIBUTES',
|
11
|
+
OWNED_RESOURCES: 'OWNED_RESOURCES',
|
12
|
+
ALL_ROLES: 'ALL_ROLES',
|
13
|
+
RESOURCE: 'RESOURCE',
|
14
|
+
PUBLIC_KEYS: 'PUBLIC_KEYS'
|
15
|
+
};
|
16
|
+
|
17
|
+
module.exports.fetch = function(type, kind, id, callback, errCallback) {
|
18
|
+
var defaultCallback = function(res) {
|
19
|
+
if (res.error) {
|
20
|
+
errCallback(res);
|
21
|
+
} else {
|
22
|
+
callback(res);
|
23
|
+
}
|
24
|
+
};
|
25
|
+
|
26
|
+
switch (type) {
|
27
|
+
case c.ATTRIBUTES:
|
28
|
+
request
|
29
|
+
.get('/api/'+
|
30
|
+
utils.pluralize(kind) +
|
31
|
+
'/' +
|
32
|
+
window.encodeURIComponent(id))
|
33
|
+
.end(defaultCallback);
|
34
|
+
break;
|
35
|
+
|
36
|
+
case c.OWNED_RESOURCES:
|
37
|
+
var roleid = [kind, id].join(':');
|
38
|
+
|
39
|
+
request
|
40
|
+
.get('/api/authz/' +
|
41
|
+
conjur.app.configuration.account +
|
42
|
+
'/resources?owner=' +
|
43
|
+
roleid)
|
44
|
+
.end(function(res) {
|
45
|
+
if (res.error) {
|
46
|
+
errCallback(res);
|
47
|
+
} else {
|
48
|
+
res.body = res.body.filter(function(item) {
|
49
|
+
// assets of 'secret' kind are internal
|
50
|
+
return item.id.split(':')[1] !== 'secret';
|
51
|
+
});
|
52
|
+
|
53
|
+
callback(res);
|
54
|
+
}
|
55
|
+
});
|
56
|
+
break;
|
57
|
+
|
58
|
+
case c.ALL_ROLES:
|
59
|
+
request
|
60
|
+
.get('/api/authz/' +
|
61
|
+
conjur.app.configuration.account +
|
62
|
+
'/roles/' +
|
63
|
+
window.encodeURIComponent(kind) +
|
64
|
+
'/' +
|
65
|
+
window.encodeURIComponent(id) +
|
66
|
+
'?all')
|
67
|
+
.end(defaultCallback);
|
68
|
+
break;
|
69
|
+
|
70
|
+
case c.RESOURCE:
|
71
|
+
request
|
72
|
+
.get('/api/authz/' +
|
73
|
+
conjur.app.configuration.account +
|
74
|
+
'/resources/' +
|
75
|
+
kind +
|
76
|
+
'/' +
|
77
|
+
window.encodeURIComponent(id))
|
78
|
+
.end(defaultCallback);
|
79
|
+
break;
|
80
|
+
|
81
|
+
case c.PUBLIC_KEYS:
|
82
|
+
request
|
83
|
+
.get('/api/pubkeys/' + window.encodeURIComponent(id))
|
84
|
+
.end(defaultCallback);
|
85
|
+
break;
|
86
|
+
};
|
87
|
+
};
|
@@ -0,0 +1,36 @@
|
|
1
|
+
/* global conjur */
|
2
|
+
|
3
|
+
'use strict';
|
4
|
+
|
5
|
+
var request = require('superagent');
|
6
|
+
|
7
|
+
var c = module.exports.c = {
|
8
|
+
LAYER_MEMBERS_USE: 'LAYER_MEMBERS_USE',
|
9
|
+
LAYER_MEMBERS_ADMIN: 'LAYER_MEMBERS_ADMIN'
|
10
|
+
};
|
11
|
+
|
12
|
+
module.exports.fetch = function(type, id, callback, errCallback) {
|
13
|
+
var defaultCallback = function(res) {
|
14
|
+
if (res.error) {
|
15
|
+
errCallback(res);
|
16
|
+
} else {
|
17
|
+
callback(res);
|
18
|
+
}
|
19
|
+
};
|
20
|
+
|
21
|
+
var role = '';
|
22
|
+
|
23
|
+
if (type === c.LAYER_MEMBERS_USE) {
|
24
|
+
role = '@/layer/' + id + '/use_host';
|
25
|
+
} else if (type === c.LAYER_MEMBERS_ADMIN) {
|
26
|
+
role = '@/layer/' + id + '/admin_host';
|
27
|
+
}
|
28
|
+
|
29
|
+
request
|
30
|
+
.get('/api/authz/' +
|
31
|
+
conjur.app.configuration.account +
|
32
|
+
'/roles/' +
|
33
|
+
role +
|
34
|
+
'?members')
|
35
|
+
.end(defaultCallback);
|
36
|
+
};
|
@@ -0,0 +1,82 @@
|
|
1
|
+
/* global conjur */
|
2
|
+
|
3
|
+
'use strict';
|
4
|
+
|
5
|
+
var request = require('superagent');
|
6
|
+
|
7
|
+
module.exports.fetch = function(kind, callback, errCallback) {
|
8
|
+
var defaultCallback = function(res) {
|
9
|
+
if (res.error) {
|
10
|
+
errCallback(res);
|
11
|
+
} else {
|
12
|
+
callback(res);
|
13
|
+
}
|
14
|
+
};
|
15
|
+
|
16
|
+
if (kind === 'custom-type') {
|
17
|
+
request
|
18
|
+
.get('/api/authz/' +
|
19
|
+
window.encodeURIComponent(conjur.app.configuration.account) +
|
20
|
+
'/resources')
|
21
|
+
.end(defaultCallback);
|
22
|
+
} else {
|
23
|
+
request
|
24
|
+
.get('/api/authz/' +
|
25
|
+
window.encodeURIComponent(conjur.app.configuration.account) +
|
26
|
+
'/resources/' +
|
27
|
+
window.encodeURIComponent(kind))
|
28
|
+
.end(defaultCallback);
|
29
|
+
}
|
30
|
+
};
|
31
|
+
|
32
|
+
module.exports.fetchOne = function(kind, id, callback, errCallback) {
|
33
|
+
var defaultCallback = function(res) {
|
34
|
+
if (res.error) {
|
35
|
+
errCallback(res);
|
36
|
+
} else {
|
37
|
+
callback(res);
|
38
|
+
}
|
39
|
+
};
|
40
|
+
|
41
|
+
request
|
42
|
+
.get('/api/authz/' +
|
43
|
+
window.encodeURIComponent(conjur.app.configuration.account) +
|
44
|
+
'/resources/' +
|
45
|
+
window.encodeURIComponent(kind) +
|
46
|
+
'/' +
|
47
|
+
window.encodeURIComponent(id))
|
48
|
+
.end(defaultCallback);
|
49
|
+
};
|
50
|
+
|
51
|
+
module.exports.fetchGroupRoles = function(id, callback, errCallback) {
|
52
|
+
request
|
53
|
+
.get('/api/authz/' +
|
54
|
+
conjur.app.configuration.account +
|
55
|
+
'/roles/group/' +
|
56
|
+
id +
|
57
|
+
'?members')
|
58
|
+
.end(function(res) {
|
59
|
+
if (res.error) {
|
60
|
+
errCallback(res);
|
61
|
+
} else {
|
62
|
+
callback(res);
|
63
|
+
}
|
64
|
+
});
|
65
|
+
};
|
66
|
+
|
67
|
+
module.exports.fetchResources = function(kind, id, callback, errCallback) {
|
68
|
+
var role = escape(conjur.app.configuration.account + ':' + kind + ':' + id);
|
69
|
+
|
70
|
+
request
|
71
|
+
.get('/api/authz/' +
|
72
|
+
conjur.app.configuration.account +
|
73
|
+
'/resources?acting_as=' +
|
74
|
+
role)
|
75
|
+
.end(function(res) {
|
76
|
+
if (res.error) {
|
77
|
+
errCallback(res);
|
78
|
+
} else {
|
79
|
+
callback(res);
|
80
|
+
}
|
81
|
+
});
|
82
|
+
};
|
@@ -0,0 +1,37 @@
|
|
1
|
+
/* global conjur */
|
2
|
+
|
3
|
+
'use strict';
|
4
|
+
|
5
|
+
var request = require('superagent');
|
6
|
+
|
7
|
+
var c = module.exports.c = {
|
8
|
+
MEMBERS_EXECUTE: 'MEMBERS_EXECUTE',
|
9
|
+
MEMBERS_UPDATE: 'MEMBERS_UPDATE'
|
10
|
+
};
|
11
|
+
|
12
|
+
module.exports.fetch = function(type, id, callback, errCallback) {
|
13
|
+
var defaultCallback = function(res) {
|
14
|
+
if (res.error) {
|
15
|
+
errCallback(res);
|
16
|
+
} else {
|
17
|
+
callback(res);
|
18
|
+
}
|
19
|
+
};
|
20
|
+
|
21
|
+
var privilege = '';
|
22
|
+
|
23
|
+
if (type === c.MEMBERS_EXECUTE) {
|
24
|
+
privilege = 'execute';
|
25
|
+
} else if (type === c.MEMBERS_UPDATE) {
|
26
|
+
privilege = 'update';
|
27
|
+
}
|
28
|
+
|
29
|
+
request
|
30
|
+
.get('/api/authz/' +
|
31
|
+
conjur.app.configuration.account +
|
32
|
+
'/roles/allowed_to/' +
|
33
|
+
privilege +
|
34
|
+
'/variable/' +
|
35
|
+
window.encodeURIComponent(id))
|
36
|
+
.end(defaultCallback);
|
37
|
+
};
|
@@ -0,0 +1,19 @@
|
|
1
|
+
/* global conjur */
|
2
|
+
|
3
|
+
'use strict';
|
4
|
+
|
5
|
+
var request = require('superagent');
|
6
|
+
|
7
|
+
module.exports = function(query, callback, errCallback) {
|
8
|
+
request
|
9
|
+
.get('/api/authz/' +
|
10
|
+
conjur.app.configuration.account +
|
11
|
+
'/resources?search=' + escape(query.replace('-',' ')))
|
12
|
+
.end(function(res) {
|
13
|
+
if (res.error) {
|
14
|
+
errCallback(res);
|
15
|
+
} else {
|
16
|
+
callback(res);
|
17
|
+
}
|
18
|
+
});
|
19
|
+
};
|
@@ -0,0 +1,22 @@
|
|
1
|
+
/* global jest, describe, it, expect */
|
2
|
+
|
3
|
+
'use strict';
|
4
|
+
|
5
|
+
jest.mock('../../navbar/navbar');
|
6
|
+
jest.dontMock('../app');
|
7
|
+
|
8
|
+
var React = require('react/addons'),
|
9
|
+
TestUtils = React.addons.TestUtils,
|
10
|
+
App = require('../app');
|
11
|
+
|
12
|
+
describe('app', () => {
|
13
|
+
it('default render', () => {
|
14
|
+
var component = TestUtils.renderIntoDocument(
|
15
|
+
<App />
|
16
|
+
);
|
17
|
+
|
18
|
+
var element = TestUtils.findRenderedDOMComponentWithClass(component, 'container');
|
19
|
+
|
20
|
+
expect(element.getDOMNode()).toBe(true);
|
21
|
+
});
|
22
|
+
});
|
@@ -0,0 +1,66 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var React = require('react'),
|
4
|
+
Router = require('react-router'),
|
5
|
+
RouteHandler = Router.RouteHandler,
|
6
|
+
Fluxxor = require('fluxxor'),
|
7
|
+
FluxMixin = Fluxxor.FluxMixin(React),
|
8
|
+
StoreWatchMixin = Fluxxor.StoreWatchMixin;
|
9
|
+
|
10
|
+
var Navbar = require('../navbar/navbar'),
|
11
|
+
Flash = require('../flash/flash');
|
12
|
+
|
13
|
+
module.exports = React.createClass({
|
14
|
+
displayName: 'App',
|
15
|
+
|
16
|
+
mixins: [FluxMixin, StoreWatchMixin('AppStore')],
|
17
|
+
|
18
|
+
getStateFromFlux() {
|
19
|
+
var flux = this.getFlux();
|
20
|
+
|
21
|
+
return flux.store('AppStore').getState();
|
22
|
+
},
|
23
|
+
|
24
|
+
getDefaultProps() {
|
25
|
+
return {
|
26
|
+
userId: conjur.app.userId
|
27
|
+
};
|
28
|
+
},
|
29
|
+
|
30
|
+
render() {
|
31
|
+
var flash;
|
32
|
+
|
33
|
+
if (typeof this.state.flash.msg === 'string') {
|
34
|
+
flash = (
|
35
|
+
<Flash msg={this.state.flash.msg}
|
36
|
+
handleClose={this.handleFlashClose} />
|
37
|
+
);
|
38
|
+
}
|
39
|
+
|
40
|
+
return (
|
41
|
+
<div className="container">
|
42
|
+
<Navbar userId={this.props.userId} />
|
43
|
+
{flash}
|
44
|
+
<div id="modal"></div>
|
45
|
+
<div id="content">
|
46
|
+
<RouteHandler />
|
47
|
+
</div>
|
48
|
+
<div id="bottom" className="navbar-default">
|
49
|
+
<a href="http://conjur.net" className="nav-item"
|
50
|
+
target="_blank">© 2014, Conjur Inc.</a>
|
51
|
+
</div>
|
52
|
+
</div>
|
53
|
+
);
|
54
|
+
},
|
55
|
+
|
56
|
+
handleFlashClose() {
|
57
|
+
this.setState({flash: {}});
|
58
|
+
},
|
59
|
+
|
60
|
+
componentDidMount() {
|
61
|
+
var flux = this.getFlux();
|
62
|
+
|
63
|
+
flux.actions.audit.loadAll(true);
|
64
|
+
flux.actions.resources.load('custom-type');
|
65
|
+
}
|
66
|
+
});
|