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

Merge main changes to Feature-Anywhere branch #4295

Merged
Merged
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
e74ab2d
Fix header icon (#3910) (#3915)
opensearch-trigger-bot[bot] Apr 22, 2023
ef2cb84
Add server side private IP blocking for data source endpoints validat…
kristenTian Apr 24, 2023
a947240
Docs (Jest): Update jest documentation links (#3931)
joshuarrrr Apr 24, 2023
b97a4b5
Revert "[CCI] Replace jquery usage in console plugin with native meth…
joshuarrrr Apr 24, 2023
0e34c3c
[BUG][Dashboard listing] push to history if dashboard otherwise nav (…
kavilla Apr 25, 2023
66aa122
remove jquery console release note for https://github.com/opensearch-…
joshuarrrr Apr 25, 2023
755f16b
[CCI] Update js-yaml to v4.0.5 (#3770)
andreymyssak Apr 25, 2023
ac2ee3a
Update README.md (#3788)
vagimeli Apr 26, 2023
a8ace28
Bump yaml to 2.2.2 (#3947)
manasvinibs Apr 27, 2023
ca0bb8f
Bump `joi` to v14 to avoid the possibility of prototype poisoning in …
AMoo-Miki May 2, 2023
f5a978d
[Doc] Add communication guide (#3837)
joshuarrrr May 3, 2023
5ea0cbe
Temporarily hardcode chromedriver to 112.0.0 to enable all ftr tests …
ananzh May 5, 2023
6e352ff
Fix wording and duplicate code in embeddable example plugin (#3911)
abbyhu2000 May 5, 2023
0188d05
[CI] setup Chrome and utilize binary path (#3997)
kavilla May 11, 2023
8121c9d
[Dashboards listing] fix listing limit (#4021)
kavilla May 15, 2023
0e25f2e
[CCI] Fix EUI/OUI type errors (#3798)
Nicksqain May 15, 2023
87e7951
Fix bottom bar visibility using create portal (#3336) (#3978)
SergeyMyssak May 16, 2023
69b1854
Adds threshold to code coverage changes for project (#4040)
ashwin-pc May 16, 2023
873b7f3
Updates PR template for screenshots and test instructions (#4042)
ashwin-pc May 16, 2023
2c33d57
Replace re2 with RegExp in timeline and add unit tests (#3908)
ananzh May 16, 2023
b04e657
[Console] [CCI] Remove unused ul element and its custom styling. (#3993)
curq May 17, 2023
c5058a3
Add 1.3.10 release note (#4060) (#4063)
opensearch-trigger-bot[bot] May 18, 2023
e737790
[Multiple Datasource] Support Amazon OpenSearch Serverless (#3957)
zhongnansu May 19, 2023
83d7b5b
Remove Sass from `tile_map` plugin (#4110)
BSFishy May 23, 2023
61ea841
Design for New Saved Object Service Interface for Custom Repository (…
bandinib-amzn May 23, 2023
1524784
enhance grouping for context menu options (#3924)
sikhote May 24, 2023
6399a6c
Adding Tao and Zilong to MAINTAINERS (#4137)
zengyan-amazon May 25, 2023
574f119
[MD]Update data-test-subj for functional tests & fix bug in edit flow…
zhongnansu May 25, 2023
1c0ffee
Add support for Node.js >=14.20.1 <19 (#4071)
AMoo-Miki May 26, 2023
ec41f59
Remove timeline application (#3971)
ananzh May 26, 2023
bd7d707
Use `exec` in the CLI shell scripts to prevent new process creation (…
AMoo-Miki May 26, 2023
4978786
chore (lychee): Add company.net to exclusion list (#4171)
joshuarrrr May 30, 2023
20c928f
Bundle Node 14 as a fallback for operating systems that cannot run No…
AMoo-Miki May 30, 2023
821ad73
Refactor authentication description message (#4179)
zhongnansu May 31, 2023
da501e4
[CI] skip checksum verification for cypress tests (#4188)
kavilla May 31, 2023
f017eaa
Adds plugin manifest config to define OpenSearch plugin dependency an…
manasvinibs Jun 1, 2023
efbcb69
[Table Visualization] Remove custom styling for text-align:center in …
curq Jun 1, 2023
bb0c98f
Add new MAINTAINERS to CODEOWNERS file (#4199)
Flyingliuhub Jun 1, 2023
5ffb3d8
Add 2.8.0 release notes (#4204)
kavilla Jun 1, 2023
487cd36
Chore(CHANGELOG): Update with 2.7, 2.8 releases (#3890)
joshuarrrr Jun 2, 2023
5c5de03
[Saved Object Service] Adds Repository Factory Provider (#4149)
bandinib-amzn Jun 5, 2023
cb27336
add category option for context menus (#4144)
sikhote Jun 6, 2023
55b293a
[CCI] Add bluebird replaces for src/plugins/saved_objects (#4026)
Nicksqain Jun 8, 2023
2322c53
Validate and correct change log after 2.8 release (#4275)
zhongnansu Jun 10, 2023
99f7c37
Merge remote-tracking branch 'origin/main' into main-merge
lezzago Jun 15, 2023
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
Prev Previous commit
Next Next commit
[BUG][Dashboard listing] push to history if dashboard otherwise nav (#…
…3922)

History push will just to the current route. However, dashboardsProvider
was implemented with the expectation that it was a different app.

So when a plugin registered it was attempting to navigate to
`app/dashboard#/app/{url}`

Add tests and extra data test subject.

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
  • Loading branch information
kavilla authored Apr 25, 2023

Verified

This commit was created on github.com and signed with GitHub’s verified signature.
commit 0e34c3ccbc7de911862694c98f910dd223d5c27a
16 changes: 12 additions & 4 deletions src/plugins/dashboard/public/application/legacy_app.js
Original file line number Diff line number Diff line change
@@ -163,11 +163,19 @@ export function initDashboardApp(app, deps) {
};
};

$scope.editItem = ({ editUrl }) => {
history.push(editUrl);
$scope.editItem = ({ appId, editUrl }) => {
if (appId === 'dashboard') {
history.push(editUrl);
} else {
deps.core.application.navigateToUrl(editUrl);
}
};
$scope.viewItem = ({ viewUrl }) => {
history.push(deps.addBasePath(viewUrl));
$scope.viewItem = ({ appId, viewUrl }) => {
if (appId === 'dashboard') {
history.push(viewUrl);
} else {
deps.core.application.navigateToUrl(viewUrl);
}
};
$scope.delete = (dashboards) => {
const ids = dashboards.map((d) => ({ id: d.id, appId: d.appId }));
Original file line number Diff line number Diff line change
@@ -57,7 +57,7 @@ describe('create button with props', () => {
expect(createButtons.length).toBe(0);
const createDropdown = findTestSubject(component, 'createMenuDropdown');
createDropdown.simulate('click');
const contextMenus = findTestSubject(component, 'contextMenuItem');
const contextMenus = findTestSubject(component, 'contextMenuItem-test');
expect(contextMenus.length).toBe(2);
expect(contextMenus.at(0).prop('href')).toBe('test1');
});
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ const CreateButton = (props: CreateButtonProps) => {
<EuiContextMenuItem
key={provider.savedObjectsType}
href={provider.createUrl}
data-test-subj="contextMenuItem"
data-test-subj={`contextMenuItem-${provider.appId}`}
>
{provider.createLinkText}
</EuiContextMenuItem>
1 change: 1 addition & 0 deletions test/plugin_functional/config.ts
Original file line number Diff line number Diff line change
@@ -52,6 +52,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
require.resolve('./test_suites/doc_views_links'),
require.resolve('./test_suites/application_links'),
require.resolve('./test_suites/data_plugin'),
require.resolve('./test_suites/dashboard_listing_plugin'),
],
services: {
...functionalConfig.get('services'),
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"id": "dashboard_listing_test_plugin",
"version": "0.0.1",
"opensearchDashboardsVersion": "opensearchDashboards",
"configPath": ["dashboard_listing_test_plugin"],
"server": false,
"ui": true,
"requiredPlugins": ["dashboard"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "dashboard_listing_test_plugin",
"version": "1.0.0",
"main": "target/test/plugin_functional/plugins/dashboard_listing_test_plugin",
"opensearchDashboards": {
"version": "opensearchDashboards",
"templateVersion": "1.0.0"
},
"license": "Apache-2.0",
"scripts": {
"osd": "../../../../scripts/use_node ../../../../scripts/osd.js",
"build": "../../../../scripts/use_node ../../../../scripts/remove.js './target' && tsc"
},
"devDependencies": {
"typescript": "4.0.2"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Any modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

import { PluginInitializer } from 'opensearch-dashboards/public';
import {
DashboardListingTestPlugin,
DashboardListingTestPluginSetup,
DashboardListingTestPluginStart,
} from './plugin';

export const plugin: PluginInitializer<
DashboardListingTestPluginSetup,
DashboardListingTestPluginStart
> = () => new DashboardListingTestPlugin();
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Any modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

import * as React from 'react';
import { render, unmountComponentAtNode } from 'react-dom';
import { Router, Switch, Route, Link } from 'react-router-dom';
import { CoreSetup, Plugin } from 'opensearch-dashboards/public';

export class DashboardListingTestPlugin
implements Plugin<DashboardListingTestPluginSetup, DashboardListingTestPluginStart> {
public setup(core: CoreSetup, setupDeps: SetupDependencies) {
const ID = 'dashboard_listing_test_plugin';
const BASE_URL = core.http.basePath.prepend(`/app/${ID}#`);
setupDeps.dashboard.registerDashboardProvider({
appId: ID,
savedObjectsType: 'dashboardTest',
savedObjectsName: 'Dashboard Test',
editUrlPathFn: (obj: SavedObject) => `${BASE_URL}/${obj.id}/edit`,
viewUrlPathFn: (obj: SavedObject) => `${BASE_URL}/${obj.id}`,
createLinkText: 'Test Dashboard',
createSortText: 'Test Dashboard',
createUrl: `${BASE_URL}/create`,
});

core.application.register({
id: ID,
title: 'Dashboard Listing Test Plugin',
appRoute: `app/${ID}`,
async mount(context, { element }) {
render(
<h1 data-test-subj="dashboardListingTestHeader">Dashboard Listing Test Header</h1>,
element
);

return () => unmountComponentAtNode(element);
},
});
}

public start() {}
public stop() {}
}

export type DashboardListingTestPluginSetup = ReturnType<DashboardListingTestPlugin['setup']>;
export type DashboardListingTestPluginStart = ReturnType<DashboardListingTestPlugin['start']>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true
},
"include": [
"index.ts",
"public/**/*.ts",
"public/**/*.tsx",
"../../../../typings/**/*",
],
"exclude": [],
"references": [
{ "path": "../../../../src/core/tsconfig.json" }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Any modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

import url from 'url';
import expect from '@osd/expect';

const getPathWithHash = (absoluteUrl: string) => {
const parsed = url.parse(absoluteUrl);
return `${parsed.path}${parsed.hash ?? ''}`;
};

export default function ({ getService, getPageObjects }) {
const testSubjects = getService('testSubjects');
const PageObjects = getPageObjects(['common', 'dashboard', 'header']);
const browser = getService('browser');
const listingTable = getService('listingTable');
const find = getService('find');

describe('dashboard listing plugin', function describeIndexTests() {
const dashboardName = 'Dashboard Test';

before(async () => {
await PageObjects.dashboard.initTests({
opensearchDashboardsIndex: '../functional/fixtures/opensearch_archiver/dashboard/legacy',
});
await PageObjects.dashboard.clickCreateDashboardPrompt();
await PageObjects.dashboard.saveDashboard('default');
await PageObjects.dashboard.gotoDashboardLandingPage();
});

it('should be able to navigate to create a dashboard', async () => {
await testSubjects.click('createMenuDropdown');
await testSubjects.click('contextMenuItem-dashboard');
await PageObjects.dashboard.saveDashboard(dashboardName);

await PageObjects.dashboard.gotoDashboardLandingPage();
await listingTable.searchAndExpectItemsCount('dashboard', dashboardName, 1);
});

it('should be able to navigate to view dashboard', async () => {
await listingTable.clickItemLink('dashboard', dashboardName);
await PageObjects.header.awaitGlobalLoadingIndicatorHidden();
await PageObjects.dashboard.getIsInViewMode();
await PageObjects.dashboard.gotoDashboardLandingPage();
});

it('should be able to navigate to edit dashboard', async () => {
await listingTable.searchForItemWithName(dashboardName);
const editBttn = await find.allByCssSelector('.euiToolTipAnchor');
await editBttn[0].click();
await PageObjects.dashboard.clickCancelOutOfEditMode();
await PageObjects.dashboard.gotoDashboardLandingPage();
});

it('should be able to navigate to create a test dashboard', async () => {
await testSubjects.click('createMenuDropdown');
await testSubjects.click('contextMenuItem-dashboard_listing_test_plugin');
expect(getPathWithHash(await browser.getCurrentUrl())).to.eql(
'/app/dashboard_listing_test_plugin#/create'
);
});
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Any modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

export default function ({ getService, loadTestFile }) {
const browser = getService('browser');
const opensearchArchiver = getService('opensearchArchiver');

async function loadLogstash() {
await browser.setWindowSize(1200, 900);
await opensearchArchiver.loadIfNeeded(
'../functional/fixtures/opensearch_archiver/logstash_functional'
);
}

async function unloadLogstash() {
await opensearchArchiver.unload(
'../functional/fixtures/opensearch_archiver/logstash_functional'
);
}

describe('dashboard listing plugin', () => {
before(loadLogstash);
after(unloadLogstash);

loadTestFile(require.resolve('./dashboard_listing_plugin'));
});
}