diff --git a/integtest.sh b/integtest.sh deleted file mode 100755 index 9081d879d..000000000 --- a/integtest.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/bash - -set -e - -function usage() { - echo "" - echo "This script is used to run integration tests for plugin installed on a remote OpenSearch/Dashboards cluster." - echo "--------------------------------------------------------------------------" - echo "Usage: $0 [args]" - echo "" - echo "Required arguments:" - echo "None" - echo "" - echo "Optional arguments:" - echo -e "-b BIND_ADDRESS\t, defaults to localhost | 127.0.0.1, can be changed to any IP or domain name for the cluster location." - echo -e "-p BIND_PORT\t, defaults to 9200 or 5601 depends on OpenSearch or Dashboards, can be changed to any port for the cluster location." - echo -e "-s SECURITY_ENABLED\t(true | false), defaults to true. Specify the OpenSearch/Dashboards have security enabled or not." - echo -e "-c CREDENTIAL\t(usename:password), no defaults, effective when SECURITY_ENABLED=true." - echo -e "-h\tPrint this message." - echo "--------------------------------------------------------------------------" -} - -while getopts ":hb:p:s:c:" arg; do - case $arg in - h) - usage - exit 1 - ;; - b) - BIND_ADDRESS=$OPTARG - ;; - p) - BIND_PORT=$OPTARG - ;; - s) - SECURITY_ENABLED=$OPTARG - ;; - c) - CREDENTIAL=$OPTARG - ;; - :) - echo "-${OPTARG} requires an argument" - usage - exit 1 - ;; - ?) - echo "Invalid option: -${OPTARG}" - exit 1 - ;; - esac -done - - -if [ -z "$BIND_ADDRESS" ] -then - BIND_ADDRESS="localhost" -fi - -if [ -z "$BIND_PORT" ] -then - BIND_PORT="5601" -fi - -if [ -z "$SECURITY_ENABLED" ] -then - SECURITY_ENABLED="true" -fi - -if [ -z "$CREDENTIAL" ] -then - CREDENTIAL="admin:admin" - USERNAME=`echo $CREDENTIAL | awk -F ':' '{print $1}'` - PASSWORD=`echo $CREDENTIAL | awk -F ':' '{print $2}'` -fi - -yarn osd bootstrap -cypress run --env security_enabled=$SECURITY_ENABLED opensearch_dashboards=${BIND_ADDRESS}:${BIND_PORT} diff --git a/public/pages/CreateDataStream/containers/BackingIndices/BackingIndices.tsx b/public/pages/CreateDataStream/containers/BackingIndices/BackingIndices.tsx index b7f327a83..9f941c933 100644 --- a/public/pages/CreateDataStream/containers/BackingIndices/BackingIndices.tsx +++ b/public/pages/CreateDataStream/containers/BackingIndices/BackingIndices.tsx @@ -103,7 +103,7 @@ export default function BackingIndices(props: SubDetailProps) { { field: "managed", name: "Managed by policy", - sortable: false, + sortable: true, truncateText: true, textOnly: true, render: renderNumber, diff --git a/public/pages/Indices/containers/Indices/__snapshots__/Indices.test.tsx.snap b/public/pages/Indices/containers/Indices/__snapshots__/Indices.test.tsx.snap index 6eba9f596..191b4b655 100644 --- a/public/pages/Indices/containers/Indices/__snapshots__/Indices.test.tsx.snap +++ b/public/pages/Indices/containers/Indices/__snapshots__/Indices.test.tsx.snap @@ -349,21 +349,29 @@ exports[` spec renders the component 1`] = ` - - Managed by policy + + Managed by policy + - + - +

Actions

diff --git a/public/pages/VisualCreatePolicy/components/States/__snapshots__/State.test.tsx.snap b/public/pages/VisualCreatePolicy/components/States/__snapshots__/State.test.tsx.snap index e602ff46a..aeade8c53 100644 --- a/public/pages/VisualCreatePolicy/components/States/__snapshots__/State.test.tsx.snap +++ b/public/pages/VisualCreatePolicy/components/States/__snapshots__/State.test.tsx.snap @@ -157,7 +157,6 @@ exports[` spec renders the component 1`] = ` >
spec renders the component 1`] = ` >
spec renders the component 1`] = ` >
{ + function customSort(array, key, sortDirection) { + return array.sort((a, b) => { let flag; - const aStatus = a.extraStatus as string; - const bStatus = b.extraStatus as string; + const aValue = a[key] as string; + const bValue = b[key] as string; + if (sortDirection === "asc") { - flag = aStatus < bStatus; + flag = aValue < bValue; } else { - flag = aStatus > bStatus; + flag = aValue > bValue; } return flag ? -1 : 1; }); } + if (sortField === "status") { + // add new more status to status field so we need to sort + customSort(indicesResponse, "extraStatus", sortDirection); + } + // Filtering out indices that belong to a data stream. This must be done before pagination. const filteredIndices = showDataStreams ? indicesResponse : indicesResponse.filter((index) => index.data_stream === null); @@ -169,17 +177,19 @@ export default class IndexService { const managedStatus = await this._getManagedStatus(request, indexNames); + const allIndices = paginatedIndices.map((catIndex: CatIndex) => ({ + ...catIndex, + managed: managedStatus[catIndex.index] ? "Yes" : "No", + managedPolicy: managedStatus[catIndex.index], + })); + // NOTE: Cannot use response.ok due to typescript type checking return response.custom({ statusCode: 200, body: { ok: true, response: { - indices: paginatedIndices.map((catIndex: CatIndex) => ({ - ...catIndex, - managed: managedStatus[catIndex.index] ? "Yes" : "No", - managedPolicy: managedStatus[catIndex.index], - })), + indices: sortField === "managed" ? customSort(allIndices, "managed", sortDirection) : allIndices, totalIndices: filteredIndices.length, }, },