mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
close https://github.com/elastic/kibana/issues/172599 # Backport This will backport the following commits from `main` to `8.12`: - [Unskip download csv permissions test (#173660)](https://github.com/elastic/kibana/pull/173660) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Anton Dosov","email":"anton.dosov@elastic.co"},"sourceCommit":{"committedDate":"2023-12-21T10:44:05Z","message":"Unskip download csv permissions test (#173660)\n\n## Summary\r\n\r\n\r\nclose https://github.com/elastic/kibana/issues/172599\r\n\r\n\r\nI couldn't reproduce the failure, looks like it is very rare. But when\r\nreviewing the code I noticed possible race conditions and refactored.\r\nSuggest we merge the refactor and observe.\r\n\r\nBefore fix\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4647\r\n100x passed - means flakiness hard to reproduce\r\nAfter fix\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4649\r\n50x passed - still stable","sha":"7fe9faea3c92198646a4aaf2dfd0e5afccb730b2","branchLabelMapping":{"^v8.13.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:SharedUX","backport:prev-minor","v8.13.0"],"title":"Unskip download csv permissions test ","number":173660,"url":"https://github.com/elastic/kibana/pull/173660","mergeCommit":{"message":"Unskip download csv permissions test (#173660)\n\n## Summary\r\n\r\n\r\nclose https://github.com/elastic/kibana/issues/172599\r\n\r\n\r\nI couldn't reproduce the failure, looks like it is very rare. But when\r\nreviewing the code I noticed possible race conditions and refactored.\r\nSuggest we merge the refactor and observe.\r\n\r\nBefore fix\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4647\r\n100x passed - means flakiness hard to reproduce\r\nAfter fix\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4649\r\n50x passed - still stable","sha":"7fe9faea3c92198646a4aaf2dfd0e5afccb730b2"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.13.0","branchLabelMappingKey":"^v8.13.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/173660","number":173660,"mergeCommit":{"message":"Unskip download csv permissions test (#173660)\n\n## Summary\r\n\r\n\r\nclose https://github.com/elastic/kibana/issues/172599\r\n\r\n\r\nI couldn't reproduce the failure, looks like it is very rare. But when\r\nreviewing the code I noticed possible race conditions and refactored.\r\nSuggest we merge the refactor and observe.\r\n\r\nBefore fix\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4647\r\n100x passed - means flakiness hard to reproduce\r\nAfter fix\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4649\r\n50x passed - still stable","sha":"7fe9faea3c92198646a4aaf2dfd0e5afccb730b2"}}]}] BACKPORT--> Co-authored-by: Anton Dosov <anton.dosov@elastic.co>
This commit is contained in:
parent
8b64cecfbe
commit
d39a80e08b
1 changed files with 15 additions and 28 deletions
|
@ -44,12 +44,10 @@ export class ReportingCsvPanelAction implements ActionDefinition<ActionContext>
|
|||
private isDownloading: boolean;
|
||||
public readonly type = '';
|
||||
public readonly id = CSV_REPORTING_ACTION;
|
||||
private licenseHasDownloadCsv: boolean = false;
|
||||
private capabilityHasDownloadCsv: boolean = false;
|
||||
private notifications: NotificationsSetup;
|
||||
private apiClient: ReportingAPIClient;
|
||||
private startServices$: Params['startServices$'];
|
||||
private usesUiCapabilities: any;
|
||||
private readonly notifications: NotificationsSetup;
|
||||
private readonly apiClient: ReportingAPIClient;
|
||||
private readonly startServices$: Params['startServices$'];
|
||||
private readonly usesUiCapabilities: boolean;
|
||||
|
||||
constructor({ core, apiClient, startServices$, usesUiCapabilities }: Params) {
|
||||
this.isDownloading = false;
|
||||
|
@ -78,34 +76,23 @@ export class ReportingCsvPanelAction implements ActionDefinition<ActionContext>
|
|||
}
|
||||
|
||||
public isCompatible = async (context: ActionContext) => {
|
||||
await new Promise<void>((resolve) => {
|
||||
this.startServices$.subscribe(([{ application }, { licensing }]) => {
|
||||
licensing.license$.subscribe((license) => {
|
||||
const results = license.check('reporting', 'basic');
|
||||
const { showLinks } = checkLicense(results);
|
||||
this.licenseHasDownloadCsv = showLinks;
|
||||
});
|
||||
|
||||
if (this.usesUiCapabilities) {
|
||||
this.capabilityHasDownloadCsv = application.capabilities.dashboard?.downloadCsv === true;
|
||||
} else {
|
||||
this.capabilityHasDownloadCsv = true; // deprecated
|
||||
}
|
||||
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
|
||||
if (!this.licenseHasDownloadCsv || !this.capabilityHasDownloadCsv) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const { embeddable } = context;
|
||||
|
||||
if (embeddable.type !== 'search') {
|
||||
return false;
|
||||
}
|
||||
|
||||
const [{ application }, { licensing }] = await firstValueFrom(this.startServices$);
|
||||
const license = await firstValueFrom(licensing.license$);
|
||||
const licenseHasDownloadCsv = checkLicense(license.check('reporting', 'basic')).showLinks;
|
||||
const capabilityHasDownloadCsv = this.usesUiCapabilities
|
||||
? application.capabilities.dashboard?.downloadCsv === true
|
||||
: true; // deprecated
|
||||
|
||||
if (!licenseHasDownloadCsv || !capabilityHasDownloadCsv) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const savedSearch = embeddable.getSavedSearch();
|
||||
const query = savedSearch?.searchSource.getField('query');
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue