Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "name-request",
"version": "5.8.0",
"version": "5.8.1",
"private": true,
"appName": "Name Request UI",
"sbcName": "SBC Common Components",
Expand Down
63 changes: 47 additions & 16 deletions app/src/components/new-request/stats.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
nudge-left="45"
content-class="bottom-tooltip wait-time-tooltip"
transition="fade-transition"
:disabled="isMobile"
:disabled="isMobile || !showPriorityTooltip"
>
<template #activator="{ on }">
<div
Expand All @@ -35,7 +35,7 @@
{{ priorityWaitTime }}
</div>
<div class="stats-unit">
Hours
Days
</div>
</div>
<div class="stats-content-inner-2">
Expand All @@ -61,7 +61,7 @@
nudge-left="45"
content-class="bottom-tooltip new-submission-wait-time-tooltip"
transition="fade-transition"
:disabled="isMobile"
:disabled="isMobile || !showRegularTooltip"
>
<template #activator="{ on }">
<div
Expand Down Expand Up @@ -111,11 +111,22 @@ export default class Stats extends Vue {

async created (): Promise<void> {
if (
/*
* Feature-flag semantics for hardcoded_*_wait_time:
* - flag > 0 : use the flag value (explicit positive wait time).
* - flag === 0 OR FF disabled: fall back to backend stats.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the FF is "disabled", it's still providing a value.

I think it makes sense for the "disabled" value to be 0. It's like that right now:
image

* - flag < 0 : flag indicates the wait time is disabled.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the word "disabled" here again is confusing.

How about saying "flag indicates API value should be used"?

*/
GetFeatureFlag('hardcoded_regular_wait_time') === 0 ||
GetFeatureFlag('hardcoded_priority_wait_time') === 0
) {
const stats = await NamexServices.fetchStats()
if (stats) this.setStats(stats)
try {
const stats = await NamexServices.fetchStats()
console.info('[stats] fetched stats', stats)
if (stats) this.setStats(stats)
} catch (error) {
console.error('Error fetching stats:', error)
}
}
}

Expand All @@ -125,22 +136,42 @@ export default class Stats extends Vue {

/** The regular wait time, in days. */
get regularWaitTime (): string | number {
const regularWaitTime = GetFeatureFlag('hardcoded_regular_wait_time')
if (regularWaitTime > 0) {
return regularWaitTime
} else {
return (this.getStats?.regular_wait_time ?? '-')
const flagVal = GetFeatureFlag('hardcoded_regular_wait_time')

if (flagVal > 0) return flagVal
if (flagVal < 0) return '-'

const statVal = this.getStats?.regular_wait_time
if (statVal > 0) {
return statVal
}

return '-'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is simple and effective now 👍

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: do we ever want to display "0" on the page? The current code doesn't support that.

}

/** The priority wait time, in hours. */
/** The priority wait time, in days. */
get priorityWaitTime (): string | number {
const priorityWaitTime = GetFeatureFlag('hardcoded_priority_wait_time')
if (priorityWaitTime > 0) {
return priorityWaitTime
} else {
return (this.getStats?.priority_wait_time ?? '-')
const flagVal = GetFeatureFlag('hardcoded_priority_wait_time')

if (flagVal > 0) return flagVal
if (flagVal < 0) return '-'

const statVal = this.getStats?.priority_wait_time
if (statVal > 0) {
return statVal
}

return '-'
}

get showRegularTooltip (): boolean {
const val = Number(this.regularWaitTime)
return Number.isFinite(val) && val > 0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you don't need all the checks here... This works:

image

But, if you want to keep this, I'm OK with it.

}

get showPriorityTooltip (): boolean {
const val = Number(this.priorityWaitTime)
return Number.isFinite(val) && val > 0
}
}
</script>
Expand Down
Loading