Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add command button to filter tasks by project #2

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/acct_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ int ACCT_MGR_OP::do_rpc(ACCT_MGR_INFO& _ami, bool _via_gui) {
//
if (ami.send_tasks_all || ami.send_tasks_active) {
mf.printf("<results>\n");
gstate.write_tasks_gui(mf, !ami.send_tasks_all);
gstate.write_tasks_gui(mf, !ami.send_tasks_all, "");
mf.printf("</results>\n");
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion client/client_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ struct CLIENT_STATE {
int parse_app_info(PROJECT*, FILE*);
int write_state_gui(MIOFILE&);
int write_file_transfers_gui(MIOFILE&);
int write_tasks_gui(MIOFILE&, bool);
int write_tasks_gui(MIOFILE&, bool, const std::string&);
void sort_results();
void sort_projects_by_name();

Expand Down
14 changes: 12 additions & 2 deletions client/cs_statefile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1047,15 +1047,25 @@ int CLIENT_STATE::write_state_gui(MIOFILE& f) {
return 0;
}

int CLIENT_STATE::write_tasks_gui(MIOFILE& f, bool active_only) {
int CLIENT_STATE::write_tasks_gui(MIOFILE& f, bool active_only, const std::string& project_name) {
unsigned int i;

if (active_only) {
for (i=0; i<active_tasks.active_tasks.size(); i++) {
RESULT* rp = active_tasks.active_tasks[i]->result;
rp->write_gui(f);
}
} else {
}
else if (!project_name.empty()) {
for (i=0; i<results.size(); i++) {
RESULT *rp = results[i];

if (!project_name.compare(results[i]->project->get_project_name())) {
rp->write_gui(f);
}
}
}
else {
for (i=0; i<results.size(); i++) {
RESULT* rp = results[i];
rp->write_gui(f);
Expand Down
9 changes: 6 additions & 3 deletions client/gui_rpc_server_ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ static void handle_get_simple_gui_info(GUI_RPC_CONN& grc) {
PROJECT* p = gstate.projects[i];
p->write_state(grc.mfout, true);
}
gstate.write_tasks_gui(grc.mfout, true);
gstate.write_tasks_gui(grc.mfout, true, "");
grc.mfout.printf("</simple_gui_info>\n");
}

Expand Down Expand Up @@ -1286,11 +1286,14 @@ static void handle_get_old_results(GUI_RPC_CONN& grc) {

static void handle_get_results(GUI_RPC_CONN& grc) {
bool active_only = false;
std::string project_name = "";

while (!grc.xp.get_tag()) {
if (grc.xp.parse_bool("active_only", active_only)) continue;
if (grc.xp.parse_bool("active_only", active_only)
&& grc.xp.parse_string("project_name", project_name)) continue;
}
grc.mfout.printf("<results>\n");
gstate.write_tasks_gui(grc.mfout, active_only);
gstate.write_tasks_gui(grc.mfout, active_only, project_name);
grc.mfout.printf("</results>\n");
}

Expand Down
1 change: 1 addition & 0 deletions clientgui/Events.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
#define ID_TASK_WORK_ABORT 9203
#define ID_TASK_SHOW_PROPERTIES 9204
#define ID_TASK_WORK_VMCONSOLE 9205
#define ID_TASK_FILTERBY_PROJECT 9206
#define ID_TASK_TRANSFERS_RETRYNOW 9300
#define ID_TASK_TRANSFERS_ABORT 9301
#define ID_TASK_MESSAGES_COPYALL 9400
Expand Down
Loading