diff --git a/.github/workflows/cypress-workflow.yml b/.github/workflows/cypress-workflow.yml index 956501d3..4af087c3 100644 --- a/.github/workflows/cypress-workflow.yml +++ b/.github/workflows/cypress-workflow.yml @@ -38,7 +38,7 @@ jobs: - name: Get Kibana version id: kibana_version run: | - echo "::set-output name=kibana_version::$(node -p "(require('./index-management-kibana-plugin/package.json').kibana.version).match(/[.0-9]+/)[0]")" + echo "::set-output name=kibana_version::$(node -p "(require('./index-management-kibana-plugin/kibana.json').kibanaVersion).match(/[.0-9]+/)[0]")" - name: Checkout Kibana uses: actions/checkout@v2 with: @@ -69,16 +69,17 @@ jobs: yarn kbn bootstrap - name: Run kibana server run: | - cd kibana/plugins/index-management-kibana-plugin + cd kibana yarn start --no-base-path --no-watch & sleep 300 # timeout 300 bash -c 'while [[ "$(curl -s localhost:5601/api/status | jq -r '.status.overall.state')" != "green" ]]; do sleep 5; done' # for now just chrome, use matrix to do all browsers later - name: Cypress tests - uses: cypress-io/github-action@v1 + uses: cypress-io/github-action@v2 with: working-directory: kibana/plugins/index-management-kibana-plugin command: yarn run cypress run + wait-on: 'http://localhost:5601' browser: chrome # Screenshots are only captured on failure, will change this once we do visual regression tests - uses: actions/upload-artifact@v1 diff --git a/.github/workflows/release-workflow.yml b/.github/workflows/release-workflow.yml index 4cb2b5dd..2ac0994e 100644 --- a/.github/workflows/release-workflow.yml +++ b/.github/workflows/release-workflow.yml @@ -17,7 +17,7 @@ jobs: - name: Get Kibana version id: kibana_version run: | - echo "::set-output name=kibana_version::$(node -p "(require('./index-management-kibana-plugin/package.json').kibana.version).match(/[.0-9]+/)[0]")" + echo "::set-output name=kibana_version::$(node -p "(require('./index-management-kibana-plugin/kibana.json').kibanaVersion).match(/[.0-9]+/)[0]")" - name: Checkout Kibana uses: actions/checkout@v2 with: diff --git a/.github/workflows/unit-tests-workflow.yml b/.github/workflows/unit-tests-workflow.yml index da5a8211..bf8b42a8 100644 --- a/.github/workflows/unit-tests-workflow.yml +++ b/.github/workflows/unit-tests-workflow.yml @@ -16,7 +16,7 @@ jobs: - name: Get Kibana version id: kibana_version run: | - echo "::set-output name=kibana_version::$(node -p "(require('./index-management-kibana-plugin/package.json').kibana.version).match(/[.0-9]+/)[0]")" + echo "::set-output name=kibana_version::$(node -p "(require('./index-management-kibana-plugin/kibana.json').kibanaVersion).match(/[.0-9]+/)[0]")" - name: Checkout Kibana uses: actions/checkout@v2 with: diff --git a/cypress/integration/indices_spec.js b/cypress/integration/indices_spec.js index 560565a6..47be1ae3 100644 --- a/cypress/integration/indices_spec.js +++ b/cypress/integration/indices_spec.js @@ -80,7 +80,10 @@ describe("Indices", () => { // Click apply policy button cy.get(`[data-test-subj="Apply policyButton"]`).click({ force: true }); - cy.get(`input[data-test-subj="comboBoxSearchInput"]`).focus().type(POLICY_ID, { parseSpecialCharSequences: false, delay: 1 }); + cy.get(`input[data-test-subj="comboBoxSearchInput"]`).focus().type(POLICY_ID, { + parseSpecialCharSequences: false, + delay: 1, + }); // Click the policy option cy.get(`button[role="option"]`).first().click({ force: true }); diff --git a/public/pages/Indices/components/ApplyPolicyModal/ApplyPolicyModal.tsx b/public/pages/Indices/components/ApplyPolicyModal/ApplyPolicyModal.tsx index 2e5acc3f..f59f0be9 100644 --- a/public/pages/Indices/components/ApplyPolicyModal/ApplyPolicyModal.tsx +++ b/public/pages/Indices/components/ApplyPolicyModal/ApplyPolicyModal.tsx @@ -149,7 +149,7 @@ export default class ApplyPolicyModal extends Component rollup._id).join(","); - const explainResponse = await this.explainRollup(context, request, response, ids); - if (explainResponse.payload.ok) { - rollups.map((item) => { - item.metadata = explainResponse.payload.response[item._id]; - }); - return response.custom({ - statusCode: 200, - body: { ok: true, response: { rollups: rollups, totalRollups: totalRollups, metadata: explainResponse } }, - }); - } else - return response.custom({ - statusCode: 200, - body: { ok: false, error: explainResponse.payload.error }, - }); + if (totalRollups) { + const ids = rollups.map((rollup) => rollup._id).join(","); + const explainResponse = await this.explainRollup(context, request, response, ids); + if (explainResponse.payload.ok) { + rollups.map((item) => { + item.metadata = explainResponse.payload.response[item._id]; + }); + return response.custom({ + statusCode: 200, + body: { ok: true, response: { rollups: rollups, totalRollups: totalRollups, metadata: explainResponse } }, + }); + } else + return response.custom({ + statusCode: 200, + body: { ok: false, error: explainResponse.payload.error }, + }); + } + return response.custom({ + statusCode: 200, + body: { ok: true, response: { rollups: rollups, totalRollups: totalRollups, metadata: {} } }, + }); } catch (err) { if (err.statusCode === 404 && err.body.error.type === "index_not_found_exception") { return response.custom({