Skip to content

Commit

Permalink
chore(ui): refactor the namespace flows
Browse files Browse the repository at this point in the history
  • Loading branch information
tchiotludo committed Jan 27, 2025
1 parent 64dcc96 commit a69f8b9
Showing 1 changed file with 41 additions and 30 deletions.
71 changes: 41 additions & 30 deletions ui/src/components/namespace/NamespaceFlows.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<el-table-column
prop="state.startDate"
:label="$t('last execution date')"
v-if="user.hasAny(permission.EXECUTION)"
>
<template #default="scope">
<date-ago
Expand All @@ -51,6 +52,7 @@
<el-table-column
prop="state.current"
:label="$t('last execution status')"
v-if="user.hasAny(permission.EXECUTION)"
>
<template #default="scope">
<status
Expand All @@ -64,6 +66,7 @@
<el-table-column
prop="state"
:label="$t('execution statistics')"
v-if="user.hasAny(permission.EXECUTION)"
class-name="row-graph"
>
<template #default="scope">
Expand Down Expand Up @@ -102,6 +105,7 @@

<script>
import {mapState} from "vuex";
import permission from "../../models/permission";
import DataTable from "../layout/DataTable.vue";
import DataTableActions from "../../mixins/dataTableActions";
import MarkdownTooltip from "../layout/MarkdownTooltip.vue"
Expand All @@ -119,56 +123,63 @@
components: {DataTable, MarkdownTooltip, Labels, DateAgo, Status, StateChart, TriggerAvatar, Kicon, TextSearch},
mixins: [DataTableActions],
computed: {
...mapState("auth", ["user"]),
...mapState("flow", ["flows", "total"]),
...mapState("stat", ["dailyGroupByFlow", "lastExecutions"]),
},
data() {
return {
permission: permission,
dailyGroupByFlowReady: false,
lastExecutionByFlowReady: false
}
},
methods: {
loadQuery(base) {
loadQuery(base) {
return _merge(base, this.queryWithFilter())
},
loadData(callback) {
const params = {
namespace: this.$route.params.id,
page: this.$route.query.page || this.internalPageNumber,
page: this.$route.query.page || this.internalPageNumber,
size: this.$route.query.size || this.internalPageSize
}
this.$store.dispatch("flow/findFlows", this.loadQuery(params)).then((flows) => {
this.dailyGroupByFlowReady = false;
this.lastExecutionByFlowReady = false;
this.$store
.dispatch("flow/findFlows", this.loadQuery(params))
.then((flows) => {
this.dailyGroupByFlowReady = false;
this.lastExecutionByFlowReady = false;
if (flows.results && flows.results.length > 0) {
this.$store
.dispatch("stat/dailyGroupByFlow", {
flows: flows.results
.map(flow => {
return {namespace: flow.namespace, id: flow.id}
}),
startDate: this.$moment(this.startDate).add(-1, "day").startOf("day").toISOString(true),
endDate: this.$moment(this.endDate).endOf("day").toISOString(true)
})
.then(() => {
this.dailyGroupByFlowReady = true
})
if (flows.results && flows.results.length > 0) {
if (this.user && this.user.hasAny(permission.EXECUTION)) {
this.$store
.dispatch("stat/dailyGroupByFlow", {
flows: flows.results
.map(flow => {
return {namespace: flow.namespace, id: flow.id}
}),
startDate: this.$moment(this.startDate).add(-1, "day").startOf("day").toISOString(true),
endDate: this.$moment(this.endDate).endOf("day").toISOString(true)
})
.then(() => {
this.dailyGroupByFlowReady = true
})
this.$store
.dispatch("stat/lastExecutions", {
flows: flows.results
.map(flow => {
return {namespace: flow.namespace, id: flow.id}
}),
})
.then(() => {
this.lastExecutionByFlowReady = true
})
}
}).finally(callback);
this.$store
.dispatch("stat/lastExecutions", {
flows: flows.results
.map(flow => {
return {namespace: flow.namespace, id: flow.id}
}),
})
.then(() => {
this.lastExecutionByFlowReady = true
})
}
}
})
.finally(callback);
},
getLastExecution(row) {
let noState = {state: null, startDate: null}
Expand Down

0 comments on commit a69f8b9

Please sign in to comment.