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 minDate = new Date();
|
||||
minDate.setFullYear(minDate.getFullYear() - 1);
|
||||
minDate.setMonth(0);
|
||||
minDate.setDate(1);
|
||||
|
||||
const where = {dated: {gte: minDate}};
|
||||
filter = mergeFilters(filter, {where});
|
||||
|
|
|
@ -69,12 +69,14 @@
|
|||
<vn-date-picker
|
||||
vn-one
|
||||
label="From"
|
||||
ng-model="filter.from">
|
||||
ng-model="filter.from"
|
||||
on-change="$ctrl.onChangeDate(value)">
|
||||
</vn-date-picker>
|
||||
<vn-date-picker
|
||||
vn-one
|
||||
label="To"
|
||||
ng-model="filter.to">
|
||||
ng-model="filter.to"
|
||||
on-change="$ctrl.onChangeDate(value)">
|
||||
</vn-date-picker>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal class="vn-mt-lg">
|
||||
|
|
|
@ -5,16 +5,34 @@ class Controller extends SearchPanel {
|
|||
constructor($, $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() {
|
||||
this.$http.get('Campaigns/upcoming').then(res => {
|
||||
const filter = this.$.filter;
|
||||
filter.campaign = res.data.id;
|
||||
this.filter.campaign = res.data.id;
|
||||
});
|
||||
}
|
||||
|
||||
onChangeDate(value) {
|
||||
if (value)
|
||||
this.filter.campaign = null;
|
||||
}
|
||||
|
||||
get campaignSelection() {
|
||||
return this._campaignSelection;
|
||||
}
|
||||
|
@ -22,14 +40,13 @@ class Controller extends SearchPanel {
|
|||
set 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;
|
||||
const from = new Date(value.dated);
|
||||
from.setDate(from.getDate() - value.scopeDays);
|
||||
|
||||
filter.to = value.dated;
|
||||
filter.from = from;
|
||||
this.filter.to = value.dated;
|
||||
this.filter.from = from;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,10 @@ class Controller extends Section {
|
|||
}
|
||||
};
|
||||
|
||||
this.setDefaultFilter();
|
||||
}
|
||||
|
||||
setDefaultFilter() {
|
||||
const minDate = new Date();
|
||||
minDate.setHours(0, 0, 0, 0);
|
||||
minDate.setMonth(minDate.getMonth() - 2);
|
||||
|
|
Loading…
Reference in New Issue