Skip to content

Commit

Permalink
refactor: replace getCurrentInstance router access with useRouter
Browse files Browse the repository at this point in the history
  • Loading branch information
elevatebart committed Nov 29, 2024
1 parent 68e113c commit 7c0bd59
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 11 deletions.
5 changes: 3 additions & 2 deletions ui/src/components/LeftMenuLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
</script>

<script setup>
import {computed, getCurrentInstance, ref, onMounted} from "vue"
import {computed, ref, onMounted} from "vue"
import {useRouter} from "vue-router";
import EnterpriseTooltip from "./EnterpriseTooltip.vue";
const props = defineProps({
Expand All @@ -38,7 +39,7 @@
},
})
const router = getCurrentInstance().appContext.config.globalProperties.$router
const router = useRouter()
const isHyperLink = computed(() => {
return !!(!props.item.href || props.item.external || !router)
Expand Down
4 changes: 2 additions & 2 deletions ui/src/components/flows/FlowDependencies.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup>
import {ref, onMounted, inject, nextTick, getCurrentInstance} from "vue";
import {useRoute} from "vue-router";
import {useRoute, useRouter} from "vue-router";
import {VueFlow, useVueFlow, Position, MarkerType} from "@vue-flow/core"
import {Controls, ControlButton} from "@vue-flow/controls"
import {Background} from "@vue-flow/background";
Expand All @@ -19,7 +19,7 @@
const route = useRoute();
const store = useStore();
const axios = inject("axios")
const router = getCurrentInstance().appContext.config.globalProperties.$router;
const router = useRouter();
const t = getCurrentInstance().appContext.config.globalProperties.$t;
const loaded = ref([]);
Expand Down
7 changes: 4 additions & 3 deletions ui/src/components/inputs/EditorView.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script setup>
import {computed, getCurrentInstance, h, nextTick, onBeforeUnmount, onMounted, ref, watch,} from "vue";
import {useStore} from "vuex";
import {useRouter} from "vue-router";
// Icons
import ContentSave from "vue-material-design-icons/ContentSave.vue";
Expand Down Expand Up @@ -31,7 +32,7 @@
import {ElMessageBox} from "element-plus";
const store = useStore();
const router = getCurrentInstance().appContext.config.globalProperties.$router;
const router = useRouter();
const emit = defineEmits(["follow", "expand-subflow"]);
const toast = getCurrentInstance().appContext.config.globalProperties.$toast();
const t = getCurrentInstance().appContext.config.globalProperties.$t;
Expand Down Expand Up @@ -1413,15 +1414,15 @@
position: fixed;
z-index: 9999;
border-right: none;
& li {
height: 30px;
padding: 16px;
font-size: var(--el-font-size-small);
color: var(--bs-gray-700);
&:hover {
color: var(--bs-secondary);
color: var(--bs-secondary);
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion ui/src/components/inputs/LowCodeEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import {getCurrentInstance, nextTick, onMounted, ref, watch} from "vue";
import {useStore} from "vuex";
import {useVueFlow} from "@vue-flow/core";
import {useRouter} from "vue-router";
import TaskEdit from "../flows/TaskEdit.vue";
import SearchField from "../layout/SearchField.vue";
Expand All @@ -22,7 +23,7 @@
import Markdown from "../layout/Markdown.vue";
import Editor from "./Editor.vue";
const router = getCurrentInstance().appContext.config.globalProperties.$router;
const router = useRouter();
const vueflowId = ref(Math.random().toString());
// Vue flow methods to interact with Graph
Expand Down
8 changes: 5 additions & 3 deletions ui/src/components/namespace/NamespaceDependencies.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<script setup>
import {ref, onMounted, inject, nextTick, getCurrentInstance} from "vue";
import {ref, onMounted, inject, nextTick} from "vue";
import {useStore} from "vuex";
import {useRouter} from "vue-router"
import {VueFlow, useVueFlow, Position, MarkerType} from "@vue-flow/core"
import {Controls, ControlButton} from "@vue-flow/controls"
import {Background} from "@vue-flow/background";
Expand All @@ -11,12 +13,12 @@
import {linkedElements} from "../../utils/vueFlow"
import {apiUrl} from "override/utils/route";
import {useStore} from "vuex";
const {id: vueFlowId, addNodes, addEdges, getNodes, removeNodes, getEdges, removeEdges, fitView, addSelectedElements, removeSelectedNodes, removeSelectedEdges} = useVueFlow();
const axios = inject("axios")
const router = getCurrentInstance().appContext.config.globalProperties.$router;
const router = useRouter();
const store = useStore();
const loaded = ref([]);
Expand Down

0 comments on commit 7c0bd59

Please sign in to comment.