-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add missing information to object details screens #35
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<script setup lang="ts"> | ||
defineProps({ | ||
label: { | ||
type: String, | ||
default: undefined | ||
}, | ||
value: { | ||
type: String, | ||
default: undefined | ||
}, | ||
link: { | ||
type: Object, | ||
default: undefined | ||
} | ||
}); | ||
</script> | ||
|
||
<template> | ||
<div | ||
v-if="value && label" | ||
class="col-3" | ||
> | ||
{{ label }}: | ||
</div> | ||
<div | ||
v-if="value && link" | ||
class="col-9" | ||
> | ||
<router-link | ||
:to="link" | ||
> | ||
{{ value }} | ||
</router-link> | ||
</div> | ||
<div | ||
v-if="value && !link" | ||
class="col-9" | ||
> | ||
{{ value }} | ||
</div> | ||
</template> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,25 +2,42 @@ | |
import { onMounted, ref } from 'vue'; | ||
import { useRoute } from 'vue-router'; | ||
import { storeToRefs } from 'pinia'; | ||
import Button from 'primevue/button'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Style: We'll want to reorder the imports so that the pinia one comes before the vue one. |
||
import Dialog from 'primevue/dialog'; | ||
import { useToast } from 'primevue/usetoast'; | ||
|
||
import ObjectAccess from '@/components/object/ObjectAccess.vue'; | ||
import ObjectMetadata from '@/components/object/ObjectMetadata.vue'; | ||
import ObjectProperties from '@/components/object/ObjectProperties.vue'; | ||
import ObjectTag from '@/components/object/ObjectTag.vue'; | ||
import { useObjectStore } from '@/store'; | ||
import { | ||
DeleteObjectButton, | ||
DownloadObjectButton, | ||
ObjectAccess, | ||
ObjectMetadata, | ||
ObjectPermission, | ||
ObjectProperties, | ||
ObjectTag | ||
} from '@/components/object'; | ||
|
||
import { useObjectStore, useUserStore } from '@/store'; | ||
import { Permissions } from '@/utils/constants'; | ||
|
||
import type { Ref } from 'vue'; | ||
import type { COMSObject } from '@/interfaces'; | ||
import { ButtonMode } from '@/interfaces/common/enums'; | ||
jujaga marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
const objectStore = useObjectStore(); | ||
const toast = useToast(); | ||
const route = useRoute(); | ||
|
||
const { objectList } = storeToRefs(objectStore); | ||
const { currentUser } = storeToRefs(useUserStore()); | ||
|
||
const objectInfo: Ref<COMSObject> = ref({} as COMSObject); | ||
const isInfoLoaded: Ref<Boolean> = ref(false); | ||
const { objectList } = storeToRefs(useObjectStore()); | ||
|
||
const getObjectInfo = async (objId: string) => { | ||
const permissionsVisible: Ref<boolean> = ref(false); | ||
const permissionsObjectId: Ref<string> = ref(''); | ||
const permissionsObjectName: Ref<string> = ref(''); | ||
|
||
const getObjectInfo = (objId: string) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not suggesting we do it now, by personally i would find some code comments useful. or jsdoc or whatever. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. separate note. Does this component call the objectStore.listObjects(objId) method.. in case someone navigates straight to this page. Rather than just checking the existing objectList.value. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have a fix for that almost to go, but this ticket will merge conflict the heck out of that So would leave this and once this is merged in I'll sort it for 3049 |
||
try { | ||
objectInfo.value = (objectList.value.find((x: COMSObject) => x.id === objId) as COMSObject); | ||
isInfoLoaded.value = true; | ||
|
@@ -29,32 +46,88 @@ const getObjectInfo = async (objId: string) => { | |
} | ||
}; | ||
|
||
const showPermissions = async (objectId: string, objectName: string) => { | ||
permissionsVisible.value = true; | ||
permissionsObjectId.value = objectId; | ||
permissionsObjectName.value = objectName; | ||
}; | ||
|
||
onMounted(() => { | ||
getObjectInfo(route.query.objId as string); | ||
}); | ||
</script> | ||
|
||
<template> | ||
<div class="flex justify-content-start"> | ||
<div class="flex col align-items-center pl-0"> | ||
<font-awesome-icon | ||
icon="fa-solid fa-circle-info" | ||
style="font-size: 2rem" | ||
/> | ||
<h1 class="pl-1 font-bold"> | ||
File details | ||
</h1> | ||
<div> | ||
<div class="flex justify-content-start"> | ||
<div class="flex col align-items-center pl-0"> | ||
<font-awesome-icon | ||
icon="fa-solid fa-circle-info" | ||
style="font-size: 2rem" | ||
/> | ||
<h1 class="pl-1 font-bold"> | ||
File details | ||
</h1> | ||
</div> | ||
<div class="action-buttons"> | ||
<Button class="p-button-lg p-button-text"> | ||
<font-awesome-icon icon="fa-solid fa-share-nodes" /> | ||
</Button> | ||
<DownloadObjectButton | ||
v-if="objectStore.isActionAllowed(objectInfo.permissions, Permissions.READ, currentUser?.userId)" | ||
:mode="ButtonMode.ICON" | ||
:ids="[objectInfo.id]" | ||
/> | ||
<Button | ||
v-if="objectStore.isActionAllowed(objectInfo.permissions, Permissions.MANAGE, currentUser?.userId)" | ||
class="p-button-lg p-button-text" | ||
@click="showPermissions(objectInfo.id, objectInfo.name)" | ||
> | ||
<font-awesome-icon icon="fa-solid fa-users" /> | ||
</Button> | ||
<DeleteObjectButton | ||
v-if="objectStore.isActionAllowed(objectInfo.permissions, Permissions.DELETE, currentUser?.userId)" | ||
:mode="ButtonMode.ICON" | ||
:ids="[objectInfo.id]" | ||
/> | ||
</div> | ||
</div> | ||
|
||
<div | ||
v-if="isInfoLoaded" | ||
class="pl-2" | ||
> | ||
<ObjectProperties :object-info="objectInfo" /> | ||
<ObjectAccess :object-info="objectInfo" /> | ||
<ObjectMetadata :object-metadata="objectInfo.metadata" /> | ||
<ObjectTag :object-tag="objectInfo.tag" /> | ||
</div> | ||
</div> | ||
<div | ||
v-if="isInfoLoaded" | ||
class="pl-2" | ||
|
||
<!-- eslint-disable vue/no-v-model-argument --> | ||
<Dialog | ||
v-model:visible="permissionsVisible" | ||
:draggable="false" | ||
:modal="true" | ||
class="permissions-modal" | ||
> | ||
<ObjectProperties :object-properties="objectInfo" /> | ||
<ObjectAccess :object-access="objectInfo" /> | ||
<ObjectMetadata :object-metadata="objectInfo.metadata" /> | ||
<ObjectTag :object-tag="objectInfo.tag" /> | ||
</div> | ||
<!-- eslint-enable vue/no-v-model-argument --> | ||
<template #header> | ||
<div class="flex"> | ||
<font-awesome-icon | ||
icon="fa-solid fa-users" | ||
class="pr-3 pt-2" | ||
style="font-size: 2rem" | ||
/> | ||
<div> | ||
<h1>Object Permissions</h1> | ||
<h3>{{ permissionsObjectName }}</h3> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<ObjectPermission :object-id="permissionsObjectId" /> | ||
</Dialog> | ||
</template> | ||
|
||
<style lang="scss" scoped> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i like the way you made GriDRow re-usable.
you might be able to make this more compact:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with you here, but unfortunately nested div's break the formatting for some reason I wasn't able to figure out.