Skip to content

Commit

Permalink
Merge pull request #215 from bcgov/feature/show-bulk-add-results
Browse files Browse the repository at this point in the history
Show results of bulk invite and add/remove in table
  • Loading branch information
TimCsaky authored Jun 18, 2024
2 parents c74264c + 728cf6b commit a8f0a4a
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 3 deletions.
2 changes: 2 additions & 0 deletions frontend/src/assets/variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ $bcbox-primary: #036;
$bcbox-link-text: #1a5a96;
$bcbox-link-text-hover: #2378c7;
$bcbox-outline-on-primary: #fff;
$bcbox-success: #2e8540;
$bcbox-error: #d8292f;
$bcbox-noaction: #606060;

// highlighted sections, table rows
$bcbox-highlight-background: #d9e1e8;
Expand Down
81 changes: 78 additions & 3 deletions frontend/src/components/common/BulkPermissionResults.vue
Original file line number Diff line number Diff line change
@@ -1,21 +1,96 @@
<script setup lang="ts">
import { Dialog } from '@/lib/primevue';
import { ref } from 'vue';
import { Column, DataTable, Dialog } from '@/lib/primevue';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
// Props
type Props = {
results: Array<Object>;
resource: any;
resourceType: string;
};
const props = withDefaults(defineProps<Props>(), {});
const props = withDefaults(defineProps<Props>(), {
results: undefined
});
const modelValue = defineModel<boolean>({ default: false });
// Exports DataTable results
const batchResults = ref();
const exportCSV = (event: any) => {

Check warning on line 22 in frontend/src/components/common/BulkPermissionResults.vue

View workflow job for this annotation

GitHub Actions / Unit Tests (Frontend) (16.x)

'event' is defined but never used

Check warning on line 22 in frontend/src/components/common/BulkPermissionResults.vue

View workflow job for this annotation

GitHub Actions / Unit Tests (Frontend) (18.x)

'event' is defined but never used

Check warning on line 22 in frontend/src/components/common/BulkPermissionResults.vue

View workflow job for this annotation

GitHub Actions / Unit Tests (Frontend) (20.x)

'event' is defined but never used
batchResults.value.exportCSV();
};
</script>
<template>
<Dialog
v-model:visible="modelValue"
header="Results"
:modal="true"
>
<pre>{{ props.results }}</pre>
<DataTable
ref="batchResults"
:export-filename="`${resourceType === 'object' ? resource.name.replace(/\.[^/.]+$/, '') : resource.bucketName}_bulk_results`"

Check warning on line 34 in frontend/src/components/common/BulkPermissionResults.vue

View workflow job for this annotation

GitHub Actions / Unit Tests (Frontend) (16.x)

This line has a length of 131. Maximum allowed is 120

Check warning on line 34 in frontend/src/components/common/BulkPermissionResults.vue

View workflow job for this annotation

GitHub Actions / Unit Tests (Frontend) (18.x)

This line has a length of 131. Maximum allowed is 120

Check warning on line 34 in frontend/src/components/common/BulkPermissionResults.vue

View workflow job for this annotation

GitHub Actions / Unit Tests (Frontend) (20.x)

This line has a length of 131. Maximum allowed is 120
:value="props.results"
class="p-datatable-striped"
>
<div class="action-buttons">
<Button
v-tooltip.bottom="'Save results'"
aria-label="Save results"
class="p-button"
@click="exportCSV($event)"
>
<font-awesome-icon
icon="fa-download"
class="pl-1 pr-1 pt-1 pb-1"
/>
</Button>
</div>
<Column
field="email"
header="Email"
/>
<Column
field="description"
header="Result"
>
<template #body="{ data }">
<span>
<span class="m-1">
<font-awesome-icon
v-if="data.status === 1"
icon="fa-circle-check"
class="icon-success"
/>
<font-awesome-icon
v-else-if="data.status === 0"
icon="fa-circle-minus"
class="icon-noaction"
/>
<font-awesome-icon
v-else
icon="fa-circle-xmark"
class="icon-error"
/>
</span>
{{ data.description }}
</span>
</template>
</Column>
</DataTable>
</Dialog>
</template>

<style scoped lang="scss">
.icon-success {
color: $bcbox-success;
}
.icon-error {
color: $bcbox-error;
}
.icon-noaction {
color: $bcbox-noaction;
}
</style>

0 comments on commit a8f0a4a

Please sign in to comment.