2584 - Client consumption fixes
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
53f69ae8e5
commit
bcd5e6ea76
|
@ -24,8 +24,6 @@ module.exports = Self => {
|
||||||
const conn = Self.dataSource.connector;
|
const conn = Self.dataSource.connector;
|
||||||
const minDate = new Date();
|
const minDate = new Date();
|
||||||
minDate.setFullYear(minDate.getFullYear() - 1);
|
minDate.setFullYear(minDate.getFullYear() - 1);
|
||||||
minDate.setMonth(0);
|
|
||||||
minDate.setDate(1);
|
|
||||||
|
|
||||||
const where = {dated: {gte: minDate}};
|
const where = {dated: {gte: minDate}};
|
||||||
filter = mergeFilters(filter, {where});
|
filter = mergeFilters(filter, {where});
|
||||||
|
|
|
@ -69,12 +69,14 @@
|
||||||
<vn-date-picker
|
<vn-date-picker
|
||||||
vn-one
|
vn-one
|
||||||
label="From"
|
label="From"
|
||||||
ng-model="filter.from">
|
ng-model="filter.from"
|
||||||
|
on-change="$ctrl.onChangeDate(value)">
|
||||||
</vn-date-picker>
|
</vn-date-picker>
|
||||||
<vn-date-picker
|
<vn-date-picker
|
||||||
vn-one
|
vn-one
|
||||||
label="To"
|
label="To"
|
||||||
ng-model="filter.to">
|
ng-model="filter.to"
|
||||||
|
on-change="$ctrl.onChangeDate(value)">
|
||||||
</vn-date-picker>
|
</vn-date-picker>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal class="vn-mt-lg">
|
<vn-horizontal class="vn-mt-lg">
|
||||||
|
|
|
@ -5,16 +5,34 @@ class Controller extends SearchPanel {
|
||||||
constructor($, $element) {
|
constructor($, $element) {
|
||||||
super($, $element);
|
super($, $element);
|
||||||
|
|
||||||
this.getUpcomingCampaing();
|
this.filter = this.$.filter;
|
||||||
|
|
||||||
|
if (!this.dateParams)
|
||||||
|
this.getUpcomingCampaing();
|
||||||
|
}
|
||||||
|
|
||||||
|
get dateParams() {
|
||||||
|
if (this.$params.q) {
|
||||||
|
const params = JSON.parse(this.$params.q);
|
||||||
|
|
||||||
|
if (params.from || params.to)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
getUpcomingCampaing() {
|
getUpcomingCampaing() {
|
||||||
this.$http.get('Campaigns/upcoming').then(res => {
|
this.$http.get('Campaigns/upcoming').then(res => {
|
||||||
const filter = this.$.filter;
|
this.filter.campaign = res.data.id;
|
||||||
filter.campaign = res.data.id;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onChangeDate(value) {
|
||||||
|
if (value)
|
||||||
|
this.filter.campaign = null;
|
||||||
|
}
|
||||||
|
|
||||||
get campaignSelection() {
|
get campaignSelection() {
|
||||||
return this._campaignSelection;
|
return this._campaignSelection;
|
||||||
}
|
}
|
||||||
|
@ -22,14 +40,13 @@ class Controller extends SearchPanel {
|
||||||
set campaignSelection(value) {
|
set campaignSelection(value) {
|
||||||
this._campaignSelection = value;
|
this._campaignSelection = value;
|
||||||
|
|
||||||
if (!value) return;
|
if (value) {
|
||||||
|
const from = new Date(value.dated);
|
||||||
|
from.setDate(from.getDate() - value.scopeDays);
|
||||||
|
|
||||||
const filter = this.$.filter;
|
this.filter.to = value.dated;
|
||||||
const from = new Date(value.dated);
|
this.filter.from = from;
|
||||||
from.setDate(from.getDate() - value.scopeDays);
|
}
|
||||||
|
|
||||||
filter.to = value.dated;
|
|
||||||
filter.from = from;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,10 @@ class Controller extends Section {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.setDefaultFilter();
|
||||||
|
}
|
||||||
|
|
||||||
|
setDefaultFilter() {
|
||||||
const minDate = new Date();
|
const minDate = new Date();
|
||||||
minDate.setHours(0, 0, 0, 0);
|
minDate.setHours(0, 0, 0, 0);
|
||||||
minDate.setMonth(minDate.getMonth() - 2);
|
minDate.setMonth(minDate.getMonth() - 2);
|
||||||
|
|
Loading…
Reference in New Issue