Skip to content

Commit

Permalink
fix(ui): last issues with vue3
Browse files Browse the repository at this point in the history
  • Loading branch information
tchiotludo committed Dec 21, 2022
1 parent a4aa1f2 commit 17bd3c9
Show file tree
Hide file tree
Showing 10 changed files with 216 additions and 194 deletions.
318 changes: 164 additions & 154 deletions ui/package-lock.json

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@
},
"dependencies": {
"ansi-to-html": "^0.7.2",
"axios": "1.2.0",
"axios": "1.2.1",
"bootstrap": "^5.2.3",
"chart.js": "^4.0.1",
"chart.js": "^4.1.1",
"core-js": "^3.26.1",
"cron-parser": "^4.7.0",
"cron-validator": "^1.3.1",
"cronstrue": "^2.20.0",
"cronstrue": "^2.21.0",
"cytoscape": "3.23.0",
"cytoscape-dagre": "^2.4.0",
"cytoscape-dom-node": "^1.1.0",
"element-plus": "^2.2.25",
"cytoscape-dom-node": "^1.1.1",
"element-plus": "^2.2.27",
"humanize-duration": "^3.27.3",
"js-yaml": "^4.1.0",
"lodash": "4.17.21",
"markdown-it": "^13.0.1",
"markdown-it-anchor": "^8.6.5",
"markdown-it-anchor": "^8.6.6",
"markdown-it-mark": "^3.0.1",
"markdown-it-meta": "0.0.1",
"md5": "^2.3.0",
Expand All @@ -52,20 +52,20 @@
"@vue/cli-plugin-babel": "^5.0.8",
"@vue/cli-plugin-unit-jest": "^5.0.8",
"@vue/cli-service": "^5.0.8",
"@vue/test-utils": "^2.2.4",
"@vue/vue3-jest": "^29.2.1",
"@vue/test-utils": "^2.2.6",
"@vue/vue3-jest": "^29.2.2",
"babel-jest": "^29.3.1",
"buffer": "^6.0.3",
"eslint": "^8.28.0",
"eslint-plugin-jest": "^27.1.6",
"eslint": "^8.30.0",
"eslint-plugin-jest": "^27.1.7",
"eslint-plugin-vue": "^9.8.0",
"jest": "^29.3.1",
"jest-transform-stub": "^2.0.0",
"monaco-editor": "0.34.0",
"monaco-editor": "0.34.1",
"monaco-editor-webpack-plugin": "7.0.1",
"monaco-yaml": "4.0.0-alpha.0",
"process": "^0.11.10",
"sass": "^1.56.1",
"sass": "^1.57.1",
"sass-loader": "^13.2.0"
},
"babel": {
Expand Down
5 changes: 1 addition & 4 deletions ui/src/components/Status.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
return State.icon()[this.status];
},
type () {
return State.type()[this.status];
return State.colorClass()[this.status];
}
}
};
Expand All @@ -50,9 +50,6 @@
&.no-label {
padding: 8px;
line-height: 1;
:deep([class*=el-icon] + span) {
margin-left: 0;
}
}
}
</style>
4 changes: 2 additions & 2 deletions ui/src/components/executions/Logs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<collapse>
<el-form-item>
<el-input
:model-value="filter"
v-model="filter"
@update:model-value="onChange"
:placeholder="$t('search')"
>
Expand All @@ -14,7 +14,7 @@
</el-form-item>
<el-form-item>
<log-level-selector
:value="level"
v-model="level"
@update:model-value="onChange"
/>
</el-form-item>
Expand Down
4 changes: 2 additions & 2 deletions ui/src/components/flows/FlowRun.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</el-alert>
<el-form class="ks-horizontal" :model="inputs" ref="form">
<el-form-item
v-for="input in flow.inputs"
v-for="input in flow.inputs || []"
:key="input.id"
:label="input.name"
:required="input.required !== false"
Expand Down Expand Up @@ -98,7 +98,7 @@
};
},
mounted() {
for (const input of this.flow.inputs) {
for (const input of this.flow.inputs || []) {
this.inputs[input.name] = input.defaults;
if (input.type === "DATETIME" && input.defaults) {
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/flows/TriggerFlow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
};
},
mounted() {
if (!this.flow) {
if (!this.flow && this.flowId && this.namespace) {
this.$store
.dispatch("flow/loadFlow", {
id: this.flowId,
Expand Down
12 changes: 9 additions & 3 deletions ui/src/components/stats/StateChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
</template>

<script>
import {computed, defineComponent, ref} from "vue"
import {computed, defineComponent, ref, getCurrentInstance} from "vue";
import {useRoute, useRouter} from "vue-router"
import {BarChart} from "vue-chart-3";
import Utils from "../../utils/utils.js";
import {defaultConfig, tooltip, chartClick} from "../../utils/charts.js";
Expand Down Expand Up @@ -54,7 +55,10 @@
},
},
setup(props, {root}) {
setup(props) {
const moment = getCurrentInstance().appContext.config.globalProperties.$moment;
const route = useRoute();
const router = useRouter();
const {t} = useI18n({useScope: "global"});
let duration = t("duration")
Expand All @@ -68,7 +72,9 @@
onClick: (e, elements) => {
if (elements.length > 0 && elements[0].index !== undefined && elements[0].datasetIndex !== undefined ) {
chartClick(
root,
moment,
router,
route,
{
date: e.chart.data.labels[elements[0].index],
status: e.chart.data.datasets[elements[0].datasetIndex].label,
Expand Down
9 changes: 9 additions & 0 deletions ui/src/styles/layout/element-plus-overload.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// button
.el-button {
--el-button-disabled-border-color: var(--bs-border-color);
--el-button-hover-text-color: var(--bs-body-color);

a:hover & {
color: var(--el-button-text-color) !important;
Expand All @@ -15,6 +16,10 @@
position: relative;
top: -3px;
}

[class*=el-icon] + span:empty {
margin-left: 0;
}
}

.el-input-group__append, .el-input-group__prepend {
Expand Down Expand Up @@ -424,6 +429,10 @@ form.ks-horizontal {
--el-notification-border-color: var(--bs-border-color);
--el-notification-title-color: var(--bs-body-color);

.el-notification__group {
flex-grow: 2;
}

.el-notification__content {
text-align: left;
}
Expand Down
26 changes: 15 additions & 11 deletions ui/src/utils/charts.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,36 +69,40 @@ export function defaultConfig(override) {
}, override);
}

export function chartClick(self, event) {
export function chartClick(moment, router, route, event) {
const query = {};

if (event.date) {
query.start = self.$moment(event.date).toISOString(true);
query.end = self.$moment(event.date).add(1, "d").toISOString(true);
query.start = moment(event.date).toISOString(true);
query.end = moment(event.date).add(1, "d").toISOString(true);
}

if (event.startDate) {
query.start = self.$moment(event.startDate).toISOString(true);
query.start = moment(event.startDate).toISOString(true);
}

if (event.endDate) {
query.end = self.$moment(event.endDate).toISOString(true);
query.end = moment(event.endDate).toISOString(true);
}

if (event.status) {
query.status = event.status.toUpperCase();
}

if (self.$route.query.namespace) {
query.namespace = self.$route.query.namespace;
if (event.state) {
query.state = event.state;
}

if (self.$route.query.q) {
query.q = self.$route.query.q;
if (route.query.namespace) {
query.namespace = route.query.namespace;
}

if (route.query.q) {
query.q = route.query.q;
}

if (event.namespace && event.flowId) {
self.$router.push({
router.push({
name: "flows/update",
params: {
namespace: event.namespace,
Expand All @@ -113,7 +117,7 @@ export function chartClick(self, event) {
query.namespace = event.namespace;
}

self.$router.push({
router.push({
name: "executions/list",
params: {tab: "executions"},
query: query
Expand Down
6 changes: 1 addition & 5 deletions ui/src/utils/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const STATE = Object.freeze({
},
PAUSED: {
name: "PAUSED",
colorClass: "purple",
colorClass: "",
color: "#6d81f5",
icon: PauseCircle,
isRunning: false,
Expand Down Expand Up @@ -155,10 +155,6 @@ export default class State {
return _mapValues(STATE, state => state.colorClass);
}

static type() {
return _mapValues(STATE, state => state.colorClass);
}

static color() {
return _mapValues(STATE, state => state.color);
}
Expand Down

0 comments on commit 17bd3c9

Please sign in to comment.