Skip to content

Commit

Permalink
Merge pull request #45 from simonsobs/dev
Browse files Browse the repository at this point in the history
Adapt the namespace `ctrl` in GraphQL queries
  • Loading branch information
TaiSakuma authored May 15, 2024
2 parents 78daccc + 05c7434 commit 9436d91
Show file tree
Hide file tree
Showing 32 changed files with 168 additions and 102 deletions.
6 changes: 3 additions & 3 deletions src/api/use-continuous-enabled-subscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ type ContinuousEnabledSubscription = _ContinuousEnabledSubscription &

export function useSubscribeContinuousEnabled(): ContinuousEnabledSubscription {
const query = useQContinuousEnabledQuery({ requestPolicy: "network-only" });
const subscription = useContinuousEnabledSubscription();
const subscription = useContinuousEnabledSubscription({});

const error = computed(() => subscription.error?.value || query.error?.value);

const continuousEnabled = computed(() =>
error.value
? undefined
: subscription.data?.value?.continuousEnabled ||
query.data?.value?.continuousEnabled
: subscription.data?.value?.ctrlContinuousEnabled ||
query.data?.value?.ctrl.continuousEnabled
);

const ret = { continuousEnabled, error, subscription, query };
Expand Down
4 changes: 2 additions & 2 deletions src/api/use-run-no-subscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ type RunNoSubscription = _RunNoSubscription & PromiseLike<_RunNoSubscription>;

export function useSubscribeRunNo(): RunNoSubscription {
const query = useQRunNoQuery({ requestPolicy: "network-only" });
const subscription = useRunNoSubscription();
const subscription = useRunNoSubscription({});

const error = computed(() => subscription.error?.value || query.error?.value);

const runNo = computed(() =>
error.value
? undefined
: subscription.data?.value?.runNo || query.data?.value?.runNo
: subscription.data?.value?.ctrlRunNo || query.data?.value?.ctrl.runNo
);

const ret = { runNo, error, subscription, query };
Expand Down
4 changes: 2 additions & 2 deletions src/api/use-state-subscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ type StateSubscription = _StateSubscription & PromiseLike<_StateSubscription>;

export function useSubscribeState(): StateSubscription {
const query = useQStateQuery({ requestPolicy: "network-only" });
const subscription = useStateSubscription();
const subscription = useStateSubscription({});

const error = computed(() => subscription.error?.value || query.error?.value);

const state = computed(() =>
error.value
? undefined
: subscription.data?.value?.state || query.data?.value?.state
: subscription.data?.value?.ctrlState || query.data?.value?.ctrl.state
);

const ret = { state, error, subscription, query };
Expand Down
4 changes: 2 additions & 2 deletions src/api/use-trace_ids-subscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ type TraceIdsSubscription = _TraceIdsSubscription & PromiseLike<_TraceIdsSubscri

export function useSubscribeTraceIds(): TraceIdsSubscription {
const query = useQTraceIdsQuery({ requestPolicy: "network-only" });
const subscription = useTraceIdsSubscription();
const subscription = useTraceIdsSubscription({});

const error = computed(() => subscription.error?.value || query.error?.value);

const traceIds = computed(() =>
error.value
? undefined
: subscription.data?.value?.traceIds || query.data?.value?.traceIds
: subscription.data?.value?.ctrlTraceIds || query.data?.value?.ctrl.traceIds
);

const ret = { traceIds, error, subscription, query };
Expand Down
4 changes: 2 additions & 2 deletions src/components/exception/Exception.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ watch(props, (val) => {
});
watch(query.data, (val) => {
alert.value = !!val?.exception;
exception.value = val?.exception;
alert.value = !!val?.ctrl.exception;
exception.value = val?.ctrl.exception;
});
watch(alert, (val) => {
Expand Down
8 changes: 4 additions & 4 deletions src/components/main/console-frame/ConsoleFrame.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</v-card-actions>
<v-card-text id="main" class="g-content py-1">
<pre
class="overflow-auto">{{ data?.stdout }}<span ref="bottom"></span></pre>
class="overflow-auto">{{ data?.ctrlStdout }}<span ref="bottom"></span></pre>
</v-card-text>
</v-card>
</v-layout>
Expand All @@ -28,15 +28,15 @@ import { ref, nextTick } from "vue";
import { useStdoutSubscription } from "@/graphql/codegen/generated";

const handleSubscription = (
messages = { stdout: "" },
response: { stdout: string }
messages = { ctrlStdout: "" },
response: { ctrlStdout: string }
) => {
nextTick(() => {
nextTick(() => {
if (bottom.value) bottom.value.scrollIntoView(false);
});
});
return { stdout: messages.stdout + response.stdout };
return { ctrlStdout: messages.ctrlStdout + response.ctrlStdout };
};
const subscription = useStdoutSubscription({}, handleSubscription);
const bottom = ref(null as HTMLElement | null);
Expand Down
2 changes: 1 addition & 1 deletion src/components/main/trace-frame/TraceFrame.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const subscription = usePromptingSubscription({
variables: { traceId: props.traceId },
});
const prompting = computed(() => subscription.data.value?.prompting);
const prompting = computed(() => subscription.data.value?.ctrlPrompting);
const basename = computed(() => {
const fileName = prompting?.value?.fileName || "";
Expand Down
2 changes: 1 addition & 1 deletion src/components/main/trace-frame/code-editor/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useSourceQuery } from "@/graphql/codegen/generated";
export async function useSource(fileName: MaybeRef<string>) {
// @ts-ignore
const query = useSourceQuery({ variables: { fileName } });
const sourceLines = computed(() => query.data.value?.source);
const sourceLines = computed(() => query.data.value?.ctrl.source);
const source = computed(() => sourceLines.value?.join("\n"));
await query;
return { source };
Expand Down
4 changes: 2 additions & 2 deletions src/components/main/trace-frame/script-editor/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import {
import { useStore } from "@/plugins/pinia/stores/main";

export async function useSource() {
const query = useSourceQuery();
const savedSourceLines = computed(() => query.data.value?.source || []);
const query = useSourceQuery({});
const savedSourceLines = computed(() => query.data.value?.ctrl.source || []);
const savedSource = computed(() => savedSourceLines.value.join("\n"));

const source = ref("");
Expand Down
Loading

0 comments on commit 9436d91

Please sign in to comment.