Skip to content

Commit

Permalink
Merge pull request #613 from Gencaster/linter-force-vue-component-order
Browse files Browse the repository at this point in the history
force vue component tags order
  • Loading branch information
capital-G authored Oct 5, 2023
2 parents fa0c6a4 + 6d69742 commit 5bc215c
Show file tree
Hide file tree
Showing 20 changed files with 526 additions and 533 deletions.
7 changes: 4 additions & 3 deletions caster-editor/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@ module.exports = {
"no-console": "off",
"no-alert": "off",
"semi": ['error', 'always'],
"vue/component-tags-order": ["error", {
"order": [ [ "script", "template" ], "style" ],
}],
"vue/multi-word-component-names": "off",
"vue/no-v-model-argument": "off",
"vue/no-mutating-props": "off",
"comma-dangle": ["error", {
"arrays": "always-multiline",
"objects": "always-multiline",
"imports": "always-multiline",
"exports": "always-multiline",
"functions": "always-multiline",
}],
"vue/component-tags-order": ["error", {
"order": [ "script", "template", "style" ],
}],
},
};
54 changes: 27 additions & 27 deletions caster-editor/src/components/DialogDeleteNode.vue
Original file line number Diff line number Diff line change
@@ -1,30 +1,3 @@
<template>
<div>
<ElDialog
v-model="showDialog"
title="Careful"
center
lock-scroll
:show-close="false"
align-center
>
<span> Are you sure to delete Node "{{ node.name }}"? </span>
<template #footer>
<span class="dialog-footer">
<ElButton
type="info"
@click="emit('cancel')"
>Cancel</ElButton>
<ElButton
type="danger"
@click="deleteNode()"
> Delete Node </ElButton>
</span>
</template>
</ElDialog>
</div>
</template>

<script setup lang="ts">
import { ref, type Ref } from "vue";
import { type Node, useDeleteNodeMutation } from "@/graphql";
Expand Down Expand Up @@ -55,3 +28,30 @@ const deleteNode = async () => {
}
};
</script>

<template>
<div>
<ElDialog
v-model="showDialog"
title="Careful"
center
lock-scroll
:show-close="false"
align-center
>
<span> Are you sure to delete Node "{{ node.name }}"? </span>
<template #footer>
<span class="dialog-footer">
<ElButton
type="info"
@click="emit('cancel')"
>Cancel</ElButton>
<ElButton
type="danger"
@click="deleteNode()"
> Delete Node </ElButton>
</span>
</template>
</ElDialog>
</div>
</template>
58 changes: 29 additions & 29 deletions caster-editor/src/components/DialogExitGraph.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
<script setup lang="ts">
import { useInterfaceStore } from "@/stores/InterfaceStore";
import { storeToRefs } from "pinia";
import { ref, type Ref } from "vue";
import { useRouter } from "vue-router";
const router = useRouter();
const emit = defineEmits<{
(e: "cancel"): void;
}>();
const interfaceStore = useInterfaceStore();
const { selectedNodeForEditorUuid, newScriptCellUpdates } =
storeToRefs(interfaceStore);
const showDialog: Ref<boolean> = ref(true);
const exitGraph = () => {
showDialog.value = false;
selectedNodeForEditorUuid.value = undefined;
interfaceStore.resetUpdates();
router.push({
path: "/graph",
});
};
</script>

<template>
<div>
<ElDialog
Expand Down Expand Up @@ -33,32 +62,3 @@
</ElDialog>
</div>
</template>

<script setup lang="ts">
import { useInterfaceStore } from "@/stores/InterfaceStore";
import { storeToRefs } from "pinia";
import { ref, type Ref } from "vue";
import { useRouter } from "vue-router";
const router = useRouter();
const emit = defineEmits<{
(e: "cancel"): void;
}>();
const interfaceStore = useInterfaceStore();
const { selectedNodeForEditorUuid, newScriptCellUpdates } =
storeToRefs(interfaceStore);
const showDialog: Ref<boolean> = ref(true);
const exitGraph = () => {
showDialog.value = false;
selectedNodeForEditorUuid.value = undefined;
interfaceStore.resetUpdates();
router.push({
path: "/graph",
});
};
</script>
26 changes: 13 additions & 13 deletions caster-editor/src/components/DialogExitNode.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
<script setup lang="ts">
import { ref, type Ref } from "vue";
import { ElDialog } from "element-plus";
const emit = defineEmits<{
(e: "noSave"): void;
(e: "save"): void;
(e: "cancel"): void;
}>();
const showDialog: Ref<boolean> = ref(true);
</script>

<template>
<div>
<ElDialog
Expand Down Expand Up @@ -35,16 +48,3 @@
</ElDialog>
</div>
</template>

<script setup lang="ts">
import { ref, type Ref } from "vue";
import { ElDialog } from "element-plus";
const emit = defineEmits<{
(e: "noSave"): void;
(e: "save"): void;
(e: "cancel"): void;
}>();
const showDialog: Ref<boolean> = ref(true);
</script>
60 changes: 30 additions & 30 deletions caster-editor/src/components/DialogRenameNode.vue
Original file line number Diff line number Diff line change
@@ -1,33 +1,3 @@
<template>
<div class="rename-node-dialog">
<ElDialog
v-model="showDialog"
title="Rename Node"
:show-close="false"
:close-on-click-modal="false"
:close-on-press-escape="false"
align-center
>
<ElInput
v-model="newName"
placeholder="Please input"
/>
<template #footer>
<span class="dialog-footer">
<ElButton
type="danger"
@click="emit('cancel')"
>Cancel</ElButton>
<ElButton
type="primary"
@click="renameNode()"
> Confirm </ElButton>
</span>
</template>
</ElDialog>
</div>
</template>

<script setup lang="ts">
import { type Node, useUpdateNodeMutation } from "@/graphql";
import { ref, type Ref } from "vue";
Expand Down Expand Up @@ -60,3 +30,33 @@ const renameNode = async () => {
emit("renamed");
};
</script>

<template>
<div class="rename-node-dialog">
<ElDialog
v-model="showDialog"
title="Rename Node"
:show-close="false"
:close-on-click-modal="false"
:close-on-press-escape="false"
align-center
>
<ElInput
v-model="newName"
placeholder="Please input"
/>
<template #footer>
<span class="dialog-footer">
<ElButton
type="danger"
@click="emit('cancel')"
>Cancel</ElButton>
<ElButton
type="primary"
@click="renameNode()"
> Confirm </ElButton>
</span>
</template>
</ElDialog>
</div>
</template>
76 changes: 38 additions & 38 deletions caster-editor/src/components/DialogUpdateAudioFile.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
<script setup lang="ts">
import { type AudioFile, useUpdateAudioFileMutation } from "@/graphql";
import { ElMessage, ElForm, ElFormItem } from "element-plus";
import { ref, type Ref } from "vue";
export type AudioFileRename = Pick<AudioFile, "uuid" | "name" | "description">;
const emit = defineEmits<{
(e: "updated"): void;
(e: "cancel"): void;
}>();
const props = defineProps<{
audioFile: AudioFileRename;
}>();
const showDialog: Ref<boolean> = ref(true);
const newName: Ref<string> = ref(props.audioFile.name);
const newDescription: Ref<string> = ref(props.audioFile.description);
const updateAudioFileMutation = useUpdateAudioFileMutation();
const update = async () => {
const { error } = await updateAudioFileMutation.executeMutation({
uuid: props.audioFile.uuid,
updateAudioFile: {
description: newDescription.value,
name: newName.value,
},
});
if (error) {
ElMessage.error(`Could not rename audio file: ${error.message}`);
return;
}
emit("updated");
};
</script>

<template>
<div class="update-audio-file-dialog">
<ElDialog
Expand Down Expand Up @@ -37,41 +75,3 @@
</ElDialog>
</div>
</template>

<script setup lang="ts">
import { type AudioFile, useUpdateAudioFileMutation } from "@/graphql";
import { ElMessage, ElForm, ElFormItem } from "element-plus";
import { ref, type Ref } from "vue";
export type AudioFileRename = Pick<AudioFile, "uuid" | "name" | "description">;
const emit = defineEmits<{
(e: "updated"): void;
(e: "cancel"): void;
}>();
const props = defineProps<{
audioFile: AudioFileRename;
}>();
const showDialog: Ref<boolean> = ref(true);
const newName: Ref<string> = ref(props.audioFile.name);
const newDescription: Ref<string> = ref(props.audioFile.description);
const updateAudioFileMutation = useUpdateAudioFileMutation();
const update = async () => {
const { error } = await updateAudioFileMutation.executeMutation({
uuid: props.audioFile.uuid,
updateAudioFile: {
description: newDescription.value,
name: newName.value,
},
});
if (error) {
ElMessage.error(`Could not rename audio file: ${error.message}`);
return;
}
emit("updated");
};
</script>
28 changes: 14 additions & 14 deletions caster-editor/src/components/GraphsList.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
<script lang="ts" setup>
import type { Graph } from "@/graphql";
import AddGraph from "@/components/DialogAddGraph.vue";
import { ref, type Ref } from "vue";
export type GraphListType = Pick<Graph, "name" | "uuid">;
defineProps<{
graphs: GraphListType[];
}>();
const createGraphDialogVisible: Ref<boolean> = ref(false);
</script>

<template>
<div>
<h1>Select one of your Graphs</h1>
Expand Down Expand Up @@ -42,20 +56,6 @@
</div>
</template>

<script lang="ts" setup>
import type { Graph } from "@/graphql";
import AddGraph from "@/components/DialogAddGraph.vue";
import { ref, type Ref } from "vue";
export type GraphListType = Pick<Graph, "name" | "uuid">;
defineProps<{
graphs: GraphListType[];
}>();
const createGraphDialogVisible: Ref<boolean> = ref(false);
</script>

<style lang="scss" scoped>
@import "@/assets/scss/variables.module.scss";
Expand Down
Loading

0 comments on commit 5bc215c

Please sign in to comment.