File tree Expand file tree Collapse file tree
frontend/src/pages/team/Applications/components/compact
test/e2e/frontend/cypress/tests/applications Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5252 :show-text =" showButtonLabels"
5353 />
5454
55- <ff-kebab-menu @click.stop >
55+ <ff-kebab-menu v-if = " shouldDisplayKebabMenu " @click.stop >
5656 <ff-list-item
5757 :disabled =" localInstance.pendingStateChange || instanceRunning "
5858 label =" Start"
8282</template >
8383
8484<script >
85+ import { mapGetters } from ' vuex'
86+
8587import InstanceStatusPolling from ' ../../../../../components/InstanceStatusPolling.vue'
8688import AuditMixin from ' ../../../../../mixins/Audit.js'
8789import instanceActionsMixin from ' ../../../../../mixins/InstanceActions.js'
@@ -121,6 +123,7 @@ export default {
121123 }
122124 },
123125 computed: {
126+ ... mapGetters (' account' , [' isAdminUser' ]),
124127 isInstanceRunning () {
125128 return this .localInstance .meta ? .state === ' running'
126129 },
@@ -135,6 +138,9 @@ export default {
135138 },
136139 instanceSuspended () {
137140 return this .localInstance .meta ? .state === ' suspended'
141+ },
142+ shouldDisplayKebabMenu () {
143+ return this .isAdminUser || this .hasPermission (' project:change-status' )
138144 }
139145 },
140146 watch: {
Original file line number Diff line number Diff line change @@ -375,6 +375,65 @@ describe('FlowForge - Applications', () => {
375375 } )
376376 } )
377377
378+ it ( 'doesn\'t display the instance kebab menu for non-owner users' , ( ) => {
379+ cy . intercept (
380+ 'GET' ,
381+ '/api/*/teams/*/user' ,
382+ { role : 30 }
383+ ) . as ( 'getTeamRole' )
384+ cy . intercept (
385+ 'GET' ,
386+ '/api/*/teams/*/applications/status*' ,
387+ { count : 1 , applications : [ { id : 'some-id' , instances : [ ] , devices : [ ] } ] }
388+ ) . as ( 'getAppStatuses' )
389+ cy . intercept ( 'get' , '/api/*/applications/*/devices*' , {
390+ meta : { } ,
391+ count : 0 ,
392+ devices : [ ]
393+ } ) . as ( 'getDevices' )
394+ cy . intercept (
395+ 'GET' ,
396+ '/api/*/teams/*/applications*' ,
397+ req => req . reply ( res => {
398+ res . send ( {
399+ count : 1 ,
400+ applications : [
401+ {
402+ id : 'some-id' ,
403+ name : 'My app' ,
404+ description : 'My empty app description' ,
405+ instancesSummary : {
406+ instances : [
407+ {
408+ id : 1 ,
409+ name : 'instance-1' ,
410+ meta : {
411+ versions : {
412+ launcher : '2.3.1'
413+ } ,
414+ state : 'running'
415+ } ,
416+ url : 'https://www.google.com:123/search?q=rick+astley'
417+ }
418+ ]
419+ } ,
420+ devicesSummary : {
421+ devices : [
422+ ]
423+ }
424+ }
425+ ]
426+ } )
427+ } )
428+ ) . as ( 'getApplication' )
429+
430+ cy . visit ( '/' )
431+ cy . wait ( '@getTeamRole' )
432+ cy . wait ( '@getDevices' )
433+
434+ cy . get ( '[data-el="kebab-menu"]' ) . should ( 'not.exist' )
435+ } )
436+
378437 describe ( 'can search through' , ( ) => {
379438 it ( 'applications' , ( ) => {
380439 cy . intercept (
You can’t perform that action at this time.
0 commit comments