BigW Consortium Gitlab

Commit 8068d977 by Filipa Lacerda

Adds permissions to actions component

parent 51e79186
......@@ -24,9 +24,7 @@
'actions-component': window.gl.environmentsList.ActionsComponent,
},
props: {
model: Object,
},
props: ['model', 'can-create-deployment', 'can-create-deployment', 'can-read-environment'],
data() {
return {
......@@ -247,6 +245,14 @@
return undefined;
},
canReadEnvironmentParsed() {
return convertToBoolean(this.canReadEnvironment);
},
canCreateDeploymentParsed() {
return convertToBoolean(this.canCreateDeployment);
},
},
/**
......@@ -261,6 +267,19 @@
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: {
/**
* Toggles the visibility of a folders' children.
......@@ -272,6 +291,10 @@
},
},
ready() {
debugger;
},
template: `
<tr>
<td v-bind:class="rowClass">
......@@ -340,7 +363,7 @@
<td class="hidden-xs">
<div v-if="!isFolder">
<div v-if="hasManualActions">
<div v-if="hasManualActions && canCreateDeploymentParsed">
<actions-component :actions="manualActions"></actions-component>
</div>
</div>
......
......@@ -5,7 +5,7 @@
- content_for :page_specific_javascripts do
= 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
%ul.nav-links{ "v-if" => "!loading" }
%li{class: ('active' if @scope.nil?)}
......@@ -56,5 +56,9 @@
%th
%th.hidden-xs
%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