Use `GlTable` for the deployment approval rules in the add rule modal
Problem to solve
The UI of the protected environments settings is a bit messy when items are missing (group inheritance toggle, the lack of photo for maintainers). It also has some issues on the smaller screens.
UX proposal
| Before | After |
|---|---|
![]() |
![]() |
![]() |
![]() |
Implementation guide
Work with add_approvers component. Refactor the view to use GlTableLite.
-
Import and include
GlTableLiteinto the components list. -
Add
fieldsobject (can be added in $options) like this:fields: [ { key: 'approvers', label: s__('ProtectedEnvironments|Approvers'), }, { key: 'approvals', label: s__('ProtectedEnvironments|Approvals required'), }, { key: 'inheritance', label: s__('ProtectedEnvironments|Enable group inheritance'), }, { key: 'remove', label: '', tdClass: 'gl-text-right', }, ], -
Render the
GlTableLitecomponent:<gl-table-lite :fields="$options.fields" :items="approverInfo" data-testid="approval-rules" stacked="md" class="-gl-mb-5 md:gl-mb-0" > -
Render a template for each cell reusing the existing logic. Example:
<template #cell(approvers)="{ item: approver, index }"> <gl-avatar v-if="approver.avatarShape" :key="`${index}-avatar`" :src="approver.avatarUrl" :size="24" :entity-id="approver.id" :entity-name="approver.entityName" :shape="approver.avatarShape" /> <span v-else :key="`${index}-avatar`" class="gl-w-6"></span> <gl-link v-if="approver.webUrl" :key="`${index}-name`" :href="approver.webUrl"> {{ approver.name }} </gl-link> <span v-else :key="`${index}-name`">{{ approver.name }}</span> </template> -
Make sure the tests are still passing:
Edited by Anna Vovchenko



