Skip to content

Commit

Permalink
replace GridSharing with SharingIndicators in GridList
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedhamidawan committed Oct 23, 2023
1 parent 0c7e02f commit cecbcd9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
15 changes: 7 additions & 8 deletions client/src/components/Grid/GridList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import { registry } from "./configs/registry";
import { FieldKeyHandler, Operation, RowData } from "./configs/types";
import GridOperations from "./GridElements/GridOperations.vue";
import GridSharing from "./GridElements/GridSharing.vue";
import GridText from "./GridElements/GridText.vue";
import FilterMenu from "@/components/Common/FilterMenu.vue";
import SharingIndicators from "@/components/Indices/SharingIndicators.vue";
import LoadingSpan from "@/components/LoadingSpan.vue";
import StatelessTags from "@/components/TagsMultiselect/StatelessTags.vue";
//@ts-ignore
Expand Down Expand Up @@ -63,13 +63,13 @@ const searchTerm = ref("");
const showAdvanced = ref(false);
/**
* Manually set filter value, used for tags
* Manually set filter value, used for tags and `SharingIndicators`
*/
function applyFilter(filter: string, value: string, quoted = false) {
function applyFilter(filter: string, value: string | boolean, quoted = false) {
const setFilterValue = gridConfig.value?.filtering.setFilterValue;
const quotedValue = quoted ? `'${value}'` : value;
if (setFilterValue) {
filterText.value = setFilterValue(filterText.value, filter, quotedValue) || "";
filterText.value = setFilterValue(filterText.value, filter, quotedValue.toString()) || "";
}
}
Expand Down Expand Up @@ -219,11 +219,10 @@ watch(operationMessage, () => {
:operations="fieldEntry.operations"
@execute="onOperation($event, rowData)" />
<GridText v-else-if="fieldEntry.type == 'text'" :text="rowData[fieldEntry.key]" />
<GridSharing
<SharingIndicators
v-else-if="fieldEntry.type == 'sharing'"
:published="rowData.sharing_status.published"
:importable="rowData.sharing_status.importable"
:users_shared_with_length="rowData.sharing_status.users_shared_with.length" />
:object="rowData.sharing_status"
@filter="(filter) => applyFilter(filter, true)" />
<UtcDate v-else-if="fieldEntry.type == 'date'" :date="rowData[fieldEntry.key]" mode="elapsed" />
<StatelessTags
v-else-if="fieldEntry.type == 'tags'"
Expand Down
14 changes: 12 additions & 2 deletions client/src/components/Indices/SharingIndicators.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<script setup lang="ts">
import { library } from "@fortawesome/fontawesome-svg-core";
import { faGlobe, faLink, faShareAlt } from "@fortawesome/free-solid-svg-icons";
import { faGlobe, faLink, faShareAlt, faUsers } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
import { BButton, VBTooltip } from "bootstrap-vue";
library.add(faGlobe, faShareAlt, faLink);
library.add(faGlobe, faShareAlt, faLink, faUsers);
interface SharingIndicatorsProps {
object: Object;
Expand Down Expand Up @@ -44,5 +44,15 @@ const props = defineProps<SharingIndicatorsProps>();
@click.prevent="$emit('filter', 'shared_with_me')">
<FontAwesomeIcon icon="share-alt" />
</BButton>
<!-- this can later be changed to an active button, currently, no such filter -->
<BButton
v-if="props.object.users_shared_with && props.object.users_shared_with.length"
v-b-tooltip.hover.noninteractive
size="sm"
variant="link"
disabled
:title="`Shared with ${props.object.users_shared_with.length} user(s)` | localize">
<FontAwesomeIcon icon="users" />
</BButton>
</span>
</template>

0 comments on commit cecbcd9

Please sign in to comment.