diff --git a/.github/workflows/build_and_test_workflow.yml b/.github/workflows/build_and_test_workflow.yml index 48c74b29765..d82d0f45bb0 100644 --- a/.github/workflows/build_and_test_workflow.yml +++ b/.github/workflows/build_and_test_workflow.yml @@ -3,10 +3,10 @@ name: Build and test -# trigger on every commit push and PR for all branches except feature branches +# trigger on every commit push and PR for all branches except feature branches and pushes for backport branches on: push: - branches: [ '**', '!feature/**' ] + branches: [ '**', '!feature/**', '!backport/**' ] pull_request: branches: [ '**', '!feature/**' ] @@ -182,7 +182,7 @@ jobs: working-directory: ./artifacts strategy: matrix: - version: [ osd-2.0.0 ] + version: [ osd-2.0.0, osd-2.1.0 ] steps: - name: Checkout code uses: actions/checkout@v2 @@ -221,6 +221,10 @@ jobs: - name: Skipping tests if: steps.verify-opensearch-exists.outputs.version-exists != 'true' run: echo Tests were skipped because an OpenSearch release build does not exist for this version yet! + + - name: Setting environment variable to run tests for ${{ matrix.version }} + if: steps.verify-opensearch-exists.outputs.version-exists == 'true' + run: echo "BWC_VERSIONS=${{ matrix.version }}" >> $GITHUB_ENV - name: Download OpenSearch Dashboards uses: actions/download-artifact@v3 @@ -233,4 +237,13 @@ jobs: - name: Run tests if: steps.verify-opensearch-exists.outputs.version-exists == 'true' run: | - ./bwctest.sh -s false -o ${{ env.OPENSEARCH_URL }} -d ${{ steps.download.outputs.download-path }}/opensearch-dashboards-${{ env.VERSION }}-linux-x64.tar.gz \ No newline at end of file + ./bwctest.sh -s false -o ${{ env.OPENSEARCH_URL }} -d ${{ steps.download.outputs.download-path }}/opensearch-dashboards-${{ env.VERSION }}-linux-x64.tar.gz + + - uses: actions/upload-artifact@v3 + if: ${{ failure() && steps.verify-opensearch-exists.outputs.version-exists == 'true' }} + with: + name: ${{ matrix.version }}-test-failures + path: | + ./artifacts/bwc_tmp/test/cypress/videos/without-security/* + ./artifacts/bwc_tmp/test/cypress/screenshots/without-security/* + retention-days: 1 diff --git a/bwctest.sh b/bwctest.sh index def139795a4..fce7173a4b1 100755 --- a/bwctest.sh +++ b/bwctest.sh @@ -13,7 +13,7 @@ set -e -DEFAULT_VERSIONS="osd-2.0.0," +DEFAULT_VERSIONS="osd-2.0.0,osd-2.1.0" function usage() { echo "" diff --git a/cypress/integration/with-security/check_filter_and_query.js b/cypress/integration/with-security/check_filter_and_query.js index 0055e5c078e..e1a486dcfce 100644 --- a/cypress/integration/with-security/check_filter_and_query.js +++ b/cypress/integration/with-security/check_filter_and_query.js @@ -12,6 +12,8 @@ import { const miscUtils = new MiscUtils(cy); const commonUI = new CommonUI(cy); const loginPage = new LoginPage(cy); +const startDate = 'Nov 1, 2016 @ 00:00:00.000'; +const endDate = `Dec 31, ${new Date().getFullYear()} @ 00:00:00.000`; describe('check dashboards filter and query', () => { beforeEach(() => { @@ -66,7 +68,7 @@ describe('check dashboards filter and query', () => { .find('[class="osdSavedQueryListItem__labelText"]') .should('have.text', 'test-query') .click(); - commonUI.setDateRange('Dec 1, 2021 @ 00:00:00.000', 'Jan 1, 2021 @ 00:00:00.000'); + commonUI.setDateRange(endDate, startDate); //[Logs] vistor chart should show osx 100% cy.get('[data-title="[Logs] Visitors by OS"]') diff --git a/cypress/integration/without-security/check_filter_and_query.js b/cypress/integration/without-security/check_filter_and_query.js index 30911d05ba7..65b9aaf4a98 100644 --- a/cypress/integration/without-security/check_filter_and_query.js +++ b/cypress/integration/without-security/check_filter_and_query.js @@ -10,6 +10,8 @@ import { const miscUtils = new MiscUtils(cy); const commonUI = new CommonUI(cy); +const startDate = 'Nov 1, 2016 @ 00:00:00.000'; +const endDate = `Dec 31, ${new Date().getFullYear()} @ 00:00:00.000`; describe('check dashboards filter and query', () => { beforeEach(() => { @@ -56,7 +58,7 @@ describe('check dashboards filter and query', () => { .find('[class="osdSavedQueryListItem__labelText"]') .should('have.text', 'test-query') .click(); - commonUI.setDateRange('Dec 1, 2021 @ 00:00:00.000', 'Jan 1, 2021 @ 00:00:00.000'); + commonUI.setDateRange(endDate, startDate); //[Logs] vistor chart should show osx 100% cy.get('[data-title="[Logs] Visitors by OS"]') diff --git a/cypress/test-data/with-security/osd-2.1.0.tar.gz b/cypress/test-data/with-security/osd-2.1.0.tar.gz new file mode 100644 index 00000000000..c1028e5705a Binary files /dev/null and b/cypress/test-data/with-security/osd-2.1.0.tar.gz differ diff --git a/cypress/test-data/without-security/osd-2.1.0.tar.gz b/cypress/test-data/without-security/osd-2.1.0.tar.gz new file mode 100644 index 00000000000..642bca840e6 Binary files /dev/null and b/cypress/test-data/without-security/osd-2.1.0.tar.gz differ diff --git a/src/core/public/chrome/README.md b/src/core/public/chrome/README.md new file mode 100644 index 00000000000..6ec765a3bb0 --- /dev/null +++ b/src/core/public/chrome/README.md @@ -0,0 +1,130 @@ + +## Chrome Service + +- [About!](#about-) +- [Nav Controls Service](#navcontrolsservice-) +- [Nav Links Service](#navlinksservice-) +- [Recently Accessed Service](#recentlyaccessedservice-) +- [Doc Title Service](#doctitleservice-) +- [UI](#ui-) + +## About : +- **Signature** - `export interface ChromeStart` +The chrome service is a high level UI service that is part of CoreStart (Core services exposed to the Plugin start lifecycle) and offers other plugins a way to add navigation controls to the UI, edit the document title, manipuate navlinks on global header as well as edit the recent accessed tab. It consists of these sub-services/components. + +- NavControlsService : for registering new controls to be displayed in the navigation bar. +- NavLinksService : for manipulating nav links. +- RecentlyAccessedService : for recently accessed history. +- DocTitleService: for accessing and updating the document title +- UI : All the UI components,icons e.g. header, loaders. + + +- How to access ? add in interface `chrome: ChromeStart && chrome.servicesName => e.g chrome.docTitle.method` +- Where it is getting Registered/Executed ? [Staring Point](https://github.com/opensearch-project/OpenSearch-Dashboards/blob/2.1/src/core/public/rendering/rendering_service.tsx) +- How header component is getting rendered ? `const chromeUi = chrome.getHeaderComponent(); ` +- Chrome Methods [See chrome interface/methods](https://github.com/opensearch-project/OpenSearch-Dashboards/blob/2.1/src/core/public/chrome/chrome_service.tsx) + + +### NavControlsService : +- Interface : ChromeNavControls +- **Signature** - `navControls: ChromeNavControls` +- Registering new controller + +Example : +Register a left-side nav control rendered with React. + +```jsx +chrome.navControls.registerLeft({ + mount(targetDomElement) { + ReactDOM.mount(, targetDomElement); + return () => ReactDOM.unmountComponentAtNode(targetDomElement); + } +}) +``` +### NavLinksService : +- Interface : ChromeNavLinks +- **Signature** - `navLinks: ChromeNavLinks` +- e.g. Method : + +Get an observable for a sorted list of navlinks :- + +`getNavLinks$(): Observable>>` + +Get the state of a navlink at this point in time :- + +`get(id: string): ChromeNavLink | undefined` + +Get the current state of all navlinks :- + +`getAll(): Array>` + +Check whether or not a navlink exists :- + +`has(id: string): boolean` + +Remove all navlinks except the one matching the given id :- +`showOnly(id: string): void` + +- How to access + ###### Get the current state of all navlinks: + `core.chrome.navLinks.getAll()` + + ###### Get the state of a navlink at this point in time: + `core.chrome.navLinks.get()` + +### RecentlyAccessedService : + +- Interface : ChromeRecentlyAccessed +- Signature : ```recentlyAccessed: ChromeRecentlyAccessed``` +- The Recently viewed items are stored in the browser's local storage. +- You can go back to the recent search/visualization/dashboard , each item has (link,label,id) +- Methods : + +Adds a new item to the recently accessed history :- + +`add(link: string, label: string, id: string): void` + +Gets an Array of the current recently accessed history :- + +`get(): ChromeRecentlyAccessedHistoryItem[]` + +Gets an Observable of the array of recently accessed history :- + +`get$(): Observable` + +- How to access + ###### Adds a new item to the recently accessed history : + ` + chrome.recentlyAccessed.add('/app/map/1234', 'Map 1234', '1234'); + ` + ###### Gets an Array of the current recently accessed history : + ` + chrome.recentlyAccessed.get().forEach(console.log);; + ` + +### DocTitleService : +- Interface : ChromeDocTitle +- **Signature** - `docTitle: ChromeDocTitle` + ###### - How to change the title of the document + + + ```ts + chrome.docTitle.change('My application title') + chrome.docTitle.change(['My application', 'My section']) + ``` +### UI : +###### consists of tsx/scss files && renders UI components from css Library e.g `````` + +###### Adding/overriding existing css : +- Create scss file and define class e.g .osdCustomClass{} +- pass className prop to UI component. + e.g ` ` + +###### UI Components : + - HeaderBreadcrumbs : Props + + - responsive:boolean Hides extra (above the max) breadcrumbs under a collapsed item as the window gets smaller. + - max: Collapses the inner items past the maximum set here into a single ellipses item. + - breadcrumbs : The array of individual Breadcrumb items + + \ No newline at end of file