-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from simonsobs/queue
Add Queue
- Loading branch information
Showing
51 changed files
with
1,504 additions
and
210 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { computed } from "vue"; | ||
import type { ComputedRef } from "vue"; | ||
import { | ||
useQScheduleAutoModeModeQuery, | ||
useScheduleAutoModeModeSubscription, | ||
} from "@/graphql/codegen/generated"; | ||
|
||
// type AutoMode = "off" | "scheduler" | "queue"; | ||
|
||
interface _ScheduleAutoModeModeSubscription { | ||
autoModeMode: ComputedRef<string | undefined>; | ||
error: ComputedRef<Error | undefined>; | ||
subscription: ReturnType<typeof useScheduleAutoModeModeSubscription>; | ||
query: ReturnType<typeof useQScheduleAutoModeModeQuery>; | ||
} | ||
|
||
type ScheduleAutoModeModeSubscription = _ScheduleAutoModeModeSubscription & | ||
PromiseLike<_ScheduleAutoModeModeSubscription>; | ||
|
||
export function useSubscribeScheduleAutoModeMode(): ScheduleAutoModeModeSubscription { | ||
const query = useQScheduleAutoModeModeQuery({ requestPolicy: "network-only" }); | ||
const subscription = useScheduleAutoModeModeSubscription(); | ||
|
||
const error = computed(() => subscription.error?.value || query.error?.value); | ||
|
||
const autoModeMode = computed(() => | ||
error.value | ||
? undefined | ||
: subscription.data?.value?.scheduleAutoModeMode || | ||
query.data?.value?.schedule.autoMode.mode | ||
); | ||
|
||
const ret = { autoModeMode, error, subscription, query }; | ||
|
||
return { | ||
...ret, | ||
async then(onFulfilled, onRejected) { | ||
await query; | ||
return Promise.resolve(ret).then(onFulfilled, onRejected); | ||
}, | ||
}; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { computed } from "vue"; | ||
import type { ComputedRef } from "vue"; | ||
import { | ||
useQScheduleQueueItemsQuery, | ||
useSScheduleQueueItemsSubscription, | ||
} from "@/graphql/codegen/generated"; | ||
import type { ScheduleQueueItem } from "@/graphql/codegen/generated"; | ||
|
||
interface _ScheduleQueueItemsSubscription { | ||
items: ComputedRef<ScheduleQueueItem[] | undefined>; | ||
loading: ComputedRef<boolean>; | ||
error: ComputedRef<Error | undefined>; | ||
subscription: ReturnType<typeof useSScheduleQueueItemsSubscription>; | ||
query: ReturnType<typeof useQScheduleQueueItemsQuery>; | ||
} | ||
|
||
type ScheduleQueueItemsSubscription = _ScheduleQueueItemsSubscription & | ||
PromiseLike<_ScheduleQueueItemsSubscription>; | ||
|
||
export function useSubscribeScheduleQueueItems(): ScheduleQueueItemsSubscription { | ||
const query = useQScheduleQueueItemsQuery({ requestPolicy: "network-only" }); | ||
const subscription = useSScheduleQueueItemsSubscription(); | ||
|
||
const loading = computed(() => query.fetching?.value); | ||
const error = computed(() => subscription.error?.value || query.error?.value); | ||
|
||
const items = computed(() => | ||
error.value | ||
? undefined | ||
: subscription.data?.value?.scheduleQueueItems || | ||
query.data?.value?.schedule.queue.items | ||
); | ||
|
||
const ret = { items, loading, error, subscription, query }; | ||
|
||
return { | ||
...ret, | ||
async then(onFulfilled, onRejected) { | ||
await query; | ||
return Promise.resolve(ret).then(onFulfilled, onRejected); | ||
}, | ||
}; | ||
} |
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
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,17 @@ | ||
<template> | ||
<v-card-actions> | ||
<button-off v-if="mode === 'off'"></button-off> | ||
<button-scheduler v-else-if="mode === 'scheduler'"></button-scheduler> | ||
<button-queue v-else-if="mode === 'queue'"></button-queue> | ||
<button-error v-else></button-error> | ||
</v-card-actions> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import ButtonError from "./modes/error/Button.vue"; | ||
import ButtonOff from "./modes/off/Button.vue"; | ||
import ButtonScheduler from "./modes/scheduler/Button.vue"; | ||
import ButtonQueue from "./modes/queue/Button.vue"; | ||
import { useSubscribeScheduleAutoModeMode } from "@/api"; | ||
const { autoModeMode: mode } = await useSubscribeScheduleAutoModeMode(); | ||
</script> |
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,12 @@ | ||
<template> | ||
<v-menu> | ||
<template v-slot:activator="{ props }"> | ||
<v-btn v-bind="props" variant="tonal" color="error"> Auto Mode: Unknown </v-btn> | ||
</template> | ||
<dialog-error></dialog-error> | ||
</v-menu> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import DialogError from "./Dialog.vue"; | ||
</script> |
Oops, something went wrong.