-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #215 from bcgov/feature/show-bulk-add-results
Show results of bulk invite and add/remove in table
- Loading branch information
Showing
2 changed files
with
80 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 GitHub Actions / Unit Tests (Frontend) (16.x)
Check warning on line 22 in frontend/src/components/common/BulkPermissionResults.vue GitHub Actions / Unit Tests (Frontend) (18.x)
|
||
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 GitHub Actions / Unit Tests (Frontend) (16.x)
Check warning on line 34 in frontend/src/components/common/BulkPermissionResults.vue GitHub Actions / Unit Tests (Frontend) (18.x)
|
||
: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> |