Skip to content
Snippets Groups Projects

Add UI components for Beyond Identity check exclusions by Projects

Merged Jacques Erasmus requested to merge 454372-beyond-identity-exclusions-ui into master
All threads resolved!
2 files
+ 55
5
Compare changes
  • Side-by-side
  • Inline
Files
2
<script>
import { GlAlert, GlButton } from '@gitlab/ui';
import { GlAlert, GlButton, GlIcon, GlAvatar } from '@gitlab/ui';
import { s__ } from '~/locale';
import BeyondIdentityTabs from './beyond_identity_tabs.vue';
import AddExclusionsDrawer from './add_exclusions_drawer.vue';
@@ -11,21 +11,51 @@ export default {
GlButton,
BeyondIdentityTabs,
AddExclusionsDrawer,
GlAvatar,
GlIcon,
},
props: {},
data() {
return {
errorMessage: null,
isDrawerOpen: false,
exclusions: [],
lastRemovedExclusion: null, // needed for Undo
};
},
computed: {},
computed: {
formattedExclusions() {
return this.exclusions.map((exclusion) => ({
...exclusion,
icon: exclusion.type === 'project' ? 'project' : 'group',
}));
},
},
created() {
this.loadExclusions();
},
methods: {
loadExclusions() {
// TODO
// TODO: replace mock data with real data
this.exclusions = [
{ name: 'Project 1', id: 1, type: 'project', avatarUrl: null },
{ name: 'Project 2', id: 2, type: 'project', avatarUrl: null },
];
},
removeExclusion(exclusion) {
// TODO: open confirmation modal
// TODO: replace with backend call
this.lastRemovedExclusion = exclusion;
this.exclusions = this.exclusions.filter((item) => item.id !== exclusion);
// TODO: show toast (with Undo action)
},
undoRemoveExclusion() {
// TODO: replace with backend call
this.exclusions.push(this.lastRemovedExclusion);
},
toggleDrawer() {
this.isDrawerOpen = !this.isDrawerOpen;
},
},
i18n: {
@@ -56,7 +86,27 @@ export default {
{{ errorMessage }}
</gl-alert>
<div v-else>TODO: List exclusions here</div>
<div
v-for="(exclusion, index) in formattedExclusions"
v-else
:key="index"
class="gl-display-flex gl-justify-content-space-between gl-p-4 gl-py-3 gl-pl-7 gl-border-b gl-align-items-center gl-gap-3"
>
<gl-icon :name="exclusion.icon" class="gl-text-secondary" />
<gl-avatar
:alt="exclusion.name"
:entity-name="exclusion.name"
:size="32"
:src="exclusion.avatarUrl"
shape="rect"
fallback-on-error
/>
<span class="gl-display-flex gl-flex-direction-column gl-flex-grow-1">
<span class="gl-font-weight-bold">{{ exclusion.name }}</span>
</span>
<gl-button icon="remove" category="tertiary" @click="() => removeExclusion(exclusion.id)" />
</div>
<add-exclusions-drawer :is-open="isDrawerOpen" @close="isDrawerOpen = false" />
</div>
Loading