diff --git a/package-lock.json b/package-lock.json index 6831a778657..6214beb1f03 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,7 @@ "@babel/core": "7.16.0", "@babel/parser": "7.16.0", "@mongodb-js/monorepo-tools": "^1.1.1", - "@mongodb-js/sbom-tools": "^0.5.2", + "@mongodb-js/sbom-tools": "^0.5.3", "@testing-library/dom": "^8.11.1", "babel-loader": "^7.1.5", "husky": "^8.0.3", @@ -13606,6 +13606,15 @@ "@types/chai": "*" } }, + "node_modules/@types/cheerio": { + "version": "0.22.32", + "resolved": "https://registry.npmjs.org/@types/cheerio/-/cheerio-0.22.32.tgz", + "integrity": "sha512-4RrpCp5ufWTLb6/1RCOjazRhUM6DTD79l763det29n8kLmPB7XeN46cxlUf2GsSF+0g6CbWT5nYl8C/Gs15bdg==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/clean-css": { "version": "4.2.5", "resolved": "https://registry.npmjs.org/@types/clean-css/-/clean-css-4.2.5.tgz", @@ -13675,6 +13684,27 @@ "@types/ms": "*" } }, + "node_modules/@types/enzyme": { + "version": "3.10.14", + "resolved": "https://registry.npmjs.org/@types/enzyme/-/enzyme-3.10.14.tgz", + "integrity": "sha512-JeTG2MNUX1bH2DqccwUe3SuPoLu+kUz5UgR3Tvl9nBdfNj7rBZscytctSjEatd5Ul9GXXGKaQBaxODIgJYVRqA==", + "dev": true, + "dependencies": { + "@types/cheerio": "*", + "@types/react": "^16" + } + }, + "node_modules/@types/enzyme/node_modules/@types/react": { + "version": "16.14.47", + "resolved": "https://registry.npmjs.org/@types/react/-/react-16.14.47.tgz", + "integrity": "sha512-m0EmmY73mbQegA+aqo0+O/hHU9iTi+hNYotJ3cM4sLFox8NqZv3XVXQhhqpd3YH6YC7h+YIyJFd36O5KlaJLCA==", + "dev": true, + "dependencies": { + "@types/prop-types": "*", + "@types/scheduler": "*", + "csstype": "^3.0.2" + } + }, "node_modules/@types/eslint": { "version": "7.28.0", "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-7.28.0.tgz", @@ -45935,7 +45965,7 @@ "@mongodb-js/webpack-config-compass": "^1.2.0", "@testing-library/react": "^12.1.4", "@testing-library/user-event": "^13.5.0", - "@types/d3": "3.5.x", + "@types/d3": "^3.5.x", "@types/d3-flextree": "^2.1.0", "@types/d3-hierarchy": "^3.1.2", "chai": "^4.2.0", @@ -47139,8 +47169,13 @@ "@mongodb-js/compass-logging": "^1.2.0" }, "devDependencies": { + "@mongodb-js/eslint-config-compass": "^1.0.9", "@mongodb-js/mocha-config-compass": "^1.3.1", + "@mongodb-js/prettier-config-compass": "^1.0.1", + "@mongodb-js/tsconfig-compass": "^1.0.3", "@mongodb-js/webpack-config-compass": "^1.2.0", + "@types/d3": "^3.5.x", + "@types/enzyme": "^3.10.14", "chai": "^4.1.2", "d3": "^3.5.17", "d3-timer": "^1.0.3", @@ -47149,8 +47184,6 @@ "electron-mocha": "^10.1.0", "enzyme": "^3.11.0", "eslint": "^7.25.0", - "eslint-config-mongodb-js": "^2.1.0", - "eslint-plugin-react": "^7.24.0", "hadron-app": "^5.11.0", "hadron-app-registry": "^9.0.10", "lodash": "^4.17.21", @@ -47169,582 +47202,12 @@ "react": "^17.0.2" } }, - "packages/compass-serverstats/node_modules/acorn": { - "version": "5.7.4", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.4.tgz", - "integrity": "sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg==", - "dev": true, - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "packages/compass-serverstats/node_modules/acorn-jsx": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz", - "integrity": "sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s=", - "dev": true, - "dependencies": { - "acorn": "^3.0.4" - } - }, - "packages/compass-serverstats/node_modules/acorn-jsx/node_modules/acorn": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz", - "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=", - "dev": true, - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "packages/compass-serverstats/node_modules/ajv": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", - "integrity": "sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY=", - "dev": true, - "dependencies": { - "co": "^4.6.0", - "json-stable-stringify": "^1.0.1" - } - }, - "packages/compass-serverstats/node_modules/ajv-keywords": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-1.5.1.tgz", - "integrity": "sha1-MU3QpLM2j609/NxU7eYXG4htrzw=", - "dev": true, - "peerDependencies": { - "ajv": ">=4.10.0" - } - }, - "packages/compass-serverstats/node_modules/ansi-escapes": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-1.4.0.tgz", - "integrity": "sha1-06ioOzGapneTZisT52HHkRQiMG4=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "packages/compass-serverstats/node_modules/ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "packages/compass-serverstats/node_modules/chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true, - "dependencies": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "packages/compass-serverstats/node_modules/chalk/node_modules/supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true, - "engines": { - "node": ">=0.8.0" - } - }, - "packages/compass-serverstats/node_modules/cli-cursor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-1.0.2.tgz", - "integrity": "sha1-ZNo/fValRBLll5S9Ytw1KV6PKYc=", - "dev": true, - "dependencies": { - "restore-cursor": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "packages/compass-serverstats/node_modules/cli-width": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.1.tgz", - "integrity": "sha512-GRMWDxpOB6Dgk2E5Uo+3eEBvtOOlimMmpbFiKuLFnQzYDavtLFY3K5ona41jgN/WdRZtG7utuVSVTL4HbZHGkw==", - "dev": true - }, - "packages/compass-serverstats/node_modules/doctrine": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", - "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", - "dev": true, - "dependencies": { - "esutils": "^2.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "packages/compass-serverstats/node_modules/eslint-config-mongodb-js": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/eslint-config-mongodb-js/-/eslint-config-mongodb-js-2.3.0.tgz", - "integrity": "sha512-9zxJawyp68GNX63pfqeLV47/ShSyY7Hce3l/XhrD8dihFhygs+5C7lk12ogDePK3OmOer1pREvwgR8q0YvV4Pw==", - "dev": true, - "dependencies": { - "babel-eslint": "^7.1.0", - "eslint": "^3.3.1", - "eslint-plugin-chai-friendly": "^0.4.0", - "eslint-plugin-react": "^6.1.2" - } - }, - "packages/compass-serverstats/node_modules/eslint-config-mongodb-js/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "dependencies": { - "ms": "2.0.0" - } - }, - "packages/compass-serverstats/node_modules/eslint-config-mongodb-js/node_modules/eslint": { - "version": "3.19.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-3.19.0.tgz", - "integrity": "sha1-yPxiAcf0DdCJQbh8CFdnOGpnmsw=", - "dev": true, - "dependencies": { - "babel-code-frame": "^6.16.0", - "chalk": "^1.1.3", - "concat-stream": "^1.5.2", - "debug": "^2.1.1", - "doctrine": "^2.0.0", - "escope": "^3.6.0", - "espree": "^3.4.0", - "esquery": "^1.0.0", - "estraverse": "^4.2.0", - "esutils": "^2.0.2", - "file-entry-cache": "^2.0.0", - "glob": "^7.0.3", - "globals": "^9.14.0", - "ignore": "^3.2.0", - "imurmurhash": "^0.1.4", - "inquirer": "^0.12.0", - "is-my-json-valid": "^2.10.0", - "is-resolvable": "^1.0.0", - "js-yaml": "^3.5.1", - "json-stable-stringify": "^1.0.0", - "levn": "^0.3.0", - "lodash": "^4.0.0", - "mkdirp": "^0.5.0", - "natural-compare": "^1.4.0", - "optionator": "^0.8.2", - "path-is-inside": "^1.0.1", - "pluralize": "^1.2.1", - "progress": "^1.1.8", - "require-uncached": "^1.0.2", - "shelljs": "^0.7.5", - "strip-bom": "^3.0.0", - "strip-json-comments": "~2.0.1", - "table": "^3.7.8", - "text-table": "~0.2.0", - "user-home": "^2.0.0" - }, - "bin": { - "eslint": "bin/eslint.js" - }, - "engines": { - "node": ">=4" - } - }, - "packages/compass-serverstats/node_modules/eslint-config-mongodb-js/node_modules/eslint-plugin-react": { - "version": "6.10.3", - "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-6.10.3.tgz", - "integrity": "sha1-xUNb6wZ3ThLH2y9qut3L+QDNP3g=", - "dev": true, - "dependencies": { - "array.prototype.find": "^2.0.1", - "doctrine": "^1.2.2", - "has": "^1.0.1", - "jsx-ast-utils": "^1.3.4", - "object.assign": "^4.0.4" - }, - "engines": { - "node": ">=0.10" - }, - "peerDependencies": { - "eslint": "^2.0.0 || ^3.0.0" - } - }, - "packages/compass-serverstats/node_modules/eslint-config-mongodb-js/node_modules/eslint-plugin-react/node_modules/doctrine": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", - "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=", - "dev": true, - "dependencies": { - "esutils": "^2.0.2", - "isarray": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "packages/compass-serverstats/node_modules/espree": { - "version": "3.5.4", - "resolved": "https://registry.npmjs.org/espree/-/espree-3.5.4.tgz", - "integrity": "sha512-yAcIQxtmMiB/jL32dzEp2enBeidsB7xWPLNiw3IIkpVds1P+h7qF9YwJq1yUNzp2OKXgAprs4F61ih66UsoD1A==", - "dev": true, - "dependencies": { - "acorn": "^5.5.0", - "acorn-jsx": "^3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "packages/compass-serverstats/node_modules/figures": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", - "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=", - "dev": true, - "dependencies": { - "escape-string-regexp": "^1.0.5", - "object-assign": "^4.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "packages/compass-serverstats/node_modules/file-entry-cache": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz", - "integrity": "sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E=", - "dev": true, - "dependencies": { - "flat-cache": "^1.2.1", - "object-assign": "^4.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "packages/compass-serverstats/node_modules/flat-cache": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.3.4.tgz", - "integrity": "sha512-VwyB3Lkgacfik2vhqR4uv2rvebqmDvFu4jlN/C1RzWoJEo8I7z4Q404oiqYCkq41mni8EzQnm95emU9seckwtg==", - "dev": true, - "dependencies": { - "circular-json": "^0.3.1", - "graceful-fs": "^4.1.2", - "rimraf": "~2.6.2", - "write": "^0.2.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "packages/compass-serverstats/node_modules/globals": { - "version": "9.18.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", - "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "packages/compass-serverstats/node_modules/ignore": { - "version": "3.3.10", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.10.tgz", - "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==", + "packages/compass-serverstats/node_modules/@types/d3": { + "version": "3.5.49", + "resolved": "https://registry.npmjs.org/@types/d3/-/d3-3.5.49.tgz", + "integrity": "sha512-khhSZi6pn4K/7ReH264ZSsD4/yzWZpHDph9yqjILGnwJabm2lTH4lkjHqn4LyELN9bkFul7VLD7j3NjHDvkquQ==", "dev": true }, - "packages/compass-serverstats/node_modules/inquirer": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-0.12.0.tgz", - "integrity": "sha1-HvK/1jUE3wvHV4X/+MLEHfEvB34=", - "dev": true, - "dependencies": { - "ansi-escapes": "^1.1.0", - "ansi-regex": "^2.0.0", - "chalk": "^1.0.0", - "cli-cursor": "^1.0.1", - "cli-width": "^2.0.0", - "figures": "^1.3.5", - "lodash": "^4.3.0", - "readline2": "^1.0.1", - "run-async": "^0.1.0", - "rx-lite": "^3.1.2", - "string-width": "^1.0.1", - "strip-ansi": "^3.0.0", - "through": "^2.3.6" - } - }, - "packages/compass-serverstats/node_modules/is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dev": true, - "dependencies": { - "number-is-nan": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "packages/compass-serverstats/node_modules/jsx-ast-utils": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-1.4.1.tgz", - "integrity": "sha1-OGchPo3Xm/Ho8jAMDPwe+xgsDfE=", - "dev": true, - "engines": { - "node": ">=4.0" - } - }, - "packages/compass-serverstats/node_modules/levn": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", - "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", - "dev": true, - "dependencies": { - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "packages/compass-serverstats/node_modules/minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true - }, - "packages/compass-serverstats/node_modules/mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "deprecated": "Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)", - "dev": true, - "dependencies": { - "minimist": "0.0.8" - }, - "bin": { - "mkdirp": "bin/cmd.js" - } - }, - "packages/compass-serverstats/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, - "packages/compass-serverstats/node_modules/onetime": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", - "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "packages/compass-serverstats/node_modules/optionator": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", - "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", - "dev": true, - "dependencies": { - "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.6", - "levn": "~0.3.0", - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2", - "word-wrap": "~1.2.3" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "packages/compass-serverstats/node_modules/prelude-ls": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", - "dev": true, - "engines": { - "node": ">= 0.8.0" - } - }, - "packages/compass-serverstats/node_modules/progress": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz", - "integrity": "sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74=", - "dev": true, - "engines": { - "node": ">=0.4.0" - } - }, - "packages/compass-serverstats/node_modules/restore-cursor": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-1.0.1.tgz", - "integrity": "sha1-NGYfRohjJ/7SmRR5FSJS35LapUE=", - "dev": true, - "dependencies": { - "exit-hook": "^1.0.0", - "onetime": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "packages/compass-serverstats/node_modules/rimraf": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", - "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", - "dev": true, - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - } - }, - "packages/compass-serverstats/node_modules/run-async": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/run-async/-/run-async-0.1.0.tgz", - "integrity": "sha1-yK1KXhEGYeQCp9IbUw4AnyX444k=", - "dev": true, - "dependencies": { - "once": "^1.3.0" - } - }, - "packages/compass-serverstats/node_modules/slice-ansi": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-0.0.4.tgz", - "integrity": "sha1-7b+JA/ZvfOL46v1s7tZeJkyDGzU=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "packages/compass-serverstats/node_modules/string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true, - "dependencies": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "packages/compass-serverstats/node_modules/strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "packages/compass-serverstats/node_modules/strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "packages/compass-serverstats/node_modules/table": { - "version": "3.8.3", - "resolved": "https://registry.npmjs.org/table/-/table-3.8.3.tgz", - "integrity": "sha1-K7xULw/amGGnVdOUf+/Ys/UThV8=", - "dev": true, - "dependencies": { - "ajv": "^4.7.0", - "ajv-keywords": "^1.0.0", - "chalk": "^1.1.1", - "lodash": "^4.0.0", - "slice-ansi": "0.0.4", - "string-width": "^2.0.0" - } - }, - "packages/compass-serverstats/node_modules/table/node_modules/ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "packages/compass-serverstats/node_modules/table/node_modules/is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "packages/compass-serverstats/node_modules/table/node_modules/string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "dependencies": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "packages/compass-serverstats/node_modules/table/node_modules/strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "dependencies": { - "ansi-regex": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "packages/compass-serverstats/node_modules/type-check": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", - "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", - "dev": true, - "dependencies": { - "prelude-ls": "~1.1.2" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "packages/compass-serverstats/node_modules/write": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/write/-/write-0.2.1.tgz", - "integrity": "sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c=", - "dev": true, - "dependencies": { - "mkdirp": "^0.5.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, "packages/compass-settings": { "name": "@mongodb-js/compass-settings", "version": "0.16.0", @@ -59426,7 +58889,7 @@ "@mongodb-js/webpack-config-compass": "^1.2.0", "@testing-library/react": "^12.1.4", "@testing-library/user-event": "^13.5.0", - "@types/d3": "3.5.x", + "@types/d3": "^3.5.x", "@types/d3-flextree": "^2.1.0", "@types/d3-hierarchy": "^3.1.2", "chai": "^4.2.0", @@ -60523,8 +59986,13 @@ "requires": { "@mongodb-js/compass-components": "^1.14.0", "@mongodb-js/compass-logging": "^1.2.0", + "@mongodb-js/eslint-config-compass": "^1.0.9", "@mongodb-js/mocha-config-compass": "^1.3.1", + "@mongodb-js/prettier-config-compass": "^1.0.1", + "@mongodb-js/tsconfig-compass": "^1.0.3", "@mongodb-js/webpack-config-compass": "^1.2.0", + "@types/d3": "^3.5.x", + "@types/enzyme": "^3.10.14", "chai": "^4.1.2", "d3": "^3.5.17", "d3-timer": "^1.0.3", @@ -60533,8 +60001,6 @@ "electron-mocha": "^10.1.0", "enzyme": "^3.11.0", "eslint": "^7.25.0", - "eslint-config-mongodb-js": "^2.1.0", - "eslint-plugin-react": "^7.24.0", "hadron-app": "^5.11.0", "hadron-app-registry": "^9.0.10", "lodash": "^4.17.21", @@ -60548,467 +60014,11 @@ "xvfb-maybe": "^0.2.1" }, "dependencies": { - "acorn": { - "version": "5.7.4", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.4.tgz", - "integrity": "sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg==", - "dev": true - }, - "acorn-jsx": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz", - "integrity": "sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s=", - "dev": true, - "requires": { - "acorn": "^3.0.4" - }, - "dependencies": { - "acorn": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz", - "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=", - "dev": true - } - } - }, - "ajv": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", - "integrity": "sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY=", - "dev": true, - "requires": { - "co": "^4.6.0", - "json-stable-stringify": "^1.0.1" - } - }, - "ajv-keywords": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-1.5.1.tgz", - "integrity": "sha1-MU3QpLM2j609/NxU7eYXG4htrzw=", - "dev": true - }, - "ansi-escapes": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-1.4.0.tgz", - "integrity": "sha1-06ioOzGapneTZisT52HHkRQiMG4=", - "dev": true - }, - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true, - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - }, - "dependencies": { - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true - } - } - }, - "cli-cursor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-1.0.2.tgz", - "integrity": "sha1-ZNo/fValRBLll5S9Ytw1KV6PKYc=", - "dev": true, - "requires": { - "restore-cursor": "^1.0.1" - } - }, - "cli-width": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.1.tgz", - "integrity": "sha512-GRMWDxpOB6Dgk2E5Uo+3eEBvtOOlimMmpbFiKuLFnQzYDavtLFY3K5ona41jgN/WdRZtG7utuVSVTL4HbZHGkw==", - "dev": true - }, - "doctrine": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", - "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", - "dev": true, - "requires": { - "esutils": "^2.0.2" - } - }, - "eslint-config-mongodb-js": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/eslint-config-mongodb-js/-/eslint-config-mongodb-js-2.3.0.tgz", - "integrity": "sha512-9zxJawyp68GNX63pfqeLV47/ShSyY7Hce3l/XhrD8dihFhygs+5C7lk12ogDePK3OmOer1pREvwgR8q0YvV4Pw==", - "dev": true, - "requires": { - "babel-eslint": "^7.1.0", - "eslint": "^3.3.1", - "eslint-plugin-chai-friendly": "^0.4.0", - "eslint-plugin-react": "^6.1.2" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "eslint": { - "version": "3.19.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-3.19.0.tgz", - "integrity": "sha1-yPxiAcf0DdCJQbh8CFdnOGpnmsw=", - "dev": true, - "requires": { - "babel-code-frame": "^6.16.0", - "chalk": "^1.1.3", - "concat-stream": "^1.5.2", - "debug": "^2.1.1", - "doctrine": "^2.0.0", - "escope": "^3.6.0", - "espree": "^3.4.0", - "esquery": "^1.0.0", - "estraverse": "^4.2.0", - "esutils": "^2.0.2", - "file-entry-cache": "^2.0.0", - "glob": "^7.0.3", - "globals": "^9.14.0", - "ignore": "^3.2.0", - "imurmurhash": "^0.1.4", - "inquirer": "^0.12.0", - "is-my-json-valid": "^2.10.0", - "is-resolvable": "^1.0.0", - "js-yaml": "^3.5.1", - "json-stable-stringify": "^1.0.0", - "levn": "^0.3.0", - "lodash": "^4.0.0", - "mkdirp": "^0.5.0", - "natural-compare": "^1.4.0", - "optionator": "^0.8.2", - "path-is-inside": "^1.0.1", - "pluralize": "^1.2.1", - "progress": "^1.1.8", - "require-uncached": "^1.0.2", - "shelljs": "^0.7.5", - "strip-bom": "^3.0.0", - "strip-json-comments": "~2.0.1", - "table": "^3.7.8", - "text-table": "~0.2.0", - "user-home": "^2.0.0" - } - }, - "eslint-plugin-react": { - "version": "6.10.3", - "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-6.10.3.tgz", - "integrity": "sha1-xUNb6wZ3ThLH2y9qut3L+QDNP3g=", - "dev": true, - "requires": { - "array.prototype.find": "^2.0.1", - "doctrine": "^1.2.2", - "has": "^1.0.1", - "jsx-ast-utils": "^1.3.4", - "object.assign": "^4.0.4" - }, - "dependencies": { - "doctrine": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", - "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=", - "dev": true, - "requires": { - "esutils": "^2.0.2", - "isarray": "^1.0.0" - } - } - } - } - } - }, - "espree": { - "version": "3.5.4", - "resolved": "https://registry.npmjs.org/espree/-/espree-3.5.4.tgz", - "integrity": "sha512-yAcIQxtmMiB/jL32dzEp2enBeidsB7xWPLNiw3IIkpVds1P+h7qF9YwJq1yUNzp2OKXgAprs4F61ih66UsoD1A==", - "dev": true, - "requires": { - "acorn": "^5.5.0", - "acorn-jsx": "^3.0.0" - } - }, - "figures": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", - "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=", - "dev": true, - "requires": { - "escape-string-regexp": "^1.0.5", - "object-assign": "^4.1.0" - } - }, - "file-entry-cache": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz", - "integrity": "sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E=", - "dev": true, - "requires": { - "flat-cache": "^1.2.1", - "object-assign": "^4.0.1" - } - }, - "flat-cache": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.3.4.tgz", - "integrity": "sha512-VwyB3Lkgacfik2vhqR4uv2rvebqmDvFu4jlN/C1RzWoJEo8I7z4Q404oiqYCkq41mni8EzQnm95emU9seckwtg==", - "dev": true, - "requires": { - "circular-json": "^0.3.1", - "graceful-fs": "^4.1.2", - "rimraf": "~2.6.2", - "write": "^0.2.1" - } - }, - "globals": { - "version": "9.18.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", - "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", - "dev": true - }, - "ignore": { - "version": "3.3.10", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.10.tgz", - "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==", - "dev": true - }, - "inquirer": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-0.12.0.tgz", - "integrity": "sha1-HvK/1jUE3wvHV4X/+MLEHfEvB34=", - "dev": true, - "requires": { - "ansi-escapes": "^1.1.0", - "ansi-regex": "^2.0.0", - "chalk": "^1.0.0", - "cli-cursor": "^1.0.1", - "cli-width": "^2.0.0", - "figures": "^1.3.5", - "lodash": "^4.3.0", - "readline2": "^1.0.1", - "run-async": "^0.1.0", - "rx-lite": "^3.1.2", - "string-width": "^1.0.1", - "strip-ansi": "^3.0.0", - "through": "^2.3.6" - } - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dev": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "jsx-ast-utils": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-1.4.1.tgz", - "integrity": "sha1-OGchPo3Xm/Ho8jAMDPwe+xgsDfE=", - "dev": true - }, - "levn": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", - "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", - "dev": true, - "requires": { - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2" - } - }, - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true - }, - "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true, - "requires": { - "minimist": "0.0.8" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, - "onetime": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", - "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=", - "dev": true - }, - "optionator": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", - "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", - "dev": true, - "requires": { - "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.6", - "levn": "~0.3.0", - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2", - "word-wrap": "~1.2.3" - } - }, - "prelude-ls": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", - "dev": true - }, - "progress": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz", - "integrity": "sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74=", - "dev": true - }, - "restore-cursor": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-1.0.1.tgz", - "integrity": "sha1-NGYfRohjJ/7SmRR5FSJS35LapUE=", - "dev": true, - "requires": { - "exit-hook": "^1.0.0", - "onetime": "^1.0.0" - } - }, - "rimraf": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", - "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - }, - "run-async": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/run-async/-/run-async-0.1.0.tgz", - "integrity": "sha1-yK1KXhEGYeQCp9IbUw4AnyX444k=", - "dev": true, - "requires": { - "once": "^1.3.0" - } - }, - "slice-ansi": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-0.0.4.tgz", - "integrity": "sha1-7b+JA/ZvfOL46v1s7tZeJkyDGzU=", - "dev": true - }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true, - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", - "dev": true - }, - "strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "@types/d3": { + "version": "3.5.49", + "resolved": "https://registry.npmjs.org/@types/d3/-/d3-3.5.49.tgz", + "integrity": "sha512-khhSZi6pn4K/7ReH264ZSsD4/yzWZpHDph9yqjILGnwJabm2lTH4lkjHqn4LyELN9bkFul7VLD7j3NjHDvkquQ==", "dev": true - }, - "table": { - "version": "3.8.3", - "resolved": "https://registry.npmjs.org/table/-/table-3.8.3.tgz", - "integrity": "sha1-K7xULw/amGGnVdOUf+/Ys/UThV8=", - "dev": true, - "requires": { - "ajv": "^4.7.0", - "ajv-keywords": "^1.0.0", - "chalk": "^1.1.1", - "lodash": "^4.0.0", - "slice-ansi": "0.0.4", - "string-width": "^2.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - } - } - }, - "type-check": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", - "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", - "dev": true, - "requires": { - "prelude-ls": "~1.1.2" - } - }, - "write": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/write/-/write-0.2.1.tgz", - "integrity": "sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c=", - "dev": true, - "requires": { - "mkdirp": "^0.5.1" - } } } }, @@ -68446,6 +67456,15 @@ "@types/chai": "*" } }, + "@types/cheerio": { + "version": "0.22.32", + "resolved": "https://registry.npmjs.org/@types/cheerio/-/cheerio-0.22.32.tgz", + "integrity": "sha512-4RrpCp5ufWTLb6/1RCOjazRhUM6DTD79l763det29n8kLmPB7XeN46cxlUf2GsSF+0g6CbWT5nYl8C/Gs15bdg==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, "@types/clean-css": { "version": "4.2.5", "resolved": "https://registry.npmjs.org/@types/clean-css/-/clean-css-4.2.5.tgz", @@ -68515,6 +67534,29 @@ "@types/ms": "*" } }, + "@types/enzyme": { + "version": "3.10.14", + "resolved": "https://registry.npmjs.org/@types/enzyme/-/enzyme-3.10.14.tgz", + "integrity": "sha512-JeTG2MNUX1bH2DqccwUe3SuPoLu+kUz5UgR3Tvl9nBdfNj7rBZscytctSjEatd5Ul9GXXGKaQBaxODIgJYVRqA==", + "dev": true, + "requires": { + "@types/cheerio": "*", + "@types/react": "^16" + }, + "dependencies": { + "@types/react": { + "version": "16.14.47", + "resolved": "https://registry.npmjs.org/@types/react/-/react-16.14.47.tgz", + "integrity": "sha512-m0EmmY73mbQegA+aqo0+O/hHU9iTi+hNYotJ3cM4sLFox8NqZv3XVXQhhqpd3YH6YC7h+YIyJFd36O5KlaJLCA==", + "dev": true, + "requires": { + "@types/prop-types": "*", + "@types/scheduler": "*", + "csstype": "^3.0.2" + } + } + } + }, "@types/eslint": { "version": "7.28.0", "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-7.28.0.tgz", diff --git a/package.json b/package.json index c559218ba6f..010fba97d20 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "@babel/core": "7.16.0", "@babel/parser": "7.16.0", "@mongodb-js/monorepo-tools": "^1.1.1", - "@mongodb-js/sbom-tools": "^0.5.2", + "@mongodb-js/sbom-tools": "^0.5.3", "@testing-library/dom": "^8.11.1", "babel-loader": "^7.1.5", "husky": "^8.0.3", diff --git a/packages/compass-explain-plan/package.json b/packages/compass-explain-plan/package.json index 9b51194b059..f8640be90f0 100644 --- a/packages/compass-explain-plan/package.json +++ b/packages/compass-explain-plan/package.json @@ -74,7 +74,7 @@ "@mongodb-js/webpack-config-compass": "^1.2.0", "@testing-library/react": "^12.1.4", "@testing-library/user-event": "^13.5.0", - "@types/d3": "3.5.x", + "@types/d3": "^3.5.x", "@types/d3-flextree": "^2.1.0", "@types/d3-hierarchy": "^3.1.2", "chai": "^4.2.0", diff --git a/packages/compass-serverstats/.depcheckrc b/packages/compass-serverstats/.depcheckrc index 0ad711abc06..8df91b5de8d 100644 --- a/packages/compass-serverstats/.depcheckrc +++ b/packages/compass-serverstats/.depcheckrc @@ -1,6 +1,7 @@ -ignores: [ - "mongodb-compass", - # webpack always externalizes 'clipboard' for legacy reasons - "clipboard", - "react-dom" -] +ignores: + - "@mongodb-js/prettier-config-compass" + - "@mongodb-js/tsconfig-compass" + - "mongodb-compass" + # webpack always externalizes 'clipboard' for legacy reasons + - "clipboard" + - "react-dom" \ No newline at end of file diff --git a/packages/compass-serverstats/.eslintignore b/packages/compass-serverstats/.eslintignore new file mode 100644 index 00000000000..85a8a75e68c --- /dev/null +++ b/packages/compass-serverstats/.eslintignore @@ -0,0 +1,2 @@ +.nyc-output +dist diff --git a/packages/compass-serverstats/.eslintrc b/packages/compass-serverstats/.eslintrc deleted file mode 100644 index 4fb1f9df647..00000000000 --- a/packages/compass-serverstats/.eslintrc +++ /dev/null @@ -1,15 +0,0 @@ -{ - "env": { - "mocha": true, - "node": true, - }, - "rules": { - "camelcase": 1 - }, - "extends": [ - "mongodb-js/node", - "mongodb-js/browser", - "mongodb-js/react" - ], - "plugins": ["react"] -} diff --git a/packages/compass-serverstats/.eslintrc.js b/packages/compass-serverstats/.eslintrc.js new file mode 100644 index 00000000000..e4cf824b6ac --- /dev/null +++ b/packages/compass-serverstats/.eslintrc.js @@ -0,0 +1,8 @@ +module.exports = { + root: true, + extends: ['@mongodb-js/eslint-config-compass'], + parserOptions: { + tsconfigRootDir: __dirname, + project: ['./tsconfig-lint.json'], + }, +}; diff --git a/packages/compass-serverstats/.prettierignore b/packages/compass-serverstats/.prettierignore new file mode 100644 index 00000000000..fd5c1106409 --- /dev/null +++ b/packages/compass-serverstats/.prettierignore @@ -0,0 +1,3 @@ +.nyc_output +coverage +dist diff --git a/packages/compass-serverstats/.prettierrc.json b/packages/compass-serverstats/.prettierrc.json new file mode 100644 index 00000000000..18853d1532e --- /dev/null +++ b/packages/compass-serverstats/.prettierrc.json @@ -0,0 +1 @@ +"@mongodb-js/prettier-config-compass" diff --git a/packages/compass-serverstats/README.md b/packages/compass-serverstats/README.md index ae943b7ec1c..9afd0b0b8f9 100644 --- a/packages/compass-serverstats/README.md +++ b/packages/compass-serverstats/README.md @@ -20,61 +20,38 @@ const realTimeLineChart = require('compass-serverstats').d3.realTimeLineChart; const el = document.getElementById('myChart'); const data = { - "dataSets" : [ + dataSets: [ { - "line" : "virtual", - "count" : [ - 2.48, - 2.48, - 2.49 - ], - "active" : true + line: 'virtual', + count: [2.48, 2.48, 2.49], + active: true, }, { - "line" : "resident", - "count" : [ - 0.02, - 0.02, - 0.02 - ], - "active":true + line: 'resident', + count: [0.02, 0.02, 0.02], + active: true, }, { - "line" : "mapped", - "count" : [ - 0, - 0, - 0 - ], - "active":true - } - ], - "localTime" : [ - "2016-10-30T07:12:05.077Z", - "2016-10-30T07:12:06.069Z", - "2016-10-30T07:12:07.153Z" - ], - "skip" : [ - false, - false, - false + line: 'mapped', + count: [0, 0, 0], + active: true, + }, ], - "yDomain" : [ - 0, - 2.49 + localTime: [ + '2016-10-30T07:12:05.077Z', + '2016-10-30T07:12:06.069Z', + '2016-10-30T07:12:07.153Z', ], - "xLength" : 60, - "labels" : { - "title" : "memory", - "keys" : [ - "vsize", - "resident", - "mapped" - ], - "yAxis" : "GB" + skip: [false, false, false], + yDomain: [0, 2.49], + xLength: 60, + labels: { + title: 'memory', + keys: ['vsize', 'resident', 'mapped'], + yAxis: 'GB', }, - "keyLength" : 6, - "paused" : false + keyLength: 6, + paused: false, }; d3.select(el).datum(data).call(realTimeLineChart()); @@ -106,7 +83,6 @@ For completeness, below is a list of directories present in this module: - `src` components, actions and stores source code, as well as style files. This is the place to implement your own components. `npm run compile` will use `./src` as input and create `./lib`. - `test` implement your tests here, and name the files `*.test.js`. - [npm_img]: https://img.shields.io/npm/v/mongodb-component-template.svg?style=flat-square [npm_url]: https://www.npmjs.org/package/mongodb-component-template [enzyme]: http://airbnb.io/enzyme/ diff --git a/packages/compass-serverstats/package.json b/packages/compass-serverstats/package.json index 50cf09d417e..573f6a177b1 100644 --- a/packages/compass-serverstats/package.json +++ b/packages/compass-serverstats/package.json @@ -18,13 +18,18 @@ "webpack": "webpack-compass", "test": "mocha", "test-electron": "xvfb-maybe electron-mocha --no-sandbox", - "check": "npm run lint && npm run depcheck", - "lint": "eslint \"./{src,test}/**/*.{js,jsx}\"", + "typecheck": "tsc -p tsconfig-lint.json --noEmit", + "check": "npm run typecheck && npm run lint && npm run depcheck", + "check-ci": "npm run check", + "eslint": "eslint", + "prettier": "prettier", + "lint": "npm run eslint . && npm run prettier -- --check .", "depcheck": "compass-scripts check-peer-deps && depcheck", "test-ci": "npm run test", "test-ci-electron": "npm run test-electron", "prepublishOnly": "npm run compile && compass-scripts check-exports-exist", - "bootstrap": "npm run compile" + "bootstrap": "npm run compile", + "reformat": "npm run prettier -- --write . && npm run eslint . --fix" }, "license": "SSPL", "peerDependencies": { @@ -37,8 +42,13 @@ "@mongodb-js/compass-logging": "^1.2.0" }, "devDependencies": { + "@mongodb-js/eslint-config-compass": "^1.0.9", "@mongodb-js/mocha-config-compass": "^1.3.1", + "@mongodb-js/prettier-config-compass": "^1.0.1", + "@mongodb-js/tsconfig-compass": "^1.0.3", "@mongodb-js/webpack-config-compass": "^1.2.0", + "@types/d3": "^3.5.x", + "@types/enzyme": "^3.10.14", "chai": "^4.1.2", "d3": "^3.5.17", "d3-timer": "^1.0.3", @@ -47,8 +57,6 @@ "electron-mocha": "^10.1.0", "enzyme": "^3.11.0", "eslint": "^7.25.0", - "eslint-config-mongodb-js": "^2.1.0", - "eslint-plugin-react": "^7.24.0", "hadron-app": "^5.11.0", "hadron-app-registry": "^9.0.10", "lodash": "^4.17.21", diff --git a/packages/compass-serverstats/src/actions/index.js b/packages/compass-serverstats/src/actions/index.js index b29cd985800..07e59257e02 100644 --- a/packages/compass-serverstats/src/actions/index.js +++ b/packages/compass-serverstats/src/actions/index.js @@ -14,7 +14,7 @@ const Actions = Reflux.createActions([ 'serverStats', 'top', 'killOp', - { mouseOver: { sync: true }} + { mouseOver: { sync: true } }, ]); module.exports = Actions; diff --git a/packages/compass-serverstats/src/components/chart-component.jsx b/packages/compass-serverstats/src/components/chart-component.jsx index 9f959a9b176..884785df6b4 100644 --- a/packages/compass-serverstats/src/components/chart-component.jsx +++ b/packages/compass-serverstats/src/components/chart-component.jsx @@ -14,7 +14,7 @@ const LINE_COLORS = [ palette.blue.base, palette.red.light1, palette.purple.base, - palette.yellow.light2 + palette.yellow.light2, ]; /** @@ -78,8 +78,12 @@ class ChartComponent extends React.Component { if (!data.localTime || data.localTime.length === 0) { return; } - const maxTime = data.localTime ? data.localTime[data.localTime.length - 1] : new Date(); - const minTime = data.xLength ? new Date(maxTime.getTime() - (data.xLength * 1000)) : maxTime; + const maxTime = data.localTime + ? data.localTime[data.localTime.length - 1] + : new Date(); + const minTime = data.xLength + ? new Date(maxTime.getTime() - data.xLength * 1000) + : maxTime; this.chart .width(this.props.width) @@ -102,7 +106,9 @@ class ChartComponent extends React.Component { .y2Domain(data.secondScale ? [0, data.secondScale.currentMax] : null) .y2Val((d) => d) - .y2Values((selectionData) => selectionData.secondScale ? [selectionData.secondScale] : []) + .y2Values((selectionData) => + selectionData.secondScale ? [selectionData.secondScale] : [] + ) .y2Units(data.secondScale ? data.secondScale.units : '') .y2Data((y2Value) => y2Value.count) .y2Label((y2Value) => y2Value.line) @@ -115,9 +121,7 @@ class ChartComponent extends React.Component { .on('mouseout', Actions.mouseOut) .eventDispatcher(this.props.dispatcher); - d3.select(this.containerRef) - .datum(this.state.data) - .call(this.chart); + d3.select(this.containerRef).datum(this.state.data).call(this.chart); } /** @@ -128,9 +132,11 @@ class ChartComponent extends React.Component { render() { return (
-
{ - this.containerRef = container; - }} /> +
{ + this.containerRef = container; + }} + />
); } @@ -140,7 +146,7 @@ ChartComponent.propTypes = { width: PropTypes.number, height: PropTypes.number, store: PropTypes.any.isRequired, - dispatcher: PropTypes.any.isRequired + dispatcher: PropTypes.any.isRequired, }; ChartComponent.displayName = 'ChartComponent'; diff --git a/packages/compass-serverstats/src/components/current-op-component.jsx b/packages/compass-serverstats/src/components/current-op-component.jsx index 45becf7a0b4..edd90f84c57 100644 --- a/packages/compass-serverstats/src/components/current-op-component.jsx +++ b/packages/compass-serverstats/src/components/current-op-component.jsx @@ -31,8 +31,12 @@ class CurrentOpComponent extends React.Component { */ componentDidMount() { this.unsubscribeRefresh = this.props.store.listen(this.refresh.bind(this)); - this.unsubscribeShowOperationDetails = Actions.showOperationDetails.listen(this.hide.bind(this)); - this.unsubscribeHideOperationDetails = Actions.hideOperationDetails.listen(this.show.bind(this)); + this.unsubscribeShowOperationDetails = Actions.showOperationDetails.listen( + this.hide.bind(this) + ); + this.unsubscribeHideOperationDetails = Actions.hideOperationDetails.listen( + this.show.bind(this) + ); if (!DBErrorStore.ops.currentOp) { this.unsubscribeError = DBErrorStore.listen(this.stop.bind(this)); @@ -125,9 +129,7 @@ class CurrentOpComponent extends React.Component {

Slowest Operations

-
+
✔ No Slow Operations
@@ -141,9 +143,14 @@ class CurrentOpComponent extends React.Component { */ renderGraph() { const showOperationDetails = this.showOperationDetails; - const rows = this.state.data.map(function(row, i) { + const rows = this.state.data.map(function (row, i) { return ( -
  • + // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions +
  • {row.op}
    {row.ns}
    {row.ms_running + ' ms'}
    @@ -156,9 +163,7 @@ class CurrentOpComponent extends React.Component {

    Slowest Operations

    -
      - {rows} -
    +
      {rows}
  • ); @@ -182,7 +187,7 @@ class CurrentOpComponent extends React.Component { CurrentOpComponent.propTypes = { store: PropTypes.any.isRequired, - interval: PropTypes.number.isRequired + interval: PropTypes.number.isRequired, }; CurrentOpComponent.displayName = 'CurrentOpComponent'; diff --git a/packages/compass-serverstats/src/components/dberror-component.tsx b/packages/compass-serverstats/src/components/dberror-component.tsx index fb56ff1b8be..fdfaf4fba93 100644 --- a/packages/compass-serverstats/src/components/dberror-component.tsx +++ b/packages/compass-serverstats/src/components/dberror-component.tsx @@ -4,38 +4,37 @@ import { ErrorSummary, css, spacing } from '@mongodb-js/compass-components'; const errorContainerStyles = css({ padding: spacing[2], - position: 'relative' + position: 'relative', }); /** * Represents the component that renders DB Errors. */ -function DBErrorComponent({ - store -}: { - store: Store -}) { +function DBErrorComponent({ store }: { store: Store }) { const [data, setData] = useState([]); - const onRefresh = useCallback((data) => { - setData(data); - }, [setData]); + const onRefresh = useCallback( + (data) => { + setData(data); + }, + [setData] + ); const errors = useMemo(() => { return !data || data.length < 1 ? [] - : data.map((row) => { + : (data as any[]).map((row) => { return `Command "${row.ops}" returned error "${row.errorMsg}"`; }); }, [data]); useEffect(() => { - const unsubscribeRefresh = store.listen(onRefresh); + const unsubscribeRefresh = store.listen(onRefresh, store); return () => { unsubscribeRefresh(); }; - }, [onRefresh]); + }, [store, onRefresh]); if (!data || data.length < 1) { return null; diff --git a/packages/compass-serverstats/src/components/detailview-component.jsx b/packages/compass-serverstats/src/components/detailview-component.jsx index 8f89eebe26a..24f45a7090c 100644 --- a/packages/compass-serverstats/src/components/detailview-component.jsx +++ b/packages/compass-serverstats/src/components/detailview-component.jsx @@ -13,8 +13,12 @@ class DetailViewComponent extends React.Component { } componentDidMount() { - this.unsubscribeShowOperationDetails = Actions.showOperationDetails.listen(this.show.bind(this)); - this.unsubscribeHideOperationDetails = Actions.hideOperationDetails.listen(this.hide.bind(this)); + this.unsubscribeShowOperationDetails = Actions.showOperationDetails.listen( + this.show.bind(this) + ); + this.unsubscribeHideOperationDetails = Actions.hideOperationDetails.listen( + this.hide.bind(this) + ); } componentWillUnmount() { @@ -68,7 +72,7 @@ class DetailViewComponent extends React.Component { } renderZero() { - return (
    ); + return
    ; } renderGraph() { @@ -76,40 +80,68 @@ class DetailViewComponent extends React.Component {

    operation details

    -
    - +
    +
    {this.state.data.op}
    -
    {this.state.data.ns}
    -
    {this.state.data.ms_running + ' ms'}
    +
    + {this.state.data.ns} +
    +
    + {this.state.data.ms_running + ' ms'} +
    • opid
      -
      {this.state.data.opid}
      +
      + {this.state.data.opid} +
    • client s
      -
      {this.state.data.client}
      +
      + {this.state.data.client} +
    • active
      -
      {this.state.data.active}
      +
      + {this.state.data.active} +
    • wait lock
      -
      {this.state.data.waitingForLock}
      +
      + {this.state.data.waitingForLock} +
    • - +
    -
    {JSON.stringify(this.state.data, this.removeMs, 4)}
    +
    + {JSON.stringify(this.state.data, this.removeMs, 4)} +
    ); diff --git a/packages/compass-serverstats/src/components/index.less b/packages/compass-serverstats/src/components/index.less index 373acd0b854..21a71d1b95c 100644 --- a/packages/compass-serverstats/src/components/index.less +++ b/packages/compass-serverstats/src/components/index.less @@ -1,4 +1,4 @@ -@import (reference) "mongodb-compass/src/app/styles/index.less"; +@import (reference) 'mongodb-compass/src/app/styles/index.less'; @import './rtss-db.less'; @import './rtss-lists.less'; @@ -6,7 +6,8 @@ .rt-perf { background: @palette__black; - font-family: "Euclid Circular A", "Helvetica Neue", Helvetica, Arial, sans-serif; + font-family: 'Euclid Circular A', 'Helvetica Neue', Helvetica, Arial, + sans-serif; font-weight: 500; min-width: 100%; diff --git a/packages/compass-serverstats/src/components/index.tsx b/packages/compass-serverstats/src/components/index.tsx index 09c42e806fa..07217eeae8c 100644 --- a/packages/compass-serverstats/src/components/index.tsx +++ b/packages/compass-serverstats/src/components/index.tsx @@ -4,7 +4,6 @@ import React, { useEffect, useRef, useState } from 'react'; import { Banner, LeafyGreenProvider, - Theme, css, cx, spacing, @@ -28,7 +27,7 @@ const REFRESH_STATS_INTERVAL_MS = 1000; const workspaceContainerStyles = css({ display: 'flex', flexDirection: 'column', - overflow: 'auto' + overflow: 'auto', }); const workspaceBackgroundStyles = css({ @@ -50,13 +49,13 @@ const workspaceStyles = css({ const mongosWarningStyles = css({ margin: spacing[2], - marginBottom: 0 + marginBottom: 0, }); function PerformancePanel({ - eventDispatcher + eventDispatcher, }: { - eventDispatcher: TimeScrubEventDispatcher + eventDispatcher: TimeScrubEventDispatcher; }) { return (
    @@ -85,22 +84,25 @@ function PerformancePanelMsgs() { // Trigger the component refresh when stores are updated. ServerStatsStore.listen(() => { forceUpdate({}); - }); + }, ServerStatsStore); TopStore.listen(() => { forceUpdate({}); - }); + }, TopStore); }, []); return (
    - {ServerStatsStore.isMongos && ( + {(ServerStatsStore as any).isMongos && ( - Top command is not available for mongos, some charts may not show any data. + Top command is not available for mongos, some charts may not show any + data. )} - {TopStore.topUnableToRetrieveSomeCollections && ( + {(TopStore as any).topUnableToRetrieveSomeCollections && ( - Top command is unable to retrieve information about certain collections, resulting in incomplete data being displayed on the charts. + Top command is unable to retrieve information about certain + collections, resulting in incomplete data being displayed on the + charts. )}
    @@ -121,22 +123,15 @@ function PerformanceComponent() { }; }, []); - const { - className: scrollbarStyles - } = useScrollbars(); + const { className: scrollbarStyles } = useScrollbars(); return (
    - +
    - +
    diff --git a/packages/compass-serverstats/src/components/rtss-charts.less b/packages/compass-serverstats/src/components/rtss-charts.less index 8ad432e5caa..c6a5b46db5a 100644 --- a/packages/compass-serverstats/src/components/rtss-charts.less +++ b/packages/compass-serverstats/src/components/rtss-charts.less @@ -1,4 +1,4 @@ -@import (reference) "mongodb-compass/src/app/styles/index.less"; +@import (reference) 'mongodb-compass/src/app/styles/index.less'; .rt-perf { display: flex; @@ -43,13 +43,15 @@ margin: 15px 0 0 55px; } - &-y-axis-label, &-y2-axis-label { + &-y-axis-label, + &-y2-axis-label { font-size: 9px; color: @palette__gray--light-2; margin: 5px 0; } - &-legend-item, &-legend-2-item { + &-legend-item, + &-legend-2-item { margin-top: 5px; display: flex; flex-grow: 1; @@ -63,14 +65,16 @@ margin-left: 18px; } - &-legend-linename, &-legend-2-linename { + &-legend-linename, + &-legend-2-linename { text-transform: uppercase; font-size: 10px; color: @palette__gray--light-2; margin: 0 0 0 5px; } - &-legend-count, &-legend-2-count { + &-legend-count, + &-legend-2-count { font-size: 12px; color: @palette__white; margin: 5px 0 0 5px; @@ -83,4 +87,4 @@ stroke: none; } } -} \ No newline at end of file +} diff --git a/packages/compass-serverstats/src/components/rtss-db.less b/packages/compass-serverstats/src/components/rtss-db.less index e3dc5bdf906..342f10735a7 100644 --- a/packages/compass-serverstats/src/components/rtss-db.less +++ b/packages/compass-serverstats/src/components/rtss-db.less @@ -8,7 +8,6 @@ justify-content: center; } - /* table */ .rtDbs__table { width: 1020px; @@ -37,7 +36,7 @@ } .rtDbs__row:hover { background-color: @palette__gray--dark-1; - transition: all .7s ease-out; + transition: all 0.7s ease-out; } .rtDbs__row-item { height: 45px; diff --git a/packages/compass-serverstats/src/components/rtss-lists.less b/packages/compass-serverstats/src/components/rtss-lists.less index f8060f95726..c053ea690e1 100644 --- a/packages/compass-serverstats/src/components/rtss-lists.less +++ b/packages/compass-serverstats/src/components/rtss-lists.less @@ -1,4 +1,4 @@ -@import (reference) "mongodb-compass/src/app/styles/index.less"; +@import (reference) 'mongodb-compass/src/app/styles/index.less'; .rt { height: 100%; @@ -44,7 +44,8 @@ margin: 0; padding: 0; } -.rt-lists__item, .rt-lists__empty-error { +.rt-lists__item, +.rt-lists__empty-error { position: relative; width: 100%; height: 46px; @@ -78,13 +79,12 @@ } /* LAYOUT */ -.rt-lists__header{ +.rt-lists__header { margin-top: -4px; display: flex; flex-direction: row; width: 100%; margin-bottom: 0; - } .rt-details__header { @@ -96,7 +96,8 @@ margin-top: -12px; } -.rt-lists__headerlabel, .rt-details__headerlabel { +.rt-lists__headerlabel, +.rt-details__headerlabel { color: @palette__white; text-transform: uppercase; font-size: 11px; @@ -145,7 +146,8 @@ font-size: 9px; /* R/W */ color: @palette__white; } -.rt-lists__r { /* R/W bar */ +.rt-lists__r { + /* R/W bar */ height: 14px; width: 30%; background-color: @palette__gray--dark-1; diff --git a/packages/compass-serverstats/src/components/server-stats-graphs-component.jsx b/packages/compass-serverstats/src/components/server-stats-graphs-component.jsx index 8a6825b6048..212d569f154 100644 --- a/packages/compass-serverstats/src/components/server-stats-graphs-component.jsx +++ b/packages/compass-serverstats/src/components/server-stats-graphs-component.jsx @@ -61,10 +61,30 @@ class ServerStatsComponent extends React.Component { const { eventDispatcher } = this.props; return (
    - - - - + + + +
    ); } @@ -72,10 +92,9 @@ class ServerStatsComponent extends React.Component { ServerStatsComponent.propTypes = { interval: PropTypes.number.isRequired, - eventDispatcher: PropTypes.object.isRequired + eventDispatcher: PropTypes.object.isRequired, }; - ServerStatsComponent.displayName = 'ServerStatsComponent'; module.exports = ServerStatsComponent; diff --git a/packages/compass-serverstats/src/components/server-stats-lists-component.jsx b/packages/compass-serverstats/src/components/server-stats-lists-component.jsx index ad93c7c783f..efdc59a8904 100644 --- a/packages/compass-serverstats/src/components/server-stats-lists-component.jsx +++ b/packages/compass-serverstats/src/components/server-stats-lists-component.jsx @@ -14,14 +14,17 @@ class ServerStatsListsComponent extends React.Component {
    - +
    ); } } ServerStatsListsComponent.propTypes = { - interval: PropTypes.number.isRequired + interval: PropTypes.number.isRequired, }; module.exports = ServerStatsListsComponent; diff --git a/packages/compass-serverstats/src/components/server-stats-toolbar.tsx b/packages/compass-serverstats/src/components/server-stats-toolbar.tsx index 7b07f92c7d7..7a38ab5d9f9 100644 --- a/packages/compass-serverstats/src/components/server-stats-toolbar.tsx +++ b/packages/compass-serverstats/src/components/server-stats-toolbar.tsx @@ -1,6 +1,14 @@ import React, { useCallback, useEffect, useState } from 'react'; import d3 from 'd3'; -import { Button, Icon, css, cx, spacing, palette, useDarkMode } from '@mongodb-js/compass-components'; +import { + Button, + Icon, + css, + cx, + spacing, + palette, + useDarkMode, +} from '@mongodb-js/compass-components'; import { createLoggerAndTelemetry } from '@mongodb-js/compass-logging'; import Actions from '../actions'; @@ -12,7 +20,7 @@ const serverStatsToolbarStyles = css({ display: 'flex', flexDirection: 'row', alignItems: 'center', - padding: spacing[3] + padding: spacing[3], }); const serverStatsToolbarDarkThemeStyles = css({ @@ -28,7 +36,7 @@ const serverStatsToolbarLightThemeStyles = css({ const timeStyles = css({ padding: `${spacing[2]}px ${spacing[5]}px`, borderRadius: '3px', - marginLeft: spacing[2] + marginLeft: spacing[2], }); const timeLightThemeStyles = css({ @@ -46,41 +54,40 @@ export type TimeScrubEventDispatcher = { }; type ServerStatsToolbarProps = { - eventDispatcher: TimeScrubEventDispatcher -} + eventDispatcher: TimeScrubEventDispatcher; +}; -function ServerStatsToolbar({ - eventDispatcher -}: ServerStatsToolbarProps) { +function ServerStatsToolbar({ eventDispatcher }: ServerStatsToolbarProps) { const darkMode = useDarkMode(); - const [ time, setTime ] = useState('00:00:00'); - const [ isPaused, setPaused ] = useState(ServerStatsStore.isPaused); + const [time, setTime] = useState('00:00:00'); + const [isPaused, setPaused] = useState((ServerStatsStore as any).isPaused); useEffect(() => { - eventDispatcher.on('newXValue', xDate => { + eventDispatcher.on('newXValue', (xDate) => { // When the cursor position results in a new time on the graphs, by user // scrubbing or live viewing, we receive a new time to display. - setTime(d3.time.format.utc('%X')(xDate)); + setTime((d3 as any).time.format.utc('%X')(xDate) as string); }); - }, []); + }, [eventDispatcher]); const onPlayPauseClicked = useCallback(() => { if (isPaused) { track('Performance Resumed'); - } - else { + } else { track('Performance Paused'); } - setPaused(!isPaused) + setPaused(!isPaused); Actions.pause(); - }, [ isPaused ]); + }, [isPaused]); return (
    ); } -export { - ServerStatsToolbar -}; +export { ServerStatsToolbar }; diff --git a/packages/compass-serverstats/src/components/top-component.jsx b/packages/compass-serverstats/src/components/top-component.jsx index b6dade7d55c..f37b083e313 100644 --- a/packages/compass-serverstats/src/components/top-component.jsx +++ b/packages/compass-serverstats/src/components/top-component.jsx @@ -29,8 +29,12 @@ class TopComponent extends React.Component { */ componentDidMount() { this.unsubscribeRefresh = this.props.store.listen(this.refresh.bind(this)); - this.unsubscribeShowOperationDetails = Actions.showOperationDetails.listen(this.hide.bind(this)); - this.unsubscribeHideOperationDetails = Actions.hideOperationDetails.listen(this.show.bind(this)); + this.unsubscribeShowOperationDetails = Actions.showOperationDetails.listen( + this.hide.bind(this) + ); + this.unsubscribeHideOperationDetails = Actions.hideOperationDetails.listen( + this.show.bind(this) + ); if (!DBErrorStore.ops.top) { this.unsubscribeError = DBErrorStore.listen(this.stop.bind(this)); @@ -124,7 +128,7 @@ class TopComponent extends React.Component { * @returns {React.Component} The table. */ renderGraph() { - const rows = this.state.data.map(function(row, i) { + const rows = this.state.data.map(function (row, i) { const styleLoad = { width: `${row.loadPercent}%` }; const styleLoadR = { width: `${row.loadPercentR}%` }; const styleLoadW = { width: `${row.loadPercentW}%` }; @@ -139,8 +143,12 @@ class TopComponent extends React.Component { %
    -
    R
    -
    W
    +
    + R +
    +
    + W +
    ); @@ -152,9 +160,7 @@ class TopComponent extends React.Component {

    Hottest Collections

    -
      - {rows} -
    +
      {rows}
    ); @@ -178,7 +184,7 @@ class TopComponent extends React.Component { TopComponent.propTypes = { store: PropTypes.any.isRequired, - interval: PropTypes.number.isRequired + interval: PropTypes.number.isRequired, }; TopComponent.displayName = 'TopComponent'; diff --git a/packages/compass-serverstats/src/d3/real-time-chart-lines.js b/packages/compass-serverstats/src/d3/real-time-chart-lines.js index 2f3504301ce..e00e8b1fcda 100644 --- a/packages/compass-serverstats/src/d3/real-time-chart-lines.js +++ b/packages/compass-serverstats/src/d3/real-time-chart-lines.js @@ -15,47 +15,62 @@ function realTimeChartLines() { const y = (datum, i) => yScale(yVal(datum, i)); function component(selection) { - selection.each(function(data) { + selection.each(function (data) { const lineGroup = d3.select(this); // establish the path-generating function for each line - const line = d3.svg.line() + const line = d3.svg + .line() .defined(defined) .interpolate('monotone') .x(x) .y(y); // establish a clip-path to prevent the lines being drawn out of bounds - lineGroup.selectAll('defs').data([0]).enter() + lineGroup + .selectAll('defs') + .data([0]) + .enter() .append('defs') .append('clipPath') .attr('id', 'clip') .append('rect'); - lineGroup.selectAll('clipPath#clip rect') + lineGroup + .selectAll('clipPath#clip rect') .attr('width', Math.abs(xScale.range()[0] - xScale.range()[1])) - .attr('height', Math.abs(yScale.range()[0] - yScale.range()[1]) + strokeWidth); + .attr( + 'height', + Math.abs(yScale.range()[0] - yScale.range()[1]) + strokeWidth + ); - lineGroup - .attr('clip-path', 'url(#clip)'); + lineGroup.attr('clip-path', 'url(#clip)'); // add the paths to the provided selection - const dataLines = lineGroup.selectAll('path.line').data(data, (d, i) => i); - dataLines.enter().append('path') + const dataLines = lineGroup + .selectAll('path.line') + .data(data, (d, i) => i); + dataLines + .enter() + .append('path') .attr('class', 'line') .attr('stroke-width', strokeWidth) .attr('stroke', (d, i) => color(i)) .style('fill', 'none'); // draw the proper path - dataLines - .attr('d', (lineData, i) => line(yData(lineData, i))); + dataLines.attr('d', (lineData, i) => line(yData(lineData, i))); // animate if animation parameters have been specified if (!isNaN(Number(singlePointDistance)) && expectedPointSpeed) { dataLines.interrupt('translate'); dataLines - .attr('transform', isNaN(singlePointDistance) ? null : `translate(${singlePointDistance})`) + .attr( + 'transform', + isNaN(singlePointDistance) + ? null + : `translate(${singlePointDistance})` + ) .transition('translate') .duration(expectedPointSpeed) .ease(d3.ease('linear')) @@ -64,61 +79,61 @@ function realTimeChartLines() { }); } - component.xScale = function(value) { + component.xScale = function (value) { if (typeof value === 'undefined') return xScale; xScale = value; return component; }; - component.yScale = function(value) { + component.yScale = function (value) { if (typeof value === 'undefined') return yScale; yScale = value; return component; }; - component.xVal = function(value) { + component.xVal = function (value) { if (typeof value === 'undefined') return xVal; xVal = value; return component; }; - component.yVal = function(value) { + component.yVal = function (value) { if (typeof value === 'undefined') return yVal; yVal = value; return component; }; - component.yData = function(value) { + component.yData = function (value) { if (typeof value === 'undefined') return yData; yData = value; return component; }; - component.color = function(value) { + component.color = function (value) { if (typeof value === 'undefined') return color; color = value; return component; }; - component.defined = function(value) { + component.defined = function (value) { if (typeof value === 'undefined') return defined; defined = value; return component; }; - component.singlePointDistance = function(value) { + component.singlePointDistance = function (value) { if (typeof value === 'undefined') return singlePointDistance; singlePointDistance = value; return component; }; - component.expectedPointSpeed = function(value) { + component.expectedPointSpeed = function (value) { if (typeof value === 'undefined') return expectedPointSpeed; expectedPointSpeed = value; return component; }; - component.strokeWidth = function(value) { + component.strokeWidth = function (value) { if (typeof value === 'undefined') return strokeWidth; strokeWidth = value; return component; diff --git a/packages/compass-serverstats/src/d3/real-time-legend.js b/packages/compass-serverstats/src/d3/real-time-legend.js index cfd468517b7..a07c8f4efc6 100644 --- a/packages/compass-serverstats/src/d3/real-time-legend.js +++ b/packages/compass-serverstats/src/d3/real-time-legend.js @@ -5,22 +5,27 @@ function realTimeLegend() { let prefix = 'legend'; let color = d3.scale.category10(); let bubbleWidth = 8; - let onToggle = function(/* d, i, active */) { /* no-op */ }; + let onToggle = function (/* d, i, active */) { + /* no-op */ + }; let justifyContent = 'flex-start'; let format = (d) => d; let yData = (yValues) => yValues.data; function component(selection) { - selection.each(function(data) { + selection.each(function (data) { // Legend const legendGroup = d3.select(this); - const legendDiv = legendGroup.selectAll(`div.${prefix}-item`).data(data).enter() + const legendDiv = legendGroup + .selectAll(`div.${prefix}-item`) + .data(data) + .enter() .append('div') .attr('class', `${prefix}-item`); - // Add boxes for legend - legendDiv.append('svg') + legendDiv + .append('svg') .attr('height', bubbleWidth + 2) .attr('width', bubbleWidth + 2) .append('rect') @@ -33,79 +38,78 @@ function realTimeLegend() { .attr('y', 1) .attr('rx', bubbleWidth / 5) .attr('ry', bubbleWidth / 5) - .on('click', function(d, i) { + .on('click', function (d, i) { const rect = d3.select(this); const active = rect.style('fill-opacity') !== '1'; const newOpacity = active ? 1 : 0; - rect.transition().duration(100) - .style('fill-opacity', newOpacity); + rect.transition().duration(100).style('fill-opacity', newOpacity); onToggle(d, i, active); }); // Add text for legend - const textSection = legendDiv.append('div') + const textSection = legendDiv + .append('div') .attr('class', `${prefix}-text`); - textSection - .append('p') - .attr('class', `${prefix}-linename`) - .text(label); + textSection.append('p').attr('class', `${prefix}-linename`).text(label); textSection .append('p') - .attr('data-testid', function(d) { return `performance-${label(d)}`; }) + .attr('data-testid', function (d) { + return `performance-${label(d)}`; + }) .attr('class', `${prefix}-count`); const valueText = legendGroup.selectAll(`p.${prefix}-count`); - component.showValues = function(nearestXIndex) { + component.showValues = function (nearestXIndex) { valueText.text((d, i) => format(yData(d, i)[nearestXIndex])); }; }); } - component.label = function(value) { + component.label = function (value) { if (typeof value === 'undefined') return label; label = value; return component; }; - component.color = function(value) { + component.color = function (value) { if (typeof value === 'undefined') return color; color = value; return component; }; - component.bubbleWidth = function(value) { + component.bubbleWidth = function (value) { if (typeof value === 'undefined') return bubbleWidth; bubbleWidth = value; return component; }; - component.onToggle = function(value) { + component.onToggle = function (value) { if (typeof value === 'undefined') return onToggle; onToggle = value; return component; }; - component.justifyContent = function(value) { + component.justifyContent = function (value) { if (typeof value === 'undefined') return justifyContent; justifyContent = value; return component; }; - component.yData = function(value) { + component.yData = function (value) { if (typeof value === 'undefined') return yData; yData = value; return component; }; - component.prefix = function(value) { + component.prefix = function (value) { if (typeof value === 'undefined') return prefix; prefix = value; return component; }; - component.format = function(value) { + component.format = function (value) { if (typeof value === 'undefined') return format; format = value; return component; diff --git a/packages/compass-serverstats/src/d3/real-time-line-chart.js b/packages/compass-serverstats/src/d3/real-time-line-chart.js index 2c353d3b559..07cd02bfc7b 100644 --- a/packages/compass-serverstats/src/d3/real-time-line-chart.js +++ b/packages/compass-serverstats/src/d3/real-time-line-chart.js @@ -46,10 +46,15 @@ function realTimeLineChart() { let enableMouse = true; let onOverlay = false; // Default dispatcher, will be changed to one shared between charts. - let eventDispatcher = d3.dispatch('mouseover', 'updateoverlay', 'mouseout', 'newXValue'); + let eventDispatcher = d3.dispatch( + 'mouseover', + 'updateoverlay', + 'mouseout', + 'newXValue' + ); function chart(selection) { - selection.each(function(data) { + selection.each(function (data) { const subHeight = height - margin.top - margin.bottom; const subWidth = width - margin.left - margin.right; @@ -58,15 +63,12 @@ function realTimeLineChart() { */ // Scale configuration - x - .domain(xDomain) - .range([0, subWidth]); - y - .domain(yDomain) - .range([subHeight - strokeWidth, strokeWidth / 2]); - y2 - .domain(y2Domain ? y2Domain : [0, 0]) - .range([subHeight - strokeWidth, strokeWidth / 2]); + x.domain(xDomain).range([0, subWidth]); + y.domain(yDomain).range([subHeight - strokeWidth, strokeWidth / 2]); + y2.domain(y2Domain ? y2Domain : [0, 0]).range([ + subHeight - strokeWidth, + strokeWidth / 2, + ]); // Lines configuration let lineContainer = null; @@ -106,7 +108,8 @@ function realTimeLineChart() { .onToggle((d, i, active) => { const newOpacity = active ? 1 : 0; - lineContainer.selectAll('path.line') + lineContainer + .selectAll('path.line') .filter((pathD) => pathD === d) .transition('opacity') .duration(100) @@ -123,7 +126,8 @@ function realTimeLineChart() { .onToggle((d, i, active) => { const newOpacity = active ? 1 : 0; - line2Container.selectAll('path.line') + line2Container + .selectAll('path.line') .filter((pathD) => d === pathD) .transition('opacity') .duration(100) @@ -138,7 +142,10 @@ function realTimeLineChart() { * Prevent the overlay from highlighting data that hasn't been animated * yet by preventing the overlay from showing the very last data point. */ - let nearestDefinedPoint = Math.min(bisectPosition, xValues(data).length - 1); + let nearestDefinedPoint = Math.min( + bisectPosition, + xValues(data).length - 1 + ); while (!defined(null, nearestDefinedPoint)) { nearestDefinedPoint++; } @@ -152,7 +159,7 @@ function realTimeLineChart() { .eventDispatcher(eventDispatcher) .on('updateoverlay', (xPosition) => { let nearestXIndex = xValues(data).length - 1; - let indexOffset = (subWidth + bubbleWidth / 2); + let indexOffset = subWidth + bubbleWidth / 2; if (onOverlay && xPosition === undefined) { return; @@ -169,7 +176,8 @@ function realTimeLineChart() { } if (enableMouse) { - d3.select(this).selectAll('g.serverstats-overlay-group') + d3.select(this) + .selectAll('g.serverstats-overlay-group') .attr('transform', `translate(${indexOffset})`); } }) @@ -184,7 +192,8 @@ function realTimeLineChart() { legend.showValues(lastItem); legend2.showValues(lastItem); - d3.select(this).selectAll('g.serverstats-overlay-group') + d3.select(this) + .selectAll('g.serverstats-overlay-group') .attr('transform', `translate(${zeroPosition})`); eventDispatcher.newXValue(xValues(data)[lastItem]); @@ -196,20 +205,24 @@ function realTimeLineChart() { */ const container = d3.select(this); - container - .style('height', `${height}px`) - .style('width', `${width}px`); + container.style('height', `${height}px`).style('width', `${width}px`); // Add Title const chartTitleClass = `${prefix}-chart-title`; - container.selectAll(`p.${chartTitleClass}`).data([0]).enter() + container + .selectAll(`p.${chartTitleClass}`) + .data([0]) + .enter() .append('p') .attr('class', chartTitleClass) .style('margin-left', `${margin.left}px`) .text(title); // Create row for drawn elements and labels - const chartRowEnter = container.selectAll(`div.${prefix}-chart-row`).data([0]).enter() + const chartRowEnter = container + .selectAll(`div.${prefix}-chart-row`) + .data([0]) + .enter() .append('div') .attr('class', `${prefix}-chart-row`) .style('display', 'flex') @@ -218,32 +231,33 @@ function realTimeLineChart() { // Create first axis label const maxYValueClass = `${prefix}-max-y-value`; const maxYUnitsClass = `${prefix}-max-y-units`; - const firstAxisLabel = chartRowEnter.append('p') + const firstAxisLabel = chartRowEnter + .append('p') .attr('class', `${prefix}-y-axis-label`) .style('text-align', 'right') - .style('width', `${margin.left - (bubbleWidth / 2)}px`); - firstAxisLabel.append('span') - .attr('class', maxYValueClass); - firstAxisLabel.append('span') - .attr('class', maxYUnitsClass); + .style('width', `${margin.left - bubbleWidth / 2}px`); + firstAxisLabel.append('span').attr('class', maxYValueClass); + firstAxisLabel.append('span').attr('class', maxYUnitsClass); // Create svg for drawn elements chartRowEnter .append('svg') .attr('class', `${prefix}-chart`) - // chart group + // chart group .append('g') .attr('class', `${prefix}-chart-group`) .attr('transform', `translate(${bubbleWidth / 2}, ${bubbleWidth / 2})`) - // Chart background + // Chart background .append('rect') .attr('class', `${prefix}-chart-background`); - container.selectAll(`svg.${prefix}-chart`) - .attr('height', subHeight + (bubbleWidth / 2)) + container + .selectAll(`svg.${prefix}-chart`) + .attr('height', subHeight + bubbleWidth / 2) .attr('width', subWidth + bubbleWidth); - container.selectAll(`rect.${prefix}-chart-background`) + container + .selectAll(`rect.${prefix}-chart-background`) .attr('width', subWidth) .attr('height', subHeight); @@ -252,34 +266,37 @@ function realTimeLineChart() { // Create second axis label const maxY2ValueClass = `${prefix}-max-y2-value`; const maxY2UnitsClass = `${prefix}-max-y2-units`; - const secondAxisLabel = chartRowEnter.append('p') + const secondAxisLabel = chartRowEnter + .append('p') .attr('class', `${prefix}-y2-axis-label`) - .style('width', `${margin.right - (bubbleWidth / 2)}px`); - secondAxisLabel.append('span') - .attr('class', maxY2ValueClass); - secondAxisLabel.append('span') - .attr('class', maxY2UnitsClass); - - lineContainer = g.selectAll('.chart-line-group-container').data([yValues(data)]); - lineContainer.enter() + .style('width', `${margin.right - bubbleWidth / 2}px`); + secondAxisLabel.append('span').attr('class', maxY2ValueClass); + secondAxisLabel.append('span').attr('class', maxY2UnitsClass); + + lineContainer = g + .selectAll('.chart-line-group-container') + .data([yValues(data)]); + lineContainer + .enter() .append('g') .attr('class', 'chart-line-group-container'); lineContainer.call(lines); // Update labels - container.selectAll(`span.${maxYValueClass}`) - .text(yFormat(yDomain[1])); - container.selectAll(`span.${maxYUnitsClass}`) - .text(` ${yUnits}`); - container.selectAll(`span.${maxY2ValueClass}`) + container.selectAll(`span.${maxYValueClass}`).text(yFormat(yDomain[1])); + container.selectAll(`span.${maxYUnitsClass}`).text(` ${yUnits}`); + container + .selectAll(`span.${maxY2ValueClass}`) .text(y2Domain ? y2Format(y2Domain[1]) : ''); - container.selectAll(`span.${maxY2UnitsClass}`) - .text(` ${y2Units}`); + container.selectAll(`span.${maxY2UnitsClass}`).text(` ${y2Units}`); const legendContainerClass = `${prefix}-legend-container`; - const fullLegendContainer = container.selectAll(`div.${legendContainerClass}`).data([0]); - fullLegendContainer.enter() + const fullLegendContainer = container + .selectAll(`div.${legendContainerClass}`) + .data([0]); + fullLegendContainer + .enter() .append('div') .attr('class', legendContainerClass) .style('margin-left', `${margin.left}px`) @@ -287,31 +304,36 @@ function realTimeLineChart() { .style('display', 'flex') .style('justify-content', 'space-between'); - const l = fullLegendContainer.selectAll(`div.${legendClass}`).data([yValues(data)]); + const l = fullLegendContainer + .selectAll(`div.${legendClass}`) + .data([yValues(data)]); l.enter() .append('div') .style('display', 'flex') .attr('class', legendClass); l.call(legend); - line2Container = g.selectAll('.chart-line-group-container-2').data([y2Values(data)]); - line2Container.enter() + line2Container = g + .selectAll('.chart-line-group-container-2') + .data([y2Values(data)]); + line2Container + .enter() .append('g') .attr('class', 'chart-line-group-container-2'); line2Container.call(lines2); - const l2 = fullLegendContainer.selectAll(`div.${legendClass}-2`).data([y2Values(data)]); + const l2 = fullLegendContainer + .selectAll(`div.${legendClass}-2`) + .data([y2Values(data)]); l2.enter() .append('div') .style('display', 'flex') .attr('class', `${legendClass}-2`); l2.call(legend2); - container - .selectAll(`svg.${prefix}-chart`) - .call(mouseOverlay); + container.selectAll(`svg.${prefix}-chart`).call(mouseOverlay); - chart.setPosition = function(xPosition) { + chart.setPosition = function (xPosition) { const nearestXIndex = getNearestXIndex(xPosition); realTimeMouseOverlay.setPosition(xPosition); legend.showValues(nearestXIndex); @@ -327,7 +349,7 @@ function realTimeLineChart() { * * @returns {Function|Number} The chart component, or the existing value if none supplied */ - chart.width = function(value) { + chart.width = function (value) { if (typeof value === 'undefined') return width; width = value; return chart; @@ -340,7 +362,7 @@ function realTimeLineChart() { * * @returns {Function|Number} The chart component, or the existing value if none supplied */ - chart.height = function(value) { + chart.height = function (value) { if (typeof value === 'undefined') return height; height = value; return chart; @@ -353,7 +375,7 @@ function realTimeLineChart() { * * @returns {Function|String} The chart component, or the existing value if none supplied */ - chart.title = function(value) { + chart.title = function (value) { if (typeof value === 'undefined') return title; title = value; return chart; @@ -367,7 +389,7 @@ function realTimeLineChart() { * * @returns {Function|Array} The chart component, or the existing value if none supplied */ - chart.xDomain = function(value) { + chart.xDomain = function (value) { if (typeof value === 'undefined') return xDomain; xDomain = value; return chart; @@ -380,7 +402,7 @@ function realTimeLineChart() { * * @returns {Function|Array} The chart component, or the existing value if none supplied */ - chart.yDomain = function(value) { + chart.yDomain = function (value) { if (typeof value === 'undefined') return yDomain; yDomain = value; return chart; @@ -394,7 +416,7 @@ function realTimeLineChart() { * * @returns {Function|Array} The chart component, or the existing value if none supplied */ - chart.y2Domain = function(value) { + chart.y2Domain = function (value) { if (typeof value === 'undefined') return y2Domain; y2Domain = value; return chart; @@ -408,7 +430,7 @@ function realTimeLineChart() { * * @returns {Function} The chart component, or the existing value if none supplied */ - chart.xVal = function(value) { + chart.xVal = function (value) { if (typeof value === 'undefined') return xVal; xVal = value; return chart; @@ -422,7 +444,7 @@ function realTimeLineChart() { * * @returns {Function} The chart component, or the existing value if none supplied */ - chart.xValues = function(value) { + chart.xValues = function (value) { if (typeof value === 'undefined') return xValues; xValues = value; return chart; @@ -436,7 +458,7 @@ function realTimeLineChart() { * * @returns {Function} The chart component, or the existing value if none supplied */ - chart.yVal = function(value) { + chart.yVal = function (value) { if (typeof value === 'undefined') return yVal; yVal = value; return chart; @@ -449,7 +471,7 @@ function realTimeLineChart() { * * @returns {Function|String} The chart component, or the existing value if none supplied */ - chart.yUnits = function(value) { + chart.yUnits = function (value) { if (typeof value === 'undefined') return yUnits; yUnits = value; return chart; @@ -462,7 +484,7 @@ function realTimeLineChart() { * * @returns {Function} The chart component, or the existing value if non supplied */ - chart.yFormat = function(value) { + chart.yFormat = function (value) { if (typeof value === 'undefined') return yFormat; yFormat = value; return chart; @@ -476,7 +498,7 @@ function realTimeLineChart() { * * @returns {Function} The chart component, or the existing value if none supplied */ - chart.y2Val = function(value) { + chart.y2Val = function (value) { if (typeof value === 'undefined') return y2Val; y2Val = value; return chart; @@ -489,7 +511,7 @@ function realTimeLineChart() { * * @returns {Function|String} The chart component, or the existing value if none supplied */ - chart.y2Units = function(value) { + chart.y2Units = function (value) { if (typeof value === 'undefined') return y2Units; y2Units = value; return chart; @@ -502,7 +524,7 @@ function realTimeLineChart() { * * @returns {Function} The chart component, or the existing value if non supplied */ - chart.y2Format = function(value) { + chart.y2Format = function (value) { if (typeof value === 'undefined') return y2Format; y2Format = value; return chart; @@ -518,7 +540,7 @@ function realTimeLineChart() { * * @returns {Function} The chart component, or the existing value if none supplied */ - chart.yValues = function(value) { + chart.yValues = function (value) { if (typeof value === 'undefined') return yValues; yValues = value; return chart; @@ -534,7 +556,7 @@ function realTimeLineChart() { * * @returns {Function} The chart component, or the existing value if none supplied */ - chart.yData = function(value) { + chart.yData = function (value) { if (typeof value === 'undefined') return yData; yData = value; return chart; @@ -548,7 +570,7 @@ function realTimeLineChart() { * * @returns {Function} The chart component, or the existing value if none supplied */ - chart.yLabel = function(value) { + chart.yLabel = function (value) { if (typeof value === 'undefined') return yLabel; yLabel = value; return chart; @@ -562,7 +584,7 @@ function realTimeLineChart() { * * @returns {Function} The chart component, or the existing value if none supplied */ - chart.y2Values = function(value) { + chart.y2Values = function (value) { if (typeof value === 'undefined') return y2Values; y2Values = value; return chart; @@ -576,7 +598,7 @@ function realTimeLineChart() { * * @returns {Function} The chart component, or the existing value if none supplied */ - chart.y2Data = function(value) { + chart.y2Data = function (value) { if (typeof value === 'undefined') return y2Data; y2Data = value; return chart; @@ -590,7 +612,7 @@ function realTimeLineChart() { * * @returns {Function} The chart component, or the existing value if none supplied */ - chart.y2Label = function(value) { + chart.y2Label = function (value) { if (typeof value === 'undefined') return y2Label; y2Label = value; return chart; @@ -605,7 +627,7 @@ function realTimeLineChart() { * * @returns {Function} The chart component, or the existing value if none supplied */ - chart.defined = function(value) { + chart.defined = function (value) { if (typeof value === 'undefined') return defined; defined = value; return chart; @@ -619,7 +641,7 @@ function realTimeLineChart() { * * @returns {Function} The chart component, or the existing value if none supplied */ - chart.color = function(value) { + chart.color = function (value) { if (typeof value === 'undefined') return color; color = value; return chart; @@ -635,7 +657,7 @@ function realTimeLineChart() { * * @returns {Function} The chart component */ - chart.on = function(event, listener) { + chart.on = function (event, listener) { dispatch.on(event, listener); return chart; }; @@ -647,7 +669,7 @@ function realTimeLineChart() { * * @returns {Function|String} The chart component, or the existing value if none supplied */ - chart.prefix = function(value) { + chart.prefix = function (value) { if (typeof value === 'undefined') return prefix; prefix = value; return chart; @@ -661,7 +683,7 @@ function realTimeLineChart() { * * @returns {Function|Number} The chart component, or the existing value if none supplied */ - chart.animationDelay = function(value) { + chart.animationDelay = function (value) { if (typeof value === 'undefined') return animationDelay; animationDelay = value; return chart; @@ -674,7 +696,7 @@ function realTimeLineChart() { * * @returns {Function|Number} The chart component, or the existing value if none supplied */ - chart.singlePointTime = function(value) { + chart.singlePointTime = function (value) { if (typeof value === 'undefined') return singlePointTime; singlePointTime = value; return chart; @@ -687,7 +709,7 @@ function realTimeLineChart() { * * @returns {Function|Number} The chart component, or the existing value if none supplied */ - chart.strokeWidth = function(value) { + chart.strokeWidth = function (value) { if (typeof value === 'undefined') return strokeWidth; strokeWidth = value; return chart; @@ -700,7 +722,7 @@ function realTimeLineChart() { * * @returns {Function|Boolean} The chart component, or the existing value if none supplied */ - chart.enableMouse = function(value) { + chart.enableMouse = function (value) { if (typeof value === 'undefined') return enableMouse; enableMouse = value; return chart; @@ -713,7 +735,7 @@ function realTimeLineChart() { * * @returns {Function|Object} The chart component, or the existing value if none supplied */ - chart.eventDispatcher = function(value) { + chart.eventDispatcher = function (value) { if (typeof value === 'undefined') return eventDispatcher; eventDispatcher = value; return chart; diff --git a/packages/compass-serverstats/src/d3/real-time-mouse-overlay.js b/packages/compass-serverstats/src/d3/real-time-mouse-overlay.js index f5d876b7551..e7c8d58388c 100644 --- a/packages/compass-serverstats/src/d3/real-time-mouse-overlay.js +++ b/packages/compass-serverstats/src/d3/real-time-mouse-overlay.js @@ -1,7 +1,6 @@ const d3 = require('d3'); const { palette } = require('@mongodb-js/compass-components'); - function realTimeMouseOverlay() { let prefix = 'serverstats-overlay'; let bubbleWidth = 30; @@ -13,33 +12,49 @@ function realTimeMouseOverlay() { let eventDispatcher = d3.dispatch('mouseover', 'updateoverlay', 'mouseout'); function component(selection) { - selection.each(function(data) { + selection.each(function (data) { const svg = d3.select(this); const height = svg.attr('height'); const width = svg.attr('width'); - const basePosition = width - (bubbleWidth / 2); + const basePosition = width - bubbleWidth / 2; // Create overlay marker const overlayGroupClass = `${prefix}-group`; const overlayGroup = svg.selectAll(`g.${overlayGroupClass}`).data([data]); - overlayGroup.enter() + overlayGroup + .enter() .append('g') .attr('class', overlayGroupClass) .attr('transform', `translate(${basePosition})`); - overlayGroup.selectAll('line').data([data]).enter() + overlayGroup + .selectAll('line') + .data([data]) + .enter() .append('line') .attr('stroke', palette.white) .attr('class', `${prefix}-line`); - overlayGroup.selectAll('line') - .attr('x1', 0).attr('y1', height) - .attr('x2', 0).attr('y2', 0); - - overlayGroup.selectAll('path').data([data]).enter() + overlayGroup + .selectAll('line') + .attr('x1', 0) + .attr('y1', height) + .attr('x2', 0) + .attr('y2', 0); + + overlayGroup + .selectAll('path') + .data([data]) + .enter() .append('path') .attr('stroke', palette.white) .attr('fill', palette.white) .attr('class', `${prefix}-triangle`) - .attr('d', d3.svg.symbol().type('triangle-down').size(bubbleWidth * 3)) + .attr( + 'd', + d3.svg + .symbol() + .type('triangle-down') + .size(bubbleWidth * 3) + ) .attr('stroke', palette.white) .attr('stroke-width', strokeWidth); @@ -49,14 +64,20 @@ function realTimeMouseOverlay() { clearInterval(updateMousePosition); xPosition = xPosition || d3.mouse(this)[0]; eventDispatcher.updateoverlay(xPosition); - updateMousePosition = setInterval(sendMouseEvents.bind(this, xPosition), 20); + updateMousePosition = setInterval( + sendMouseEvents.bind(this, xPosition), + 20 + ); } - const mouseTarget = svg.selectAll(`rect.${prefix}-mouse-target`).data([data]) - .attr('height', height - (bubbleWidth / 2)) + const mouseTarget = svg + .selectAll(`rect.${prefix}-mouse-target`) + .data([data]) + .attr('height', height - bubbleWidth / 2) .attr('width', width - bubbleWidth); - const mouseTargetEnter = mouseTarget.enter() + const mouseTargetEnter = mouseTarget + .enter() .append('rect') .attr('class', `${prefix}-mouse-target`) .attr('fill', 'none') @@ -66,12 +87,12 @@ function realTimeMouseOverlay() { if (enableMouse) { mouseTargetEnter - .on('mouseover', function() { + .on('mouseover', function () { const xPosition = d3.mouse(this)[0]; eventDispatcher.mouseover(xPosition); }) .on('mousemove', sendMouseEvents) - .on('mouseout', function() { + .on('mouseout', function () { clearInterval(updateMousePosition); eventDispatcher.mouseout(basePosition); }); @@ -86,48 +107,48 @@ function realTimeMouseOverlay() { eventDispatcher.updateoverlay(); } - component.setPosition = function(xPosition) { + component.setPosition = function (xPosition) { overlayGroup.attr('transform', `translate(${xPosition})`); }; }); } - component.title = function(value) { + component.title = function (value) { if (typeof value === 'undefined') return title; title = value; return component; }; - component.bubbleWidth = function(value) { + component.bubbleWidth = function (value) { if (typeof value === 'undefined') return bubbleWidth; bubbleWidth = value; return component; }; - component.on = function(event, cb) { + component.on = function (event, cb) { eventDispatcher.on(`${event}.${title}`, cb); return component; }; - component.prefix = function(value) { + component.prefix = function (value) { if (typeof value === 'undefined') return prefix; prefix = value; return component; }; - component.strokeWidth = function(value) { + component.strokeWidth = function (value) { if (typeof value === 'undefined') return strokeWidth; strokeWidth = value; return component; }; - component.enableMouse = function(value) { + component.enableMouse = function (value) { if (typeof value === 'undefined') return enableMouse; enableMouse = value; return component; }; - component.eventDispatcher = function(value) { + component.eventDispatcher = function (value) { if (typeof value === 'undefined') return eventDispatcher; eventDispatcher = value; return component; diff --git a/packages/compass-serverstats/src/index.js b/packages/compass-serverstats/src/index.js index 48244762863..858d5b4d11a 100644 --- a/packages/compass-serverstats/src/index.js +++ b/packages/compass-serverstats/src/index.js @@ -9,7 +9,7 @@ const TopStore = require('./stores/top-store'); const INSTANCE_TAB_ROLE = { component: PerformanceComponent, name: 'Performance', - order: 3 + order: 3, }; /** @@ -28,9 +28,18 @@ function activate(appRegistry) { * Deactivate all the components in the RTSS package. */ function deactivate() { - global.hadronApp.appRegistry.deregisterRole('Instance.Tab', INSTANCE_TAB_ROLE); - global.hadronApp.appRegistry.deregisterStore('RTSS.ServerStatsStore', ServerStatsStore); - global.hadronApp.appRegistry.deregisterStore('RTSS.CurrentOpStore', CurrentOpStore); + global.hadronApp.appRegistry.deregisterRole( + 'Instance.Tab', + INSTANCE_TAB_ROLE + ); + global.hadronApp.appRegistry.deregisterStore( + 'RTSS.ServerStatsStore', + ServerStatsStore + ); + global.hadronApp.appRegistry.deregisterStore( + 'RTSS.CurrentOpStore', + CurrentOpStore + ); global.hadronApp.appRegistry.deregisterStore('RTSS.TopStore', TopStore); } diff --git a/packages/compass-serverstats/src/stores/current-op-store.js b/packages/compass-serverstats/src/stores/current-op-store.js index cfe6a3c8550..3073be951b0 100644 --- a/packages/compass-serverstats/src/stores/current-op-store.js +++ b/packages/compass-serverstats/src/stores/current-op-store.js @@ -12,12 +12,11 @@ const debug = require('debug')('mongodb-compass:server-stats:current-op-store'); * triggers with the result of the command. */ const CurrentOpStore = Reflux.createStore({ - /** * Initializing the store should set up the listener for * the 'currentOpComplete' command. */ - init: function() { + init: function () { this.restart(); this.listenTo(Actions.currentOp, this.currentOp); this.listenTo(Actions.pause, this.pause); @@ -27,14 +26,14 @@ const CurrentOpStore = Reflux.createStore({ this.listenTo(Actions.killOp, this.killOp); }, - onActivated: function(appRegistry) { + onActivated: function (appRegistry) { appRegistry.on('data-service-connected', (err, ds) => { if (err) throw err; this.dataService = ds; }); }, - restart: function() { + restart: function () { this.allOps = []; this.isPaused = false; this.endPause = 0; @@ -45,18 +44,18 @@ const CurrentOpStore = Reflux.createStore({ this.errored = []; }, - pause: function() { + pause: function () { this.endPause = this.allOps.length; this.isPaused = !this.isPaused; }, - killOp: function(id) { + killOp: function (id) { this.dataService.killOp(id).catch((err) => { Actions.dbError({ op: 'currentOp', error: err }); }); }, - mouseOver: function(index) { + mouseOver: function (index) { const startPause = Math.max(this.endPause - this.xLength, 0); const visOps = this.allOps.slice(startPause, this.endPause); const visErrors = this.errored.slice(startPause, this.endPause); @@ -69,7 +68,7 @@ const CurrentOpStore = Reflux.createStore({ this.trigger(visErrors[this.overlayIndex], data); }, - mouseOut: function() { + mouseOut: function () { this.inOverlay = false; const startPause = Math.max(this.endPause - this.xLength, 0); const visOps = this.allOps.slice(startPause, this.endPause); @@ -78,12 +77,13 @@ const CurrentOpStore = Reflux.createStore({ this.trigger(visErrors[this.overlayIndex], data); }, - currentOp: async function() { + currentOp: async function () { if (!this.dataService) { return; } - let error = null; let response; + let error = null; + let response; try { response = await this.dataService.currentOp(); @@ -91,10 +91,15 @@ const CurrentOpStore = Reflux.createStore({ error = err; } // Trigger error banner changes - if (error === null && this.errored.length > 0 && this.errored[this.errored.length - 1] !== null) { // Trigger error removal - Actions.dbError({'op': 'currentOp', 'error': null }); + if ( + error === null && + this.errored.length > 0 && + this.errored[this.errored.length - 1] !== null + ) { + // Trigger error removal + Actions.dbError({ op: 'currentOp', error: null }); } else if (error !== null) { - Actions.dbError({'op': 'currentOp', 'error': error }); + Actions.dbError({ op: 'currentOp', error: error }); } this.errored.push(error); @@ -108,10 +113,11 @@ const CurrentOpStore = Reflux.createStore({ if (error === null) { // If response is empty, send empty list let doc = []; - if (response !== undefined && ('inprog' in response)) { + if (response !== undefined && 'inprog' in response) { doc = response.inprog; } - if (this.starting) { // Skip first to match charts + if (this.starting) { + // Skip first to match charts this.starting = false; // TODO: skip first error as well? return; } @@ -120,29 +126,41 @@ const CurrentOpStore = Reflux.createStore({ continue; } if (!('microsecs_running' in doc[i])) { - debug('Error: currentOp result from DB did not include \'microsecs_running\'', doc[i]); + debug( + "Error: currentOp result from DB did not include 'microsecs_running'", + doc[i] + ); doc[i].ms_running = 0; } else { doc[i].ms_running = round(doc[i].microsecs_running / 1000, 2); } if (!('ns' in doc[i]) || !('op' in doc[i])) { - debug('Error: currentOp result from DB did not include \'ns\' or \'op\'', doc[i]); + debug( + "Error: currentOp result from DB did not include 'ns' or 'op'", + doc[i] + ); } if (!('active' in doc[i])) { - debug('Error: currentOp result from DB did not include \'active\'', doc[i]); + debug( + "Error: currentOp result from DB did not include 'active'", + doc[i] + ); } else { doc[i].active = doc[i].active.toString(); } if (!('waitingForLock' in doc[i])) { - debug('Error: currentOp result from DB did not include \'waitingForLock\'', doc[i]); + debug( + "Error: currentOp result from DB did not include 'waitingForLock'", + doc[i] + ); } else { doc[i].waitingForLock = doc[i].waitingForLock.toString(); } totals.push(doc[i]); } - totals.sort(function(a, b) { - const f = (b.ms_running < a.ms_running) ? -1 : 0; - return (a.ms_running < b.ms_running) ? 1 : f; + totals.sort(function (a, b) { + const f = b.ms_running < a.ms_running ? -1 : 0; + return a.ms_running < b.ms_running ? 1 : f; }); // Add current state to all this.allOps.push(totals); @@ -158,7 +176,7 @@ const CurrentOpStore = Reflux.createStore({ return; } this.trigger(error, totals); - } + }, }); module.exports = CurrentOpStore; diff --git a/packages/compass-serverstats/src/stores/dberror-store.js b/packages/compass-serverstats/src/stores/dberror-store.js index 98423ac7e61..f590b3abf80 100644 --- a/packages/compass-serverstats/src/stores/dberror-store.js +++ b/packages/compass-serverstats/src/stores/dberror-store.js @@ -4,16 +4,19 @@ const translate = require('mongodb-js-errors').translate; const { isEqual } = require('lodash'); const DBErrorStore = Reflux.createStore({ - - init: function() { + init: function () { this.restart(); this.listenTo(Actions.dbError, this.dbError); this.listenTo(Actions.restart, this.restart); }, - restart: function() { - this.ops = {top: null, currentOp: null, serverStatus: null}; - this.srcName = {top: 'Hottest Collections', currentOp: 'Slowest Operations', serverStatus: 'Stats Charts'}; + restart: function () { + this.ops = { top: null, currentOp: null, serverStatus: null }; + this.srcName = { + top: 'Hottest Collections', + currentOp: 'Slowest Operations', + serverStatus: 'Stats Charts', + }; }, /** @@ -31,16 +34,17 @@ const DBErrorStore = Reflux.createStore({ return error; }, - publish: function() { + publish: function () { const msg = []; - for (let key in this.ops) { // eslint-disable-line prefer-const - if (this.ops.hasOwnProperty( key ) ) { + for (let key in this.ops) { + // eslint-disable-line prefer-const + if (Object.prototype.hasOwnProperty.call(this.ops, key)) { if (this.ops[key] !== null) { msg.push({ errorMsg: this._translateMessage(this.ops[key]).message, ops: key, type: this.ops[key].name, - srcName: this.srcName[key] + srcName: this.srcName[key], }); } } @@ -48,7 +52,7 @@ const DBErrorStore = Reflux.createStore({ this.trigger(msg); }, - dbError: function(data) { + dbError: function (data) { // Remove previous error if (this.ops[data.op] !== null && data.error === null) { this.ops[data.op] = data.error; @@ -59,8 +63,7 @@ const DBErrorStore = Reflux.createStore({ this.ops[data.op] = data.error; this.publish(); } - } - + }, }); module.exports = DBErrorStore; diff --git a/packages/compass-serverstats/src/stores/globallock-store.js b/packages/compass-serverstats/src/stores/globallock-store.js index ed5029b1e3e..060a4ca7506 100644 --- a/packages/compass-serverstats/src/stores/globallock-store.js +++ b/packages/compass-serverstats/src/stores/globallock-store.js @@ -8,15 +8,14 @@ const { max } = require('lodash'); /* eslint complexity:0 */ const GlobalLockStore = Reflux.createStore({ - - init: function() { + init: function () { this.restart(); this.listenTo(ServerStatsStore, this.globalLock); this.listenTo(Actions.restart, this.restart); }, - restart: function() { - this.totalCount = {aReads: [], aWrites: [], qReads: [], qWrites: []}; + restart: function () { + this.totalCount = { aReads: [], aWrites: [], qReads: [], qWrites: [] }; this.localTime = []; this.skip = []; this.currentMaxs = []; @@ -24,26 +23,33 @@ const GlobalLockStore = Reflux.createStore({ this.xLength = 60; this.endPause = 0; this.isPaused = false; - this.data = {dataSets: [ - {line: 'aReads', count: [], active: true}, - {line: 'aWrites', count: [], active: true}, - {line: 'qReads', count: [], active: true}, - {line: 'qWrites', count: [], active: true}], - localTime: [], - skip: [], - yDomain: [0, 1], - xLength: this.xLength, - labels: { - title: 'read & write', - keys: ['active reads', 'active writes', 'queued reads', 'queued writes'], - yAxis: '' - }, - keyLength: 4, - paused: false + this.data = { + dataSets: [ + { line: 'aReads', count: [], active: true }, + { line: 'aWrites', count: [], active: true }, + { line: 'qReads', count: [], active: true }, + { line: 'qWrites', count: [], active: true }, + ], + localTime: [], + skip: [], + yDomain: [0, 1], + xLength: this.xLength, + labels: { + title: 'read & write', + keys: [ + 'active reads', + 'active writes', + 'queued reads', + 'queued writes', + ], + yAxis: '', + }, + keyLength: 4, + paused: false, }; }, - globalLock: function(error, doc, isPaused) { + globalLock: function (error, doc, isPaused) { if (!error && doc && 'localTime' in doc && 'globalLock' in doc) { if (this.starting) { this.starting = false; @@ -57,20 +63,32 @@ const GlobalLockStore = Reflux.createStore({ raw.qReads = doc.globalLock.currentQueue.readers; raw.qWrites = doc.globalLock.currentQueue.writers; - if (this.localTime.length > 0 && doc.localTime.getTime() - this.localTime[this.localTime.length - 1].getTime() < 500) { // If we're playing catchup + if ( + this.localTime.length > 0 && + doc.localTime.getTime() - + this.localTime[this.localTime.length - 1].getTime() < + 500 + ) { + // If we're playing catchup return; } - const skipped = this.localTime.length > 0 && doc.localTime - this.localTime[this.localTime.length - 1] > 2000; + const skipped = + this.localTime.length > 0 && + doc.localTime - this.localTime[this.localTime.length - 1] > 2000; - if (isPaused && !this.isPaused) { // Move into pause state + if (isPaused && !this.isPaused) { + // Move into pause state this.isPaused = true; this.endPause = this.localTime.length; - } else if (!isPaused && this.isPaused) { // Move out of pause state + } else if (!isPaused && this.isPaused) { + // Move out of pause state this.isPaused = false; this.endPause = this.localTime.length + 1; - } else if (!isPaused && !this.isPaused) { // Wasn't paused, isn't paused now + } else if (!isPaused && !this.isPaused) { + // Wasn't paused, isn't paused now this.endPause++; - if (skipped) { // If time has been skipped, then add this point twice so it is visible + if (skipped) { + // If time has been skipped, then add this point twice so it is visible this.endPause++; } } @@ -83,7 +101,10 @@ const GlobalLockStore = Reflux.createStore({ if (skipped) { this.totalCount[key].push(val); } - this.data.dataSets[q].count = this.totalCount[key].slice(startPause, this.endPause); + this.data.dataSets[q].count = this.totalCount[key].slice( + startPause, + this.endPause + ); } const maxs = [1]; for (let q = 0; q < this.data.dataSets.length; q++) { @@ -103,7 +124,7 @@ const GlobalLockStore = Reflux.createStore({ this.data.paused = isPaused; } this.trigger(error, this.data); - } + }, }); module.exports = GlobalLockStore; diff --git a/packages/compass-serverstats/src/stores/mem-store.js b/packages/compass-serverstats/src/stores/mem-store.js index 1c06d0b347b..4a764943b25 100644 --- a/packages/compass-serverstats/src/stores/mem-store.js +++ b/packages/compass-serverstats/src/stores/mem-store.js @@ -6,15 +6,14 @@ const { remove, has, round, max } = require('lodash'); /* eslint complexity:0 */ const MemStore = Reflux.createStore({ - - init: function() { + init: function () { this.restart(); this.listenTo(ServerStatsStore, this.mem); this.listenTo(Actions.restart, this.restart); }, - restart: function() { - this.totalCount = {virtual: [], resident: [], mapped: []}; + restart: function () { + this.totalCount = { virtual: [], resident: [], mapped: [] }; this.localTime = []; this.skip = []; this.currentMaxs = []; @@ -22,25 +21,27 @@ const MemStore = Reflux.createStore({ this.xLength = 60; this.endPause = 0; this.isPaused = false; - this.data = {dataSets: [ - {line: 'virtual', count: [], 'active': true}, - {line: 'resident', count: [], 'active': true}, - {line: 'mapped', count: [], 'active': true}], - localTime: [], - skip: [], - yDomain: [0, 1], - xLength: this.xLength, - labels: { - title: 'memory', - keys: ['vsize', 'resident', 'mapped'], - yAxis: 'GB' - }, - keyLength: 6, - paused: false + this.data = { + dataSets: [ + { line: 'virtual', count: [], active: true }, + { line: 'resident', count: [], active: true }, + { line: 'mapped', count: [], active: true }, + ], + localTime: [], + skip: [], + yDomain: [0, 1], + xLength: this.xLength, + labels: { + title: 'memory', + keys: ['vsize', 'resident', 'mapped'], + yAxis: 'GB', + }, + keyLength: 6, + paused: false, }; }, - mem: function(error, doc, isPaused) { + mem: function (error, doc, isPaused) { if (!error && doc && 'localTime' in doc && 'mem' in doc) { if (this.starting) { this.starting = false; @@ -49,20 +50,32 @@ const MemStore = Reflux.createStore({ let key; let val; - if (this.localTime.length > 0 && doc.localTime.getTime() - this.localTime[this.localTime.length - 1].getTime() < 500) { // If we're playing catchup + if ( + this.localTime.length > 0 && + doc.localTime.getTime() - + this.localTime[this.localTime.length - 1].getTime() < + 500 + ) { + // If we're playing catchup return; } - const skipped = this.localTime.length > 0 && doc.localTime - this.localTime[this.localTime.length - 1] > 2000; + const skipped = + this.localTime.length > 0 && + doc.localTime - this.localTime[this.localTime.length - 1] > 2000; - if (isPaused && !this.isPaused) { // Move into pause state + if (isPaused && !this.isPaused) { + // Move into pause state this.isPaused = true; this.endPause = this.localTime.length; - } else if (!isPaused && this.isPaused) { // Move out of pause state + } else if (!isPaused && this.isPaused) { + // Move out of pause state this.isPaused = false; this.endPause = this.localTime.length + 1; - } else if (!isPaused && !this.isPaused) { // Wasn't paused, isn't paused now + } else if (!isPaused && !this.isPaused) { + // Wasn't paused, isn't paused now this.endPause++; - if (skipped) { // If time has been skipped, then add this point twice so it is visible + if (skipped) { + // If time has been skipped, then add this point twice so it is visible this.endPause++; } } @@ -80,7 +93,10 @@ const MemStore = Reflux.createStore({ if (skipped) { this.totalCount[key].push(val); } - this.data.dataSets[q].count = this.totalCount[key].slice(startPause, this.endPause); + this.data.dataSets[q].count = this.totalCount[key].slice( + startPause, + this.endPause + ); } const maxs = [1]; for (let q = 0; q < this.data.dataSets.length; q++) { @@ -100,7 +116,7 @@ const MemStore = Reflux.createStore({ this.data.paused = isPaused; } this.trigger(error, this.data); - } + }, }); module.exports = MemStore; diff --git a/packages/compass-serverstats/src/stores/network-store.js b/packages/compass-serverstats/src/stores/network-store.js index 1535c4db3d2..f363fe58c2c 100644 --- a/packages/compass-serverstats/src/stores/network-store.js +++ b/packages/compass-serverstats/src/stores/network-store.js @@ -7,15 +7,14 @@ const { max } = require('lodash'); /* eslint complexity:0 */ const NetworkStore = Reflux.createStore({ - - init: function() { + init: function () { this.restart(); this.listenTo(ServerStatsStore, this.network); this.listenTo(Actions.restart, this.restart); }, - restart: function() { - this.bytesPerSec = {bytesIn: [], bytesOut: []}; + restart: function () { + this.bytesPerSec = { bytesIn: [], bytesOut: [] }; this.connectionCount = []; this.localTime = []; this.skip = []; @@ -25,50 +24,64 @@ const NetworkStore = Reflux.createStore({ this.xLength = 60; this.endPause = 0; this.isPaused = false; - this.data = {dataSets: [ - {line: 'bytesIn', count: [], active: true, current: 0}, - {line: 'bytesOut', count: [], active: true, current: 0}], - localTime: [], - skip: [], - yDomain: [0, 1], - xLength: this.xLength, - labels: { - title: 'network', - keys: ['net in', 'net out', 'connections'], - yAxis: 'KB' - }, - keyLength: 6, - secondScale: { - line: 'connections', - count: [], - active: true, - currentMax: 1, - units: 'conn' - }, - paused: false + this.data = { + dataSets: [ + { line: 'bytesIn', count: [], active: true, current: 0 }, + { line: 'bytesOut', count: [], active: true, current: 0 }, + ], + localTime: [], + skip: [], + yDomain: [0, 1], + xLength: this.xLength, + labels: { + title: 'network', + keys: ['net in', 'net out', 'connections'], + yAxis: 'KB', + }, + keyLength: 6, + secondScale: { + line: 'connections', + count: [], + active: true, + currentMax: 1, + units: 'conn', + }, + paused: false, }; }, - network: function(error, doc, isPaused) { + network: function (error, doc, isPaused) { if (!error && doc && 'localTime' in doc && 'network' in doc) { let key; let val; let count; - if (this.localTime.length > 0 && doc.localTime.getTime() - this.localTime[this.localTime.length - 1].getTime() < 500) { // If we're playing catchup + if ( + this.localTime.length > 0 && + doc.localTime.getTime() - + this.localTime[this.localTime.length - 1].getTime() < + 500 + ) { + // If we're playing catchup return; } - const skipped = this.localTime.length > 0 && doc.localTime - this.localTime[this.localTime.length - 1] > 2000; + const skipped = + this.localTime.length > 0 && + doc.localTime - this.localTime[this.localTime.length - 1] > 2000; - if (isPaused && !this.isPaused) { // Move into pause state + if (isPaused && !this.isPaused) { + // Move into pause state this.isPaused = true; this.endPause = this.localTime.length; - } else if (!isPaused && this.isPaused) { // Move out of pause state + } else if (!isPaused && this.isPaused) { + // Move out of pause state this.isPaused = false; this.endPause = this.localTime.length + 1; - } else if (!isPaused && !this.isPaused && !this.starting) { // Wasn't paused, isn't paused now + } else if (!isPaused && !this.isPaused && !this.starting) { + // Wasn't paused, isn't paused now this.endPause++; - if (skipped) { // If time has been skipped, then add this point twice so it is visible + if (skipped) { + // If time has been skipped, then add this point twice so it is visible this.endPause++; } } @@ -78,7 +91,8 @@ const NetworkStore = Reflux.createStore({ key = this.data.dataSets[q].line; count = round(doc.network[key] / 1000, 2); // convert to KB - if (this.starting) { // don't add data, starting point + if (this.starting) { + // don't add data, starting point this.data.dataSets[q].current = count; continue; } @@ -87,7 +101,10 @@ const NetworkStore = Reflux.createStore({ if (skipped) { this.bytesPerSec[key].push(val); } - this.data.dataSets[q].count = this.bytesPerSec[key].slice(startPause, this.endPause); + this.data.dataSets[q].count = this.bytesPerSec[key].slice( + startPause, + this.endPause + ); this.data.dataSets[q].current = count; } if (this.starting) { @@ -112,9 +129,13 @@ const NetworkStore = Reflux.createStore({ this.skip.push(skipped); } this.skip.push(false); - this.data.secondScale.count = this.connectionCount.slice(startPause, this.endPause); + this.data.secondScale.count = this.connectionCount.slice( + startPause, + this.endPause + ); this.secondCurrentMaxs.push(max(this.data.secondScale.count)); - this.data.secondScale.currentMax = this.secondCurrentMaxs[this.endPause - 1]; + this.data.secondScale.currentMax = + this.secondCurrentMaxs[this.endPause - 1]; // Add the rest of the data this.data.yDomain = [0, this.currentMaxs[this.endPause - 1]]; @@ -124,7 +145,7 @@ const NetworkStore = Reflux.createStore({ this.data.paused = isPaused; } this.trigger(error, this.data); - } + }, }); module.exports = NetworkStore; diff --git a/packages/compass-serverstats/src/stores/opcounters-store.js b/packages/compass-serverstats/src/stores/opcounters-store.js index dfbe7e65818..a9b11701a9f 100644 --- a/packages/compass-serverstats/src/stores/opcounters-store.js +++ b/packages/compass-serverstats/src/stores/opcounters-store.js @@ -6,17 +6,21 @@ const { max } = require('lodash'); /* eslint complexity:0 */ const OpCounterStore = Reflux.createStore({ - - init: function() { + init: function () { this.restart(); this.listenTo(ServerStatsStore, this.opCounter); this.listenTo(Actions.restart, this.restart); }, - restart: function() { + restart: function () { this.opsPerSec = { - insert: [], query: [], update: [], - delete: [], command: [], getmore: []}; + insert: [], + query: [], + update: [], + delete: [], + command: [], + getmore: [], + }; this.localTime = []; this.skip = []; this.currentMaxs = []; @@ -24,48 +28,69 @@ const OpCounterStore = Reflux.createStore({ this.xLength = 60; this.endPause = 0; this.isPaused = false; - this.data = {dataSets: [ - {line: 'insert', count: [], active: true, current: 0}, - {line: 'query', count: [], active: true, current: 0}, - {line: 'update', count: [], active: true, current: 0}, - {line: 'delete', count: [], active: true, current: 0}, - {line: 'command', count: [], active: true, current: 0}, - {line: 'getmore', count: [], active: true, current: 0}], - localTime: [], - skip: [], - yDomain: [0, 1], - xLength: this.xLength, - labels: { - title: 'operations', - keys: ['inserts', 'queries', 'updates', 'deletes', 'commands', 'getmores'], - yAxis: 'ops' - }, - keyLength: 6, - paused: false, - trigger: true + this.data = { + dataSets: [ + { line: 'insert', count: [], active: true, current: 0 }, + { line: 'query', count: [], active: true, current: 0 }, + { line: 'update', count: [], active: true, current: 0 }, + { line: 'delete', count: [], active: true, current: 0 }, + { line: 'command', count: [], active: true, current: 0 }, + { line: 'getmore', count: [], active: true, current: 0 }, + ], + localTime: [], + skip: [], + yDomain: [0, 1], + xLength: this.xLength, + labels: { + title: 'operations', + keys: [ + 'inserts', + 'queries', + 'updates', + 'deletes', + 'commands', + 'getmores', + ], + yAxis: 'ops', + }, + keyLength: 6, + paused: false, + trigger: true, }; }, - opCounter: function(error, doc, isPaused) { + opCounter: function (error, doc, isPaused) { if (!error && doc && 'localTime' in doc && 'opcounters' in doc) { let key; let val; let count; - if (this.localTime.length > 0 && doc.localTime.getTime() - this.localTime[this.localTime.length - 1].getTime() < 500) { // If we're playing catchup + if ( + this.localTime.length > 0 && + doc.localTime.getTime() - + this.localTime[this.localTime.length - 1].getTime() < + 500 + ) { + // If we're playing catchup return; } - const skipped = this.localTime.length > 0 && doc.localTime - this.localTime[this.localTime.length - 1] > 2000; + const skipped = + this.localTime.length > 0 && + doc.localTime - this.localTime[this.localTime.length - 1] > 2000; - if (isPaused && !this.isPaused) { // Move into pause state + if (isPaused && !this.isPaused) { + // Move into pause state this.isPaused = true; this.endPause = this.localTime.length; - } else if (!isPaused && this.isPaused) { // Move out of pause state + } else if (!isPaused && this.isPaused) { + // Move out of pause state this.isPaused = false; this.endPause = this.localTime.length + 1; - } else if (!isPaused && !this.isPaused && !this.starting) { // Wasn't paused, isn't paused now + } else if (!isPaused && !this.isPaused && !this.starting) { + // Wasn't paused, isn't paused now this.endPause++; - if (skipped) { // If time has been skipped, then add this point twice so it is visible. + if (skipped) { + // If time has been skipped, then add this point twice so it is visible. this.endPause++; } } @@ -74,7 +99,8 @@ const OpCounterStore = Reflux.createStore({ for (let q = 0; q < this.data.dataSets.length; q++) { key = this.data.dataSets[q].line; count = doc.opcounters[key]; - if (this.starting) { // don't add data, starting point + if (this.starting) { + // don't add data, starting point this.data.dataSets[q].current = count; continue; } @@ -84,7 +110,10 @@ const OpCounterStore = Reflux.createStore({ if (skipped) { this.opsPerSec[key].push(val); } - this.data.dataSets[q].count = this.opsPerSec[key].slice(startPause, this.endPause); + this.data.dataSets[q].count = this.opsPerSec[key].slice( + startPause, + this.endPause + ); this.data.dataSets[q].current = count; } if (this.starting) { @@ -109,7 +138,7 @@ const OpCounterStore = Reflux.createStore({ this.data.paused = isPaused; } this.trigger(error, this.data); - } + }, }); module.exports = OpCounterStore; diff --git a/packages/compass-serverstats/src/stores/server-stats-graphs-store.js b/packages/compass-serverstats/src/stores/server-stats-graphs-store.js index 17ccee0c5a3..6bd961264fa 100644 --- a/packages/compass-serverstats/src/stores/server-stats-graphs-store.js +++ b/packages/compass-serverstats/src/stores/server-stats-graphs-store.js @@ -4,15 +4,14 @@ const Actions = require('../actions'); // const debug = require('debug')('mongodb-compass:server-stats:graphs-store'); const ServerStatsStore = Reflux.createStore({ - - init: function() { + init: function () { this.restart(); this.listenTo(Actions.serverStats, this.serverStats); this.listenTo(Actions.restart, this.restart); this.listenTo(Actions.pause, this.pause); }, - onActivated: function(appRegistry) { + onActivated: function (appRegistry) { appRegistry.on('data-service-connected', (err, ds) => { if (!err) { this.dataService = ds; @@ -22,31 +21,33 @@ const ServerStatsStore = Reflux.createStore({ }); }, - restart: function() { + restart: function () { this.isPaused = false; }, - serverStats: async function() { + serverStats: async function () { if (!this.dataService) { return; } - let error = null; let doc; + let error = null; + let doc; try { doc = await this.dataService.serverStatus(); } catch (err) { error = err; } - if (error === null && this.error !== null) { // Trigger error removal - Actions.dbError({'op': 'serverStatus', 'error': null }); + if (error === null && this.error !== null) { + // Trigger error removal + Actions.dbError({ op: 'serverStatus', error: null }); } else if (error !== null) { - Actions.dbError({'op': 'serverStatus', 'error': error }); + Actions.dbError({ op: 'serverStatus', error: error }); } this.trigger(error, doc, this.isPaused); }, - pause: function() { + pause: function () { this.isPaused = !this.isPaused; - } + }, }); module.exports = ServerStatsStore; diff --git a/packages/compass-serverstats/src/stores/top-store.js b/packages/compass-serverstats/src/stores/top-store.js index 347227cbb0b..294baf1049d 100644 --- a/packages/compass-serverstats/src/stores/top-store.js +++ b/packages/compass-serverstats/src/stores/top-store.js @@ -13,12 +13,11 @@ const debug = require('debug')('mongodb-compass:server-stats:top-store'); * triggers with the result of the command. */ const TopStore = Reflux.createStore({ - /** * Initializing the store should set up the listener for * the 'topComplete' command. */ - init: function() { + init: function () { this.restart(); this.listenTo(Actions.top, this.topDelta); this.listenTo(Actions.pause, this.pause); @@ -27,7 +26,7 @@ const TopStore = Reflux.createStore({ this.listenTo(Actions.mouseOut, this.mouseOut); }, - onActivated: function(appRegistry) { + onActivated: function (appRegistry) { appRegistry.on('data-service-connected', (err, ds) => { if (err) throw err; this.dataService = ds; @@ -35,7 +34,7 @@ const TopStore = Reflux.createStore({ }); }, - restart: function() { + restart: function () { this.allOps = []; this.errored = []; this.isPaused = false; @@ -49,12 +48,12 @@ const TopStore = Reflux.createStore({ this.topUnableToRetrieveSomeCollections = false; }, - pause: function() { + pause: function () { this.endPause = this.allOps.length; this.isPaused = !this.isPaused; }, - mouseOver: function(index) { + mouseOver: function (index) { const startPause = Math.max(this.endPause - this.xLength, 0); const visOps = this.allOps.slice(startPause, this.endPause); const visErrors = this.errored.slice(startPause, this.endPause); @@ -67,7 +66,7 @@ const TopStore = Reflux.createStore({ this.trigger(visErrors[this.overlayIndex], data); }, - mouseOut: function() { + mouseOut: function () { this.inOverlay = false; const startPause = Math.max(this.endPause - this.xLength, 0); const visOps = this.allOps.slice(startPause, this.endPause); @@ -77,7 +76,7 @@ const TopStore = Reflux.createStore({ }, // Calculate list as current hottest collection (like Cloud and system top) - topDelta: async function() { + topDelta: async function () { // early return in mongos since top command is not available if (this.isMongos) { return; @@ -87,7 +86,8 @@ const TopStore = Reflux.createStore({ return; } - let error = null; let response; + let error = null; + let response; try { response = await this.dataService.top(); @@ -96,10 +96,15 @@ const TopStore = Reflux.createStore({ } // Trigger error banner changes - if (error === null && this.errored.length > 0 && this.errored[this.errored.length - 1] !== null) { // Trigger error removal - Actions.dbError({'op': 'top', 'error': null }); + if ( + error === null && + this.errored.length > 0 && + this.errored[this.errored.length - 1] !== null + ) { + // Trigger error removal + Actions.dbError({ op: 'top', error: null }); } else if (error !== null) { - Actions.dbError({'op': 'top', 'error': error }); + Actions.dbError({ op: 'top', error: error }); } this.errored.push(error); // Update op list if error @@ -112,15 +117,20 @@ const TopStore = Reflux.createStore({ if (error === null) { // If response is empty, send empty list let doc = {}; - if (response !== undefined && ('totals' in response)) { + if (response !== undefined && 'totals' in response) { doc = response.totals; } const numCores = global.hadronApp.instance.host.cpu_cores; const cadence = 1000000; // Can safetly assume we're polling 1x/sec TODO const t2s = {}; - for (let collname in doc) { // eslint-disable-line prefer-const + for (let collname in doc) { + // eslint-disable-line prefer-const // Ignore special collections - if (!doc.hasOwnProperty(collname) || collname === 'note' || toNS(collname).specialish) { + if ( + !Object.prototype.hasOwnProperty.call(doc, collname) || + collname === 'note' || + toNS(collname).specialish + ) { continue; } @@ -132,13 +142,17 @@ const TopStore = Reflux.createStore({ continue; } - if (!('readLock' in value) || !('writeLock' in value) || !('total' in value)) { + if ( + !('readLock' in value) || + !('writeLock' in value) || + !('total' in value) + ) { debug('Error: top response from DB missing fields', value); } t2s[collname] = { - 'loadPercentR': value.readLock.time, - 'loadPercentL': value.writeLock.time, - 'loadPercent': value.total.time + loadPercentR: value.readLock.time, + loadPercentL: value.writeLock.time, + loadPercent: value.total.time, }; } // Must skip first data point in order to show deltas. @@ -148,30 +162,40 @@ const TopStore = Reflux.createStore({ return; } // Calculate system load per collection - for (let collname in t2s) { // eslint-disable-line prefer-const - if (!t2s.hasOwnProperty(collname)) { + for (let collname in t2s) { + // eslint-disable-line prefer-const + if (!Object.prototype.hasOwnProperty.call(t2s, collname)) { continue; } - const t1 = collname in this.t1s ? this.t1s[collname] : {'loadPercent': 0, 'loadPercentR': 0, 'loadPercentL': 0}; + const t1 = + collname in this.t1s + ? this.t1s[collname] + : { loadPercent: 0, loadPercentR: 0, loadPercentL: 0 }; const t2 = t2s[collname]; const tDelta = t2.loadPercent - t1.loadPercent; - const loadL = tDelta === 0 ? 0 : round(((t2.loadPercentL - t1.loadPercentL) / tDelta) * 100, 0); - const loadR = tDelta === 0 ? 0 : round(((t2.loadPercentR - t1.loadPercentR) / tDelta) * 100, 0); + const loadL = + tDelta === 0 + ? 0 + : round(((t2.loadPercentL - t1.loadPercentL) / tDelta) * 100, 0); + const loadR = + tDelta === 0 + ? 0 + : round(((t2.loadPercentR - t1.loadPercentR) / tDelta) * 100, 0); totals.push({ - 'collectionName': collname, - 'loadPercent': round((tDelta * 100) / (cadence * numCores), 2), // System load. - 'loadPercentR': loadR, - 'loadPercentL': loadL + collectionName: collname, + loadPercent: round((tDelta * 100) / (cadence * numCores), 2), // System load. + loadPercentR: loadR, + loadPercentL: loadL, }); } this.t1s = t2s; // Sort - totals.sort(function(a, b) { - const f = (b.loadPercent < a.loadPercent) ? -1 : 0; - return (a.loadPercent < b.loadPercent) ? 1 : f; + totals.sort(function (a, b) { + const f = b.loadPercent < a.loadPercent ? -1 : 0; + return a.loadPercent < b.loadPercent ? 1 : f; }); // Add current state to all this.allOps.push(totals); @@ -187,7 +211,7 @@ const TopStore = Reflux.createStore({ return; } this.trigger(error, totals); - } + }, }); module.exports = TopStore; diff --git a/packages/compass-serverstats/test/enzyme/chart-component.test.js b/packages/compass-serverstats/test/enzyme/chart-component.test.js index 723d5c56393..34216dcab01 100644 --- a/packages/compass-serverstats/test/enzyme/chart-component.test.js +++ b/packages/compass-serverstats/test/enzyme/chart-component.test.js @@ -7,22 +7,19 @@ const { mount } = require('enzyme'); const ChartComponent = require('../../src/components/chart-component'); const OpCountersStore = require('../../src/stores/opcounters-store'); -describe('', () => { - context('when rendering the chart component', () => { +describe('', function () { + context('when rendering the chart component', function () { let component = null; - beforeEach(() => { + beforeEach(function () { const dispatcher = d3.dispatch('mouseover'); component = mount( - + ); }); - it('checks redraw() of the component', () => { - component.setState({data: {localTime: [], xLength: 1}}); + it('checks redraw() of the component', function () { + component.setState({ data: { localTime: [], xLength: 1 } }); expect(component).to.exist; }); }); diff --git a/packages/compass-serverstats/test/enzyme/performance-component.test.js b/packages/compass-serverstats/test/enzyme/performance-component.test.js index c9055ea45e0..95f7ca2c8e8 100644 --- a/packages/compass-serverstats/test/enzyme/performance-component.test.js +++ b/packages/compass-serverstats/test/enzyme/performance-component.test.js @@ -9,31 +9,31 @@ const ServerStatsStore = require('../../src/stores/server-stats-graphs-store'); const TopStore = require('../../src/stores/top-store'); const { PerformanceComponent } = require('../../src/components/'); -describe('rtss', () => { +describe('rtss', function () { const appDataService = app.dataService; const appInstance = app.instance; - afterEach(() => { + afterEach(function () { // Restore properties on the global app object, // so they don't affect other tests app.dataService = appDataService; app.instance = appInstance; }); - context('when connected to a mongos', () => { + context('when connected to a mongos', function () { let component = null; - beforeEach(() => { + beforeEach(function () { ServerStatsStore.isMongos = true; component = mount(); }); - afterEach(() => { + afterEach(function () { ServerStatsStore.isMongos = false; component.unmount(); }); - it('displays the top not available in mongos message', () => { + it('displays the top not available in mongos message', function () { const state = component.find(Banner); expect(state.text()).to.include( 'Top command is not available for mongos, some charts may not show any data.' @@ -41,24 +41,27 @@ describe('rtss', () => { }); }); - context('when top is unable to retrieve information about some collections', () => { - let component = null; + context( + 'when top is unable to retrieve information about some collections', + function () { + let component = null; - beforeEach(() => { - TopStore.topUnableToRetrieveSomeCollections = true; - component = mount(); - }); + beforeEach(function () { + TopStore.topUnableToRetrieveSomeCollections = true; + component = mount(); + }); - afterEach(() => { - TopStore.topUnableToRetrieveSomeCollections = false; - component.unmount(); - }); + afterEach(function () { + TopStore.topUnableToRetrieveSomeCollections = false; + component.unmount(); + }); - it('displays a warning message', () => { - const state = component.find(Banner); - expect(state.text()).to.include( - 'Top command is unable to retrieve information about certain collections, resulting in incomplete data being displayed on the charts.' - ); - }); - }); + it('displays a warning message', function () { + const state = component.find(Banner); + expect(state.text()).to.include( + 'Top command is unable to retrieve information about certain collections, resulting in incomplete data being displayed on the charts.' + ); + }); + } + ); }); diff --git a/packages/compass-serverstats/test/enzyme/server-stats-toolbar.test.tsx b/packages/compass-serverstats/test/enzyme/server-stats-toolbar.test.tsx index 93f6b236955..dac16cdafb5 100644 --- a/packages/compass-serverstats/test/enzyme/server-stats-toolbar.test.tsx +++ b/packages/compass-serverstats/test/enzyme/server-stats-toolbar.test.tsx @@ -6,31 +6,31 @@ import d3 from 'd3'; import realTimeDispatcher from '../../src/d3/real-time-dispatcher'; import { ServerStatsToolbar } from '../../src/components/server-stats-toolbar'; -describe('', function() { - context('when initialized, mounted and rendered', function() { - beforeEach(function() { +describe('', function () { + context('when initialized, mounted and rendered', function () { + beforeEach(function () { this.dispatcher = realTimeDispatcher(); this.component = enzyme.mount( - + ); }); - it('shows a default time of 00:00:00', function() { - expect(this.component.find('[data-testid="server-stats-time"]').text()).to.equal('00:00:00'); + it('shows a default time of 00:00:00', function () { + expect( + this.component.find('[data-testid="server-stats-time"]').text() + ).to.equal('00:00:00'); }); - context('when the eventDispatcher notifies a newXValue', function() { - beforeEach(function() { + context('when the eventDispatcher notifies a newXValue', function () { + beforeEach(function () { this.date = new Date(1512153289331); this.dispatcher.newXValue(this.date); }); - it('shows the correct time', function() { + it('shows the correct time', function () { expect( this.component.find('[data-testid="server-stats-time"]').text() - ).to.equal(d3.time.format.utc('%X')(this.date)); + ).to.equal((d3 as any).time.format.utc('%X')(this.date)); }); }); }); diff --git a/packages/compass-serverstats/tsconfig-lint.json b/packages/compass-serverstats/tsconfig-lint.json new file mode 100644 index 00000000000..6bdef84f322 --- /dev/null +++ b/packages/compass-serverstats/tsconfig-lint.json @@ -0,0 +1,5 @@ +{ + "extends": "./tsconfig.json", + "include": ["**/*"], + "exclude": ["node_modules", "dist"] +} diff --git a/packages/compass-serverstats/tsconfig.json b/packages/compass-serverstats/tsconfig.json new file mode 100644 index 00000000000..e45df8e2f65 --- /dev/null +++ b/packages/compass-serverstats/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "@mongodb-js/tsconfig-compass/tsconfig.react.json", + "compilerOptions": { + "outDir": "dist", + "allowJs": true + }, + "include": ["src/**/*"], + "exclude": ["./src/**/*.spec.*"] +}