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

Kavilla/debounce dash app #56

Open
wants to merge 4 commits into
base: kavilla/set_current_container
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
540 changes: 270 additions & 270 deletions .github/workflows/build_and_test_workflow.yml

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions .github/workflows/changelog_verifier.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
name: "Changelog Verifier"
on:
pull_request:
branches: [ '**', '!feature/**' ]
types: [opened, edited, review_requested, synchronize, reopened, ready_for_review, labeled, unlabeled]
# name: "Changelog Verifier"
# on:
# pull_request:
# branches: [ '**', '!feature/**' ]
# types: [opened, edited, review_requested, synchronize, reopened, ready_for_review, labeled, unlabeled]

jobs:
# Enforces the update of a changelog file on every pull request
verify-changelog:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.event.pull_request.head.sha }}
# jobs:
# # Enforces the update of a changelog file on every pull request
# verify-changelog:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
# ref: ${{ github.event.pull_request.head.sha }}

- uses: dangoslen/changelog-enforcer@v3
with:
skipLabels: "autocut, Skip-Changelog"
# - uses: dangoslen/changelog-enforcer@v3
# with:
# skipLabels: "autocut, Skip-Changelog"
180 changes: 90 additions & 90 deletions .github/workflows/cypress_workflow.yml
Original file line number Diff line number Diff line change
@@ -1,104 +1,104 @@
name: Run cypress tests
# name: Run cypress tests

# trigger on every PR for all branches
on:
pull_request:
branches: [ '**' ]
paths-ignore:
- '**/*.md'
# # trigger on every PR for all branches
# on:
# pull_request:
# branches: [ '**' ]
# paths-ignore:
# - '**/*.md'

env:
FTR_PATH: 'ftr'
START_CMD: 'node ../scripts/opensearch_dashboards --dev --no-base-path --no-watch'
OPENSEARCH_SNAPSHOT_CMD: 'node ../scripts/opensearch snapshot'
SPEC: 'cypress/integration/core-opensearch-dashboards/opensearch-dashboards/**/*.js,'
CYPRESS_BROWSER: 'chromium'
CYPRESS_VISBUILDER_ENABLED: true
CYPRESS_DATASOURCE_MANAGEMENT_ENABLED: false
OSD_SNAPSHOT_SKIP_VERIFY_CHECKSUM: true
# env:
# FTR_PATH: 'ftr'
# START_CMD: 'node ../scripts/opensearch_dashboards --dev --no-base-path --no-watch'
# OPENSEARCH_SNAPSHOT_CMD: 'node ../scripts/opensearch snapshot'
# SPEC: 'cypress/integration/core-opensearch-dashboards/opensearch-dashboards/**/*.js,'
# CYPRESS_BROWSER: 'chromium'
# CYPRESS_VISBUILDER_ENABLED: true
# CYPRESS_DATASOURCE_MANAGEMENT_ENABLED: false
# OSD_SNAPSHOT_SKIP_VERIFY_CHECKSUM: true

jobs:
cypress-tests:
runs-on: ubuntu-latest
container:
image: docker://opensearchstaging/ci-runner:ci-runner-rockylinux8-opensearch-dashboards-integtest-v2
options: --user 1001
env:
# prevents extra Cypress installation progress messages
CI: 1
# avoid warnings like "tput: No value for $TERM and no -T specified"
TERM: xterm
name: Run cypress tests
steps:
- name: Checkout code
uses: actions/checkout@v2
# jobs:
# cypress-tests:
# runs-on: ubuntu-latest
# container:
# image: docker://opensearchstaging/ci-runner:ci-runner-rockylinux8-opensearch-dashboards-integtest-v2
# options: --user 1001
# env:
# # prevents extra Cypress installation progress messages
# CI: 1
# # avoid warnings like "tput: No value for $TERM and no -T specified"
# TERM: xterm
# name: Run cypress tests
# steps:
# - name: Checkout code
# uses: actions/checkout@v2

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
# - name: Setup Node
# uses: actions/setup-node@v2
# with:
# node-version-file: '.nvmrc'
# registry-url: 'https://registry.npmjs.org'

- name: Setup Yarn
run: |
npm uninstall -g yarn
npm i -g [email protected]
# - name: Setup Yarn
# run: |
# npm uninstall -g yarn
# npm i -g [email protected]

- name: Run bootstrap
run: yarn osd bootstrap
# - name: Run bootstrap
# run: yarn osd bootstrap

- name: Build plugins
run: node scripts/build_opensearch_dashboards_platform_plugins --no-examples --workers 10
# - name: Build plugins
# run: node scripts/build_opensearch_dashboards_platform_plugins --no-examples --workers 10

- name: Checkout
uses: actions/checkout@v2
with:
path: ${{ env.FTR_PATH }}
repository: opensearch-project/opensearch-dashboards-functional-test
ref: '${{ github.base_ref }}'
# - name: Checkout
# uses: actions/checkout@v2
# with:
# path: ${{ env.FTR_PATH }}
# repository: opensearch-project/opensearch-dashboards-functional-test
# ref: '${{ github.base_ref }}'

- name: Get Cypress version
id: cypress_version
run: |
echo "::set-output name=cypress_version::$(cat ./${{ env.FTR_PATH }}/package.json | jq '.devDependencies.cypress' | tr -d '"')"
# - name: Get Cypress version
# id: cypress_version
# run: |
# echo "::set-output name=cypress_version::$(cat ./${{ env.FTR_PATH }}/package.json | jq '.devDependencies.cypress' | tr -d '"')"

- name: Cache Cypress
id: cache-cypress
uses: actions/cache@v1
with:
path: ~/.cache/Cypress
key: cypress-cache-v2-${{ runner.os }}-${{ hashFiles('**/package.json') }}
env:
CYPRESS_INSTALL_BINARY: ${{ steps.cypress_version.outputs.cypress_version }}
- run: npx cypress cache list
- run: npx cypress cache path
# - name: Cache Cypress
# id: cache-cypress
# uses: actions/cache@v1
# with:
# path: ~/.cache/Cypress
# key: cypress-cache-v2-${{ runner.os }}-${{ hashFiles('**/package.json') }}
# env:
# CYPRESS_INSTALL_BINARY: ${{ steps.cypress_version.outputs.cypress_version }}
# - run: npx cypress cache list
# - run: npx cypress cache path

- name: Run tests
uses: cypress-io/github-action@v2
with:
working-directory: ${{ env.FTR_PATH }}
start: ${{ env.OPENSEARCH_SNAPSHOT_CMD }}, ${{ env.START_CMD }}
wait-on: 'http://localhost:9200, http://localhost:5601'
command: yarn cypress:run-without-security --browser ${{ env.CYPRESS_BROWSER }} --spec ${{ env.SPEC }}
# - name: Run tests
# uses: cypress-io/github-action@v2
# with:
# working-directory: ${{ env.FTR_PATH }}
# start: ${{ env.OPENSEARCH_SNAPSHOT_CMD }}, ${{ env.START_CMD }}
# wait-on: 'http://localhost:9200, http://localhost:5601'
# command: yarn cypress:run-without-security --browser ${{ env.CYPRESS_BROWSER }} --spec ${{ env.SPEC }}

# Screenshots are only captured on failure, will change this once we do visual regression tests
- uses: actions/upload-artifact@v3
if: failure()
with:
name: ftr-cypress-screenshots
path: ${{ env.FTR_PATH }}/cypress/screenshots
retention-days: 1
# # Screenshots are only captured on failure, will change this once we do visual regression tests
# - uses: actions/upload-artifact@v3
# if: failure()
# with:
# name: ftr-cypress-screenshots
# path: ${{ env.FTR_PATH }}/cypress/screenshots
# retention-days: 1

- uses: actions/upload-artifact@v3
if: always()
with:
name: ftr-cypress-videos
path: ${{ env.FTR_PATH }}/cypress/videos
retention-days: 1
# - uses: actions/upload-artifact@v3
# if: always()
# with:
# name: ftr-cypress-videos
# path: ${{ env.FTR_PATH }}/cypress/videos
# retention-days: 1

- uses: actions/upload-artifact@v3
if: always()
with:
name: ftr-cypress-results
path: ${{ env.FTR_PATH }}/cypress/results
retention-days: 1
# - uses: actions/upload-artifact@v3
# if: always()
# with:
# name: ftr-cypress-results
# path: ${{ env.FTR_PATH }}/cypress/results
# retention-days: 1
52 changes: 26 additions & 26 deletions .github/workflows/links_checker.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
# Copyright OpenSearch Contributors
# SPDX-License-Identifier: Apache-2.0
# # Copyright OpenSearch Contributors
# # SPDX-License-Identifier: Apache-2.0

name: Link Checker
# name: Link Checker

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# on:
# push:
# branches: [ main ]
# pull_request:
# branches: [ main ]

jobs:
linkchecker:
# jobs:
# linkchecker:

runs-on: ubuntu-latest
# runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Load Excludes
run: |
LYCHEE_EXCLUDE=$(sed -e :a -e 'N;s/\n/ --exclude /;ta' .lycheeexclude)
echo "LYCHEE_EXCLUDE=$LYCHEE_EXCLUDE" >> $GITHUB_ENV
- name: Lychee Link Checker
id: lychee
uses: lycheeverse/[email protected]
with:
args: --accept=200,403,429 --exclude ${{ env.LYCHEE_EXCLUDE }} --exclude-mail "**/*.html" "**/*.md" "**/*.txt" "**/*.json" "**/*.js" "**/*.ts" "**/*.tsx"
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Fail if there were link errors
run: exit ${{ steps.lychee.outputs.exit_code }}
# steps:
# - uses: actions/checkout@v2
# - name: Load Excludes
# run: |
# LYCHEE_EXCLUDE=$(sed -e :a -e 'N;s/\n/ --exclude /;ta' .lycheeexclude)
# echo "LYCHEE_EXCLUDE=$LYCHEE_EXCLUDE" >> $GITHUB_ENV
# - name: Lychee Link Checker
# id: lychee
# uses: lycheeverse/[email protected]
# with:
# args: --accept=200,403,429 --exclude ${{ env.LYCHEE_EXCLUDE }} --exclude-mail "**/*.html" "**/*.md" "**/*.txt" "**/*.json" "**/*.js" "**/*.ts" "**/*.tsx"
# env:
# GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
# - name: Fail if there were link errors
# run: exit ${{ steps.lychee.outputs.exit_code }}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { debounceTime } from 'rxjs/operators';
import { migrateAppState } from '../lib/migrate_app_state';
import {
IOsdUrlStateStorage,
Expand All @@ -19,6 +20,7 @@ import { ViewMode } from '../../embeddable_plugin';
import { getDashboardIdFromUrl } from '../lib';
import { syncQueryStateWithUrl } from '../../../../data/public';
import { SavedObjectDashboard } from '../../saved_dashboards';
import { DashboardConstants } from '../../dashboard_constants';

const APP_STATE_STORAGE_KEY = '_a';

Expand Down Expand Up @@ -114,6 +116,9 @@ export const createDashboardGlobalAndAppState = ({
// and just allow $scope.$on('destroy') fire later and clean up everything
}
},
// state$: osdUrlStateStorage
// .change$(APP_STATE_STORAGE_KEY)
// .pipe(debounceTime(DashboardConstants.URL_APP_STATE_UPDATES_DEBOUNCE_MS)),
},
stateStorage: osdUrlStateStorage,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { i18n } from '@osd/i18n';
import { EMPTY, Observable, Subscription, merge, pipe } from 'rxjs';
import {
catchError,
debounceTime,
distinctUntilChanged,
filter,
map,
Expand Down Expand Up @@ -141,21 +142,24 @@ export const handleDashboardContainerInputs = (
const subscriptions = new Subscription();
const { filterManager, queryString } = services.data.query;

const inputSubscription = dashboardContainer.getInput$().subscribe(() => {
if (
!opensearchFilters.compareFilters(
dashboardContainer.getInput().filters,
filterManager.getFilters(),
opensearchFilters.COMPARE_ALL_OPTIONS
)
) {
// Add filters modifies the object passed to it, hence the clone deep.
filterManager.addFilters(cloneDeep(dashboardContainer.getInput().filters));
appState.transitions.set('query', queryString.getQuery());
}
// triggered when dashboard embeddable container has changes, and update the appState
handleDashboardContainerChanges(dashboardContainer, appState, services, dashboard);
});
const inputSubscription = dashboardContainer
.getInput$()
.pipe(debounceTime(DashboardConstants.HANDLE_INPUT_CHANGES_DEBOUNCE_MS))
.subscribe(() => {
if (
!opensearchFilters.compareFilters(
dashboardContainer.getInput().filters,
filterManager.getFilters(),
opensearchFilters.COMPARE_ALL_OPTIONS
)
) {
// Add filters modifies the object passed to it, hence the clone deep.
filterManager.addFilters(cloneDeep(dashboardContainer.getInput().filters));
appState.transitions.set('query', queryString.getQuery());
}
// triggered when dashboard embeddable container has changes, and update the appState
handleDashboardContainerChanges(dashboardContainer, appState, services, dashboard);
});

subscriptions.add(inputSubscription);

Expand Down
3 changes: 3 additions & 0 deletions src/plugins/dashboard/public/dashboard_constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ export const DashboardConstants = {
ADD_EMBEDDABLE_TYPE: 'addEmbeddableType',
DASHBOARDS_ID: 'dashboards',
DASHBOARD_ID: 'dashboard',

HANDLE_INPUT_CHANGES_DEBOUNCE_MS: 50,
URL_APP_STATE_UPDATES_DEBOUNCE_MS: 15,
};

export function createDashboardEditUrl(id: string) {
Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/dashboard/dashboard_state.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export default function ({ getService, getPageObjects }) {

// TODO: race condition it seems with the query from previous state
// https://github.com/opensearch-project/OpenSearch-Dashboards/issues/4193
it.skip('Tile map with no changes will update with visualization changes', async () => {
it('Tile map with no changes will update with visualization changes', async () => {
await PageObjects.dashboard.gotoDashboardLandingPage();

await PageObjects.dashboard.clickNewDashboard();
Expand Down