Skip to content

Commit

Permalink
feat: Small tweaks before GRITS (#130)
Browse files Browse the repository at this point in the history
Co-authored-by: Evan Strat <[email protected]>
  • Loading branch information
evan10s and evan10s authored Oct 16, 2024
1 parent aa522b8 commit 86acb20
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 21 deletions.
12 changes: 6 additions & 6 deletions .github/ISSUE_TEMPLATE/1-auto_rename.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ body:
attributes:
label: Association problem type
options:
- Select a value...
- Strong association to the wrong match
- Association status unexpectedly weak
- Association was expected but not made
- Something else (describe in Additional Information)
validations:
required: true
- type: input
attributes:
label: Video file path
description: Relative path of the video file (within the videos directory) that was incorrectly associated. If multiple related instances, add more details in the Additional Information section below
validations:
required: false
required: true
- type: input
attributes:
label: Expected match key
Expand All @@ -28,13 +29,13 @@ body:
label: Actual associated match key
description: The full match key (e.g., 2024gadal_qm1) of the match that Auto Rename associated with the video file. Enter N/A if no association was made, but you were expecting one.
validations:
required: false
required: true
- type: dropdown
attributes:
label: Association status
description: The full match key (e.g., 2024gadal_qm1) of the match that Auto Rename associated with the video file. Enter N/A if no association was made, but you were expecting one.
description: The full match key (e.g., 2024gadal_qm1) of the match that Auto Rename associated with the video file.
options:
- Select a value...
- N/A (No association created)
- Unmatched
- Strong
- Weak
Expand All @@ -57,7 +58,6 @@ body:
attributes:
label: Are you running Match Uploader using the official Docker Compose setup?
options:
- Select a value...
- "Yes"
- "No"
validations:
Expand Down
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/2-bug.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ body:
attributes:
label: Are you running Match Uploader using the official Docker Compose setup?
options:
- Select a value...
- "Yes"
- "No"
validations:
Expand All @@ -34,6 +33,8 @@ body:
- YouTube integration
- The Blue Alliance integration
- FRC Events integration
validations:
required: true
- type: textarea
attributes:
label: Relevant error or log output
Expand Down
3 changes: 3 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<-- Describe your change below, leaving the checkbox at the bottom -->

- [ ] Make sure you prefix your PR title (instructions https://github.com/gafirst/match-uploader/blob/main/README.md#releases) to trigger a release after you merge this PR
2 changes: 2 additions & 0 deletions client/src/components/matches/MatchMetadata.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<VSwitch v-model="matchStore.isReplay"
color="primary"
label="Replay"
:loading="matchStore.descriptionLoading || matchStore.matchVideosLoading"
:disabled="matchStore.descriptionLoading || matchStore.matchVideosLoading"
inset
/>
</div>
Expand Down
68 changes: 59 additions & 9 deletions client/src/components/nav/NavDrawer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<VBadge v-if="item.badge?.show"
:color="item.badge.color"
:content="item.badge.content"
:dot="item.badge.dot"
>
<VIcon :icon="item.icon" />
</VBadge>
Expand All @@ -33,30 +34,79 @@ import {useWorkerStore} from "@/stores/worker";
import {WorkerJobStatus} from "@/types/WorkerJob";
import { useAutoRenameStore } from "@/stores/autoRename";
import { AutoRenameAssociationStatus } from "@/types/autoRename/AutoRenameAssociationStatus";
import { useLiveModeStore } from "@/stores/liveMode";
import { LiveModeStatus } from "@/types/liveMode/LiveModeStatus";
import { useSettingsStore } from "@/stores/settings";
const workerStore = useWorkerStore();
const autoRenameStore = useAutoRenameStore();
const liveModeStore = useLiveModeStore();
const settingsStore = useSettingsStore();
autoRenameStore.getAssociations();
const liveModeDotColor = computed(() => {
if (!liveModeStore.isActive) {
return "";
}
if ([LiveModeStatus.ERROR, LiveModeStatus.STOPPED].includes(liveModeStore.state)) {
return "error";
}
if (liveModeStore.state === LiveModeStatus.WAITING && liveModeStore.error) {
return "error";
}
if (liveModeStore.missingPlaylistLabels.length > 0) {
return "warning";
}
return "success";
});
const autoRenameBadge = computed(() => {
const numAssociationsToReview = autoRenameStore.associationsInStatus(
[AutoRenameAssociationStatus.WEAK, AutoRenameAssociationStatus.FAILED],
).length;
if (numAssociationsToReview > 0) {
return {
show: true,
color: "warning",
content: numAssociationsToReview,
};
}
if (!settingsStore.isFirstLoad && settingsStore.settings.autoRenameEnabled) {
return {
show: true,
color: "success",
dot: true,
};
}
return {
show: false,
};
});
const navItems = computed(() => {
return [
{
title: "Upload",
to: "/upload",
icon: "mdi-cloud-upload-outline",
badge: {
show: liveModeStore.isActive,
color: liveModeDotColor.value,
dot: true,
},
},
{
title: "Auto rename",
to: "/autoRename",
icon: "mdi-auto-mode",
badge: {
show: autoRenameStore.associationsInStatus(
[AutoRenameAssociationStatus.WEAK, AutoRenameAssociationStatus.FAILED],
).length > 0,
color: "warning",
content: autoRenameStore.associationsInStatus(
[AutoRenameAssociationStatus.WEAK, AutoRenameAssociationStatus.FAILED],
).length,
},
badge: autoRenameBadge.value,
},
{
title: "Worker queue",
Expand Down
5 changes: 3 additions & 2 deletions client/src/stores/match.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,8 @@ export const useMatchStore = defineStore("match", () => {

descriptionLoading.value = true;
descriptionFetchError.value = "";

const result = await fetch(`/api/v1/matches/${selectedMatchKey.value}/description`)
description.value = "";
const result = await fetch(`/api/v1/matches/${selectedMatchKey.value}/description?isReplay=${isReplay.value}`)
.catch((error) => {
descriptionFetchError.value = `Unable to retrieve description for ${selectedMatchKey.value}: ${error}`;
descriptionLoading.value = false;
Expand Down Expand Up @@ -347,6 +347,7 @@ export const useMatchStore = defineStore("match", () => {

watch(isReplay, async (value, oldValue, onCleanup) => {
await getMatchVideos();
await getSuggestedDescription();
});

return {
Expand Down
11 changes: 10 additions & 1 deletion client/src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
class="pa-3 video-preview"
>
<h3>{{ video.videoLabel ?? "Unlabeled" }}</h3>
<VAlert v-if="video.videoLabel && !playlistStore.playlistMappings[video.videoLabel.toLowerCase()]"
<VAlert v-if="isVideoMissingPlaylistMapping(video)"
density="compact"
class="mb-2"
variant="tonal"
Expand Down Expand Up @@ -84,6 +84,7 @@ import {useWorkerStore} from "@/stores/worker";
import MatchMetadata from "@/components/matches/MatchMetadata.vue";
import LiveMode from "@/components/liveMode/LiveMode.vue";
import { UPLOAD_VIDEO_TASK } from "@/types/WorkerJob";
import { MatchVideoInfo } from "@/types/MatchVideoInfo";

const error = ref("");

Expand All @@ -100,6 +101,14 @@ const videosMdColWidth = computed(() => {
}
});

function isVideoMissingPlaylistMapping(video: MatchVideoInfo) {
if (!video.videoLabel) {
return !playlistStore.playlistMappings["unlabeled"];
}

return !playlistStore.playlistMappings[video.videoLabel.toLowerCase()];
}

</script>

<style scoped>
Expand Down
7 changes: 5 additions & 2 deletions server/src/routes/matches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ matchesRouter.get(
"matchKey",
"Match key is required and must pass a format test. (See MatchKey class for regex.)",
).isString().matches(MatchKey.matchKeyRegex),
query("isReplay").default(false).isBoolean().toBoolean(),
generateDescription,
);

Expand All @@ -104,9 +105,11 @@ async function generateDescription(req: IReq, res: IRes): Promise<void> {
eventName,
playoffsType,
} = await getSettings();
const { matchKey: matchKeyRaw } = matchedData(req);

const { matchKey: matchKeyRaw, isReplay } = matchedData(req);
const matchKey = MatchKey.fromString(matchKeyRaw as string, playoffsType as PlayoffsType);
const match = new Match(matchKey);
const match = new Match(matchKey, isReplay as boolean);

res.json({
ok: true,
description: await generateMatchVideoDescription(match, eventName),
Expand Down

0 comments on commit 86acb20

Please sign in to comment.