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

Improve logging and error handling; Fix edit report bug; Fix header/footer rendering #123

Merged
merged 13 commits into from
Oct 15, 2020

Conversation

zhongnansu
Copy link
Member

Issue #, if available:

Description of changes:

  • Improve logging/error handling
    • add logging for recurring jobs
    • add logging for puppeteer failure stack trace
    • add logging for createVisualReport, (will polish in next PR)
    • get rid of the statusCode undefined error in error handler itself, it's a bug.
  • Covert header/footer from markdown to html
  • Fix the rendering for header/footer in detail page
  • Fix Editing report definition page and the update API. Now user can edit a report definition to whatever he wants.
  • Disable weekly and monthly on UI, since we don't have full support for them now.
  • Detect login page and simulate a login for kibana/ES with security plugin enabled(will polish in next PR)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link
Contributor

@joshuali925 joshuali925 left a comment

Choose a reason for hiding this comment

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

LGTM, one comment left

logger.info('at login page');
await page.type('[placeholder=Username]', 'admin', { delay: 30 });
await page.type('[placeholder=Password]', 'admin', { delay: 30 });
await page.click("[type='submit']");
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add another goto queryUrl here after login and delay? Login might not redirect you to the same url

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah will do

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to delay after clicking submit? or this works instantly

Copy link
Member Author

Choose a reason for hiding this comment

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

good point. I my latest commit, I removed delay as dependency, instead using page.waitForNavigation()

@@ -51,6 +52,7 @@ export function EditReportDefinition(props) {
};

const reportDefinitionId = props['match']['params']['reportDefinitionId'];
let curReportDefinition: ReportDefinitionSchemaType;
Copy link
Contributor

Choose a reason for hiding this comment

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

np: can we spell out the entire word -> currentReportDefinition vs curReportDefinition

Copy link
Member Author

Choose a reason for hiding this comment

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

will change

await callUpdateAPI(metadata);
})
.catch((error) => {
console.log('error when deleting report definition:', error);
Copy link
Contributor

Choose a reason for hiding this comment

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

np: add a toast for when this error is triggered

Copy link
Member Author

Choose a reason for hiding this comment

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

will add

logger.info(`page url includes login? ${page.url().includes('login')}`);
await delay(5000);

if (page.url().includes('login')) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add some comments about what this section is doing? Looks like an auto-login for FGAC domains?

Copy link
Member Author

Choose a reason for hiding this comment

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

will do

Copy link
Contributor

@davidcui1225 davidcui1225 left a comment

Choose a reason for hiding this comment

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

Left some comments

channelSchema
),
}),
delivery: deliverySchema,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can the delivery type be inferred from the number of items in the recipients so that in the future (when multiple channels are supported), index need not be migrated to new schema?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's a good point. Will address in future PR.

logger.info('at login page');
await page.type('[placeholder=Username]', 'admin', { delay: 30 });
await page.type('[placeholder=Password]', 'admin', { delay: 30 });
await page.click("[type='submit']");
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to delay after clicking submit? or this works instantly

Comment on lines +84 to +86
export const DEFAULT_REPORT_HEADER = '<h1>Open Distro Kibana Reports</h1>';

export const DEFAULT_REPORT_FOOTER = '<h1>Open Distro Kibana Reports</h1>';
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice

await page.click("[type='submit']");
logger.info('Goto queryUrl again after login');
await page.goto(queryUrl, { waitUntil: 'networkidle0' });
await delay(5000);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we hard-coding a delay here?

Copy link
Member Author

Choose a reason for hiding this comment

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

removed

Copy link
Contributor

@davidcui1225 davidcui1225 left a comment

Choose a reason for hiding this comment

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

LGTM- just a few minor questions

@zhongnansu zhongnansu merged commit 26c9c04 into opendistro-for-elasticsearch:dev Oct 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants