Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit 6f444a7

Browse files
committed
reorg
1 parent 25f3ceb commit 6f444a7

File tree

1 file changed

+36
-36
lines changed

1 file changed

+36
-36
lines changed

assets/javascripts/discourse/components/admin-report-sentiment-analysis.gjs

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -41,30 +41,6 @@ export default class AdminReportSentimentAnalysis extends Component {
4141
.classList.add("active");
4242
});
4343

44-
@action
45-
async openToChart() {
46-
const queryParams = this.router.currentRoute.queryParams;
47-
if (queryParams.selectedChart) {
48-
this.selectedChart = this.transformedData.find(
49-
(data) => data.title === queryParams.selectedChart
50-
);
51-
52-
if (!this.selectedChart) {
53-
return;
54-
}
55-
this.showingSelectedChart = true;
56-
57-
try {
58-
const response = await this.postRequest();
59-
this.posts = response.posts.map((post) => Post.create(post));
60-
this.hasMorePosts = response.has_more;
61-
this.nextOffset = response.next_offset;
62-
} catch (e) {
63-
popupAjaxError(e);
64-
}
65-
}
66-
}
67-
6844
clearActiveFilters(element) {
6945
const filterButtons = element.querySelectorAll("li button");
7046
for (let button of filterButtons) {
@@ -105,18 +81,6 @@ export default class AdminReportSentimentAnalysis extends Component {
10581
}
10682
}
10783

108-
async postRequest() {
109-
return await ajax("/discourse-ai/sentiment/posts", {
110-
data: {
111-
group_by: this.currentGroupFilter,
112-
group_value: this.selectedChart?.title,
113-
start_date: this.args.model.start_date,
114-
end_date: this.args.model.end_date,
115-
offset: this.nextOffset,
116-
},
117-
});
118-
}
119-
12084
get colors() {
12185
return ["#2ecc71", "#95a5a6", "#e74c3c"];
12286
}
@@ -207,6 +171,42 @@ export default class AdminReportSentimentAnalysis extends Component {
207171
];
208172
}
209173

174+
async postRequest() {
175+
return await ajax("/discourse-ai/sentiment/posts", {
176+
data: {
177+
group_by: this.currentGroupFilter,
178+
group_value: this.selectedChart?.title,
179+
start_date: this.args.model.start_date,
180+
end_date: this.args.model.end_date,
181+
offset: this.nextOffset,
182+
},
183+
});
184+
}
185+
186+
@action
187+
async openToChart() {
188+
const queryParams = this.router.currentRoute.queryParams;
189+
if (queryParams.selectedChart) {
190+
this.selectedChart = this.transformedData.find(
191+
(data) => data.title === queryParams.selectedChart
192+
);
193+
194+
if (!this.selectedChart) {
195+
return;
196+
}
197+
this.showingSelectedChart = true;
198+
199+
try {
200+
const response = await this.postRequest();
201+
this.posts = response.posts.map((post) => Post.create(post));
202+
this.hasMorePosts = response.has_more;
203+
this.nextOffset = response.next_offset;
204+
} catch (e) {
205+
popupAjaxError(e);
206+
}
207+
}
208+
}
209+
210210
@action
211211
async showDetails(data) {
212212
if (this.selectedChart === data) {

0 commit comments

Comments
 (0)