-
Notifications
You must be signed in to change notification settings - Fork 26
Add displaying of usage per month #2266
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -11,6 +11,8 @@ import { userIndicatorMapper } from "./userIndicatorMapper"; | |
import ConfirmDialog from "@/components/ConfirmDialog.vue"; | ||
import { useShowToast } from "@/composables/toast"; | ||
import ResultsCount from "@/components/ResultsCount.vue"; | ||
import { useHiddenFeature } from "./useHiddenFeature"; | ||
import { license } from "@/composables/serviceLicense"; | ||
|
||
enum NameFilterType { | ||
beginsWith = "Begins with", | ||
|
@@ -66,6 +68,9 @@ const filteredData = computed(() => { | |
}) | ||
.sort(sortItem?.comparer); | ||
}); | ||
// We can remove this hidden toggle once we have new edition licenses. | ||
const hiddenFeatureToggle = useHiddenFeature(["ArrowUp", "ArrowUp", "ArrowDown", "ArrowDown"]); | ||
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 added a hidden keys combo to turn on this feature for testing purposes |
||
const showMonthly = computed(() => license.edition === "MonthlyUsage" || hiddenFeatureToggle.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. The name of the "edition" needs to be updated once we decide. |
||
|
||
onMounted(async () => { | ||
await loadData(); | ||
|
@@ -221,7 +226,8 @@ async function save() { | |
<thead> | ||
<tr> | ||
<th scope="col">{{ props.columnTitle }}</th> | ||
<th scope="col" class="text-end formatThroughputColumn">Maximum daily throughput</th> | ||
<th v-if="showMonthly" scope="col" class="text-end formatThroughputColumn">Highest monthly throughput <i class="fa fa-info-circle text-primary" v-tippy="'In the last 12 months'" /></th> | ||
<th v-else scope="col" class="text-end formatThroughputColumn">Maximum daily throughput <i class="fa fa-info-circle text-primary" v-tippy="'In the last 12 months'" /></th> | ||
<th scope="col">Endpoint Type <i class="fa fa-info-circle text-primary" v-tippy="'Pick the most correct option'" /></th> | ||
</tr> | ||
</thead> | ||
|
@@ -233,7 +239,8 @@ async function save() { | |
<td class="col" aria-label="name"> | ||
{{ row.name }} | ||
</td> | ||
<td class="col text-end formatThroughputColumn" style="width: 250px" aria-label="maximum daily throughput">{{ row.max_daily_throughput.toLocaleString() }}</td> | ||
<td v-if="showMonthly" class="col text-end formatThroughputColumn" style="width: 250px" aria-label="maximum usage throughput">{{ row.max_monthly_throughput ? row.max_monthly_throughput.toLocaleString() : "0" }}</td> | ||
<td v-else class="col text-end formatThroughputColumn" style="width: 250px" aria-label="maximum usage throughput">{{ row.max_daily_throughput.toLocaleString() }}</td> | ||
<td class="col" style="width: 350px" aria-label="endpoint type"> | ||
<select class="form-select endpointType format-text" @change="(event) => updateIndicator(event, row.name)"> | ||
<option v-if="props.showEndpointTypePlaceholder" value="">Pick the most appropriate option</option> | ||
|
26 changes: 26 additions & 0 deletions
26
src/Frontend/src/views/throughputreport/endpoints/useHiddenFeature.ts
This file contains hidden or 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,26 @@ | ||
import { ref, watchEffect } from "vue"; | ||
|
||
const keys = ref<string[]>([]); | ||
const hiddenFeatureEnabled = ref(false); | ||
const keyHandler = (event: KeyboardEvent) => { | ||
keys.value.push(event.key); | ||
}; | ||
|
||
watchEffect((onCleanup) => { | ||
if (keys.value.length > 0) { | ||
const timeout = window.setTimeout(() => keys.value.splice(0), 5000); | ||
onCleanup(() => clearTimeout(timeout)); | ||
} | ||
}); | ||
|
||
window.document.addEventListener("keydown", keyHandler); | ||
|
||
export function useHiddenFeature(keyCombo: string[]) { | ||
watchEffect(() => { | ||
if (keys.value.toString() === keyCombo.toString()) { | ||
hiddenFeatureEnabled.value = true; | ||
} | ||
}); | ||
|
||
return hiddenFeatureEnabled; | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 have decided to refactor this type to be a class so we can reference its data directly.
The previous implementation was not giving the correct result.