Commit 8068d977 authored by Filipa Lacerda's avatar Filipa Lacerda

Adds permissions to actions component

parent 51e79186
...@@ -24,9 +24,7 @@ ...@@ -24,9 +24,7 @@
'actions-component': window.gl.environmentsList.ActionsComponent, 'actions-component': window.gl.environmentsList.ActionsComponent,
}, },
props: { props: ['model', 'can-create-deployment', 'can-create-deployment', 'can-read-environment'],
model: Object,
},
data() { data() {
return { return {
...@@ -247,6 +245,14 @@ ...@@ -247,6 +245,14 @@
return undefined; return undefined;
}, },
canReadEnvironmentParsed() {
return convertToBoolean(this.canReadEnvironment);
},
canCreateDeploymentParsed() {
return convertToBoolean(this.canCreateDeployment);
},
}, },
/** /**
...@@ -261,6 +267,19 @@ ...@@ -261,6 +267,19 @@
return {}.hasOwnProperty.call(obj, key); return {}.hasOwnProperty.call(obj, key);
}, },
/**
* Converts permission provided as strings to booleans.
* @param {String} string
* @returns {Boolean}
*/
convertPermissionToBoolean(string) {
if (string === 'true') {
return true;
}
return false;
},
methods: { methods: {
/** /**
* Toggles the visibility of a folders' children. * Toggles the visibility of a folders' children.
...@@ -272,6 +291,10 @@ ...@@ -272,6 +291,10 @@
}, },
}, },
ready() {
debugger;
},
template: ` template: `
<tr> <tr>
<td v-bind:class="rowClass"> <td v-bind:class="rowClass">
...@@ -340,7 +363,7 @@ ...@@ -340,7 +363,7 @@
<td class="hidden-xs"> <td class="hidden-xs">
<div v-if="!isFolder"> <div v-if="!isFolder">
<div v-if="hasManualActions"> <div v-if="hasManualActions && canCreateDeploymentParsed">
<actions-component :actions="manualActions"></actions-component> <actions-component :actions="manualActions"></actions-component>
</div> </div>
</div> </div>
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
- content_for :page_specific_javascripts do - content_for :page_specific_javascripts do
= page_specific_javascript_tag("environments/environments_bundle.js") = page_specific_javascript_tag("environments/environments_bundle.js")
#environments-list-view{ data: { environments_data: environments_list_data, "can-create-deployment" => can?(current_user, :create_deployment, @environment), "can_read_environment" => can?(current_user, :read_environment, @project)}, class: container_class } #environments-list-view{ data: { environments_data: environments_list_data, "can-create-deployment" => can?(current_user, :create_deployment, @environment), "can-read-environment" => can?(current_user, :read_environment, @project)}, class: container_class }
.top-area .top-area
%ul.nav-links{ "v-if" => "!loading" } %ul.nav-links{ "v-if" => "!loading" }
%li{class: ('active' if @scope.nil?)} %li{class: ('active' if @scope.nil?)}
...@@ -56,5 +56,9 @@ ...@@ -56,5 +56,9 @@
%th %th
%th.hidden-xs %th.hidden-xs
%tbody %tbody
%tr{"is" => "environment-item", "v-for" => "model in filteredEnvironments", ":model" => "model"} %tr{"is" => "environment-item",
"v-for" => "model in filteredEnvironments",
":model" => "model",
"can-create-deployment" => can?(current_user, :create_deployment, @environment),
"can-read-environment" => can?(current_user, :read_environment, @project)}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment