Skip to content

Commit

Permalink
refactor: add async loading for better performance (#6643)
Browse files Browse the repository at this point in the history
Co-authored-by: YannC <[email protected]>
  • Loading branch information
elevatebart and Skraye authored Jan 10, 2025
1 parent f8a7299 commit 8d57f8f
Show file tree
Hide file tree
Showing 84 changed files with 1,423 additions and 4,030 deletions.
2 changes: 1 addition & 1 deletion ui/.storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type {StorybookConfig} from "@storybook/vue3-vite";

const config: StorybookConfig = {
stories: [
"../@(tests|theme)/**/*.stories.@(js|jsx|mjs|ts|tsx)"
"../tests/**/*.stories.@(js|jsx|mjs|ts|tsx)"
],
addons: [
"@storybook/addon-essentials",
Expand Down
904 changes: 795 additions & 109 deletions ui/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"dependencies": {
"@js-joda/core": "^5.6.3",
"@kestra-io/ui-libs": "^0.0.83",
"@kestra-io/ui-libs": "^0.0.100",
"@vue-flow/background": "^1.3.2",
"@vue-flow/controls": "^1.1.2",
"@vue-flow/core": "^1.41.6",
Expand Down
File renamed without changes.
84 changes: 0 additions & 84 deletions ui/scripts/generate-palette.mjs

This file was deleted.

2 changes: 1 addition & 1 deletion ui/src/components/ErrorToastContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

<script>
import Slack from "vue-material-design-icons/Slack.vue";
import Markdown from "../utils/markdown";
import * as Markdown from "../utils/markdown";
export default {
props: {
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/Status.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</template>

<script>
import State from "../utils/state";
import {State} from "@kestra-io/ui-libs"
const StatusRemap = {
"failed": "error",
Expand Down
25 changes: 13 additions & 12 deletions ui/src/components/content/ApiDoc.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<rapi-doc
:spec-url="$store.getters['doc/resourceUrl']('kestra.yml')"
v-if="ready"
:spec-url="store.getters['doc/resourceUrl']('kestra.yml')"
:theme="theme"
render-style="view"
show-header="false"
Expand All @@ -14,23 +15,23 @@
</template>

<script setup lang="ts">
import "rapidoc";
</script>
import {ref} from "vue";
import {useStore} from "vuex";
const store = useStore();
const ready = ref(false)
// @ts-expect-error rapidoc is not typed
import("rapidoc").then(() => {
ready.value = true
});
<script lang="ts">
export default {
data() {
return {
theme: localStorage.getItem("theme") === "dark" ? "dark" : "light"
}
}
}
const theme = ref(localStorage.getItem("theme") === "dark" ? "dark" : "light")
</script>

<style lang="scss" scoped>
rapi-doc {
background: transparent;
width: 100%;
}
</style>
23 changes: 12 additions & 11 deletions ui/src/components/content/ApiDocee.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<rapi-doc
:spec-url="$store.getters['doc/resourceUrl']('kestra-ee.yml')"
:spec-url="store.getters['doc/resourceUrl']('kestra-ee.yml')"
:theme="theme"
render-style="view"
show-header="false"
Expand All @@ -14,17 +14,18 @@
</template>

<script setup lang="ts">
import "rapidoc";
</script>
import {ref} from "vue";
import {useStore} from "vuex";
const store = useStore();
const ready = ref(false)
// @ts-expect-error rapidoc is not typed
import("rapidoc").then(() => {
ready.value = true
});
<script lang="ts">
export default {
data() {
return {
theme: localStorage.getItem("theme") === "dark" ? "dark" : "light"
}
}
}
const theme = ref(localStorage.getItem("theme") === "dark" ? "dark" : "light")
</script>

<style lang="scss" scoped>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/dashboard/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@
import moment from "moment";
import {apiUrl} from "override/utils/route";
import State from "../../utils/state";
import {State} from "@kestra-io/ui-libs"
import Header from "./components/Header.vue";
import Card from "./components/Card.vue";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import moment from "moment";
import {useRoute} from "vue-router";
import Utils from "@kestra-io/ui-libs/src/utils/Utils";
import {Utils} from "@kestra-io/ui-libs";
const store = useStore();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import moment from "moment";
import {useRoute} from "vue-router";
import Utils from "@kestra-io/ui-libs/src/utils/Utils";
import {Utils} from "@kestra-io/ui-libs";
const store = useStore();
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/dashboard/components/charts/legend.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Utils from "../../../../utils/utils.js";
import {cssVariable} from "@kestra-io/ui-libs/src/utils/global";
import {cssVariable} from "@kestra-io/ui-libs";
import {getConsistentHEXColor} from "../../../../utils/charts.js";

const getOrCreateLegendList = (chart, id, direction = "row") => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import moment from "moment";
import {useRoute} from "vue-router";
import Utils from "@kestra-io/ui-libs/src/utils/Utils";
import {Utils} from "@kestra-io/ui-libs";
const {t} = useI18n({useScope: "global"});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
import moment from "moment";
import State from "../../../../../utils/state.js"
import {State} from "@kestra-io/ui-libs";
import Status from "../../../../Status.vue";
import NoData from "../../../../layout/NoData.vue";
Expand Down
5 changes: 2 additions & 3 deletions ui/src/components/docs/ContextDocs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,14 @@
import OpenInNew from "vue-material-design-icons/OpenInNew.vue";
import useMarkdownParser from "@kestra-io/ui-libs/src/composables/useMarkdownParser";
import MDCRenderer from "@kestra-io/ui-libs/src/components/content/MDCRenderer.vue";
import {MDCRenderer, getMDCParser} from "@kestra-io/ui-libs";
import DocsLayout from "./DocsLayout.vue";
import ContextDocsLink from "./ContextDocsLink.vue";
import ContextChildCard from "./ContextChildCard.vue";
import DocsMenu from "./ContextDocsMenu.vue";
import ContextInfoContent from "../ContextInfoContent.vue";
import ContextChildTableOfContents from "./ContextChildTableOfContents.vue";
const parse = useMarkdownParser();
const store = useStore();
const {t} = useI18n({useScope: "global"});
Expand Down Expand Up @@ -102,6 +100,7 @@
if (!("canShare" in navigator)) {
content = content.replaceAll(/\s*web-share\s*/g, "");
}
const parse = await getMDCParser()
ast.value = await parse(content);
}
</script>
Expand Down
5 changes: 2 additions & 3 deletions ui/src/components/docs/Docs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@
</template>

<script>
import useMarkdownParser from "@kestra-io/ui-libs/src/composables/useMarkdownParser";
import MDCRenderer from "@kestra-io/ui-libs/src/components/content/MDCRenderer.vue";
import {MDCRenderer, getMDCParser} from "@kestra-io/ui-libs";
import TopNavBar from "../layout/TopNavBar.vue";
import {mapGetters} from "vuex";
import DocsLayout from "./DocsLayout.vue";
import Toc from "./Toc.vue";
import {getCurrentInstance} from "vue";
const parse = useMarkdownParser();
export default {
computed: {
Expand Down Expand Up @@ -79,6 +77,7 @@
if (!("canShare" in navigator)) {
content = content.replaceAll(/\s*web-share\s*/g, "");
}
const parse = await getMDCParser();
this.ast = await parse(content);
},
immediate: true
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/executions/ChangeExecutionStatus.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
import {mapState} from "vuex";
import permission from "../../models/permission";
import action from "../../models/action";
import State from "../../utils/state";
import {State} from "@kestra-io/ui-libs"
import Status from "../../components/Status.vue";
import ExecutionUtils from "../../utils/executionUtils";
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/executions/ChangeStatus.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
import {mapState} from "vuex";
import permission from "../../models/permission";
import action from "../../models/action";
import State from "../../utils/state";
import {State} from "@kestra-io/ui-libs"
import Status from "../../components/Status.vue";
import ExecutionUtils from "../../utils/executionUtils";
import {shallowRef} from "vue";
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/executions/ExecutionRootTopBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import TopNavBar from "../layout/TopNavBar.vue";
import permission from "../../models/permission";
import action from "../../models/action";
import State from "../../utils/state";
import {State} from "@kestra-io/ui-libs"
import {apiUrl} from "override/utils/route";
import {mapState} from "vuex";
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/executions/Executions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@
import Kicon from "../Kicon.vue"
import Labels from "../layout/Labels.vue"
import RestoreUrl from "../../mixins/restoreUrl";
import State from "../../utils/state";
import {State} from "@kestra-io/ui-libs"
import Id from "../Id.vue";
import _merge from "lodash/merge";
import permission from "../../models/permission";
Expand Down
4 changes: 2 additions & 2 deletions ui/src/components/executions/ForEachStatus.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
</div>
</template>
<script>
import {cssVariable} from "@kestra-io/ui-libs/src/utils/global";
import {cssVariable} from "@kestra-io/ui-libs";
import {stateDisplayValues} from "../../utils/constants";
import State from "../../utils/state";
import {State} from "@kestra-io/ui-libs"
import throttle from "lodash/throttle"
export default {
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/executions/ForceRun.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@

<script>
import {mapState} from "vuex";
import {State} from "@kestra-io/ui-libs";
import permission from "../../models/permission";
import action from "../../models/action";
import State from "../../utils/state.js";
export default {
props: {
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/executions/Gantt.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
<script>
import TaskRunDetails from "../logs/TaskRunDetails.vue";
import {mapState} from "vuex";
import State from "../../utils/state";
import {State} from "@kestra-io/ui-libs"
import Duration from "../layout/Duration.vue";
import Utils from "../../utils/utils";
import FlowUtils from "../../utils/flowUtils";
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/executions/Kill.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import {mapState} from "vuex";
import permission from "../../models/permission";
import action from "../../models/action";
import State from "../../utils/state";
import {State} from "@kestra-io/ui-libs"
export default {
props: {
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/executions/Logs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
import {DynamicScroller, DynamicScrollerItem} from "vue-virtual-scroller";
import "vue-virtual-scroller/dist/vue-virtual-scroller.css"
import Collapse from "../layout/Collapse.vue";
import State from "../../utils/state";
import {State} from "@kestra-io/ui-libs"
import Utils from "../../utils/utils";
import LogLine from "../logs/LogLine.vue";
import Restart from "./Restart.vue";
Expand Down
Loading

0 comments on commit 8d57f8f

Please sign in to comment.