Skip to content

Commit

Permalink
Rename GraphQL queries
Browse files Browse the repository at this point in the history
  • Loading branch information
TaiSakuma committed May 23, 2024
1 parent e9372d3 commit 18f684b
Show file tree
Hide file tree
Showing 42 changed files with 236 additions and 232 deletions.
12 changes: 6 additions & 6 deletions src/api/use-continuous-enabled-subscription.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import { computed } from "vue";
import type { ComputedRef } from "vue";
import {
useQContinuousEnabledQuery,
useContinuousEnabledSubscription,
useCtrlContinuousEnabledQuery,
useCtrlContinuousEnabledSSubscription,
} from "@/graphql/codegen/generated";

interface _ContinuousEnabledSubscription {
continuousEnabled: ComputedRef<boolean | undefined>;
error: ComputedRef<Error | undefined>;
subscription: ReturnType<typeof useContinuousEnabledSubscription>;
query: ReturnType<typeof useQContinuousEnabledQuery>;
subscription: ReturnType<typeof useCtrlContinuousEnabledSSubscription>;
query: ReturnType<typeof useCtrlContinuousEnabledQuery>;
}

type ContinuousEnabledSubscription = _ContinuousEnabledSubscription &
PromiseLike<_ContinuousEnabledSubscription>;

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

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

Expand Down
10 changes: 5 additions & 5 deletions src/api/use-run-no-subscription.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { computed } from "vue";
import type { ComputedRef } from "vue";
import { useQRunNoQuery, useRunNoSubscription } from "@/graphql/codegen/generated";
import { useCtrlRunNoQuery, useCtrlRunNoSSubscription } from "@/graphql/codegen/generated";

interface _RunNoSubscription {
runNo: ComputedRef<number | undefined>;
error: ComputedRef<Error | undefined>;
subscription: ReturnType<typeof useRunNoSubscription>;
query: ReturnType<typeof useQRunNoQuery>;
subscription: ReturnType<typeof useCtrlRunNoSSubscription>;
query: ReturnType<typeof useCtrlRunNoQuery>;
}

type RunNoSubscription = _RunNoSubscription & PromiseLike<_RunNoSubscription>;

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

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

Expand Down
10 changes: 5 additions & 5 deletions src/api/use-state-subscription.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { computed } from "vue";
import type { ComputedRef } from "vue";
import { useQStateQuery, useStateSubscription } from "@/graphql/codegen/generated";
import { useCtrlStateQuery, useCtrlStateSSubscription } from "@/graphql/codegen/generated";

interface _StateSubscription {
state: ComputedRef<string | undefined>;
error: ComputedRef<Error | undefined>;
subscription: ReturnType<typeof useStateSubscription>;
query: ReturnType<typeof useQStateQuery>;
subscription: ReturnType<typeof useCtrlStateSSubscription>;
query: ReturnType<typeof useCtrlStateQuery>;
}

type StateSubscription = _StateSubscription & PromiseLike<_StateSubscription>;

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

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

Expand Down
12 changes: 6 additions & 6 deletions src/api/use-trace_ids-subscription.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import { computed } from "vue";
import type { ComputedRef } from "vue";
import {
useQTraceIdsQuery,
useTraceIdsSubscription,
useCtrlTraceIdsQuery,
useCtrlTraceIdsSSubscription,
} from "@/graphql/codegen/generated";

interface _TraceIdsSubscription {
traceIds: ComputedRef<number[] | undefined>;
error: ComputedRef<Error | undefined>;
subscription: ReturnType<typeof useTraceIdsSubscription>;
query: ReturnType<typeof useQTraceIdsQuery>;
subscription: ReturnType<typeof useCtrlTraceIdsSSubscription>;
query: ReturnType<typeof useCtrlTraceIdsQuery>;
}

type TraceIdsSubscription = _TraceIdsSubscription & PromiseLike<_TraceIdsSubscription>;

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

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

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 @@ -10,7 +10,7 @@
<script setup lang="ts">
import { ref, watch } from "vue";
import { useExceptionQuery } from "@/graphql/codegen/generated";
import { useCtrlExceptionQuery } from "@/graphql/codegen/generated";
import { useSubscribeState } from "@/api";
Expand All @@ -30,7 +30,7 @@ const { state } = stateSubscription;
const pause = ref(true);
const query = useExceptionQuery({ pause: pause.value });
const query = useCtrlExceptionQuery({ pause: pause.value });
watch(state, (val) => {
pause.value = val !== "finished";
Expand Down
4 changes: 2 additions & 2 deletions src/components/main/console-frame/ConsoleFrame.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<script setup lang="ts">
import { ref, nextTick } from "vue";

import { useStdoutSubscription } from "@/graphql/codegen/generated";
import { useCtrlStdoutSSubscription } from "@/graphql/codegen/generated";

const handleSubscription = (
messages = { ctrlStdout: "" },
Expand All @@ -38,7 +38,7 @@ const handleSubscription = (
});
return { ctrlStdout: messages.ctrlStdout + response.ctrlStdout };
};
const subscription = useStdoutSubscription({}, handleSubscription);
const subscription = useCtrlStdoutSSubscription({}, handleSubscription);
const bottom = ref(null as HTMLElement | null);
const data = ref(subscription.data);

Expand Down
4 changes: 2 additions & 2 deletions src/components/main/run-frame/top-bar/ActionFinished.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

<script setup lang="ts">
import { useStore } from "@/plugins/pinia/stores/main";
import { useResetMutation } from "@/graphql/codegen/generated";
import { useCtrlResetMutation } from "@/graphql/codegen/generated";
import { storeToRefs } from "pinia";
const store = useStore();
const { modified: editing } = storeToRefs(store);
const { executeMutation: executeReset } = useResetMutation();
const { executeMutation: executeReset } = useCtrlResetMutation();
</script>
8 changes: 4 additions & 4 deletions src/components/main/run-frame/top-bar/ActionInitialized.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ import { storeToRefs } from "pinia";
import { useStore } from "@/plugins/pinia/stores/main";
import {
useExecMutation,
useRunAndContinueMutation,
useCtrlExecMutation,
useCtrlRunAndContinueMutation,
} from "@/graphql/codegen/generated";
import RunInterConfirmationDialog from "./RunInterConfirmationDialog.vue";
Expand All @@ -41,8 +41,8 @@ import RunConfirmationDialog from "./RunConfirmationDialog.vue";
const store = useStore();
const { modified: editing } = storeToRefs(store);
const { executeMutation: executeExec } = useExecMutation();
const { executeMutation: executeRunAndContinue } = useRunAndContinueMutation();
const { executeMutation: executeExec } = useCtrlExecMutation();
const { executeMutation: executeRunAndContinue } = useCtrlRunAndContinueMutation();
const dialogRun = ref(false);
const dialogRunInter = ref(false);
Expand Down
12 changes: 6 additions & 6 deletions src/components/main/run-frame/top-bar/ActionRunning.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@

<script setup lang="ts">
import {
useInterruptMutation,
useTerminateMutation,
useKillMutation,
useCtrlInterruptMutation,
useCtrlTerminateMutation,
useCtrlKillMutation,
} from "@/graphql/codegen/generated";
const { executeMutation: executeInterrupt } = useInterruptMutation();
const { executeMutation: executeTerminate } = useTerminateMutation();
const { executeMutation: executeKill } = useKillMutation();
const { executeMutation: executeInterrupt } = useCtrlInterruptMutation();
const { executeMutation: executeTerminate } = useCtrlTerminateMutation();
const { executeMutation: executeKill } = useCtrlKillMutation();
</script>
4 changes: 2 additions & 2 deletions src/components/main/trace-frame/TraceAction.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

<script setup lang="ts">
import { withDefaults } from "vue";
import { useSendPdbCommandMutation } from "@/graphql/codegen/generated";
import { useCtrlSendPdbCommandMutation } from "@/graphql/codegen/generated";
interface Props {
traceNo: number;
Expand All @@ -53,7 +53,7 @@ const props = withDefaults(defineProps<Props>(), {
disabled: false,
});
const { executeMutation } = useSendPdbCommandMutation();
const { executeMutation } = useCtrlSendPdbCommandMutation();
async function pdbCommand(command: string) {
await executeMutation({
Expand Down
4 changes: 2 additions & 2 deletions src/components/main/trace-frame/TraceFrame.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import { computed, ref, toRefs } from "vue";
import path from "path";
import { usePromptingSubscription } from "@/graphql/codegen/generated";
import { useCtrlPromptingSSubscription } from "@/graphql/codegen/generated";
import { useKeyboardShortcuts } from "./keyboard-shortcuts";
import TraceAction from "./TraceAction.vue";
import CodeEditor from "./code-editor/CodeEditor.vue";
Expand All @@ -53,7 +53,7 @@ const props = defineProps<Props>();
const keyboardEvent = ref<KeyboardEvent | null>(null);
const subscription = usePromptingSubscription({
const subscription = useCtrlPromptingSSubscription({
variables: { traceId: props.traceId },
});
Expand Down
4 changes: 2 additions & 2 deletions src/components/main/trace-frame/code-editor/source.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { computed } from "vue";
import type { MaybeRef } from "vue";

import { useSourceQuery } from "@/graphql/codegen/generated";
import { useCtrlSourceQuery } from "@/graphql/codegen/generated";

export async function useSource(fileName: MaybeRef<string>) {
// @ts-ignore
const query = useSourceQuery({ variables: { fileName } });
const query = useCtrlSourceQuery({ variables: { fileName } });
const sourceLines = computed(() => query.data.value?.ctrl.source);
const source = computed(() => sourceLines.value?.join("\n"));
await query;
Expand Down
4 changes: 2 additions & 2 deletions src/components/main/trace-frame/keyboard-shortcuts.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { watch, MaybeRefOrGetter, toValue } from "vue";

import { useSendPdbCommandMutation } from "@/graphql/codegen/generated";
import { useCtrlSendPdbCommandMutation } from "@/graphql/codegen/generated";

const keyboardShortcuts = new Map([
["n", "next"],
Expand All @@ -15,7 +15,7 @@ function useKeyboardShortcuts(
disabled: MaybeRefOrGetter<boolean>,
keyboardEvent: MaybeRefOrGetter<KeyboardEvent | undefined | null>
) {
const { executeMutation } = useSendPdbCommandMutation();
const { executeMutation } = useCtrlSendPdbCommandMutation();
watch(
() => toValue(keyboardEvent),
async (event) => {
Expand Down
16 changes: 8 additions & 8 deletions src/components/main/trace-frame/script-editor/source.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { ref, computed, watchEffect } from "vue";

import {
useSourceQuery,
useResetMutation,
useLoadScriptMutation,
useLoadExampleScriptMutation,
useCtrlSourceQuery,
useCtrlResetMutation,
useScheduleSchedulerLoadScriptMutation,
useCtrlLoadExampleScriptMutation,
} from "@/graphql/codegen/generated";
import { useStore } from "@/plugins/pinia/stores/main";

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

Expand All @@ -25,7 +25,7 @@ export async function useSource() {
store.setModified(modified.value);
});

const { executeMutation: executeMutationReset } = useResetMutation();
const { executeMutation: executeMutationReset } = useCtrlResetMutation();

async function save() {
await executeMutationReset({ statement: source.value });
Expand All @@ -37,15 +37,15 @@ export async function useSource() {
source.value = savedSource.value;
}

const { executeMutation: executeMutationLoad } = useLoadScriptMutation();
const { executeMutation: executeMutationLoad } = useScheduleSchedulerLoadScriptMutation();

async function load() {
await executeMutationLoad({});
query.executeQuery();
}

const { executeMutation: executeMutationLoadExample } =
useLoadExampleScriptMutation();
useCtrlLoadExampleScriptMutation();

async function loadExample() {
await executeMutationLoadExample({});
Expand Down
Loading

0 comments on commit 18f684b

Please sign in to comment.