Skip to content

Commit

Permalink
Merge pull request getslash#610 from yaelmi3/prompt_days_upon_session…
Browse files Browse the repository at this point in the history
…_discard

Prompt for number of days when discarding a session
  • Loading branch information
vmalloc authored Jul 29, 2020
2 parents 61d0f01 + a3b3725 commit aa6af6c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
13 changes: 9 additions & 4 deletions webapp/app/session/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@ export default Controller.extend({

actions: {
async discard() {
await this.get("api").call("discard_session", {
session_id: parseInt(this.get("session_model.id")),
});
await this.get("session_model").reload();
var days = parseInt(prompt("Number of days to keep session " + this.get("session_model.logical_id"), "10"), 10);
if (Number.isInteger(days))
{
await this.get("api").call("discard_session", {
session_id: parseInt(this.get("session_model.id")),
grace_period_seconds: days * 60 * 60 * 24
});
await this.get("session_model").reload();
}
},

async preserve() {
Expand Down
17 changes: 8 additions & 9 deletions webapp/app/sessions/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,15 @@ export default Controller.extend(StatusFilterableController, SearchController, {

actions: {
async discard_results() {
if (
!window.confirm(
"This will mark all search results for future deletion. Are you sure?"
)
) {
return;
var days = parseInt(prompt("This will mark all search results for future deletion."
+ "\n" + "Please provide number of days to keep sessions"), 10);
if (Number.isInteger(days))
{
await this.get("api").call("discard_sessions_search", {
search_string: this.get("search"),
grace_period_seconds: days * 60 * 60 * 24
});
}
await this.get("api").call("discard_sessions_search", {
search_string: this.get("search"),
});
},
},
});

0 comments on commit aa6af6c

Please sign in to comment.