Skip to content
Open
Show file tree
Hide file tree
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
118 changes: 50 additions & 68 deletions web/server/vue-cli/src/components/DateTimePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@
:content-class="dialogClass"
width="400"
>
<template v-slot:activator="{ on }">
<template #activator="{ props }">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it a best practice to replace v-slot with a hash mark?

<v-text-field
v-bind="props"
:label="label"
:value="formattedDatetime"
:class="[ inputClass, 'pa-0', 'ma-0' ]"
:class="[inputClass, 'pa-0', 'ma-0']"
:prepend-inner-icon="prependInnerIcon"
:outlined="outlined"
:dense="dense"
:density="dense ? 'compact' : undefined"
hide-details
readonly
v-on="on"
>
<template #append>
<slot name="append" />
Expand All @@ -24,58 +23,51 @@

<v-card>
<v-card-text class="pa-0">
<v-tabs
v-model="activeTab"
fixed-tabs
>
<v-tabs v-model="activeTab" grow>
<v-tab>
<v-icon>mdi-calendar</v-icon>
</v-tab>

<v-tab
:disabled="!date"
>
<v-tab :disabled="!date">
<v-icon>mdi-clock-outline</v-icon>
</v-tab>
</v-tabs>

<v-tab-item>
<v-window v-model="activeTab">
<v-window-item>
<v-date-picker
v-model="date"
full-width
@input="activeTab = 1"
show-adjacent-months
color="primary"
@update:model-value="activeTab = 1"
/>
</v-tab-item>

<v-tab-item>
</v-window-item>
<v-window-item>
<v-time-picker
v-model="time"
full-width
use-seconds
format="24hr"
full-width
with-seconds
color="primary"
/>
</v-tab-item>
</v-tabs>
</v-window-item>
</v-window>
</v-card-text>

<v-card-actions>
<v-spacer />

<v-btn
color="grey lighten-1"
class="clear-btn"
text
@click.native="clear"
variant="text"
@click="clear"
>
Clear
</v-btn>

<v-btn
class="ok-btn"
color="green darken-1"
text
variant="text"
@click="ok"
>
Ok
OK
</v-btn>
</v-card-actions>
</v-card>
Expand All @@ -88,7 +80,7 @@ import { format, parse } from "date-fns";
export default {
name: "DateTimePicker",
props: {
value: { type: [ Date, String ], default: null },
value: { type: [Date, String], default: null },
label: { type: String, default: "" },
dateFormat: { type: String, default: "yyyy-MM-dd" },
timeFormat: { type: String, default: "HH:mm:ss" },
Expand All @@ -97,7 +89,7 @@ export default {
dialogClass: { type: String, default: null },
outlined: { type: Boolean, default: false },
dense: { type: Boolean, default: false },
prependInnerIcon: { type: String, default: null },
prependInnerIcon: { type: String, default: null }
},
data() {
return {
Expand All @@ -107,36 +99,31 @@ export default {
time: this.defaultTime
};
},

computed: {
dateTimeFormat() {
return `${this.dateFormat} ${this.timeFormat}`;
},

dateTime() {
if (this.date && this.time) {
const dt = this.date + " " + this.time;
return parse(dt, this.dateTimeFormat, new Date());
}

return null;
let hours, minutes;
[hours,minutes] = this.time.split(":");
const formatted = new Date(this.date);
formatted.setHours(parseInt(hours));
formatted.setMinutes(parseInt(minutes));
return formatted;
},

formattedDatetime() {
return this.dateTime ? format(this.dateTime, this.dateTimeFormat) : null;
}
},

watch: {
value() {
this.init();
value: {
handler() {
this.init();
},
immediate: true
}
},

mounted() {
this.init();
},

methods: {
init() {
if (!this.value) {
Expand All @@ -147,34 +134,34 @@ export default {
let initValue = null;
if (this.value instanceof Date) {
initValue = this.value;
} else if (typeof this.value === "string" ||
this.value instanceof String
) {
initValue = parse(this.value, this.dateTimeFormat, new Date());
} else if (typeof this.value === "string") {
try {
initValue = parse(this.value, this.dateTimeFormat, new Date());
} catch (e) {
initValue = null;
}
}

this.date = format(initValue, this.dateFormat);
this.time = format(initValue, this.timeFormat);
if (initValue) {
this.date = format(initValue, this.dateFormat);
this.time = format(initValue, this.timeFormat);
} else {
this.resetDateTimes();
}
},

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleting every single empty line will not make the code better but makes readability worse. Don't remove all of it but decide with the question: "Will it make the code readable?".

clear() {
this.reset();
this.resetDateTimes();

this.$emit("input", null);
},

ok() {
this.reset();

this.$emit("input", this.dateTime);
},

reset() {
this.dialog = false;
this.activeTab = 0;
},

resetDateTimes() {
this.date = null;
this.time = this.defaultTime;
Expand All @@ -183,13 +170,8 @@ export default {
};
</script>

<style lang="scss" scoped>
::v-deep .v-picker.v-card {
<style scoped>
.v-picker {
box-shadow: none;

& > .v-picker__title {
border-radius: 0;
}
}

</style>
53 changes: 25 additions & 28 deletions web/server/vue-cli/src/components/Run/RunFilterToolbar.vue
Original file line number Diff line number Diff line change
@@ -1,36 +1,32 @@
<template>
<v-toolbar flat class="run-filter-toolbar mb-4">
<v-row>
<v-col align-self="center">
<v-col cols="12" md="2" align-self="center">
<v-text-field
:value="runName"
:model-value="runName"
class="run-name"
prepend-inner-icon="mdi-magnify"
label="Search for runs..."
single-line
hide-details
outlined
solo
flat
dense
@input="setRunName"
variant="outlined"
density="compact"
@update:model-value="setRunName"
/>
</v-col>

<v-col align-self="center">
<v-col cols="12" md="3" align-self="center">
<v-text-field
:value="runTag"
:model-value="runTag"
class="run-tag"
prepend-inner-icon="mdi-tag"
label="Filter events by tag name..."
clearable
single-line
hide-details
outlined
solo
flat
dense
@input="setRunTag"
variant="outlined"
density="compact"
@update:model-value="setRunTag"
>
<template #append>
<tooltip-help-icon>
Expand All @@ -41,15 +37,15 @@
</v-text-field>
</v-col>

<v-col align-self="center" width="50px">
<v-col cols="12" md="2" align-self="center">
<date-time-picker
:value="storedAfter"
input-class="stored-after"
dialog-class="stored-after"
label="History stored after..."
prepend-inner-icon="mdi-calendar-arrow-right"
outlined
dense
variant="outlined"
density="compact"
@input="setStoredAfter"
>
<template #append>
Expand All @@ -62,15 +58,15 @@
</date-time-picker>
</v-col>

<v-col align-self="center" cols="2">
<v-col cols="12" md="2" align-self="center">
<date-time-picker
:value="storedBefore"
input-class="stored-before"
dialog-class="stored-before"
label="History stored before..."
prepend-inner-icon="mdi-calendar-arrow-left"
outlined
dense
variant="outlined"
density="compact"
@input="setStoredBefore"
>
<template #append>
Expand All @@ -92,13 +88,13 @@
/>

<v-btn
outlined
variant="outlined"
color="primary"
class="diff-runs-btn mr-2"
:to="diffTargetRoute"
:disabled="isDiffBtnDisabled"
>
<v-icon left>
<v-icon start>
mdi-select-compare
</v-icon>
Diff
Expand Down Expand Up @@ -135,6 +131,7 @@
<script>
import _ from "lodash";
import { mapGetters, mapMutations } from "vuex";
import { useRoute } from "vue-router";
import {
SET_RUN_HISTORY_RUN_TAG,
SET_RUN_HISTORY_STORED_AFTER,
Expand Down Expand Up @@ -162,7 +159,7 @@ export default {
selectedComparedToRuns: { type: Array, required: true },
selectedComparedToTags: { type: Array, required: true }
},

computed: {
...mapGetters("run", [
"runName",
Expand All @@ -182,7 +179,7 @@ export default {
return {
name: "reports",
query: {
...this.$router.currentRoute.query,
...this.$route.query,
"run": this.selectedBaselineRuns.length
? this.selectedBaselineRuns : undefined,
"run-tag": this.selectedBaselineTags.length
Expand Down Expand Up @@ -243,19 +240,19 @@ export default {
]),

initByUrl() {
const runName = this.$router.currentRoute.query["run"];
const runName = this.$route.query["run"];
if (runName)
this.setRunName(runName);

const runTag = this.$router.currentRoute.query["run-tag"];
const runTag = this.$route.query["run-tag"];
if (runTag)
this.setRunTag(runTag);

const storedAfter = this.$router.currentRoute.query["stored-after"];
const storedAfter = this.$route.query["stored-after"];
if (storedAfter)
this.setStoredAfter(new Date(storedAfter));

const storedBefore = this.$router.currentRoute.query["stored-before"];
const storedBefore = this.$route.query["stored-before"];
if (storedBefore)
this.setStoredBefore(new Date(storedBefore));
},
Expand Down
2 changes: 1 addition & 1 deletion web/server/vue-cli/src/services/api/cc.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function extractTagWithRunName(runWithTagName) {

class CodeCheckerService extends BaseService {
constructor() {
super("CodeCheckerService", ServiceClient,"v6.61", true);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't you remove the appended 'v' from an other place too? If I'm right, by removing this too, it will get rid of the 'v' in the whole version number.

super("CodeCheckerService", ServiceClient,"6.61", true);
}

getSameReports(bugHash) {
Expand Down
Loading
Loading