Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show policies #242

Merged
merged 2 commits into from
Sep 19, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions remoteappmanager/restresources/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ def retrieve(self, identifier):
"ui_name": image.ui_name,
"icon_128": image.icon_128,
"description": image.description,
"policy": {
"allow_home": policy.allow_home,
"volume_source": policy.volume_source,
"volume_target": policy.volume_target,
"volume_mode": policy.volume_mode,
}
},
"mapping_id": identifier,
}
Expand Down
27 changes: 23 additions & 4 deletions remoteappmanager/restresources/tests/test_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,16 @@ def get_app(self):
application_mock_2 = Mock()
application_mock_2.image = "hello2"

policy = Mock(
allow_home=True,
volume_source="foo",
volume_target="bar",
volume_mode="ro",
)

app.db.get_apps_for_user = Mock(return_value=[
("one", application_mock_1, Mock()),
("two", application_mock_2, Mock()),
("one", application_mock_1, policy),
("two", application_mock_2, policy),
])
return app

Expand Down Expand Up @@ -89,7 +96,13 @@ def prepare_side_effect(*args, **kwargs):
'image': {'description': '',
'icon_128': '',
'name': 'boo',
'ui_name': 'foo_ui'},
'ui_name': 'foo_ui',
'policy': {
"allow_home": True,
"volume_mode": 'ro',
"volume_source": "foo",
"volume_target": "bar",
}},
'mapping_id': 'one'})

self._app.container_manager.containers_from_mapping_id = \
Expand All @@ -109,7 +122,13 @@ def prepare_side_effect(*args, **kwargs):
'image': {'description': '',
'icon_128': '',
'name': 'boo',
'ui_name': 'foo_ui'},
'ui_name': 'foo_ui',
'policy': {
"allow_home": True,
"volume_mode": 'ro',
"volume_source": "foo",
"volume_target": "bar",
}},
'mapping_id': 'one'})

res = self.fetch("/api/v1/applications/three/")
Expand Down
21 changes: 20 additions & 1 deletion remoteappmanager/static/js/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,26 @@ require(
} else {
name = info.image.name;
}
html += '<div class="col-sm-7 va"><h4>'+name+'</h4></div>';
html += '<div class="col-sm-7 va"><h4>'+name+'</h4>';

var policy = info.image.policy;
var mount_html = '';

if (policy.allow_home) {
mount_html += "<li>Workspace</li>";
}
if (policy.volume_source && policy.volume_target && policy.volume_mode) {
mount_html += "<li>"+ policy.volume_source +
" &#x2192; " +
policy.volume_target +
" " +
"(" + policy.volume_mode + ")</li>";
}
if (mount_html !== '') {
html += "<ul>" + mount_html + "</ul>";
}

html += '</div>';

var cls, text, stop_style;
if (info.container !== null) {
Expand Down