Skip to content

Commit

Permalink
disable some unsupported functionality for es 1+2
Browse files Browse the repository at this point in the history
  • Loading branch information
cars10 committed Aug 20, 2023
1 parent 8a3d1f5 commit dacde28
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 20 deletions.
4 changes: 2 additions & 2 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ export default defineConfig({

/* Run your local dev server before starting the tests */
webServer: {
command: 'yarn dev',
url: 'http://localhost:5173',
command: 'yarn dev --port=5175',
url: 'http://localhost:5175',
reuseExistingServer: !process.env.CI,
},
})
5 changes: 4 additions & 1 deletion src/components/indices/IndexBulk.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
menu-anchor="top left"
menu-self="bottom left">
<q-list padding dense>
<row-menu-action method="indexForcemerge"
<row-menu-action v-if="connectionStore.activeCluster && parseInt(connectionStore.activeCluster.majorVersion) > 1"
method="indexForcemerge"
:method-params="{index: selectedIndices.join(',')}"
:text="t('indices.index_row.options.forcemerge.text', selectedIndices.length)"
icon="call_merge"
Expand Down Expand Up @@ -62,8 +63,10 @@
import { QMenu } from 'quasar'
import { useTranslation } from '../../composables/i18n'
import RowMenuAction from './RowMenuAction.vue'
import { useConnectionStore } from '../../store/connection.ts'
const t = useTranslation()
const connectionStore = useConnectionStore()
defineProps<{ selectedIndices: string[], totalItemsCount: number, filteredItemsCount: number }>()
const emit = defineEmits(['reload', 'indicesDeleted'])
Expand Down
12 changes: 9 additions & 3 deletions src/components/indices/IndexRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,13 @@
<q-separator />

<index-aliases :index="index.index" @reload="remitReloadAndCloseMenu" />
<index-reindex :index="index.index" @reload="remitReloadAndCloseMenu" />
<index-reindex v-if="connectionStore.activeCluster && parseInt(connectionStore.activeCluster.majorVersion) > 1"
:index="index.index" @reload="remitReloadAndCloseMenu" />

<q-separator />

<row-menu-action method="indexForcemerge"
<row-menu-action v-if="connectionStore.activeCluster && parseInt(connectionStore.activeCluster.majorVersion) > 1"
method="indexForcemerge"
:method-params="{ index: props.index.index }"
:text="t('indices.index_row.options.forcemerge.text')"
:growl="t('indices.index_row.options.forcemerge.growl', {index: index.index})"
Expand Down Expand Up @@ -116,7 +118,8 @@

<q-separator />

<row-menu-action method="deleteByQuery"
<row-menu-action v-if="connectionStore.activeCluster && parseInt(connectionStore.activeCluster.majorVersion) >= 5"
method="deleteByQuery"
:method-params="{ index: props.index.index }"
:text="t('indices.index_row.options.delete_by_query.text')"
:growl="t('indices.index_row.options.delete_by_query.growl', {index: index.index})"
Expand Down Expand Up @@ -144,6 +147,9 @@
import { useTranslation } from '../../composables/i18n'
import IndexReindex from './IndexReindex.vue'
import RowMenuAction from './RowMenuAction.vue'
import { useConnectionStore } from '../../store/connection.ts'
const connectionStore = useConnectionStore()
const t = useTranslation()
const props = defineProps<IndexRowProps>()
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ export const setupClusterConnection = async (page: Page) => {
window.localStorage.setItem('theme', '{"dark":true}')
})

await page.goto('http://localhost:5173')
await page.goto('http://localhost:5175')
}

export const openElasticvue = page => {
return page.goto('http://localhost:5173/')
return page.goto('http://localhost:5175/')
}
24 changes: 12 additions & 12 deletions tests/e2e/tests/Routing.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ withElastic(({ mockElastic, elastic }) => {
test.describe('Routing', () => {
test.describe('empty state', () => {
test('redirects to /welcome', async ({ page }) => {
await page.goto('http://localhost:5173/')
await page.goto('http://localhost:5175/')
expect(page.url()).toContain('/welcome')
})

test('wrong url redirects to /welcome', async ({ page }) => {
await page.goto('http://localhost:5173/foo')
await page.goto('http://localhost:5175/foo')
expect(page.url()).toContain('/welcome')
})

test('wrong cluster id redirects to /welcome', async ({ page }) => {
await page.goto('http://localhost:5173/cluster/42')
await page.goto('http://localhost:5175/cluster/42')
expect(page.url()).toContain('/welcome')
})

test('can open /welcome', async ({ page }) => {
await page.goto('http://localhost:5173/welcome')
await page.goto('http://localhost:5175/welcome')
expect(page.url()).toContain('/welcome')
})
})
Expand All @@ -35,13 +35,13 @@ withElastic(({ mockElastic, elastic }) => {

test('cannot open /welcome', async ({ page }) => {
await setupClusterConnection(page)
await page.goto('http://localhost:5173/welcome')
await page.goto('http://localhost:5175/welcome')
expect(page.url()).not.toContain('/welcome')
})

test('welcome redirects to current cluster if cluster is correct', async ({ page }) => {
await setupClusterConnection(page)
await page.goto('http://localhost:5173/welcome')
await page.goto('http://localhost:5175/welcome')
expect(page.url()).toContain('/cluster/0')
})

Expand Down Expand Up @@ -72,7 +72,7 @@ withElastic(({ mockElastic, elastic }) => {
})

await mockElastic(page)
await page.goto('http://localhost:5173')
await page.goto('http://localhost:5175')
expect(page.url()).toContain('/cluster/1')
})

Expand Down Expand Up @@ -103,7 +103,7 @@ withElastic(({ mockElastic, elastic }) => {
})

await mockElastic(page)
await page.goto('http://localhost:5173')
await page.goto('http://localhost:5175')
expect(page.url()).toContain('/cluster/0')
})

Expand All @@ -119,17 +119,17 @@ withElastic(({ mockElastic, elastic }) => {
})

await mockElastic(page)
await page.goto('http://localhost:5173')
await page.goto('http://localhost:5175')
expect(page.url()).toContain('/welcome')
})

test('can access existing clusters', async ({ page }) => {
await setupClusterConnection(page)

await page.goto('http://localhost:5173/cluster/0')
await page.goto('http://localhost:5175/cluster/0')
expect(page.url()).toContain('/cluster/0')

await page.goto('http://localhost:5173/cluster/1')
await page.goto('http://localhost:5175/cluster/1')
expect(page.url()).toContain('/cluster/1')
})

Expand All @@ -139,7 +139,7 @@ withElastic(({ mockElastic, elastic }) => {
const invalids = [42, '42', true, 'true', 'hello', null, '']

for (const value of invalids) {
await page.goto(`http://localhost:5173/cluster/${value}`)
await page.goto(`http://localhost:5175/cluster/${value}`)
expect(page.url()).toContain('/cluster/0')
}
})
Expand Down

0 comments on commit dacde28

Please sign in to comment.