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

add support for acknowledging a watch #36030

Merged
merged 2 commits into from May 6, 2019

Conversation

Projects
None yet
3 participants
@alisonelizabeth
Copy link
Contributor

commented May 3, 2019

This PR adds support for acknowledging a watch

Screenshots

Screen Shot 2019-05-03 at 9 40 01 AM

After acknowledged:
Screen Shot 2019-05-03 at 9 46 27 AM

Old UI (for reference):
Screen Shot 2019-05-02 at 8 41 39 AM

Testing

  1. Create an advanced watch with an action. For example, check the logs index for any errors.
{
  "trigger": {
    "schedule": {
      "interval": "15s"
    }
  },
  "input": {
    "search": {
      "request": {
        "search_type": "query_then_fetch",
        "indices": [
          "logs"
        ],
        "rest_total_hits_as_int": true,
        "body": {
          "query": {
            "match": {
              "message": "error"
            }
          }
        }
      }
    }
  },
  "condition": {
    "compare": {
      "ctx.payload.hits.total": {
        "gt": 0
      }
    }
  },
  "actions": {
    "log_error": {
      "logging": {
        "level": "error",
        "text": "Found {{ctx.payload.hits.total}} errors in the logs"
      }
    }
  }
}
  1. Add a document to the logs index with the console that contains an error to trigger the watch.
POST logs/_doc/1
{
  "timestamp": "2019-05-03T18:12:07.613Z",
  "request": "GET index.html",
  "status_code": 404,
  "message": "Error: File not found"
}
  1. Go back to watcher and view the details of the watch created. Note Acknowledge link in the table.
@elasticmachine

This comment has been minimized.

Copy link

commented May 3, 2019

Pinging @elastic/es-ui

@elasticmachine

This comment has been minimized.

Copy link

commented May 3, 2019

@alisonelizabeth alisonelizabeth force-pushed the alisonelizabeth:watcher-ack branch from 8231b0d to 541b3a0 May 3, 2019

@elasticmachine

This comment has been minimized.

Copy link

commented May 3, 2019

@cjcenizal
Copy link
Contributor

left a comment

Nice work! Tested locally, code LGTM. Had one minor suggestion.

];

const { error, data: watchDetail, isLoading } = loadWatchDetail(watchId);

const [actionStatuses, setActionStatuses] = useState<any[]>([]);
const [isActionStatusLoading, setIsActionStatusLoading] = useState<boolean>(false);

This comment has been minimized.

Copy link
@cjcenizal

cjcenizal May 3, 2019

Contributor

I think it'd be a little easier to follow if the variables used in the columns array were defined before columns is defined. At the same time, I think it makes sense to keep the hooks grouped together. How would you feel about moving all of the hooks to line 27, before pagination and columns are defined?

  const { error, data: watchDetail, isLoading } = loadWatchDetail(watchId);

  const [actionStatuses, setActionStatuses] = useState<any[]>([]);
  const [isActionStatusLoading, setIsActionStatusLoading] = useState<boolean>(false);

  useEffect(
    () => {
      if (watchDetail) {
        setActionStatuses(watchDetail.watchStatus.actionStatuses);
      }
    },
    [watchDetail]
  );

This comment has been minimized.

Copy link
@alisonelizabeth

alisonelizabeth May 6, 2019

Author Contributor

yeah, that makes sense. fixed.

alisonelizabeth added some commits May 2, 2019

@alisonelizabeth alisonelizabeth force-pushed the alisonelizabeth:watcher-ack branch from 541b3a0 to d4946c8 May 6, 2019

@elasticmachine

This comment has been minimized.

Copy link

commented May 6, 2019

@alisonelizabeth

This comment has been minimized.

Copy link
Contributor Author

commented May 6, 2019

retest

@elasticmachine

This comment has been minimized.

Copy link

commented May 6, 2019

@alisonelizabeth alisonelizabeth merged commit 52bbb7b into elastic:watcher-port May 6, 2019

43 checks passed

API integration tests node scripts/functional_tests --config test/api_integration/config.js --bail --debug
Details
Browser tests yarn run grunt test:browser-ci
Details
Build kbn_tp_sample_panel_action yarn build
Details
CLA All commits in pull request signed
Details
Check core API changes node scripts/check_core_api_changes
Details
Check file casing node scripts/check_file_casing --quiet
Details
Functional tests / Group 1 yarn run grunt run:functionalTests_ciGroup1
Details
Functional tests / Group 10 yarn run grunt run:functionalTests_ciGroup10
Details
Functional tests / Group 11 yarn run grunt run:functionalTests_ciGroup11
Details
Functional tests / Group 12 yarn run grunt run:functionalTests_ciGroup12
Details
Functional tests / Group 2 yarn run grunt run:functionalTests_ciGroup2
Details
Functional tests / Group 3 yarn run grunt run:functionalTests_ciGroup3
Details
Functional tests / Group 4 yarn run grunt run:functionalTests_ciGroup4
Details
Functional tests / Group 5 yarn run grunt run:functionalTests_ciGroup5
Details
Functional tests / Group 6 yarn run grunt run:functionalTests_ciGroup6
Details
Functional tests / Group 7 yarn run grunt run:functionalTests_ciGroup7
Details
Functional tests / Group 8 yarn run grunt run:functionalTests_ciGroup8
Details
Functional tests / Group 9 yarn run grunt run:functionalTests_ciGroup9
Details
Internationalization check node scripts/i18n_check --ignore-missing
Details
Interpreter functional tests node scripts/functional_tests --config test/interpreter_functional/config.js --bail --debug --kibana-install-dir ./build/oss/kibana-8.0.0-SNAPSHOT-linux-x86_64
Details
Jest integration tests yarn run grunt test:jest_integration
Details
Jest tests yarn run grunt test:jest
Details
Licenses yarn run grunt licenses
Details
Mocha tests node scripts/mocha
Details
Plugin functional tests node scripts/functional_tests --config test/plugin_functional/config.js --bail --debug --kibana-install-dir ./build/oss/kibana-8.0.0-SNAPSHOT-linux-x86_64
Details
Project tests yarn run grunt test:projects
Details
Server tests yarn run grunt test:server
Details
Type check node scripts/type_check
Details
TypeScript - all files belong to a TypeScript project node scripts/check_ts_projects
Details
Verify NOTICE.txt node scripts/notice --validate
Details
Verify dependency versions yarn run grunt verifyDependencyVersions
Details
X-Pack Functional tests / Group 1 node scripts/functional_tests --debug --bail --kibana-install-dir /var/lib/jenkins/workspace/elastic+kibana+pull-request/JOB/x-pack-ciGroup1/node/immutable/install/kibana --include-tag ciGroup1
Details
X-Pack Functional tests / Group 2 node scripts/functional_tests --debug --bail --kibana-install-dir /var/lib/jenkins/workspace/elastic+kibana+pull-request/JOB/x-pack-ciGroup2/node/immutable/install/kibana --include-tag ciGroup2
Details
X-Pack Functional tests / Group 3 node scripts/functional_tests --debug --bail --kibana-install-dir /var/lib/jenkins/workspace/elastic+kibana+pull-request/JOB/x-pack-ciGroup3/node/immutable/install/kibana --include-tag ciGroup3
Details
X-Pack Functional tests / Group 4 node scripts/functional_tests --debug --bail --kibana-install-dir /var/lib/jenkins/workspace/elastic+kibana+pull-request/JOB/x-pack-ciGroup4/node/immutable/install/kibana --include-tag ciGroup4
Details
X-Pack Functional tests / Group 5 node scripts/functional_tests --debug --bail --kibana-install-dir /var/lib/jenkins/workspace/elastic+kibana+pull-request/JOB/x-pack-ciGroup5/node/immutable/install/kibana --include-tag ciGroup5
Details
X-Pack Functional tests / Group 6 node scripts/functional_tests --debug --bail --kibana-install-dir /var/lib/jenkins/workspace/elastic+kibana+pull-request/JOB/x-pack-ciGroup6/node/immutable/install/kibana --include-tag ciGroup6
Details
X-Pack Functional tests / Group 7 node scripts/functional_tests --debug --bail --kibana-install-dir /var/lib/jenkins/workspace/elastic+kibana+pull-request/JOB/x-pack-ciGroup7/node/immutable/install/kibana --include-tag ciGroup7
Details
X-Pack Jest node scripts/jest --ci --no-cache --verbose
Details
X-Pack Mocha yarn test
Details
eslint node scripts/eslint --no-cache
Details
kibana-ci Build finished.
Details
sasslint node scripts/sasslint
Details

@alisonelizabeth alisonelizabeth deleted the alisonelizabeth:watcher-ack branch May 6, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.