-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#2489 - initial support for approval / justification history
- Loading branch information
rmmayo
committed
Jan 7, 2025
1 parent
6bb74e1
commit 64f6117
Showing
12 changed files
with
488 additions
and
29 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
51 changes: 51 additions & 0 deletions
51
dashboard/src/skills-display/components/skill/ApprovalEventMessage.vue
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
Copyright 2024 SkillTree | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
https://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
<script setup> | ||
import { computed, ref } from 'vue' | ||
import MarkdownText from '@/common-components/utilities/markdown/MarkdownText.vue'; | ||
const props = defineProps({ | ||
message: String, | ||
messageId: String | ||
}) | ||
const isDescriptionShowing = ref(false) | ||
const showMessageBtnLabel = computed(() => { | ||
return `${isDescriptionShowing.value ? 'Hide' : 'Show'} Message` | ||
}) | ||
const toggleShowMessage = () => { | ||
isDescriptionShowing.value = !isDescriptionShowing.value | ||
} | ||
</script> | ||
|
||
<template> | ||
<div v-if="props.message"> | ||
<SkillsButton | ||
:label="showMessageBtnLabel" | ||
:icon="isDescriptionShowing ? 'far fa-eye-slash' : 'far fa-eye'" | ||
class="skills-theme-btn" | ||
severity="info" | ||
size="small" | ||
@click="toggleShowMessage" | ||
data-cy="viewTimeline"/> | ||
<markdown-text v-if="isDescriptionShowing" :text="props.message" :instance-id="props.id" /> | ||
</div> | ||
</template> | ||
|
||
<style scoped> | ||
</style> |
88 changes: 88 additions & 0 deletions
88
dashboard/src/skills-display/components/skill/ApprovalHistory.vue
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 |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/* | ||
Copyright 2024 SkillTree | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
https://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
<script setup> | ||
import { useTimeUtils } from '@/common-components/utilities/UseTimeUtils.js' | ||
import ApprovalEventMessage from '@/skills-display/components/skill/ApprovalEventMessage.vue'; | ||
const props = defineProps({ | ||
events: { | ||
type: Array, | ||
required: true, | ||
}, | ||
}) | ||
const timeUtils = useTimeUtils() | ||
const REQUESTED = 'Approval Requested' | ||
// const PENDING = 'Pending Approval' | ||
const APPROVED = 'Approved' | ||
const REJECTED = 'Rejected' | ||
const AWAITING_GRADING = "Awaiting Grading" | ||
const PASSED = "Passed" | ||
const FAILED = "Failed" | ||
const COMPLETED = "Completed" | ||
const getIconClass = (item) => { | ||
const prefix = 'fas fa-' | ||
if (item.eventStatus === REQUESTED || item.eventStatus === AWAITING_GRADING) { | ||
return `${prefix}clock`; | ||
} else if (item.eventStatus === APPROVED || item.eventStatus === PASSED || item.eventStatus === COMPLETED) { | ||
return `${prefix}check`; | ||
} else if (item.eventStatus === REJECTED || item.eventStatus === FAILED) { | ||
return `${prefix}times`; | ||
} | ||
return 'fas fa-question' | ||
} | ||
const getIconBackground = (item) => { | ||
const prefix = 'bg-' | ||
if (item.eventStatus === REQUESTED || item.eventStatus === AWAITING_GRADING) { | ||
return `${prefix}yellow-500`; | ||
} else if (item.eventStatus === APPROVED || item.eventStatus === PASSED || item.eventStatus === COMPLETED) { | ||
return `${prefix}green-500`; | ||
} else if (item.eventStatus === REJECTED || item.eventStatus === FAILED) { | ||
return `${prefix}red-500`; | ||
} | ||
return 'bg-gray-500' | ||
} | ||
</script> | ||
|
||
<template> | ||
<div class="pt-2"> | ||
<Timeline :pt="{ opposite: { class: 'p-0 flex-none' } }" :value="props.events" align="left" data-cy="approvalHistoryTimeline"> | ||
<template #marker="slotProps"> | ||
<span class="flex w-2rem h-2rem align-items-center justify-content-center text-white border-circle z-1 shadow-1" :class="getIconBackground(slotProps.item)"> | ||
<i :class="getIconClass(slotProps.item)"></i> | ||
</span> | ||
</template> | ||
<template #content="slotProps"> | ||
<div class="py-2"> | ||
<span class="font-bold">{{ slotProps.item.eventStatus }}</span> | ||
<i class="fas fa-circle px-2 text-400" style="font-size: .5rem;"></i> | ||
<small class="text-muted py-2" :title="`${timeUtils.formatDate(slotProps.item.eventTime)}`">{{timeUtils.relativeTime(slotProps.item.eventTime)}}</small> | ||
</div> | ||
<div> | ||
<span class="text-muted text-sm">{{ timeUtils.formatDate(slotProps.item.eventTime) }}</span> | ||
</div> | ||
<ApprovalEventMessage class="py-2" v-if="slotProps.item.description" :message="slotProps.item.description" :messageId="slotProps.item.id" /> | ||
</template> | ||
</Timeline> | ||
</div> | ||
</template> | ||
|
||
<style> | ||
</style> |
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
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
Oops, something went wrong.