Skip to content
This repository has been archived by the owner on Jul 25, 2022. It is now read-only.

Implement GUI for Stratagem reports #2334

Merged
merged 2 commits into from
Oct 23, 2020

Conversation

ip1981
Copy link
Member

@ip1981 ip1981 commented Oct 14, 2020

reports

Signed-off-by: Igor Pashev pashev.igor@gmail.com


This change is Reviewable

@ip1981 ip1981 requested a review from a team October 14, 2020 18:11
@ip1981 ip1981 self-assigned this Oct 14, 2020
@ip1981 ip1981 force-pushed the ip1981/ex/1897/gui/stratagem/reports branch 2 times, most recently from bdec621 to 335619d Compare October 14, 2020 18:15
@ip1981 ip1981 marked this pull request as ready for review October 14, 2020 18:21
Copy link
Contributor

@mkpankov mkpankov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 7 of 7 files at r1.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @ip1981)


iml-gui/crate/src/page/stratagem/report.rs, line 45 at r1 (raw file):

    SortBy(table::SortBy<SortField>),
    DeleteReport(String),
    ReportDeleted(fetch::ResponseDataResult<Response<stratagem::list_reports::Resp>>),

Why get a whole list_reports::Resp when a single report gets deleted?


iml-gui/crate/src/page/stratagem/report.rs, line 148 at r1 (raw file):

        Msg::ReportDeleted(x) => {
            match x {
                Ok(Response::Data(_)) => {}

Maybe this should contain names or ids of deleted reports so we can directly purge them from the model?

@ip1981
Copy link
Member Author

ip1981 commented Oct 15, 2020

Why get a whole list_reports::Resp when a single report gets deleted?

It's a typo :)

@ip1981 ip1981 force-pushed the ip1981/ex/1897/gui/stratagem/reports branch from 335619d to 7839bad Compare October 15, 2020 09:47
@ip1981
Copy link
Member Author

ip1981 commented Oct 15, 2020

Maybe this should contain names or ids of deleted reports so we can directly purge them from the model?

Actually, it does not need to return anything but success/failure, because we already know what we delete.

@ip1981
Copy link
Member Author

ip1981 commented Oct 15, 2020

Maybe I should try server-side sorting.

@jgrund
Copy link
Member

jgrund commented Oct 15, 2020

This should also allow the report to be downloaded if the user clicks the report name.

Reports can be downloaded at /api/report/<REPORT_NAME>

@jgrund
Copy link
Member

jgrund commented Oct 15, 2020

Also, size should be in a human-readable form.

Signed-off-by: Igor Pashev <pashev.igor@gmail.com>
@ip1981 ip1981 force-pushed the ip1981/ex/1897/gui/stratagem/reports branch from 7839bad to 9345be1 Compare October 15, 2020 15:23
@ip1981 ip1981 requested a review from mkpankov October 15, 2020 15:24
@mkpankov
Copy link
Contributor

Actually, it does not need to return anything but success/failure, because we already know what we delete.

We can succeed in deleting one report and not the other (I/O error for example).

@ip1981 ip1981 requested a review from a team October 20, 2020 10:23

pub fn view(model: &Model, session: Option<&Session>) -> Node<Msg> {
if model.rows.is_empty() {
return empty![];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since reports are currently the only thing in here, it would be nice to present a message like no reports found, or something to that effect.

}
Msg::DeleteReport(filename) => {
if let Ok(true) = window().confirm_with_message(&format!("Delete {}?", filename)) {
let query = stratagem::delete_report::build(filename);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, it would be nice to optimistically delete the report from the model here.

@jgrund jgrund requested a review from a team October 23, 2020 19:35
@jgrund jgrund merged commit 10d8894 into master Oct 23, 2020
@jgrund jgrund deleted the ip1981/ex/1897/gui/stratagem/reports branch October 23, 2020 19:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants