Use global events to revoke env access
This commit is contained in:
parent
cd9ae2c928
commit
c7471f9e8b
@ -20,7 +20,7 @@ export default {
|
|||||||
props: {
|
props: {
|
||||||
choices: Array,
|
choices: Array,
|
||||||
initialData: String,
|
initialData: String,
|
||||||
revoke: Boolean,
|
projectId: String
|
||||||
},
|
},
|
||||||
|
|
||||||
data: function () {
|
data: function () {
|
||||||
@ -29,6 +29,10 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
mounted: function() {
|
||||||
|
this.$root.$on('revoke-' + this.projectId, this.revoke)
|
||||||
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
change: function (e) {
|
change: function (e) {
|
||||||
this.new_role = e.target.value
|
this.new_role = e.target.value
|
||||||
@ -36,14 +40,9 @@ export default {
|
|||||||
cancel: function () {
|
cancel: function () {
|
||||||
this.new_role = this.initialData
|
this.new_role = this.initialData
|
||||||
},
|
},
|
||||||
},
|
revoke: function () {
|
||||||
|
|
||||||
watch: {
|
|
||||||
revoke: function (val) {
|
|
||||||
if (val) {
|
|
||||||
this.new_role = ""
|
this.new_role = ""
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -14,19 +14,13 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
name: String
|
name: String,
|
||||||
},
|
id: String
|
||||||
|
|
||||||
data: function() {
|
|
||||||
return { revoke: false }
|
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
doRevoke: function () {
|
doRevoke: function () {
|
||||||
// This is being used to send an event to the edit-environment-role child component.
|
this.$root.$emit('revoke-' + this.id)
|
||||||
// We'll toggle this back on the next line so that it can be used again.
|
|
||||||
this.revoke = true
|
|
||||||
setTimeout(() => { this.revoke = false }, 25)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@
|
|||||||
|
|
||||||
{% for project in projects %}
|
{% for project in projects %}
|
||||||
{% set revoke_modal_name = project.name + 'RevokeModal' %}
|
{% set revoke_modal_name = project.name + 'RevokeModal' %}
|
||||||
<edit-project-roles inline-template v-bind:name="'{{ project.name }}'">
|
<edit-project-roles inline-template v-bind:name="'{{ project.name }}'" v-bind:id="'{{ project.id }}'">
|
||||||
<div is='toggler' default-visible class='block-list project-list-item'>
|
<div is='toggler' default-visible class='block-list project-list-item'>
|
||||||
<template slot-scope='props'>
|
<template slot-scope='props'>
|
||||||
<header class='block-list__header'>
|
<header class='block-list__header'>
|
||||||
@ -81,7 +81,7 @@
|
|||||||
{% set role = EnvironmentRoles.get(member.user_id, env.id).role %}
|
{% set role = EnvironmentRoles.get(member.user_id, env.id).role %}
|
||||||
|
|
||||||
<li class='block-list__item'>
|
<li class='block-list__item'>
|
||||||
<edit-environment-role inline-template initial-data='{{ role or "" }}' v-bind:choices='{{ choices | tojson }}' v-bind:revoke='revoke'>
|
<edit-environment-role inline-template initial-data='{{ role or "" }}' v-bind:choices='{{ choices | tojson }}' v-bind:project-id="'{{ project.id }}'">
|
||||||
<div class='project-list-item__environment'>
|
<div class='project-list-item__environment'>
|
||||||
<span class='project-list-item__environment__link'>
|
<span class='project-list-item__environment__link'>
|
||||||
{{ env.name }}
|
{{ env.name }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user