Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui): pass flow id as parameter for dashboard #6194

Merged
merged 1 commit into from
Nov 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 47 additions & 23 deletions ui/src/components/dashboard/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@
<div class="dashboard-filters">
<KestraFilter
prefix="dashboard"
:include="['namespace', 'state', 'scope', 'relative_date', 'absolute_date']"
:include="[
'namespace',
'state',
'scope',
'relative_date',
'absolute_date',
]"
:refresh="{shown: true, callback: fetchAll}"
/>
</div>
Expand Down Expand Up @@ -75,10 +81,18 @@

<el-row>
<el-col :xs="24" :lg="props.flow ? 24 : 16">
<ExecutionsBar :data="graphData" :total="stats.total" :class="{'me-2': !props.flow}" />
<ExecutionsBar
:data="graphData"
:total="stats.total"
:class="{'me-2': !props.flow}"
/>
</el-col>
<el-col v-if="!props.flow" :xs="24" :lg="8">
<ExecutionsDoughnut :data="graphData" :total="stats.total" class="ms-2" />
<ExecutionsDoughnut
:data="graphData"
:total="stats.total"
class="ms-2"
/>
</el-col>
</el-row>

Expand Down Expand Up @@ -159,7 +173,7 @@

<script setup>
import {onBeforeMount, ref, computed, watch} from "vue";
import {useRoute} from "vue-router";
import {useRoute, useRouter} from "vue-router";
import {useStore} from "vuex";
import {useI18n} from "vue-i18n";

Expand All @@ -171,7 +185,7 @@
import Header from "./components/Header.vue";
import Card from "./components/Card.vue";

import KestraFilter from "../filter/KestraFilter.vue"
import KestraFilter from "../filter/KestraFilter.vue";

import ExecutionsBar from "./components/charts/executions/Bar.vue";
import ExecutionsDoughnut from "./components/charts/executions/Doughnut.vue";
Expand All @@ -193,7 +207,7 @@
import action from "../../models/action.js";
// import {storageKeys} from "../../utils/constants";

// const router = useRouter();
const router = useRouter();
const route = useRoute();
const store = useStore();
const {t} = useI18n({useScope: "global"});
Expand All @@ -219,10 +233,10 @@
required: false,
default: null,
},
restoreURL:{
restoreURL: {
type: Boolean,
default: true,
}
},
});

const descriptionDialog = ref(false);
Expand Down Expand Up @@ -387,8 +401,10 @@
// };

const fetchAll = async () => {
if(!route.query.startDate || !route.query.endDate){
route.query.startDate = moment().subtract(moment.duration("PT720H").as("milliseconds")).toISOString(true);
if (!route.query.startDate || !route.query.endDate) {
route.query.startDate = moment()
.subtract(moment.duration("PT720H").as("milliseconds"))
.toISOString(true);
route.query.endDate = moment().toISOString(true);
}

Expand All @@ -412,21 +428,29 @@
});

onBeforeMount(() => {
// if (!route.query.namespace && props.restoreURL) {
// router.replace({query: {...route.query, namespace: defaultNamespace}});
// filters.value.namespace = route.query.namespace || defaultNamespace;
// }
// else {
// filters.value.namespace = null
// }

// updateParams(route.query);
if (props.flowID) {
router.replace({query: {...route.query, flowId: props.flowID}});
}

// if (!route.query.namespace && props.restoreURL) {
// router.replace({query: {...route.query, namespace: defaultNamespace}});
// filters.value.namespace = route.query.namespace || defaultNamespace;
// }
// else {
// filters.value.namespace = null
// }

// updateParams(route.query);
});

watch(route, () => {
fetchAll()
}, {immediate: true, deep: true})
</script>
watch(
route,
() => {
fetchAll();
},
{immediate: true, deep: true},
);
</script>

<style lang="scss" scoped>
@import "@kestra-io/ui-libs/src/scss/variables";
Expand Down
Loading