FEATURE: Add links to filtered emotion view on emotion dashboard table (#953)
This commit is contained in:
parent
79021252e9
commit
6c25718a7f
|
@ -6,14 +6,18 @@
|
|||
</div>
|
||||
|
||||
<div class="cell value today-count">
|
||||
{{number this.model.todayCount}}
|
||||
<a href={{this.todayLink}}>
|
||||
{{number this.model.todayCount}}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="cell value yesterday-count {{this.model.yesterdayTrend}}"
|
||||
title={{this.model.yesterdayCountTitle}}
|
||||
>
|
||||
{{number this.model.yesterdayCount}}
|
||||
<a href={{this.yesterdayLink}}>
|
||||
{{number this.model.yesterdayCount}}
|
||||
</a>
|
||||
{{d-icon this.model.yesterdayTrendIcon}}
|
||||
</div>
|
||||
|
||||
|
@ -21,7 +25,9 @@
|
|||
class="cell value sevendays-count {{this.model.sevenDaysTrend}}"
|
||||
title={{this.model.sevenDaysCountTitle}}
|
||||
>
|
||||
{{number this.model.lastSevenDaysCount}}
|
||||
<a href={{this.lastSevenDaysLink}}>
|
||||
{{number this.model.lastSevenDaysCount}}
|
||||
</a>
|
||||
{{d-icon this.model.sevenDaysTrendIcon}}
|
||||
</div>
|
||||
|
||||
|
@ -29,7 +35,10 @@
|
|||
class="cell value thirty-days-count {{this.model.thirtyDaysTrend}}"
|
||||
title={{this.model.thirtyDaysCountTitle}}
|
||||
>
|
||||
{{number this.model.lastThirtyDaysCount}}
|
||||
|
||||
<a href={{this.lastThirtyDaysLink}}>
|
||||
{{number this.model.lastThirtyDaysCount}}
|
||||
</a>
|
||||
{{#if this.model.canDisplayTrendIcon}}
|
||||
{{d-icon this.model.thirtyDaysTrendIcon}}
|
||||
{{/if}}
|
||||
|
|
|
@ -5,23 +5,35 @@ import getURL from "discourse-common/lib/get-url";
|
|||
@classNames("admin-report-counters")
|
||||
@attributeBindings("model.description:title")
|
||||
export default class AdminReportEmotion extends Component {
|
||||
get filterURL() {
|
||||
return getURL(`/filter?q=`);
|
||||
get todayLink() {
|
||||
let date = moment().format("YYYY-MM-DD");
|
||||
return this._filterURL(date);
|
||||
}
|
||||
|
||||
get today() {
|
||||
return moment().format("YYYY-MM-DD");
|
||||
get yesterdayLink() {
|
||||
let date = moment().subtract(1, "day").format("YYYY-MM-DD");
|
||||
return this._filterURL(date);
|
||||
}
|
||||
|
||||
get yesterday() {
|
||||
return moment().subtract(1, "day").format("YYYY-MM-DD");
|
||||
get lastSevenDaysLink() {
|
||||
let date = moment().subtract(1, "week").format("YYYY-MM-DD");
|
||||
return this._filterURL(date);
|
||||
}
|
||||
|
||||
get lastWeek() {
|
||||
return moment().subtract(1, "week").format("YYYY-MM-DD");
|
||||
get lastThirtyDaysLink() {
|
||||
let date = moment().subtract(1, "month").format("YYYY-MM-DD");
|
||||
return this._filterURL(date);
|
||||
}
|
||||
|
||||
get lastMonth() {
|
||||
return moment().subtract(1, "month").format("YYYY-MM-DD");
|
||||
_baseFilter() {
|
||||
return "/filter?q=activity-after%3A";
|
||||
}
|
||||
|
||||
_model() {
|
||||
return "%20order%3A" + this.model.type;
|
||||
}
|
||||
|
||||
_filterURL(date) {
|
||||
return getURL(`${this._baseFilter()}${date}${this._model()}`);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,4 +12,14 @@ RSpec.describe "Admin dashboard", type: :system do
|
|||
|
||||
expect(page).to have_css(".section.sentiment")
|
||||
end
|
||||
|
||||
xit "displays the emotion table with links" do
|
||||
SiteSetting.ai_sentiment_enabled = true
|
||||
sign_in(admin)
|
||||
|
||||
visit "/admin"
|
||||
find(".navigation-item.sentiment").click()
|
||||
|
||||
expect(page).to have_css(".admin-report.emotion-love .cell.value.today-count a")
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue