@k8slens/extensions 5.3.0-git.b4a4cc6be4.0 → 5.3.0-git.bd7ba9ff43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/common/cluster-store.d.ts +0 -1
- package/dist/src/common/k8s-api/endpoints/pods.api.d.ts +7 -6
- package/dist/src/common/k8s-api/json-api.d.ts +2 -0
- package/dist/src/common/k8s-api/kube-api.d.ts +1 -1
- package/dist/src/common/routes/port-forwards.d.ts +1 -0
- package/dist/src/extensions/extension-api.js +17 -17
- package/dist/src/renderer/components/+cluster/cluster-issues.d.ts +0 -1
- package/dist/src/renderer/components/+cluster/cluster-metric-switchers.d.ts +0 -1
- package/dist/src/renderer/components/+cluster/cluster-metrics.d.ts +0 -1
- package/dist/src/renderer/components/+cluster/cluster-overview.d.ts +0 -1
- package/dist/src/renderer/components/+cluster/cluster-pie-charts.d.ts +0 -1
- package/dist/src/renderer/components/+network-port-forwards/port-forward-details.d.ts +33 -0
- package/dist/src/renderer/components/+network-port-forwards/port-forward-menu.d.ts +1 -1
- package/dist/src/renderer/components/+network-port-forwards/port-forwards.d.ts +10 -1
- package/dist/src/renderer/components/+network-services/service-port-component.d.ts +0 -1
- package/dist/src/renderer/components/+workloads-pods/pod-container-port.d.ts +0 -1
- package/dist/src/renderer/components/+workloads-pods/pod-details-list.d.ts +0 -3
- package/dist/src/renderer/components/layout/sidebar-storage.d.ts +1 -0
- package/dist/src/renderer/components/switch/switcher.d.ts +1 -1
- package/dist/src/renderer/components/table/table.d.ts +18 -2
- package/dist/src/renderer/components/virtual-list/virtual-list.d.ts +6 -0
- package/dist/src/renderer/port-forward/port-forward-dialog.d.ts +0 -1
- package/dist/src/renderer/port-forward/port-forward.store.d.ts +1 -0
- package/package.json +1 -1
|
@@ -36860,7 +36860,7 @@ eval("class Node {\n\t/// value;\n\t/// next;\n\n\tconstructor(value) {\n\t\tthi
|
|
|
36860
36860
|
/*! exports provided: name, productName, description, homepage, version, main, copyright, license, author, scripts, config, engines, jest, build, dependencies, devDependencies, default */
|
|
36861
36861
|
/***/ (function(module) {
|
|
36862
36862
|
|
|
36863
|
-
eval("module.exports = JSON.parse(\"{\\\"name\\\":\\\"open-lens\\\",\\\"productName\\\":\\\"OpenLens\\\",\\\"description\\\":\\\"OpenLens - Open Source IDE for Kubernetes\\\",\\\"homepage\\\":\\\"https://github.com/lensapp/lens\\\",\\\"version\\\":\\\"5.3.0-alpha.2\\\",\\\"main\\\":\\\"static/build/main.js\\\",\\\"copyright\\\":\\\"© 2021 OpenLens Authors\\\",\\\"license\\\":\\\"MIT\\\",\\\"author\\\":{\\\"name\\\":\\\"OpenLens Authors\\\",\\\"email\\\":\\\"info@k8slens.dev\\\"},\\\"scripts\\\":{\\\"dev\\\":\\\"concurrently -i -k \\\\\\\"yarn run dev-run -C\\\\\\\" yarn:dev:*\\\",\\\"dev-build\\\":\\\"concurrently yarn:compile:*\\\",\\\"debug-build\\\":\\\"concurrently yarn:compile:main yarn:compile:extension-types\\\",\\\"dev-run\\\":\\\"nodemon --watch static/build/main.js --exec \\\\\\\"electron --remote-debugging-port=9223 --inspect .\\\\\\\"\\\",\\\"dev:main\\\":\\\"yarn run compile:main --watch\\\",\\\"dev:renderer\\\":\\\"yarn run webpack-dev-server --config webpack.renderer.ts\\\",\\\"dev:extension-types\\\":\\\"yarn run compile:extension-types --watch\\\",\\\"compile\\\":\\\"env NODE_ENV=production concurrently yarn:compile:*\\\",\\\"compile:main\\\":\\\"yarn run webpack --config webpack.main.ts\\\",\\\"compile:renderer\\\":\\\"yarn run webpack --config webpack.renderer.ts\\\",\\\"compile:extension-types\\\":\\\"yarn run webpack --config webpack.extensions.ts\\\",\\\"npm:fix-build-version\\\":\\\"yarn run ts-node build/set_build_version.ts\\\",\\\"npm:fix-package-version\\\":\\\"yarn run ts-node build/set_npm_version.ts\\\",\\\"build:linux\\\":\\\"yarn run compile && electron-builder --linux --dir\\\",\\\"build:mac\\\":\\\"yarn run compile && electron-builder --mac --dir\\\",\\\"build:win\\\":\\\"yarn run compile && electron-builder --win --dir\\\",\\\"integration\\\":\\\"jest --runInBand --detectOpenHandles --forceExit integration\\\",\\\"dist\\\":\\\"yarn run compile && electron-builder --publish onTag\\\",\\\"dist:dir\\\":\\\"yarn run dist --dir -c.compression=store -c.mac.identity=null\\\",\\\"download-bins\\\":\\\"concurrently yarn:download:*\\\",\\\"download:kubectl\\\":\\\"yarn run ts-node build/download_kubectl.ts\\\",\\\"download:helm\\\":\\\"yarn run ts-node build/download_helm.ts\\\",\\\"build:tray-icons\\\":\\\"yarn run ts-node build/build_tray_icon.ts\\\",\\\"lint\\\":\\\"PROD=true yarn run eslint --ext js,ts,tsx --max-warnings=0 .\\\",\\\"lint:fix\\\":\\\"yarn run lint --fix\\\",\\\"mkdocs-serve-local\\\":\\\"docker build -t mkdocs-serve-local:latest mkdocs/ && docker run --rm -it -p 8000:8000 -v ${PWD}:/docs mkdocs-serve-local:latest\\\",\\\"verify-docs\\\":\\\"docker build -t mkdocs-serve-local:latest mkdocs/ && docker run --rm -v ${PWD}:/docs mkdocs-serve-local:latest build --strict\\\",\\\"typedocs-extensions-api\\\":\\\"yarn run typedoc src/extensions/extension-api.ts\\\",\\\"version-checkout\\\":\\\"cat package.json | jq '.version' -r | xargs printf \\\\\\\"release/v%s\\\\\\\" | xargs git checkout -b\\\",\\\"version-commit\\\":\\\"cat package.json | jq '.version' -r | xargs printf \\\\\\\"release v%s\\\\\\\" | git commit --no-edit -s -F -\\\",\\\"version\\\":\\\"yarn run version-checkout && git add package.json && yarn run version-commit\\\",\\\"postversion\\\":\\\"git push --set-upstream ${GIT_REMOTE:-origin} release/v$npm_package_version\\\"},\\\"config\\\":{\\\"bundledKubectlVersion\\\":\\\"1.21.2\\\",\\\"bundledHelmVersion\\\":\\\"3.6.3\\\",\\\"sentryDsn\\\":\\\"\\\"},\\\"engines\\\":{\\\"node\\\":\\\">=14 <15\\\"},\\\"jest\\\":{\\\"collectCoverage\\\":false,\\\"verbose\\\":true,\\\"transform\\\":{\\\"^.+\\\\\\\\.tsx?$\\\":\\\"ts-jest\\\"},\\\"moduleNameMapper\\\":{\\\"\\\\\\\\.(css|scss)$\\\":\\\"<rootDir>/__mocks__/styleMock.ts\\\",\\\"\\\\\\\\.(svg)$\\\":\\\"<rootDir>/__mocks__/imageMock.ts\\\",\\\"src/(.*)\\\":\\\"<rootDir>/__mocks__/windowMock.ts\\\"},\\\"modulePathIgnorePatterns\\\":[\\\"<rootDir>/dist\\\",\\\"<rootDir>/src/extensions/npm\\\"],\\\"setupFiles\\\":[\\\"<rootDir>/src/jest.setup.ts\\\",\\\"jest-canvas-mock\\\"]},\\\"build\\\":{\\\"generateUpdatesFilesForAllChannels\\\":true,\\\"files\\\":[\\\"static/build/main.js\\\"],\\\"afterSign\\\":\\\"build/notarize.js\\\",\\\"extraResources\\\":[{\\\"from\\\":\\\"locales/\\\",\\\"to\\\":\\\"locales/\\\",\\\"filter\\\":\\\"**/*.js\\\"},{\\\"from\\\":\\\"static/\\\",\\\"to\\\":\\\"static/\\\",\\\"filter\\\":\\\"!**/main.js\\\"},{\\\"from\\\":\\\"build/tray\\\",\\\"to\\\":\\\"static/icons\\\",\\\"filter\\\":\\\"*.png\\\"},{\\\"from\\\":\\\"extensions/\\\",\\\"to\\\":\\\"./extensions/\\\",\\\"filter\\\":[\\\"**/*.tgz\\\",\\\"**/package.json\\\",\\\"!**/node_modules\\\"]},{\\\"from\\\":\\\"templates/\\\",\\\"to\\\":\\\"./templates/\\\",\\\"filter\\\":\\\"**/*.yaml\\\"},\\\"LICENSE\\\"],\\\"linux\\\":{\\\"category\\\":\\\"Network\\\",\\\"artifactName\\\":\\\"${productName}-${version}.${arch}.${ext}\\\",\\\"target\\\":[\\\"deb\\\",\\\"rpm\\\",\\\"AppImage\\\"],\\\"extraResources\\\":[{\\\"from\\\":\\\"binaries/client/linux/${arch}/kubectl\\\",\\\"to\\\":\\\"./${arch}/kubectl\\\"},{\\\"from\\\":\\\"binaries/client/${arch}/helm3/helm3\\\",\\\"to\\\":\\\"./helm3/helm3\\\"}]},\\\"mac\\\":{\\\"hardenedRuntime\\\":true,\\\"gatekeeperAssess\\\":false,\\\"entitlements\\\":\\\"build/entitlements.mac.plist\\\",\\\"entitlementsInherit\\\":\\\"build/entitlements.mac.plist\\\",\\\"extraResources\\\":[{\\\"from\\\":\\\"binaries/client/darwin/${arch}/kubectl\\\",\\\"to\\\":\\\"./${arch}/kubectl\\\"},{\\\"from\\\":\\\"binaries/client/${arch}/helm3/helm3\\\",\\\"to\\\":\\\"./helm3/helm3\\\"}]},\\\"win\\\":{\\\"target\\\":[\\\"nsis\\\"],\\\"extraResources\\\":[{\\\"from\\\":\\\"binaries/client/windows/x64/kubectl.exe\\\",\\\"to\\\":\\\"./x64/kubectl.exe\\\"},{\\\"from\\\":\\\"binaries/client/windows/ia32/kubectl.exe\\\",\\\"to\\\":\\\"./ia32/kubectl.exe\\\"},{\\\"from\\\":\\\"binaries/client/x64/helm3/helm3.exe\\\",\\\"to\\\":\\\"./helm3/helm3.exe\\\"}]},\\\"nsis\\\":{\\\"include\\\":\\\"build/installer.nsh\\\",\\\"oneClick\\\":false,\\\"allowToChangeInstallationDirectory\\\":true},\\\"protocols\\\":{\\\"name\\\":\\\"Lens Protocol Handler\\\",\\\"schemes\\\":[\\\"lens\\\"],\\\"role\\\":\\\"Viewer\\\"}},\\\"dependencies\\\":{\\\"@electron/remote\\\":\\\"^1.2.2\\\",\\\"@hapi/call\\\":\\\"^8.0.1\\\",\\\"@hapi/subtext\\\":\\\"^7.0.3\\\",\\\"@kubernetes/client-node\\\":\\\"^0.15.1\\\",\\\"@sentry/electron\\\":\\\"^2.5.0\\\",\\\"@sentry/integrations\\\":\\\"^6.10.0\\\",\\\"abort-controller\\\":\\\"^3.0.0\\\",\\\"array-move\\\":\\\"^3.0.1\\\",\\\"auto-bind\\\":\\\"^4.0.0\\\",\\\"autobind-decorator\\\":\\\"^2.4.0\\\",\\\"await-lock\\\":\\\"^2.1.0\\\",\\\"byline\\\":\\\"^5.0.0\\\",\\\"chalk\\\":\\\"^4.1.0\\\",\\\"chokidar\\\":\\\"^3.4.3\\\",\\\"conf\\\":\\\"^7.1.2\\\",\\\"crypto-js\\\":\\\"^4.1.1\\\",\\\"electron-devtools-installer\\\":\\\"^3.2.0\\\",\\\"electron-updater\\\":\\\"^4.6.0\\\",\\\"electron-window-state\\\":\\\"^5.0.3\\\",\\\"filehound\\\":\\\"^1.17.4\\\",\\\"fs-extra\\\":\\\"^9.0.1\\\",\\\"glob-to-regexp\\\":\\\"^0.4.1\\\",\\\"got\\\":\\\"^11.8.2\\\",\\\"grapheme-splitter\\\":\\\"^1.0.4\\\",\\\"handlebars\\\":\\\"^4.7.7\\\",\\\"http-proxy\\\":\\\"^1.18.1\\\",\\\"immer\\\":\\\"^9.0.6\\\",\\\"joi\\\":\\\"^17.4.2\\\",\\\"js-yaml\\\":\\\"^4.1.0\\\",\\\"jsdom\\\":\\\"^16.7.0\\\",\\\"jsonpath\\\":\\\"^1.1.1\\\",\\\"lodash\\\":\\\"^4.17.15\\\",\\\"mac-ca\\\":\\\"^1.0.6\\\",\\\"marked\\\":\\\"^2.1.3\\\",\\\"md5-file\\\":\\\"^5.0.0\\\",\\\"mobx\\\":\\\"^6.3.0\\\",\\\"mobx-observable-history\\\":\\\"^2.0.1\\\",\\\"mobx-react\\\":\\\"^7.2.0\\\",\\\"mock-fs\\\":\\\"^4.14.0\\\",\\\"moment\\\":\\\"^2.29.1\\\",\\\"moment-timezone\\\":\\\"^0.5.33\\\",\\\"monaco-editor\\\":\\\"^0.26.1\\\",\\\"node-fetch\\\":\\\"^2.6.1\\\",\\\"node-pty\\\":\\\"^0.10.1\\\",\\\"npm\\\":\\\"^6.14.15\\\",\\\"p-limit\\\":\\\"^3.1.0\\\",\\\"path-to-regexp\\\":\\\"^6.2.0\\\",\\\"proper-lockfile\\\":\\\"^4.1.2\\\",\\\"react\\\":\\\"^17.0.2\\\",\\\"react-dom\\\":\\\"^17.0.2\\\",\\\"react-material-ui-carousel\\\":\\\"^2.3.5\\\",\\\"react-monaco-editor\\\":\\\"^0.44.0\\\",\\\"react-router\\\":\\\"^5.2.0\\\",\\\"react-virtualized-auto-sizer\\\":\\\"^1.0.6\\\",\\\"readable-stream\\\":\\\"^3.6.0\\\",\\\"request\\\":\\\"^2.88.2\\\",\\\"request-promise-native\\\":\\\"^1.0.9\\\",\\\"rfc6902\\\":\\\"^4.0.2\\\",\\\"semver\\\":\\\"^7.3.2\\\",\\\"serializr\\\":\\\"^2.0.5\\\",\\\"shell-env\\\":\\\"^3.0.1\\\",\\\"spdy\\\":\\\"^4.0.2\\\",\\\"tar\\\":\\\"^6.1.10\\\",\\\"tcp-port-used\\\":\\\"^1.0.2\\\",\\\"tempy\\\":\\\"1.0.1\\\",\\\"url-parse\\\":\\\"^1.5.3\\\",\\\"uuid\\\":\\\"^8.3.2\\\",\\\"win-ca\\\":\\\"^3.4.5\\\",\\\"winston\\\":\\\"^3.3.3\\\",\\\"winston-console-format\\\":\\\"^1.0.8\\\",\\\"winston-transport-browserconsole\\\":\\\"^1.0.5\\\",\\\"ws\\\":\\\"^7.5.5\\\"},\\\"devDependencies\\\":{\\\"@emeraldpay/hashicon-react\\\":\\\"^0.4.0\\\",\\\"@material-ui/core\\\":\\\"^4.12.3\\\",\\\"@material-ui/icons\\\":\\\"^4.11.2\\\",\\\"@material-ui/lab\\\":\\\"^4.0.0-alpha.60\\\",\\\"@pmmmwh/react-refresh-webpack-plugin\\\":\\\"^0.4.3\\\",\\\"@sentry/react\\\":\\\"^6.13.3\\\",\\\"@sentry/types\\\":\\\"^6.8.0\\\",\\\"@testing-library/dom\\\":\\\"^8.9.0\\\",\\\"@testing-library/jest-dom\\\":\\\"^5.14.1\\\",\\\"@testing-library/react\\\":\\\"^11.2.6\\\",\\\"@testing-library/user-event\\\":\\\"^13.2.1\\\",\\\"@types/byline\\\":\\\"^4.2.33\\\",\\\"@types/chart.js\\\":\\\"^2.9.34\\\",\\\"@types/color\\\":\\\"^3.0.2\\\",\\\"@types/crypto-js\\\":\\\"^3.1.47\\\",\\\"@types/dompurify\\\":\\\"^2.3.1\\\",\\\"@types/electron-devtools-installer\\\":\\\"^2.2.0\\\",\\\"@types/fs-extra\\\":\\\"^9.0.1\\\",\\\"@types/glob-to-regexp\\\":\\\"^0.4.1\\\",\\\"@types/hapi\\\":\\\"^18.0.6\\\",\\\"@types/hoist-non-react-statics\\\":\\\"^3.3.1\\\",\\\"@types/html-webpack-plugin\\\":\\\"^3.2.6\\\",\\\"@types/http-proxy\\\":\\\"^1.17.7\\\",\\\"@types/jest\\\":\\\"^26.0.24\\\",\\\"@types/js-yaml\\\":\\\"^4.0.2\\\",\\\"@types/jsdom\\\":\\\"^16.2.13\\\",\\\"@types/jsonpath\\\":\\\"^0.2.0\\\",\\\"@types/lodash\\\":\\\"^4.14.155\\\",\\\"@types/marked\\\":\\\"^2.0.4\\\",\\\"@types/md5-file\\\":\\\"^4.0.2\\\",\\\"@types/mini-css-extract-plugin\\\":\\\"^0.9.1\\\",\\\"@types/mock-fs\\\":\\\"^4.13.1\\\",\\\"@types/module-alias\\\":\\\"^2.0.1\\\",\\\"@types/node\\\":\\\"14.17.26\\\",\\\"@types/node-fetch\\\":\\\"^2.5.12\\\",\\\"@types/npm\\\":\\\"^2.0.32\\\",\\\"@types/progress-bar-webpack-plugin\\\":\\\"^2.1.2\\\",\\\"@types/proper-lockfile\\\":\\\"^4.1.2\\\",\\\"@types/randomcolor\\\":\\\"^0.5.6\\\",\\\"@types/react\\\":\\\"^17.0.29\\\",\\\"@types/react-beautiful-dnd\\\":\\\"^13.1.1\\\",\\\"@types/react-dom\\\":\\\"^17.0.9\\\",\\\"@types/react-router-dom\\\":\\\"^5.3.1\\\",\\\"@types/react-select\\\":\\\"3.1.2\\\",\\\"@types/react-table\\\":\\\"^7.7.6\\\",\\\"@types/react-virtualized-auto-sizer\\\":\\\"^1.0.1\\\",\\\"@types/react-window\\\":\\\"^1.8.5\\\",\\\"@types/readable-stream\\\":\\\"^2.3.11\\\",\\\"@types/request\\\":\\\"^2.48.7\\\",\\\"@types/request-promise-native\\\":\\\"^1.0.18\\\",\\\"@types/semver\\\":\\\"^7.2.0\\\",\\\"@types/sharp\\\":\\\"^0.28.3\\\",\\\"@types/spdy\\\":\\\"^3.4.4\\\",\\\"@types/tar\\\":\\\"^4.0.5\\\",\\\"@types/tcp-port-used\\\":\\\"^1.0.0\\\",\\\"@types/tempy\\\":\\\"^0.3.0\\\",\\\"@types/triple-beam\\\":\\\"^1.3.2\\\",\\\"@types/url-parse\\\":\\\"^1.4.4\\\",\\\"@types/uuid\\\":\\\"^8.3.1\\\",\\\"@types/webdriverio\\\":\\\"^4.13.0\\\",\\\"@types/webpack\\\":\\\"^4.41.31\\\",\\\"@types/webpack-dev-server\\\":\\\"^3.11.6\\\",\\\"@types/webpack-env\\\":\\\"^1.16.3\\\",\\\"@types/webpack-node-externals\\\":\\\"^1.7.1\\\",\\\"@typescript-eslint/eslint-plugin\\\":\\\"^4.33.0\\\",\\\"@typescript-eslint/parser\\\":\\\"^4.29.1\\\",\\\"ansi_up\\\":\\\"^5.0.1\\\",\\\"chart.js\\\":\\\"^2.9.4\\\",\\\"circular-dependency-plugin\\\":\\\"^5.2.2\\\",\\\"color\\\":\\\"^3.1.2\\\",\\\"concurrently\\\":\\\"^5.3.0\\\",\\\"css-loader\\\":\\\"^5.2.7\\\",\\\"deepdash\\\":\\\"^5.3.9\\\",\\\"dompurify\\\":\\\"^2.3.3\\\",\\\"electron\\\":\\\"^13.5.1\\\",\\\"electron-builder\\\":\\\"^22.11.11\\\",\\\"electron-notarize\\\":\\\"^0.3.0\\\",\\\"esbuild\\\":\\\"^0.13.8\\\",\\\"esbuild-loader\\\":\\\"^2.15.1\\\",\\\"eslint\\\":\\\"^7.32.0\\\",\\\"eslint-plugin-header\\\":\\\"^3.1.1\\\",\\\"eslint-plugin-react\\\":\\\"^7.26.1\\\",\\\"eslint-plugin-react-hooks\\\":\\\"^4.2.0\\\",\\\"eslint-plugin-unused-imports\\\":\\\"^1.0.1\\\",\\\"file-loader\\\":\\\"^6.2.0\\\",\\\"flex.box\\\":\\\"^3.4.4\\\",\\\"fork-ts-checker-webpack-plugin\\\":\\\"^5.2.1\\\",\\\"hoist-non-react-statics\\\":\\\"^3.3.2\\\",\\\"html-webpack-plugin\\\":\\\"^4.5.2\\\",\\\"identity-obj-proxy\\\":\\\"^3.0.0\\\",\\\"include-media\\\":\\\"^1.4.9\\\",\\\"jest\\\":\\\"26.6.3\\\",\\\"jest-canvas-mock\\\":\\\"^2.3.1\\\",\\\"jest-fetch-mock\\\":\\\"^3.0.3\\\",\\\"jest-mock-extended\\\":\\\"^1.0.18\\\",\\\"make-plural\\\":\\\"^6.2.2\\\",\\\"mini-css-extract-plugin\\\":\\\"^1.6.2\\\",\\\"node-gyp\\\":\\\"7.1.2\\\",\\\"node-loader\\\":\\\"^1.0.3\\\",\\\"nodemon\\\":\\\"^2.0.13\\\",\\\"playwright\\\":\\\"^1.15.2\\\",\\\"postcss\\\":\\\"^8.3.6\\\",\\\"postcss-loader\\\":\\\"4.3.0\\\",\\\"postinstall-postinstall\\\":\\\"^2.1.0\\\",\\\"progress-bar-webpack-plugin\\\":\\\"^2.1.0\\\",\\\"randomcolor\\\":\\\"^0.6.2\\\",\\\"raw-loader\\\":\\\"^4.0.2\\\",\\\"react-beautiful-dnd\\\":\\\"^13.1.0\\\",\\\"react-refresh\\\":\\\"^0.9.0\\\",\\\"react-router-dom\\\":\\\"^5.3.0\\\",\\\"react-select\\\":\\\"3.2.0\\\",\\\"react-select-event\\\":\\\"^5.1.0\\\",\\\"react-table\\\":\\\"^7.7.0\\\",\\\"react-window\\\":\\\"^1.8.5\\\",\\\"sass\\\":\\\"^1.43.2\\\",\\\"sass-loader\\\":\\\"^8.0.2\\\",\\\"sharp\\\":\\\"^0.29.1\\\",\\\"style-loader\\\":\\\"^2.0.0\\\",\\\"tailwindcss\\\":\\\"^2.2.17\\\",\\\"ts-jest\\\":\\\"26.5.6\\\",\\\"ts-loader\\\":\\\"^7.0.5\\\",\\\"ts-node\\\":\\\"^10.2.1\\\",\\\"type-fest\\\":\\\"^1.0.2\\\",\\\"typed-emitter\\\":\\\"^1.3.1\\\",\\\"typedoc\\\":\\\"0.22.6\\\",\\\"typedoc-plugin-markdown\\\":\\\"^3.11.3\\\",\\\"typeface-roboto\\\":\\\"^1.1.13\\\",\\\"typescript\\\":\\\"^4.4.3\\\",\\\"typescript-plugin-css-modules\\\":\\\"^3.4.0\\\",\\\"url-loader\\\":\\\"^4.1.1\\\",\\\"webpack\\\":\\\"^4.46.0\\\",\\\"webpack-cli\\\":\\\"^3.3.12\\\",\\\"webpack-dev-server\\\":\\\"^3.11.2\\\",\\\"webpack-node-externals\\\":\\\"^1.7.2\\\",\\\"what-input\\\":\\\"^5.2.10\\\",\\\"xterm\\\":\\\"^4.12.0\\\",\\\"xterm-addon-fit\\\":\\\"^0.5.0\\\"}}\");\n\n//# sourceURL=webpack:///./package.json?");
|
|
36863
|
+
eval("module.exports = JSON.parse(\"{\\\"name\\\":\\\"open-lens\\\",\\\"productName\\\":\\\"OpenLens\\\",\\\"description\\\":\\\"OpenLens - Open Source IDE for Kubernetes\\\",\\\"homepage\\\":\\\"https://github.com/lensapp/lens\\\",\\\"version\\\":\\\"5.3.0-alpha.2\\\",\\\"main\\\":\\\"static/build/main.js\\\",\\\"copyright\\\":\\\"© 2021 OpenLens Authors\\\",\\\"license\\\":\\\"MIT\\\",\\\"author\\\":{\\\"name\\\":\\\"OpenLens Authors\\\",\\\"email\\\":\\\"info@k8slens.dev\\\"},\\\"scripts\\\":{\\\"dev\\\":\\\"concurrently -i -k \\\\\\\"yarn run dev-run -C\\\\\\\" yarn:dev:*\\\",\\\"dev-build\\\":\\\"concurrently yarn:compile:*\\\",\\\"debug-build\\\":\\\"concurrently yarn:compile:main yarn:compile:extension-types\\\",\\\"dev-run\\\":\\\"nodemon --watch static/build/main.js --exec \\\\\\\"electron --remote-debugging-port=9223 --inspect .\\\\\\\"\\\",\\\"dev:main\\\":\\\"yarn run compile:main --watch\\\",\\\"dev:renderer\\\":\\\"yarn run webpack-dev-server --config webpack.renderer.ts\\\",\\\"dev:extension-types\\\":\\\"yarn run compile:extension-types --watch\\\",\\\"compile\\\":\\\"env NODE_ENV=production concurrently yarn:compile:*\\\",\\\"compile:main\\\":\\\"yarn run webpack --config webpack.main.ts\\\",\\\"compile:renderer\\\":\\\"yarn run webpack --config webpack.renderer.ts\\\",\\\"compile:extension-types\\\":\\\"yarn run webpack --config webpack.extensions.ts\\\",\\\"npm:fix-build-version\\\":\\\"yarn run ts-node build/set_build_version.ts\\\",\\\"npm:fix-package-version\\\":\\\"yarn run ts-node build/set_npm_version.ts\\\",\\\"build:linux\\\":\\\"yarn run compile && electron-builder --linux --dir\\\",\\\"build:mac\\\":\\\"yarn run compile && electron-builder --mac --dir\\\",\\\"build:win\\\":\\\"yarn run compile && electron-builder --win --dir\\\",\\\"integration\\\":\\\"jest --runInBand --detectOpenHandles --forceExit integration\\\",\\\"dist\\\":\\\"yarn run compile && electron-builder --publish onTag\\\",\\\"dist:dir\\\":\\\"yarn run dist --dir -c.compression=store -c.mac.identity=null\\\",\\\"download-bins\\\":\\\"concurrently yarn:download:*\\\",\\\"download:kubectl\\\":\\\"yarn run ts-node build/download_kubectl.ts\\\",\\\"download:helm\\\":\\\"yarn run ts-node build/download_helm.ts\\\",\\\"build:tray-icons\\\":\\\"yarn run ts-node build/build_tray_icon.ts\\\",\\\"lint\\\":\\\"PROD=true yarn run eslint --ext js,ts,tsx --max-warnings=0 .\\\",\\\"lint:fix\\\":\\\"yarn run lint --fix\\\",\\\"mkdocs-serve-local\\\":\\\"docker build -t mkdocs-serve-local:latest mkdocs/ && docker run --rm -it -p 8000:8000 -v ${PWD}:/docs mkdocs-serve-local:latest\\\",\\\"verify-docs\\\":\\\"docker build -t mkdocs-serve-local:latest mkdocs/ && docker run --rm -v ${PWD}:/docs mkdocs-serve-local:latest build --strict\\\",\\\"typedocs-extensions-api\\\":\\\"yarn run typedoc src/extensions/extension-api.ts\\\",\\\"version-checkout\\\":\\\"cat package.json | jq '.version' -r | xargs printf \\\\\\\"release/v%s\\\\\\\" | xargs git checkout -b\\\",\\\"version-commit\\\":\\\"cat package.json | jq '.version' -r | xargs printf \\\\\\\"release v%s\\\\\\\" | git commit --no-edit -s -F -\\\",\\\"version\\\":\\\"yarn run version-checkout && git add package.json && yarn run version-commit\\\",\\\"postversion\\\":\\\"git push --set-upstream ${GIT_REMOTE:-origin} release/v$npm_package_version\\\"},\\\"config\\\":{\\\"bundledKubectlVersion\\\":\\\"1.21.2\\\",\\\"bundledHelmVersion\\\":\\\"3.6.3\\\",\\\"sentryDsn\\\":\\\"\\\"},\\\"engines\\\":{\\\"node\\\":\\\">=14 <15\\\"},\\\"jest\\\":{\\\"collectCoverage\\\":false,\\\"verbose\\\":true,\\\"transform\\\":{\\\"^.+\\\\\\\\.tsx?$\\\":\\\"ts-jest\\\"},\\\"moduleNameMapper\\\":{\\\"\\\\\\\\.(css|scss)$\\\":\\\"<rootDir>/__mocks__/styleMock.ts\\\",\\\"\\\\\\\\.(svg)$\\\":\\\"<rootDir>/__mocks__/imageMock.ts\\\",\\\"src/(.*)\\\":\\\"<rootDir>/__mocks__/windowMock.ts\\\"},\\\"modulePathIgnorePatterns\\\":[\\\"<rootDir>/dist\\\",\\\"<rootDir>/src/extensions/npm\\\"],\\\"setupFiles\\\":[\\\"<rootDir>/src/jest.setup.ts\\\",\\\"jest-canvas-mock\\\"]},\\\"build\\\":{\\\"generateUpdatesFilesForAllChannels\\\":true,\\\"files\\\":[\\\"static/build/main.js\\\"],\\\"afterSign\\\":\\\"build/notarize.js\\\",\\\"extraResources\\\":[{\\\"from\\\":\\\"locales/\\\",\\\"to\\\":\\\"locales/\\\",\\\"filter\\\":\\\"**/*.js\\\"},{\\\"from\\\":\\\"static/\\\",\\\"to\\\":\\\"static/\\\",\\\"filter\\\":\\\"!**/main.js\\\"},{\\\"from\\\":\\\"build/tray\\\",\\\"to\\\":\\\"static/icons\\\",\\\"filter\\\":\\\"*.png\\\"},{\\\"from\\\":\\\"extensions/\\\",\\\"to\\\":\\\"./extensions/\\\",\\\"filter\\\":[\\\"**/*.tgz\\\",\\\"**/package.json\\\",\\\"!**/node_modules\\\"]},{\\\"from\\\":\\\"templates/\\\",\\\"to\\\":\\\"./templates/\\\",\\\"filter\\\":\\\"**/*.yaml\\\"},\\\"LICENSE\\\"],\\\"linux\\\":{\\\"category\\\":\\\"Network\\\",\\\"artifactName\\\":\\\"${productName}-${version}.${arch}.${ext}\\\",\\\"target\\\":[\\\"deb\\\",\\\"rpm\\\",\\\"AppImage\\\"],\\\"extraResources\\\":[{\\\"from\\\":\\\"binaries/client/linux/${arch}/kubectl\\\",\\\"to\\\":\\\"./${arch}/kubectl\\\"},{\\\"from\\\":\\\"binaries/client/${arch}/helm3/helm3\\\",\\\"to\\\":\\\"./helm3/helm3\\\"}]},\\\"mac\\\":{\\\"hardenedRuntime\\\":true,\\\"gatekeeperAssess\\\":false,\\\"entitlements\\\":\\\"build/entitlements.mac.plist\\\",\\\"entitlementsInherit\\\":\\\"build/entitlements.mac.plist\\\",\\\"extraResources\\\":[{\\\"from\\\":\\\"binaries/client/darwin/${arch}/kubectl\\\",\\\"to\\\":\\\"./${arch}/kubectl\\\"},{\\\"from\\\":\\\"binaries/client/${arch}/helm3/helm3\\\",\\\"to\\\":\\\"./helm3/helm3\\\"}]},\\\"win\\\":{\\\"target\\\":[\\\"nsis\\\"],\\\"extraResources\\\":[{\\\"from\\\":\\\"binaries/client/windows/x64/kubectl.exe\\\",\\\"to\\\":\\\"./x64/kubectl.exe\\\"},{\\\"from\\\":\\\"binaries/client/windows/ia32/kubectl.exe\\\",\\\"to\\\":\\\"./ia32/kubectl.exe\\\"},{\\\"from\\\":\\\"binaries/client/x64/helm3/helm3.exe\\\",\\\"to\\\":\\\"./helm3/helm3.exe\\\"}]},\\\"nsis\\\":{\\\"include\\\":\\\"build/installer.nsh\\\",\\\"oneClick\\\":false,\\\"allowToChangeInstallationDirectory\\\":true},\\\"protocols\\\":{\\\"name\\\":\\\"Lens Protocol Handler\\\",\\\"schemes\\\":[\\\"lens\\\"],\\\"role\\\":\\\"Viewer\\\"}},\\\"dependencies\\\":{\\\"@electron/remote\\\":\\\"^1.2.2\\\",\\\"@hapi/call\\\":\\\"^8.0.1\\\",\\\"@hapi/subtext\\\":\\\"^7.0.3\\\",\\\"@kubernetes/client-node\\\":\\\"^0.15.1\\\",\\\"@sentry/electron\\\":\\\"^2.5.0\\\",\\\"@sentry/integrations\\\":\\\"^6.10.0\\\",\\\"abort-controller\\\":\\\"^3.0.0\\\",\\\"array-move\\\":\\\"^3.0.1\\\",\\\"auto-bind\\\":\\\"^4.0.0\\\",\\\"autobind-decorator\\\":\\\"^2.4.0\\\",\\\"await-lock\\\":\\\"^2.1.0\\\",\\\"byline\\\":\\\"^5.0.0\\\",\\\"chalk\\\":\\\"^4.1.0\\\",\\\"chokidar\\\":\\\"^3.4.3\\\",\\\"conf\\\":\\\"^7.1.2\\\",\\\"crypto-js\\\":\\\"^4.1.1\\\",\\\"electron-devtools-installer\\\":\\\"^3.2.0\\\",\\\"electron-updater\\\":\\\"^4.6.0\\\",\\\"electron-window-state\\\":\\\"^5.0.3\\\",\\\"filehound\\\":\\\"^1.17.4\\\",\\\"fs-extra\\\":\\\"^9.0.1\\\",\\\"glob-to-regexp\\\":\\\"^0.4.1\\\",\\\"got\\\":\\\"^11.8.2\\\",\\\"grapheme-splitter\\\":\\\"^1.0.4\\\",\\\"handlebars\\\":\\\"^4.7.7\\\",\\\"http-proxy\\\":\\\"^1.18.1\\\",\\\"immer\\\":\\\"^9.0.6\\\",\\\"joi\\\":\\\"^17.4.2\\\",\\\"js-yaml\\\":\\\"^4.1.0\\\",\\\"jsdom\\\":\\\"^16.7.0\\\",\\\"jsonpath\\\":\\\"^1.1.1\\\",\\\"lodash\\\":\\\"^4.17.15\\\",\\\"mac-ca\\\":\\\"^1.0.6\\\",\\\"marked\\\":\\\"^2.1.3\\\",\\\"md5-file\\\":\\\"^5.0.0\\\",\\\"mobx\\\":\\\"^6.3.0\\\",\\\"mobx-observable-history\\\":\\\"^2.0.1\\\",\\\"mobx-react\\\":\\\"^7.2.0\\\",\\\"mock-fs\\\":\\\"^4.14.0\\\",\\\"moment\\\":\\\"^2.29.1\\\",\\\"moment-timezone\\\":\\\"^0.5.33\\\",\\\"monaco-editor\\\":\\\"^0.26.1\\\",\\\"node-fetch\\\":\\\"^2.6.5\\\",\\\"node-pty\\\":\\\"^0.10.1\\\",\\\"npm\\\":\\\"^6.14.15\\\",\\\"p-limit\\\":\\\"^3.1.0\\\",\\\"path-to-regexp\\\":\\\"^6.2.0\\\",\\\"proper-lockfile\\\":\\\"^4.1.2\\\",\\\"react\\\":\\\"^17.0.2\\\",\\\"react-dom\\\":\\\"^17.0.2\\\",\\\"react-material-ui-carousel\\\":\\\"^2.3.5\\\",\\\"react-monaco-editor\\\":\\\"^0.44.0\\\",\\\"react-router\\\":\\\"^5.2.0\\\",\\\"react-virtualized-auto-sizer\\\":\\\"^1.0.6\\\",\\\"readable-stream\\\":\\\"^3.6.0\\\",\\\"request\\\":\\\"^2.88.2\\\",\\\"request-promise-native\\\":\\\"^1.0.9\\\",\\\"rfc6902\\\":\\\"^4.0.2\\\",\\\"semver\\\":\\\"^7.3.2\\\",\\\"serializr\\\":\\\"^2.0.5\\\",\\\"shell-env\\\":\\\"^3.0.1\\\",\\\"spdy\\\":\\\"^4.0.2\\\",\\\"tar\\\":\\\"^6.1.10\\\",\\\"tcp-port-used\\\":\\\"^1.0.2\\\",\\\"tempy\\\":\\\"1.0.1\\\",\\\"url-parse\\\":\\\"^1.5.3\\\",\\\"uuid\\\":\\\"^8.3.2\\\",\\\"win-ca\\\":\\\"^3.4.5\\\",\\\"winston\\\":\\\"^3.3.3\\\",\\\"winston-console-format\\\":\\\"^1.0.8\\\",\\\"winston-transport-browserconsole\\\":\\\"^1.0.5\\\",\\\"ws\\\":\\\"^7.5.5\\\"},\\\"devDependencies\\\":{\\\"@material-ui/core\\\":\\\"^4.12.3\\\",\\\"@material-ui/icons\\\":\\\"^4.11.2\\\",\\\"@material-ui/lab\\\":\\\"^4.0.0-alpha.60\\\",\\\"@pmmmwh/react-refresh-webpack-plugin\\\":\\\"^0.4.3\\\",\\\"@sentry/react\\\":\\\"^6.13.3\\\",\\\"@sentry/types\\\":\\\"^6.8.0\\\",\\\"@testing-library/dom\\\":\\\"^8.9.0\\\",\\\"@testing-library/jest-dom\\\":\\\"^5.14.1\\\",\\\"@testing-library/react\\\":\\\"^11.2.6\\\",\\\"@testing-library/user-event\\\":\\\"^13.5.0\\\",\\\"@types/byline\\\":\\\"^4.2.33\\\",\\\"@types/chart.js\\\":\\\"^2.9.34\\\",\\\"@types/color\\\":\\\"^3.0.2\\\",\\\"@types/crypto-js\\\":\\\"^3.1.47\\\",\\\"@types/dompurify\\\":\\\"^2.3.1\\\",\\\"@types/electron-devtools-installer\\\":\\\"^2.2.0\\\",\\\"@types/fs-extra\\\":\\\"^9.0.1\\\",\\\"@types/glob-to-regexp\\\":\\\"^0.4.1\\\",\\\"@types/hapi\\\":\\\"^18.0.6\\\",\\\"@types/hoist-non-react-statics\\\":\\\"^3.3.1\\\",\\\"@types/html-webpack-plugin\\\":\\\"^3.2.6\\\",\\\"@types/http-proxy\\\":\\\"^1.17.7\\\",\\\"@types/jest\\\":\\\"^26.0.24\\\",\\\"@types/js-yaml\\\":\\\"^4.0.2\\\",\\\"@types/jsdom\\\":\\\"^16.2.13\\\",\\\"@types/jsonpath\\\":\\\"^0.2.0\\\",\\\"@types/lodash\\\":\\\"^4.14.155\\\",\\\"@types/marked\\\":\\\"^2.0.4\\\",\\\"@types/md5-file\\\":\\\"^4.0.2\\\",\\\"@types/mini-css-extract-plugin\\\":\\\"^0.9.1\\\",\\\"@types/mock-fs\\\":\\\"^4.13.1\\\",\\\"@types/module-alias\\\":\\\"^2.0.1\\\",\\\"@types/node\\\":\\\"14.17.27\\\",\\\"@types/node-fetch\\\":\\\"^2.5.12\\\",\\\"@types/npm\\\":\\\"^2.0.32\\\",\\\"@types/progress-bar-webpack-plugin\\\":\\\"^2.1.2\\\",\\\"@types/proper-lockfile\\\":\\\"^4.1.2\\\",\\\"@types/randomcolor\\\":\\\"^0.5.6\\\",\\\"@types/react\\\":\\\"^17.0.29\\\",\\\"@types/react-beautiful-dnd\\\":\\\"^13.1.2\\\",\\\"@types/react-dom\\\":\\\"^17.0.9\\\",\\\"@types/react-router-dom\\\":\\\"^5.3.1\\\",\\\"@types/react-select\\\":\\\"3.1.2\\\",\\\"@types/react-table\\\":\\\"^7.7.7\\\",\\\"@types/react-virtualized-auto-sizer\\\":\\\"^1.0.1\\\",\\\"@types/react-window\\\":\\\"^1.8.5\\\",\\\"@types/readable-stream\\\":\\\"^2.3.11\\\",\\\"@types/request\\\":\\\"^2.48.7\\\",\\\"@types/request-promise-native\\\":\\\"^1.0.18\\\",\\\"@types/semver\\\":\\\"^7.2.0\\\",\\\"@types/sharp\\\":\\\"^0.29.2\\\",\\\"@types/spdy\\\":\\\"^3.4.4\\\",\\\"@types/tar\\\":\\\"^4.0.5\\\",\\\"@types/tcp-port-used\\\":\\\"^1.0.0\\\",\\\"@types/tempy\\\":\\\"^0.3.0\\\",\\\"@types/triple-beam\\\":\\\"^1.3.2\\\",\\\"@types/url-parse\\\":\\\"^1.4.4\\\",\\\"@types/uuid\\\":\\\"^8.3.1\\\",\\\"@types/webdriverio\\\":\\\"^4.13.0\\\",\\\"@types/webpack\\\":\\\"^4.41.31\\\",\\\"@types/webpack-dev-server\\\":\\\"^3.11.6\\\",\\\"@types/webpack-env\\\":\\\"^1.16.3\\\",\\\"@types/webpack-node-externals\\\":\\\"^1.7.1\\\",\\\"@typescript-eslint/eslint-plugin\\\":\\\"^4.33.0\\\",\\\"@typescript-eslint/parser\\\":\\\"^4.29.1\\\",\\\"ansi_up\\\":\\\"^5.0.1\\\",\\\"chart.js\\\":\\\"^2.9.4\\\",\\\"circular-dependency-plugin\\\":\\\"^5.2.2\\\",\\\"color\\\":\\\"^3.1.2\\\",\\\"concurrently\\\":\\\"^5.3.0\\\",\\\"css-loader\\\":\\\"^5.2.7\\\",\\\"deepdash\\\":\\\"^5.3.9\\\",\\\"dompurify\\\":\\\"^2.3.3\\\",\\\"electron\\\":\\\"^13.5.1\\\",\\\"electron-builder\\\":\\\"^22.11.11\\\",\\\"electron-notarize\\\":\\\"^0.3.0\\\",\\\"esbuild\\\":\\\"^0.13.8\\\",\\\"esbuild-loader\\\":\\\"^2.16.0\\\",\\\"eslint\\\":\\\"^7.32.0\\\",\\\"eslint-plugin-header\\\":\\\"^3.1.1\\\",\\\"eslint-plugin-react\\\":\\\"^7.26.1\\\",\\\"eslint-plugin-react-hooks\\\":\\\"^4.2.0\\\",\\\"eslint-plugin-unused-imports\\\":\\\"^1.1.5\\\",\\\"file-loader\\\":\\\"^6.2.0\\\",\\\"flex.box\\\":\\\"^3.4.4\\\",\\\"fork-ts-checker-webpack-plugin\\\":\\\"^5.2.1\\\",\\\"hoist-non-react-statics\\\":\\\"^3.3.2\\\",\\\"html-webpack-plugin\\\":\\\"^4.5.2\\\",\\\"identity-obj-proxy\\\":\\\"^3.0.0\\\",\\\"include-media\\\":\\\"^1.4.9\\\",\\\"jest\\\":\\\"26.6.3\\\",\\\"jest-canvas-mock\\\":\\\"^2.3.1\\\",\\\"jest-fetch-mock\\\":\\\"^3.0.3\\\",\\\"jest-mock-extended\\\":\\\"^1.0.18\\\",\\\"make-plural\\\":\\\"^6.2.2\\\",\\\"mini-css-extract-plugin\\\":\\\"^1.6.2\\\",\\\"node-gyp\\\":\\\"7.1.2\\\",\\\"node-loader\\\":\\\"^1.0.3\\\",\\\"nodemon\\\":\\\"^2.0.14\\\",\\\"playwright\\\":\\\"^1.15.2\\\",\\\"postcss\\\":\\\"^8.3.6\\\",\\\"postcss-loader\\\":\\\"4.3.0\\\",\\\"postinstall-postinstall\\\":\\\"^2.1.0\\\",\\\"progress-bar-webpack-plugin\\\":\\\"^2.1.0\\\",\\\"randomcolor\\\":\\\"^0.6.2\\\",\\\"raw-loader\\\":\\\"^4.0.2\\\",\\\"react-beautiful-dnd\\\":\\\"^13.1.0\\\",\\\"react-refresh\\\":\\\"^0.9.0\\\",\\\"react-router-dom\\\":\\\"^5.3.0\\\",\\\"react-select\\\":\\\"3.2.0\\\",\\\"react-select-event\\\":\\\"^5.1.0\\\",\\\"react-table\\\":\\\"^7.7.0\\\",\\\"react-window\\\":\\\"^1.8.5\\\",\\\"sass\\\":\\\"^1.43.2\\\",\\\"sass-loader\\\":\\\"^8.0.2\\\",\\\"sharp\\\":\\\"^0.29.1\\\",\\\"style-loader\\\":\\\"^2.0.0\\\",\\\"tailwindcss\\\":\\\"^2.2.17\\\",\\\"ts-jest\\\":\\\"26.5.6\\\",\\\"ts-loader\\\":\\\"^7.0.5\\\",\\\"ts-node\\\":\\\"^10.3.0\\\",\\\"type-fest\\\":\\\"^1.0.2\\\",\\\"typed-emitter\\\":\\\"^1.3.1\\\",\\\"typedoc\\\":\\\"0.22.6\\\",\\\"typedoc-plugin-markdown\\\":\\\"^3.11.3\\\",\\\"typeface-roboto\\\":\\\"^1.1.13\\\",\\\"typescript\\\":\\\"^4.4.3\\\",\\\"typescript-plugin-css-modules\\\":\\\"^3.4.0\\\",\\\"url-loader\\\":\\\"^4.1.1\\\",\\\"webpack\\\":\\\"^4.46.0\\\",\\\"webpack-cli\\\":\\\"^3.3.12\\\",\\\"webpack-dev-server\\\":\\\"^3.11.2\\\",\\\"webpack-node-externals\\\":\\\"^1.7.2\\\",\\\"what-input\\\":\\\"^5.2.10\\\",\\\"xterm\\\":\\\"^4.12.0\\\",\\\"xterm-addon-fit\\\":\\\"^0.5.0\\\"}}\");\n\n//# sourceURL=webpack:///./package.json?");
|
|
36864
36864
|
|
|
36865
36865
|
/***/ }),
|
|
36866
36866
|
|
|
@@ -37004,7 +37004,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
37004
37004
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
37005
37005
|
|
|
37006
37006
|
"use strict";
|
|
37007
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ClusterStore\", function() { return ClusterStore; });\n/* harmony import */ var electron__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! electron */ \"electron\");\n/* harmony import */ var electron__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(electron__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! mobx */ \"./node_modules/mobx/dist/mobx.esm.js\");\n/* harmony import */ var _base_store__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./base-store */ \"./src/common/base-store.ts\");\n/* harmony import */ var _main_cluster__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../main/cluster */ \"./src/main/cluster.ts\");\n/* harmony import */ var _migrations_cluster_store__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../migrations/cluster-store */ \"./src/migrations/cluster-store/index.ts\");\n/* harmony import */ var _main_logger__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../main/logger */ \"./src/main/logger.ts\");\n/* harmony import */ var _event_bus__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./event-bus */ \"./src/common/event-bus.ts\");\n/* harmony import */ var _ipc__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./ipc */ \"./src/common/ipc/index.ts\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./utils */ \"./src/common/utils/index.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (undefined && undefined.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};\n\n\n\n\n\n\n\n\n\nconst initialStates = \"cluster:states\";\nclass ClusterStore extends _base_store__WEBPACK_IMPORTED_MODULE_2__[\"BaseStore\"] {\n constructor() {\n super({\n configName: \"lens-cluster-store\",\n accessPropertiesByDotNotation: false,\n syncOptions: {\n equals: mobx__WEBPACK_IMPORTED_MODULE_1__[\"comparer\"].structural,\n },\n migrations: _migrations_cluster_store__WEBPACK_IMPORTED_MODULE_4__[\"default\"],\n });\n Object.defineProperty(this, \"clusters\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: mobx__WEBPACK_IMPORTED_MODULE_1__[\"observable\"].map()\n });\n Object.defineProperty(this, \"removedClusters\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: mobx__WEBPACK_IMPORTED_MODULE_1__[\"observable\"].map()\n });\n Object.defineProperty(this, \"disposer\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: Object(_utils__WEBPACK_IMPORTED_MODULE_8__[\"disposer\"])()\n });\n Object.defineProperty(this, \"handleStateChange\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: (event, clusterId, state) => {\n var _a;\n _main_logger__WEBPACK_IMPORTED_MODULE_5__[\"default\"].silly(`[CLUSTER-STORE]: received push-state at ${location.host} (${electron__WEBPACK_IMPORTED_MODULE_0__[\"webFrame\"].routingId})`, clusterId, state);\n (_a = this.getById(clusterId)) === null || _a === void 0 ? void 0 : _a.setState(state);\n }\n });\n Object(mobx__WEBPACK_IMPORTED_MODULE_1__[\"makeObservable\"])(this);\n this.load();\n this.pushStateToViewsAutomatically();\n }\n async loadInitialOnRenderer() {\n var _a;\n _main_logger__WEBPACK_IMPORTED_MODULE_5__[\"default\"].info(\"[CLUSTER-STORE] requesting initial state sync\");\n for (const { id, state } of await Object(_ipc__WEBPACK_IMPORTED_MODULE_7__[\"requestMain\"])(initialStates)) {\n (_a = this.getById(id)) === null || _a === void 0 ? void 0 : _a.setState(state);\n }\n }\n provideInitialFromMain() {\n Object(_ipc__WEBPACK_IMPORTED_MODULE_7__[\"ipcMainHandle\"])(initialStates, () => {\n return this.clustersList.map(cluster => ({\n id: cluster.id,\n state: cluster.getState(),\n }));\n });\n }\n pushStateToViewsAutomatically() {\n if (electron__WEBPACK_IMPORTED_MODULE_0__[\"ipcMain\"]) {\n this.disposer.push(Object(mobx__WEBPACK_IMPORTED_MODULE_1__[\"reaction\"])(() => this.connectedClustersList, () => this.pushState()));\n }\n }\n registerIpcListener() {\n _main_logger__WEBPACK_IMPORTED_MODULE_5__[\"default\"].info(`[CLUSTER-STORE] start to listen (${electron__WEBPACK_IMPORTED_MODULE_0__[\"webFrame\"].routingId})`);\n if (electron__WEBPACK_IMPORTED_MODULE_0__[\"ipcMain\"]) {\n this.disposer.push(Object(_ipc__WEBPACK_IMPORTED_MODULE_7__[\"ipcMainOn\"])(ClusterStore.StateChannel, this.handleStateChange));\n }\n if (electron__WEBPACK_IMPORTED_MODULE_0__[\"ipcRenderer\"]) {\n this.disposer.push(Object(_ipc__WEBPACK_IMPORTED_MODULE_7__[\"ipcRendererOn\"])(ClusterStore.StateChannel, this.handleStateChange));\n }\n }\n unregisterIpcListener() {\n super.unregisterIpcListener();\n this.disposer();\n }\n pushState() {\n this.clusters.forEach((c) => {\n c.pushState();\n });\n }\n get clustersList() {\n return Array.from(this.clusters.values());\n }\n get connectedClustersList() {\n return this.clustersList.filter((c) => !c.disconnected);\n }\n hasClusters() {\n return this.clusters.size > 0;\n }\n getById(id) {\n var _a;\n return (_a = this.clusters.get(id)) !== null && _a !== void 0 ? _a : null;\n }\n addCluster(clusterOrModel) {\n _event_bus__WEBPACK_IMPORTED_MODULE_6__[\"appEventBus\"].emit({ name: \"cluster\", action: \"add\" });\n const cluster = clusterOrModel instanceof _main_cluster__WEBPACK_IMPORTED_MODULE_3__[\"Cluster\"]\n ? clusterOrModel\n : new _main_cluster__WEBPACK_IMPORTED_MODULE_3__[\"Cluster\"](clusterOrModel);\n this.clusters.set(cluster.id, cluster);\n return cluster;\n }\n fromStore({ clusters = [] } = {}) {\n const currentClusters = new Map(this.clusters);\n const newClusters = new Map();\n const removedClusters = new Map();\n // update new clusters\n for (const clusterModel of clusters) {\n try {\n let cluster = currentClusters.get(clusterModel.id);\n if (cluster) {\n cluster.updateModel(clusterModel);\n }\n else {\n cluster = new _main_cluster__WEBPACK_IMPORTED_MODULE_3__[\"Cluster\"](clusterModel);\n }\n newClusters.set(clusterModel.id, cluster);\n }\n catch (error) {\n _main_logger__WEBPACK_IMPORTED_MODULE_5__[\"default\"].warn(`[CLUSTER-STORE]: Failed to update/create a cluster: ${error}`);\n }\n }\n // update removed clusters\n currentClusters.forEach(cluster => {\n if (!newClusters.has(cluster.id)) {\n removedClusters.set(cluster.id, cluster);\n }\n });\n this.clusters.replace(newClusters);\n this.removedClusters.replace(removedClusters);\n }\n toJSON() {\n return Object(_utils__WEBPACK_IMPORTED_MODULE_8__[\"toJS\"])({\n clusters: this.clustersList.map(cluster => cluster.toJSON()),\n });\n }\n}\nObject.defineProperty(ClusterStore, \"StateChannel\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"cluster:state\"\n});\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_1__[\"computed\"],\n __metadata(\"design:type\", Array),\n __metadata(\"design:paramtypes\", [])\n], ClusterStore.prototype, \"clustersList\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_1__[\"computed\"],\n __metadata(\"design:type\", Array),\n __metadata(\"design:paramtypes\", [])\n], ClusterStore.prototype, \"connectedClustersList\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_1__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Object]),\n __metadata(\"design:returntype\", void 0)\n], ClusterStore.prototype, \"fromStore\", null);\n\n\n//# sourceURL=webpack:///./src/common/cluster-store.ts?");
|
|
37007
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ClusterStore\", function() { return ClusterStore; });\n/* harmony import */ var electron__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! electron */ \"electron\");\n/* harmony import */ var electron__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(electron__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! mobx */ \"./node_modules/mobx/dist/mobx.esm.js\");\n/* harmony import */ var _base_store__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./base-store */ \"./src/common/base-store.ts\");\n/* harmony import */ var _main_cluster__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../main/cluster */ \"./src/main/cluster.ts\");\n/* harmony import */ var _migrations_cluster_store__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../migrations/cluster-store */ \"./src/migrations/cluster-store/index.ts\");\n/* harmony import */ var _main_logger__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../main/logger */ \"./src/main/logger.ts\");\n/* harmony import */ var _event_bus__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./event-bus */ \"./src/common/event-bus.ts\");\n/* harmony import */ var _ipc__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./ipc */ \"./src/common/ipc/index.ts\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./utils */ \"./src/common/utils/index.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (undefined && undefined.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};\n\n\n\n\n\n\n\n\n\nconst initialStates = \"cluster:states\";\nclass ClusterStore extends _base_store__WEBPACK_IMPORTED_MODULE_2__[\"BaseStore\"] {\n constructor() {\n super({\n configName: \"lens-cluster-store\",\n accessPropertiesByDotNotation: false,\n syncOptions: {\n equals: mobx__WEBPACK_IMPORTED_MODULE_1__[\"comparer\"].structural,\n },\n migrations: _migrations_cluster_store__WEBPACK_IMPORTED_MODULE_4__[\"default\"],\n });\n Object.defineProperty(this, \"clusters\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: mobx__WEBPACK_IMPORTED_MODULE_1__[\"observable\"].map()\n });\n Object.defineProperty(this, \"disposer\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: Object(_utils__WEBPACK_IMPORTED_MODULE_8__[\"disposer\"])()\n });\n Object.defineProperty(this, \"handleStateChange\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: (event, clusterId, state) => {\n var _a;\n _main_logger__WEBPACK_IMPORTED_MODULE_5__[\"default\"].silly(`[CLUSTER-STORE]: received push-state at ${location.host} (${electron__WEBPACK_IMPORTED_MODULE_0__[\"webFrame\"].routingId})`, clusterId, state);\n (_a = this.getById(clusterId)) === null || _a === void 0 ? void 0 : _a.setState(state);\n }\n });\n Object(mobx__WEBPACK_IMPORTED_MODULE_1__[\"makeObservable\"])(this);\n this.load();\n this.pushStateToViewsAutomatically();\n }\n async loadInitialOnRenderer() {\n var _a;\n _main_logger__WEBPACK_IMPORTED_MODULE_5__[\"default\"].info(\"[CLUSTER-STORE] requesting initial state sync\");\n for (const { id, state } of await Object(_ipc__WEBPACK_IMPORTED_MODULE_7__[\"requestMain\"])(initialStates)) {\n (_a = this.getById(id)) === null || _a === void 0 ? void 0 : _a.setState(state);\n }\n }\n provideInitialFromMain() {\n Object(_ipc__WEBPACK_IMPORTED_MODULE_7__[\"ipcMainHandle\"])(initialStates, () => {\n return this.clustersList.map(cluster => ({\n id: cluster.id,\n state: cluster.getState(),\n }));\n });\n }\n pushStateToViewsAutomatically() {\n if (electron__WEBPACK_IMPORTED_MODULE_0__[\"ipcMain\"]) {\n this.disposer.push(Object(mobx__WEBPACK_IMPORTED_MODULE_1__[\"reaction\"])(() => this.connectedClustersList, () => this.pushState()));\n }\n }\n registerIpcListener() {\n _main_logger__WEBPACK_IMPORTED_MODULE_5__[\"default\"].info(`[CLUSTER-STORE] start to listen (${electron__WEBPACK_IMPORTED_MODULE_0__[\"webFrame\"].routingId})`);\n if (electron__WEBPACK_IMPORTED_MODULE_0__[\"ipcMain\"]) {\n this.disposer.push(Object(_ipc__WEBPACK_IMPORTED_MODULE_7__[\"ipcMainOn\"])(ClusterStore.StateChannel, this.handleStateChange));\n }\n if (electron__WEBPACK_IMPORTED_MODULE_0__[\"ipcRenderer\"]) {\n this.disposer.push(Object(_ipc__WEBPACK_IMPORTED_MODULE_7__[\"ipcRendererOn\"])(ClusterStore.StateChannel, this.handleStateChange));\n }\n }\n unregisterIpcListener() {\n super.unregisterIpcListener();\n this.disposer();\n }\n pushState() {\n this.clusters.forEach((c) => {\n c.pushState();\n });\n }\n get clustersList() {\n return Array.from(this.clusters.values());\n }\n get connectedClustersList() {\n return this.clustersList.filter((c) => !c.disconnected);\n }\n hasClusters() {\n return this.clusters.size > 0;\n }\n getById(id) {\n var _a;\n return (_a = this.clusters.get(id)) !== null && _a !== void 0 ? _a : null;\n }\n addCluster(clusterOrModel) {\n _event_bus__WEBPACK_IMPORTED_MODULE_6__[\"appEventBus\"].emit({ name: \"cluster\", action: \"add\" });\n const cluster = clusterOrModel instanceof _main_cluster__WEBPACK_IMPORTED_MODULE_3__[\"Cluster\"]\n ? clusterOrModel\n : new _main_cluster__WEBPACK_IMPORTED_MODULE_3__[\"Cluster\"](clusterOrModel);\n this.clusters.set(cluster.id, cluster);\n return cluster;\n }\n fromStore({ clusters = [] } = {}) {\n const currentClusters = new Map(this.clusters);\n const newClusters = new Map();\n // update new clusters\n for (const clusterModel of clusters) {\n try {\n let cluster = currentClusters.get(clusterModel.id);\n if (cluster) {\n cluster.updateModel(clusterModel);\n }\n else {\n cluster = new _main_cluster__WEBPACK_IMPORTED_MODULE_3__[\"Cluster\"](clusterModel);\n }\n newClusters.set(clusterModel.id, cluster);\n }\n catch (error) {\n _main_logger__WEBPACK_IMPORTED_MODULE_5__[\"default\"].warn(`[CLUSTER-STORE]: Failed to update/create a cluster: ${error}`);\n }\n }\n this.clusters.replace(newClusters);\n }\n toJSON() {\n return Object(_utils__WEBPACK_IMPORTED_MODULE_8__[\"toJS\"])({\n clusters: this.clustersList.map(cluster => cluster.toJSON()),\n });\n }\n}\nObject.defineProperty(ClusterStore, \"StateChannel\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"cluster:state\"\n});\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_1__[\"computed\"],\n __metadata(\"design:type\", Array),\n __metadata(\"design:paramtypes\", [])\n], ClusterStore.prototype, \"clustersList\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_1__[\"computed\"],\n __metadata(\"design:type\", Array),\n __metadata(\"design:paramtypes\", [])\n], ClusterStore.prototype, \"connectedClustersList\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_1__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Object]),\n __metadata(\"design:returntype\", void 0)\n], ClusterStore.prototype, \"fromStore\", null);\n\n\n//# sourceURL=webpack:///./src/common/cluster-store.ts?");
|
|
37008
37008
|
|
|
37009
37009
|
/***/ }),
|
|
37010
37010
|
|
|
@@ -37436,7 +37436,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
37436
37436
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
37437
37437
|
|
|
37438
37438
|
"use strict";
|
|
37439
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PodsApi\", function() { return PodsApi; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getMetricsForPods\", function() { return getMetricsForPods; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PodStatus\", function() { return PodStatus; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Pod\", function() { return Pod; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"podsApi\", function() { return podsApi; });\n/* harmony import */ var _workload_kube_object__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../workload-kube-object */ \"./src/common/k8s-api/workload-kube-object.ts\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utils */ \"./src/common/utils/index.ts\");\n/* harmony import */ var _metrics_api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./metrics.api */ \"./src/common/k8s-api/endpoints/metrics.api.ts\");\n/* harmony import */ var _kube_api__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../kube-api */ \"./src/common/k8s-api/kube-api.ts\");\n/* harmony import */ var _utils_cluster_id_url_parsing__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils/cluster-id-url-parsing */ \"./src/common/utils/cluster-id-url-parsing.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n\n\n\n\nclass PodsApi extends _kube_api__WEBPACK_IMPORTED_MODULE_3__[\"KubeApi\"] {\n async getLogs(params, query) {\n const path = `${this.getUrl(params)}/log`;\n return this.request.get(path, { query });\n }\n}\nfunction getMetricsForPods(pods, namespace, selector = \"pod, namespace\") {\n const podSelector = pods.map(pod => pod.getName()).join(\"|\");\n const opts = { category: \"pods\", pods: podSelector, namespace, selector };\n return _metrics_api__WEBPACK_IMPORTED_MODULE_2__[\"metricsApi\"].getMetrics({\n cpuUsage: opts,\n cpuRequests: opts,\n cpuLimits: opts,\n memoryUsage: opts,\n memoryRequests: opts,\n memoryLimits: opts,\n fsUsage: opts,\n networkReceive: opts,\n networkTransmit: opts,\n }, {\n namespace,\n });\n}\nvar PodStatus;\n(function (PodStatus) {\n PodStatus[\"TERMINATED\"] = \"Terminated\";\n PodStatus[\"FAILED\"] = \"Failed\";\n PodStatus[\"PENDING\"] = \"Pending\";\n PodStatus[\"RUNNING\"] = \"Running\";\n PodStatus[\"SUCCEEDED\"] = \"Succeeded\";\n PodStatus[\"EVICTED\"] = \"Evicted\";\n})(PodStatus || (PodStatus = {}));\nclass Pod extends _workload_kube_object__WEBPACK_IMPORTED_MODULE_0__[\"WorkloadKubeObject\"] {\n constructor(data) {\n super(data);\n Object(_utils__WEBPACK_IMPORTED_MODULE_1__[\"autoBind\"])(this);\n }\n getInitContainers() {\n var _a;\n return ((_a = this.spec) === null || _a === void 0 ? void 0 : _a.initContainers) || [];\n }\n getContainers() {\n var _a;\n return ((_a = this.spec) === null || _a === void 0 ? void 0 : _a.containers) || [];\n }\n getAllContainers() {\n return [...this.getContainers(), ...this.getInitContainers()];\n }\n getRunningContainers() {\n const runningContainerNames = new Set(this.getContainerStatuses()\n .filter(({ state }) => state.running)\n .map(({ name }) => name));\n return this.getAllContainers()\n .filter(({ name }) => runningContainerNames.has(name));\n }\n getContainerStatuses(includeInitContainers = true) {\n var _a;\n const { containerStatuses = [], initContainerStatuses = [] } = (_a = this.status) !== null && _a !== void 0 ? _a : {};\n if (includeInitContainers) {\n return [...containerStatuses, ...initContainerStatuses];\n }\n return [...containerStatuses];\n }\n getRestartsCount() {\n var _a;\n const { containerStatuses = [] } = (_a = this.status) !== null && _a !== void 0 ? _a : {};\n return containerStatuses.reduce((totalCount, { restartCount }) => totalCount + restartCount, 0);\n }\n getQosClass() {\n var _a;\n return ((_a = this.status) === null || _a === void 0 ? void 0 : _a.qosClass) || \"\";\n }\n getReason() {\n var _a;\n return ((_a = this.status) === null || _a === void 0 ? void 0 : _a.reason) || \"\";\n }\n getPriorityClassName() {\n return this.spec.priorityClassName || \"\";\n }\n getStatus() {\n const phase = this.getStatusPhase();\n const reason = this.getReason();\n const trueConditionTypes = new Set(this.getConditions()\n .filter(({ status }) => status === \"True\")\n .map(({ type }) => type));\n const isInGoodCondition = [\"Initialized\", \"Ready\"].every(condition => trueConditionTypes.has(condition));\n if (reason === PodStatus.EVICTED) {\n return PodStatus.EVICTED;\n }\n if (phase === PodStatus.FAILED) {\n return PodStatus.FAILED;\n }\n if (phase === PodStatus.SUCCEEDED) {\n return PodStatus.SUCCEEDED;\n }\n if (phase === PodStatus.RUNNING && isInGoodCondition) {\n return PodStatus.RUNNING;\n }\n return PodStatus.PENDING;\n }\n // Returns pod phase or container error if occurred\n getStatusMessage() {\n if (this.getReason() === PodStatus.EVICTED)\n return \"Evicted\";\n if (this.metadata.deletionTimestamp)\n return \"Terminating\";\n const statuses = this.getContainerStatuses(false); // not including initContainers\n for (const { state } of statuses.reverse()) {\n if (state.waiting) {\n return state.waiting.reason || \"Waiting\";\n }\n if (state.terminated) {\n return state.terminated.reason || \"Terminated\";\n }\n }\n return this.getStatusPhase();\n }\n getStatusPhase() {\n var _a;\n return (_a = this.status) === null || _a === void 0 ? void 0 : _a.phase;\n }\n getConditions() {\n var _a;\n return ((_a = this.status) === null || _a === void 0 ? void 0 : _a.conditions) || [];\n }\n getVolumes() {\n return this.spec.volumes || [];\n }\n getSecrets() {\n return this.getVolumes()\n .filter(vol => vol.secret)\n .map(vol => vol.secret.secretName);\n }\n getNodeSelectors() {\n const { nodeSelector = {} } = this.spec;\n return Object.entries(nodeSelector).map(values => values.join(\": \"));\n }\n getTolerations() {\n return this.spec.tolerations || [];\n }\n getAffinity() {\n return this.spec.affinity;\n }\n hasIssues() {\n var _a;\n for (const { type, status } of this.getConditions()) {\n if (type === \"Ready\" && status !== \"True\") {\n return true;\n }\n }\n for (const { state } of this.getContainerStatuses()) {\n if (((_a = state === null || state === void 0 ? void 0 : state.waiting) === null || _a === void 0 ? void 0 : _a.reason) === \"CrashLookBackOff\") {\n return true;\n }\n }\n return this.getStatusPhase() !== \"Running\";\n }\n getLivenessProbe(container) {\n return this.getProbe(container.livenessProbe);\n }\n getReadinessProbe(container) {\n return this.getProbe(container.readinessProbe);\n }\n getStartupProbe(container) {\n return this.getProbe(container.startupProbe);\n }\n getProbe(probeData) {\n if (!probeData)\n return [];\n const { httpGet, exec, tcpSocket, initialDelaySeconds, timeoutSeconds, periodSeconds, successThreshold, failureThreshold } = probeData;\n const probe = [];\n // HTTP Request\n if (httpGet) {\n const { path, port, host, scheme } = httpGet;\n probe.push(\"http-get\", `${scheme.toLowerCase()}://${host || \"\"}:${port || \"\"}${path || \"\"}`);\n }\n // Command\n if (exec && exec.command) {\n probe.push(`exec [${exec.command.join(\" \")}]`);\n }\n // TCP Probe\n if (tcpSocket && tcpSocket.port) {\n probe.push(`tcp-socket :${tcpSocket.port}`);\n }\n probe.push(`delay=${initialDelaySeconds || \"0\"}s`, `timeout=${timeoutSeconds || \"0\"}s`, `period=${periodSeconds || \"0\"}s`, `#success=${successThreshold || \"0\"}`, `#failure=${failureThreshold || \"0\"}`);\n return probe;\n }\n getNodeName() {\n return this.spec.nodeName;\n }\n getSelectedNodeOs() {\n var _a, _b;\n return ((_a = this.spec.nodeSelector) === null || _a === void 0 ? void 0 : _a[\"kubernetes.io/os\"]) || ((_b = this.spec.nodeSelector) === null || _b === void 0 ? void 0 : _b[\"beta.kubernetes.io/os\"]);\n }\n getIPs() {\n if (!this.status.podIPs)\n return [];\n const podIPs = this.status.podIPs;\n return podIPs.map(value => value.ip);\n }\n}\nObject.defineProperty(Pod, \"kind\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"Pod\"\n});\nObject.defineProperty(Pod, \"namespaced\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: true\n});\nObject.defineProperty(Pod, \"apiBase\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"/api/v1/pods\"\n});\nlet podsApi;\nif (Object(_utils_cluster_id_url_parsing__WEBPACK_IMPORTED_MODULE_4__[\"isClusterPageContext\"])()) {\n podsApi = new PodsApi({\n objectConstructor: Pod,\n });\n}\n\n\n\n//# sourceURL=webpack:///./src/common/k8s-api/endpoints/pods.api.ts?");
|
|
37439
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PodsApi\", function() { return PodsApi; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getMetricsForPods\", function() { return getMetricsForPods; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PodStatus\", function() { return PodStatus; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Pod\", function() { return Pod; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"podsApi\", function() { return podsApi; });\n/* harmony import */ var _workload_kube_object__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../workload-kube-object */ \"./src/common/k8s-api/workload-kube-object.ts\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utils */ \"./src/common/utils/index.ts\");\n/* harmony import */ var _metrics_api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./metrics.api */ \"./src/common/k8s-api/endpoints/metrics.api.ts\");\n/* harmony import */ var _kube_api__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../kube-api */ \"./src/common/k8s-api/kube-api.ts\");\n/* harmony import */ var _utils_cluster_id_url_parsing__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils/cluster-id-url-parsing */ \"./src/common/utils/cluster-id-url-parsing.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n\n\n\n\nclass PodsApi extends _kube_api__WEBPACK_IMPORTED_MODULE_3__[\"KubeApi\"] {\n async getLogs(params, query) {\n const path = `${this.getUrl(params)}/log`;\n return this.request.get(path, { query });\n }\n}\nfunction getMetricsForPods(pods, namespace, selector = \"pod, namespace\") {\n const podSelector = pods.map(pod => pod.getName()).join(\"|\");\n const opts = { category: \"pods\", pods: podSelector, namespace, selector };\n return _metrics_api__WEBPACK_IMPORTED_MODULE_2__[\"metricsApi\"].getMetrics({\n cpuUsage: opts,\n cpuRequests: opts,\n cpuLimits: opts,\n memoryUsage: opts,\n memoryRequests: opts,\n memoryLimits: opts,\n fsUsage: opts,\n networkReceive: opts,\n networkTransmit: opts,\n }, {\n namespace,\n });\n}\nvar PodStatus;\n(function (PodStatus) {\n PodStatus[\"TERMINATED\"] = \"Terminated\";\n PodStatus[\"FAILED\"] = \"Failed\";\n PodStatus[\"PENDING\"] = \"Pending\";\n PodStatus[\"RUNNING\"] = \"Running\";\n PodStatus[\"SUCCEEDED\"] = \"Succeeded\";\n PodStatus[\"EVICTED\"] = \"Evicted\";\n})(PodStatus || (PodStatus = {}));\nclass Pod extends _workload_kube_object__WEBPACK_IMPORTED_MODULE_0__[\"WorkloadKubeObject\"] {\n constructor(data) {\n super(data);\n Object(_utils__WEBPACK_IMPORTED_MODULE_1__[\"autoBind\"])(this);\n }\n getInitContainers() {\n var _a;\n return ((_a = this.spec) === null || _a === void 0 ? void 0 : _a.initContainers) || [];\n }\n getContainers() {\n var _a;\n return ((_a = this.spec) === null || _a === void 0 ? void 0 : _a.containers) || [];\n }\n getAllContainers() {\n return [...this.getContainers(), ...this.getInitContainers()];\n }\n getRunningContainers() {\n const runningContainerNames = new Set(this.getContainerStatuses()\n .filter(({ state }) => state.running)\n .map(({ name }) => name));\n return this.getAllContainers()\n .filter(({ name }) => runningContainerNames.has(name));\n }\n getContainerStatuses(includeInitContainers = true) {\n var _a;\n const { containerStatuses = [], initContainerStatuses = [] } = (_a = this.status) !== null && _a !== void 0 ? _a : {};\n if (includeInitContainers) {\n return [...containerStatuses, ...initContainerStatuses];\n }\n return [...containerStatuses];\n }\n getRestartsCount() {\n var _a;\n const { containerStatuses = [] } = (_a = this.status) !== null && _a !== void 0 ? _a : {};\n return containerStatuses.reduce((totalCount, { restartCount }) => totalCount + restartCount, 0);\n }\n getQosClass() {\n var _a;\n return ((_a = this.status) === null || _a === void 0 ? void 0 : _a.qosClass) || \"\";\n }\n getReason() {\n var _a;\n return ((_a = this.status) === null || _a === void 0 ? void 0 : _a.reason) || \"\";\n }\n getPriorityClassName() {\n return this.spec.priorityClassName || \"\";\n }\n getStatus() {\n const phase = this.getStatusPhase();\n const reason = this.getReason();\n const trueConditionTypes = new Set(this.getConditions()\n .filter(({ status }) => status === \"True\")\n .map(({ type }) => type));\n const isInGoodCondition = [\"Initialized\", \"Ready\"].every(condition => trueConditionTypes.has(condition));\n if (reason === PodStatus.EVICTED) {\n return PodStatus.EVICTED;\n }\n if (phase === PodStatus.FAILED) {\n return PodStatus.FAILED;\n }\n if (phase === PodStatus.SUCCEEDED) {\n return PodStatus.SUCCEEDED;\n }\n if (phase === PodStatus.RUNNING && isInGoodCondition) {\n return PodStatus.RUNNING;\n }\n return PodStatus.PENDING;\n }\n // Returns pod phase or container error if occurred\n getStatusMessage() {\n if (this.getReason() === PodStatus.EVICTED)\n return \"Evicted\";\n if (this.metadata.deletionTimestamp)\n return \"Terminating\";\n const statuses = this.getContainerStatuses(false); // not including initContainers\n for (const { state } of statuses.reverse()) {\n if (state.waiting) {\n return state.waiting.reason || \"Waiting\";\n }\n if (state.terminated) {\n return state.terminated.reason || \"Terminated\";\n }\n }\n return this.getStatusPhase();\n }\n getStatusPhase() {\n var _a;\n return (_a = this.status) === null || _a === void 0 ? void 0 : _a.phase;\n }\n getConditions() {\n var _a;\n return ((_a = this.status) === null || _a === void 0 ? void 0 : _a.conditions) || [];\n }\n getVolumes() {\n return this.spec.volumes || [];\n }\n getSecrets() {\n return this.getVolumes()\n .filter(vol => vol.secret)\n .map(vol => vol.secret.secretName);\n }\n getNodeSelectors() {\n const { nodeSelector = {} } = this.spec;\n return Object.entries(nodeSelector).map(values => values.join(\": \"));\n }\n getTolerations() {\n return this.spec.tolerations || [];\n }\n getAffinity() {\n return this.spec.affinity;\n }\n hasIssues() {\n var _a;\n for (const { type, status } of this.getConditions()) {\n if (type === \"Ready\" && status !== \"True\") {\n return true;\n }\n }\n for (const { state } of this.getContainerStatuses()) {\n if (((_a = state === null || state === void 0 ? void 0 : state.waiting) === null || _a === void 0 ? void 0 : _a.reason) === \"CrashLookBackOff\") {\n return true;\n }\n }\n return this.getStatusPhase() !== \"Running\";\n }\n getLivenessProbe(container) {\n return this.getProbe(container, \"livenessProbe\");\n }\n getReadinessProbe(container) {\n return this.getProbe(container, \"readinessProbe\");\n }\n getStartupProbe(container) {\n return this.getProbe(container, \"startupProbe\");\n }\n getProbe(container, field) {\n var _a, _b;\n const probe = [];\n const probeData = container[field];\n if (!probeData) {\n return probe;\n }\n const { httpGet, exec, tcpSocket, initialDelaySeconds = 0, timeoutSeconds = 0, periodSeconds = 0, successThreshold = 0, failureThreshold = 0 } = probeData;\n // HTTP Request\n if (httpGet) {\n const { path = \"\", port, host = \"\", scheme } = httpGet;\n const resolvedPort = typeof port === \"number\"\n ? port\n // Try and find the port number associated witht the name or fallback to the name itself\n : ((_b = (_a = container.ports) === null || _a === void 0 ? void 0 : _a.find(containerPort => containerPort.name === port)) === null || _b === void 0 ? void 0 : _b.containerPort) || port;\n probe.push(\"http-get\", `${scheme.toLowerCase()}://${host}:${resolvedPort}${path}`);\n }\n // Command\n if (exec === null || exec === void 0 ? void 0 : exec.command) {\n probe.push(`exec [${exec.command.join(\" \")}]`);\n }\n // TCP Probe\n if (tcpSocket === null || tcpSocket === void 0 ? void 0 : tcpSocket.port) {\n probe.push(`tcp-socket :${tcpSocket.port}`);\n }\n probe.push(`delay=${initialDelaySeconds}s`, `timeout=${timeoutSeconds}s`, `period=${periodSeconds}s`, `#success=${successThreshold}`, `#failure=${failureThreshold}`);\n return probe;\n }\n getNodeName() {\n return this.spec.nodeName;\n }\n getSelectedNodeOs() {\n var _a, _b;\n return ((_a = this.spec.nodeSelector) === null || _a === void 0 ? void 0 : _a[\"kubernetes.io/os\"]) || ((_b = this.spec.nodeSelector) === null || _b === void 0 ? void 0 : _b[\"beta.kubernetes.io/os\"]);\n }\n getIPs() {\n if (!this.status.podIPs)\n return [];\n const podIPs = this.status.podIPs;\n return podIPs.map(value => value.ip);\n }\n}\nObject.defineProperty(Pod, \"kind\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"Pod\"\n});\nObject.defineProperty(Pod, \"namespaced\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: true\n});\nObject.defineProperty(Pod, \"apiBase\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"/api/v1/pods\"\n});\nlet podsApi;\nif (Object(_utils_cluster_id_url_parsing__WEBPACK_IMPORTED_MODULE_4__[\"isClusterPageContext\"])()) {\n podsApi = new PodsApi({\n objectConstructor: Pod,\n });\n}\n\n\n\n//# sourceURL=webpack:///./src/common/k8s-api/endpoints/pods.api.ts?");
|
|
37440
37440
|
|
|
37441
37441
|
/***/ }),
|
|
37442
37442
|
|
|
@@ -37604,7 +37604,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
37604
37604
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
37605
37605
|
|
|
37606
37606
|
"use strict";
|
|
37607
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"JsonApi\", function() { return JsonApi; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"JsonApiErrorParsed\", function() { return JsonApiErrorParsed; });\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var node_fetch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! node-fetch */ \"./node_modules/node-fetch/browser.js\");\n/* harmony import */ var node_fetch__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(node_fetch__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var querystring__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! querystring */ \"querystring\");\n/* harmony import */ var querystring__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(querystring__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _common_event_emitter__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../common/event-emitter */ \"./src/common/event-emitter.ts\");\n/* harmony import */ var _common_logger__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../common/logger */ \"./src/common/logger.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __rest = (undefined && undefined.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\n// Base http-service / json-api class\n\n\n\n\n\nclass JsonApi {\n constructor(config, reqInit) {\n Object.defineProperty(this, \"config\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: config\n });\n Object.defineProperty(this, \"reqInit\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: reqInit\n });\n Object.defineProperty(this, \"onData\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: new _common_event_emitter__WEBPACK_IMPORTED_MODULE_3__[\"EventEmitter\"]()\n });\n Object.defineProperty(this, \"onError\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: new _common_event_emitter__WEBPACK_IMPORTED_MODULE_3__[\"EventEmitter\"]()\n });\n this.config = Object.assign({}, JsonApi.configDefault, config);\n this.reqInit = Object(lodash__WEBPACK_IMPORTED_MODULE_0__[\"merge\"])({}, JsonApi.reqInitDefault, reqInit);\n this.parseResponse = this.parseResponse.bind(this);\n }\n get(path, params, reqInit = {}) {\n return this.request(path, params, Object.assign(Object.assign({}, reqInit), { method: \"get\" }));\n }\n getResponse(path, params, init = {}) {\n let reqUrl = `${this.config.serverAddress}${this.config.apiBase}${path}`;\n const reqInit = Object(lodash__WEBPACK_IMPORTED_MODULE_0__[\"merge\"])({}, this.reqInit, init);\n const { query } = params || {};\n if (!reqInit.method) {\n reqInit.method = \"get\";\n }\n if (query) {\n const queryString = Object(querystring__WEBPACK_IMPORTED_MODULE_2__[\"stringify\"])(query);\n reqUrl += (reqUrl.includes(\"?\") ? \"&\" : \"?\") + queryString;\n }\n return node_fetch__WEBPACK_IMPORTED_MODULE_1___default()(reqUrl, reqInit);\n }\n post(path, params, reqInit = {}) {\n return this.request(path, params, Object.assign(Object.assign({}, reqInit), { method: \"post\" }));\n }\n put(path, params, reqInit = {}) {\n return this.request(path, params, Object.assign(Object.assign({}, reqInit), { method: \"put\" }));\n }\n patch(path, params, reqInit = {}) {\n return this.request(path, params, Object.assign(Object.assign({}, reqInit), { method: \"PATCH\" }));\n }\n del(path, params, reqInit = {}) {\n return this.request(path, params, Object.assign(Object.assign({}, reqInit), { method: \"delete\" }));\n }\n async request(path, params, init = {}) {\n let reqUrl = `${this.config.serverAddress}${this.config.apiBase}${path}`;\n const reqInit = Object(lodash__WEBPACK_IMPORTED_MODULE_0__[\"merge\"])({}, this.reqInit, init);\n const { data, query } = params || {};\n if (data && !reqInit.body) {\n reqInit.body = JSON.stringify(data);\n }\n if (query) {\n const queryString = Object(querystring__WEBPACK_IMPORTED_MODULE_2__[\"stringify\"])(query);\n reqUrl += (reqUrl.includes(\"?\") ? \"&\" : \"?\") + queryString;\n }\n const infoLog = {\n method: reqInit.method.toUpperCase(),\n reqUrl,\n reqInit,\n };\n const res = await node_fetch__WEBPACK_IMPORTED_MODULE_1___default()(reqUrl, reqInit);\n return this.parseResponse(res, infoLog);\n }\n async parseResponse(res, log) {\n const { status } = res;\n const text = await res.text();\n let data;\n try {\n data = text ? JSON.parse(text) : \"\"; // DELETE-requests might not have response-body\n }\n catch (e) {\n data = text;\n }\n if (status >= 200 && status < 300) {\n this.onData.emit(data, res);\n this.writeLog(Object.assign(Object.assign({}, log), { data }));\n return data;\n }\n if (log.method === \"GET\" && res.status === 403) {\n this.writeLog(Object.assign(Object.assign({}, log), { error: data }));\n throw data;\n }\n const error = new JsonApiErrorParsed(data, this.parseError(data, res));\n this.onError.emit(error, res);\n this.writeLog(Object.assign(Object.assign({}, log), { error }));\n throw error;\n }\n parseError(error, res) {\n if (typeof error === \"string\") {\n return [error];\n }\n if (Array.isArray(error.errors)) {\n return error.errors.map(error => error.title);\n }\n if (error.message) {\n return [error.message];\n }\n return [res.statusText || \"Error!\"];\n }\n writeLog(log) {\n const { method, reqUrl } = log, params = __rest(log, [\"method\", \"reqUrl\"]);\n _common_logger__WEBPACK_IMPORTED_MODULE_4__[\"default\"].info(`[JSON-API] request ${method} ${reqUrl}`, params);\n }\n}\nObject.defineProperty(JsonApi, \"reqInitDefault\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {\n headers: {\n \"content-type\": \"application/json\"\n }\n }\n});\nObject.defineProperty(JsonApi, \"configDefault\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {\n debug: false\n }\n});\nclass JsonApiErrorParsed {\n constructor(error, messages) {\n Object.defineProperty(this, \"error\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: error\n });\n Object.defineProperty(this, \"messages\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: messages\n });\n Object.defineProperty(this, \"isUsedForNotification\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: false\n });\n }\n get isAborted() {\n return this.error.code === DOMException.ABORT_ERR;\n }\n toString() {\n return this.messages.join(\"\\n\");\n }\n}\n\n\n//# sourceURL=webpack:///./src/common/k8s-api/json-api.ts?");
|
|
37607
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"JsonApi\", function() { return JsonApi; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"JsonApiErrorParsed\", function() { return JsonApiErrorParsed; });\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var node_fetch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! node-fetch */ \"./node_modules/node-fetch/browser.js\");\n/* harmony import */ var node_fetch__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(node_fetch__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var querystring__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! querystring */ \"querystring\");\n/* harmony import */ var querystring__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(querystring__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _common_event_emitter__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../common/event-emitter */ \"./src/common/event-emitter.ts\");\n/* harmony import */ var _common_logger__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../common/logger */ \"./src/common/logger.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __rest = (undefined && undefined.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\n// Base http-service / json-api class\n\n\n\n\n\nclass JsonApi {\n constructor(config, reqInit) {\n var _a;\n Object.defineProperty(this, \"config\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: config\n });\n Object.defineProperty(this, \"reqInit\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: reqInit\n });\n Object.defineProperty(this, \"onData\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: new _common_event_emitter__WEBPACK_IMPORTED_MODULE_3__[\"EventEmitter\"]()\n });\n Object.defineProperty(this, \"onError\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: new _common_event_emitter__WEBPACK_IMPORTED_MODULE_3__[\"EventEmitter\"]()\n });\n Object.defineProperty(this, \"getRequestOptions\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.config = Object.assign({}, JsonApi.configDefault, config);\n this.reqInit = Object(lodash__WEBPACK_IMPORTED_MODULE_0__[\"merge\"])({}, JsonApi.reqInitDefault, reqInit);\n this.parseResponse = this.parseResponse.bind(this);\n this.getRequestOptions = (_a = config.getRequestOptions) !== null && _a !== void 0 ? _a : (() => Promise.resolve({}));\n }\n get(path, params, reqInit = {}) {\n return this.request(path, params, Object.assign(Object.assign({}, reqInit), { method: \"get\" }));\n }\n async getResponse(path, params, init = {}) {\n let reqUrl = `${this.config.serverAddress}${this.config.apiBase}${path}`;\n const reqInit = Object(lodash__WEBPACK_IMPORTED_MODULE_0__[\"merge\"])({}, this.reqInit, await this.getRequestOptions(), init);\n const { query } = params || {};\n if (!reqInit.method) {\n reqInit.method = \"get\";\n }\n if (query) {\n const queryString = Object(querystring__WEBPACK_IMPORTED_MODULE_2__[\"stringify\"])(query);\n reqUrl += (reqUrl.includes(\"?\") ? \"&\" : \"?\") + queryString;\n }\n return node_fetch__WEBPACK_IMPORTED_MODULE_1___default()(reqUrl, reqInit);\n }\n post(path, params, reqInit = {}) {\n return this.request(path, params, Object.assign(Object.assign({}, reqInit), { method: \"post\" }));\n }\n put(path, params, reqInit = {}) {\n return this.request(path, params, Object.assign(Object.assign({}, reqInit), { method: \"put\" }));\n }\n patch(path, params, reqInit = {}) {\n return this.request(path, params, Object.assign(Object.assign({}, reqInit), { method: \"PATCH\" }));\n }\n del(path, params, reqInit = {}) {\n return this.request(path, params, Object.assign(Object.assign({}, reqInit), { method: \"delete\" }));\n }\n async request(path, params, init = {}) {\n let reqUrl = `${this.config.serverAddress}${this.config.apiBase}${path}`;\n const reqInit = Object(lodash__WEBPACK_IMPORTED_MODULE_0__[\"merge\"])({}, this.reqInit, await this.getRequestOptions(), init);\n const { data, query } = params || {};\n if (data && !reqInit.body) {\n reqInit.body = JSON.stringify(data);\n }\n if (query) {\n const queryString = Object(querystring__WEBPACK_IMPORTED_MODULE_2__[\"stringify\"])(query);\n reqUrl += (reqUrl.includes(\"?\") ? \"&\" : \"?\") + queryString;\n }\n const infoLog = {\n method: reqInit.method.toUpperCase(),\n reqUrl,\n reqInit,\n };\n const res = await node_fetch__WEBPACK_IMPORTED_MODULE_1___default()(reqUrl, reqInit);\n return this.parseResponse(res, infoLog);\n }\n async parseResponse(res, log) {\n const { status } = res;\n const text = await res.text();\n let data;\n try {\n data = text ? JSON.parse(text) : \"\"; // DELETE-requests might not have response-body\n }\n catch (e) {\n data = text;\n }\n if (status >= 200 && status < 300) {\n this.onData.emit(data, res);\n this.writeLog(Object.assign(Object.assign({}, log), { data }));\n return data;\n }\n if (log.method === \"GET\" && res.status === 403) {\n this.writeLog(Object.assign(Object.assign({}, log), { error: data }));\n throw data;\n }\n const error = new JsonApiErrorParsed(data, this.parseError(data, res));\n this.onError.emit(error, res);\n this.writeLog(Object.assign(Object.assign({}, log), { error }));\n throw error;\n }\n parseError(error, res) {\n if (typeof error === \"string\") {\n return [error];\n }\n if (Array.isArray(error.errors)) {\n return error.errors.map(error => error.title);\n }\n if (error.message) {\n return [error.message];\n }\n return [res.statusText || \"Error!\"];\n }\n writeLog(log) {\n const { method, reqUrl } = log, params = __rest(log, [\"method\", \"reqUrl\"]);\n _common_logger__WEBPACK_IMPORTED_MODULE_4__[\"default\"].info(`[JSON-API] request ${method} ${reqUrl}`, params);\n }\n}\nObject.defineProperty(JsonApi, \"reqInitDefault\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {\n headers: {\n \"content-type\": \"application/json\"\n }\n }\n});\nObject.defineProperty(JsonApi, \"configDefault\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {\n debug: false\n }\n});\nclass JsonApiErrorParsed {\n constructor(error, messages) {\n Object.defineProperty(this, \"error\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: error\n });\n Object.defineProperty(this, \"messages\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: messages\n });\n Object.defineProperty(this, \"isUsedForNotification\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: false\n });\n }\n get isAborted() {\n return this.error.code === DOMException.ABORT_ERR;\n }\n toString() {\n return this.messages.join(\"\\n\");\n }\n}\n\n\n//# sourceURL=webpack:///./src/common/k8s-api/json-api.ts?");
|
|
37608
37608
|
|
|
37609
37609
|
/***/ }),
|
|
37610
37610
|
|
|
@@ -37628,7 +37628,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
37628
37628
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
37629
37629
|
|
|
37630
37630
|
"use strict";
|
|
37631
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"forCluster\", function() { return forCluster; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"forRemoteCluster\", function() { return forRemoteCluster; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ensureObjectSelfLink\", function() { return ensureObjectSelfLink; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"KubeApi\", function() { return KubeApi; });\n/* harmony import */ var lodash_merge__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/merge */ \"./node_modules/lodash/merge.js\");\n/* harmony import */ var lodash_merge__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_merge__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var querystring__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! querystring */ \"querystring\");\n/* harmony import */ var querystring__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(querystring__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _common_vars__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../common/vars */ \"./src/common/vars.ts\");\n/* harmony import */ var _main_logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../main/logger */ \"./src/main/logger.ts\");\n/* harmony import */ var _api_manager__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./api-manager */ \"./src/common/k8s-api/api-manager.ts\");\n/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./index */ \"./src/common/k8s-api/index.ts\");\n/* harmony import */ var _kube_api_parse__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./kube-api-parse */ \"./src/common/k8s-api/kube-api-parse.ts\");\n/* harmony import */ var _kube_object__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./kube-object */ \"./src/common/k8s-api/kube-object.ts\");\n/* harmony import */ var byline__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! byline */ \"./node_modules/byline/lib/byline.js\");\n/* harmony import */ var byline__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(byline__WEBPACK_IMPORTED_MODULE_8__);\n/* harmony import */ var _kube_json_api__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./kube-json-api */ \"./src/common/k8s-api/kube-json-api.ts\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../utils */ \"./src/common/utils/index.ts\");\n/* harmony import */ var abort_controller__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! abort-controller */ \"./node_modules/abort-controller/browser.js\");\n/* harmony import */ var abort_controller__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(abort_controller__WEBPACK_IMPORTED_MODULE_11__);\n/* harmony import */ var https__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! https */ \"https\");\n/* harmony import */ var https__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(https__WEBPACK_IMPORTED_MODULE_12__);\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n// Base class for building all kubernetes apis\n\n\n\n\n\n\n\n\n\n\n\n\n\nfunction forCluster(cluster, kubeClass) {\n const url = new URL(_index__WEBPACK_IMPORTED_MODULE_5__[\"apiBase\"].config.serverAddress);\n const request = new _kube_json_api__WEBPACK_IMPORTED_MODULE_9__[\"KubeJsonApi\"]({\n serverAddress: _index__WEBPACK_IMPORTED_MODULE_5__[\"apiBase\"].config.serverAddress,\n apiBase: _common_vars__WEBPACK_IMPORTED_MODULE_2__[\"apiKubePrefix\"],\n debug: _common_vars__WEBPACK_IMPORTED_MODULE_2__[\"isDevelopment\"],\n }, {\n headers: {\n \"Host\": `${cluster.metadata.uid}.localhost:${url.port}`\n }\n });\n return new KubeApi({\n objectConstructor: kubeClass,\n request\n });\n}\nfunction forRemoteCluster(config, kubeClass) {\n const reqInit = {};\n if (config.user.token) {\n reqInit.headers = {\n \"Authorization\": `Bearer ${config.user.token}`\n };\n }\n const agentOptions = {};\n if (config.cluster.skipTLSVerify === true) {\n agentOptions.rejectUnauthorized = false;\n }\n if (config.user.clientCertificateData) {\n agentOptions.cert = config.user.clientCertificateData;\n }\n if (config.user.clientKeyData) {\n agentOptions.key = config.user.clientKeyData;\n }\n if (config.cluster.caData) {\n agentOptions.ca = config.cluster.caData;\n }\n if (Object.keys(agentOptions).length > 0) {\n reqInit.agent = new https__WEBPACK_IMPORTED_MODULE_12__[\"Agent\"](agentOptions);\n }\n const request = new _kube_json_api__WEBPACK_IMPORTED_MODULE_9__[\"KubeJsonApi\"]({\n serverAddress: config.cluster.server,\n apiBase: \"\",\n debug: _common_vars__WEBPACK_IMPORTED_MODULE_2__[\"isDevelopment\"],\n }, reqInit);\n return new KubeApi({\n objectConstructor: kubeClass,\n request\n });\n}\nfunction ensureObjectSelfLink(api, object) {\n if (!object.metadata.selfLink) {\n object.metadata.selfLink = Object(_kube_api_parse__WEBPACK_IMPORTED_MODULE_6__[\"createKubeApiURL\"])({\n apiPrefix: api.apiPrefix,\n apiVersion: api.apiVersionWithGroup,\n resource: api.apiResource,\n namespace: api.isNamespaced ? object.metadata.namespace : undefined,\n name: object.metadata.name,\n });\n }\n}\nclass KubeApi {\n constructor(options) {\n var _a, _b;\n Object.defineProperty(this, \"options\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: options\n });\n Object.defineProperty(this, \"kind\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"apiBase\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"apiPrefix\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"apiGroup\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"apiVersion\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"apiVersionPreferred\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"apiResource\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"isNamespaced\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"objectConstructor\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"request\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"resourceVersions\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: new Map()\n });\n Object.defineProperty(this, \"watchDisposer\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"watchId\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 1\n });\n const { objectConstructor, request = _index__WEBPACK_IMPORTED_MODULE_5__[\"apiKube\"], kind = (_a = options.objectConstructor) === null || _a === void 0 ? void 0 : _a.kind, isNamespaced = (_b = options.objectConstructor) === null || _b === void 0 ? void 0 : _b.namespaced } = options || {};\n if (!options.apiBase) {\n options.apiBase = objectConstructor.apiBase;\n }\n const { apiBase, apiPrefix, apiGroup, apiVersion, resource } = Object(_kube_api_parse__WEBPACK_IMPORTED_MODULE_6__[\"parseKubeApi\"])(options.apiBase);\n this.kind = kind;\n this.isNamespaced = isNamespaced;\n this.apiBase = apiBase;\n this.apiPrefix = apiPrefix;\n this.apiGroup = apiGroup;\n this.apiVersion = apiVersion;\n this.apiResource = resource;\n this.request = request;\n this.objectConstructor = objectConstructor;\n this.parseResponse = this.parseResponse.bind(this);\n _api_manager__WEBPACK_IMPORTED_MODULE_4__[\"apiManager\"].registerApi(apiBase, this);\n }\n get apiVersionWithGroup() {\n var _a;\n return [this.apiGroup, (_a = this.apiVersionPreferred) !== null && _a !== void 0 ? _a : this.apiVersion]\n .filter(Boolean)\n .join(\"/\");\n }\n /**\n * Returns the latest API prefix/group that contains the required resource.\n * First tries options.apiBase, then urls in order from options.fallbackApiBases.\n */\n async getLatestApiPrefixGroup() {\n var _a;\n // Note that this.options.apiBase is the \"full\" url, whereas this.apiBase is parsed\n const apiBases = [this.options.apiBase, ...this.options.fallbackApiBases];\n for (const apiUrl of apiBases) {\n // Split e.g. \"/apis/extensions/v1beta1/ingresses\" to parts\n const { apiPrefix, apiGroup, apiVersionWithGroup, resource } = Object(_kube_api_parse__WEBPACK_IMPORTED_MODULE_6__[\"parseKubeApi\"])(apiUrl);\n // Request available resources\n try {\n const response = await this.request.get(`${apiPrefix}/${apiVersionWithGroup}`);\n // If the resource is found in the group, use this apiUrl\n if ((_a = response.resources) === null || _a === void 0 ? void 0 : _a.find(kubeResource => kubeResource.name === resource)) {\n return { apiPrefix, apiGroup };\n }\n }\n catch (error) {\n // Exception is ignored as we can try the next url\n }\n }\n throw new Error(`Can't find working API for the Kubernetes resource ${this.apiResource}`);\n }\n /**\n * Get the apiPrefix and apiGroup to be used for fetching the preferred version.\n */\n async getPreferredVersionPrefixGroup() {\n if (this.options.fallbackApiBases) {\n try {\n return await this.getLatestApiPrefixGroup();\n }\n catch (error) {\n // If valid API wasn't found, log the error and return defaults below\n _main_logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(error);\n }\n }\n return {\n apiPrefix: this.apiPrefix,\n apiGroup: this.apiGroup\n };\n }\n async checkPreferredVersion() {\n var _a, _b;\n if (this.options.fallbackApiBases && !this.options.checkPreferredVersion) {\n throw new Error(\"checkPreferredVersion must be enabled if fallbackApiBases is set in KubeApi\");\n }\n if (this.options.checkPreferredVersion && this.apiVersionPreferred === undefined) {\n const { apiPrefix, apiGroup } = await this.getPreferredVersionPrefixGroup();\n // The apiPrefix and apiGroup might change due to fallbackApiBases, so we must override them\n Object.defineProperty(this, \"apiPrefix\", {\n value: apiPrefix\n });\n Object.defineProperty(this, \"apiGroup\", {\n value: apiGroup\n });\n const res = await this.request.get(`${this.apiPrefix}/${this.apiGroup}`);\n Object.defineProperty(this, \"apiVersionPreferred\", {\n value: (_b = (_a = res === null || res === void 0 ? void 0 : res.preferredVersion) === null || _a === void 0 ? void 0 : _a.version) !== null && _b !== void 0 ? _b : null,\n });\n if (this.apiVersionPreferred) {\n Object.defineProperty(this, \"apiBase\", { value: this.getUrl() });\n _api_manager__WEBPACK_IMPORTED_MODULE_4__[\"apiManager\"].registerApi(this.apiBase, this);\n }\n }\n }\n setResourceVersion(namespace = \"\", newVersion) {\n this.resourceVersions.set(namespace, newVersion);\n }\n getResourceVersion(namespace = \"\") {\n return this.resourceVersions.get(namespace);\n }\n async refreshResourceVersion(params) {\n return this.list(params, { limit: 1 });\n }\n getUrl({ name = \"\", namespace = \"\" } = {}, query) {\n const resourcePath = Object(_kube_api_parse__WEBPACK_IMPORTED_MODULE_6__[\"createKubeApiURL\"])({\n apiPrefix: this.apiPrefix,\n apiVersion: this.apiVersionWithGroup,\n resource: this.apiResource,\n namespace: this.isNamespaced ? namespace : undefined,\n name,\n });\n return resourcePath + (query ? `?${Object(querystring__WEBPACK_IMPORTED_MODULE_1__[\"stringify\"])(this.normalizeQuery(query))}` : \"\");\n }\n normalizeQuery(query = {}) {\n if (query.labelSelector) {\n query.labelSelector = [query.labelSelector].flat().join(\",\");\n }\n if (query.fieldSelector) {\n query.fieldSelector = [query.fieldSelector].flat().join(\",\");\n }\n return query;\n }\n parseResponse(data, namespace) {\n if (!data)\n return null;\n const KubeObjectConstructor = this.objectConstructor;\n // process items list response, check before single item since there is overlap\n if (_kube_object__WEBPACK_IMPORTED_MODULE_7__[\"KubeObject\"].isJsonApiDataList(data, _kube_object__WEBPACK_IMPORTED_MODULE_7__[\"KubeObject\"].isPartialJsonApiData)) {\n const { apiVersion, items, metadata } = data;\n this.setResourceVersion(namespace, metadata.resourceVersion);\n this.setResourceVersion(\"\", metadata.resourceVersion);\n return items.map((item) => {\n const object = new KubeObjectConstructor(Object.assign({ kind: this.kind, apiVersion }, item));\n ensureObjectSelfLink(this, object);\n return object;\n });\n }\n // process a single item\n if (_kube_object__WEBPACK_IMPORTED_MODULE_7__[\"KubeObject\"].isJsonApiData(data)) {\n const object = new KubeObjectConstructor(data);\n ensureObjectSelfLink(this, object);\n return object;\n }\n // custom apis might return array for list response, e.g. users, groups, etc.\n if (Array.isArray(data)) {\n return data.map(data => new KubeObjectConstructor(data));\n }\n return null;\n }\n async list({ namespace = \"\", reqInit } = {}, query) {\n await this.checkPreferredVersion();\n const url = this.getUrl({ namespace });\n const res = await this.request.get(url, { query }, reqInit);\n const parsed = this.parseResponse(res, namespace);\n if (Array.isArray(parsed)) {\n return parsed;\n }\n if (!parsed) {\n return null;\n }\n throw new Error(`GET multiple request to ${url} returned not an array: ${JSON.stringify(parsed)}`);\n }\n async get({ name = \"\", namespace = \"default\" } = {}, query) {\n await this.checkPreferredVersion();\n const url = this.getUrl({ namespace, name });\n const res = await this.request.get(url, { query });\n const parsed = this.parseResponse(res);\n if (Array.isArray(parsed)) {\n throw new Error(`GET single request to ${url} returned an array: ${JSON.stringify(parsed)}`);\n }\n return parsed;\n }\n async create({ name = \"\", namespace = \"default\" } = {}, data) {\n await this.checkPreferredVersion();\n const apiUrl = this.getUrl({ namespace });\n const res = await this.request.post(apiUrl, {\n data: lodash_merge__WEBPACK_IMPORTED_MODULE_0___default()({\n kind: this.kind,\n apiVersion: this.apiVersionWithGroup,\n metadata: {\n name,\n namespace\n }\n }, data)\n });\n const parsed = this.parseResponse(res);\n if (Array.isArray(parsed)) {\n throw new Error(`POST request to ${apiUrl} returned an array: ${JSON.stringify(parsed)}`);\n }\n return parsed;\n }\n async update({ name = \"\", namespace = \"default\" } = {}, data) {\n await this.checkPreferredVersion();\n const apiUrl = this.getUrl({ namespace, name });\n const res = await this.request.put(apiUrl, { data });\n const parsed = this.parseResponse(res);\n if (Array.isArray(parsed)) {\n throw new Error(`PUT request to ${apiUrl} returned an array: ${JSON.stringify(parsed)}`);\n }\n return parsed;\n }\n async delete({ name = \"\", namespace = \"default\" }) {\n await this.checkPreferredVersion();\n const apiUrl = this.getUrl({ namespace, name });\n return this.request.del(apiUrl);\n }\n getWatchUrl(namespace = \"\", query = {}) {\n return this.getUrl({ namespace }, Object.assign({ watch: 1, resourceVersion: this.getResourceVersion(namespace) }, query));\n }\n watch(opts = { namespace: \"\", retry: false }) {\n let errorReceived = false;\n let timedRetry;\n const { abortController: { abort, signal } = new abort_controller__WEBPACK_IMPORTED_MODULE_11___default.a(), namespace, callback = _utils__WEBPACK_IMPORTED_MODULE_10__[\"noop\"], retry } = opts;\n const { watchId = `${this.kind.toLowerCase()}-${this.watchId++}` } = opts;\n signal.addEventListener(\"abort\", () => {\n _main_logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].info(`[KUBE-API] watch (${watchId}) aborted ${watchUrl}`);\n clearTimeout(timedRetry);\n });\n const watchUrl = this.getWatchUrl(namespace);\n const responsePromise = this.request.getResponse(watchUrl, null, { signal, timeout: 600000 });\n _main_logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].info(`[KUBE-API] watch (${watchId}) ${retry === true ? \"retried\" : \"started\"} ${watchUrl}`);\n responsePromise\n .then(response => {\n if (!response.ok) {\n _main_logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].warn(`[KUBE-API] watch (${watchId}) error response ${watchUrl}`, { status: response.status });\n return callback(null, response);\n }\n [\"end\", \"close\", \"error\"].forEach((eventName) => {\n response.body.on(eventName, () => {\n if (errorReceived)\n return; // kubernetes errors should be handled in a callback\n if (signal.aborted)\n return;\n _main_logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].info(`[KUBE-API] watch (${watchId}) ${eventName} ${watchUrl}`);\n clearTimeout(timedRetry);\n timedRetry = setTimeout(() => {\n this.watch(Object.assign(Object.assign({}, opts), { namespace, callback, watchId, retry: true }));\n }, 1000);\n });\n });\n byline__WEBPACK_IMPORTED_MODULE_8___default()(response.body).on(\"data\", (line) => {\n try {\n const event = JSON.parse(line);\n if (event.type === \"ERROR\" && event.object.kind === \"Status\") {\n errorReceived = true;\n return callback(null, new _kube_object__WEBPACK_IMPORTED_MODULE_7__[\"KubeStatus\"](event.object));\n }\n this.modifyWatchEvent(event);\n callback(event, null);\n }\n catch (ignore) {\n // ignore parse errors\n }\n });\n })\n .catch(error => {\n _main_logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(`[KUBE-API] watch (${watchId}) throwed ${watchUrl}`, error);\n callback(null, error);\n });\n return abort;\n }\n modifyWatchEvent(event) {\n switch (event.type) {\n case \"ADDED\":\n case \"DELETED\":\n case \"MODIFIED\": {\n ensureObjectSelfLink(this, event.object);\n const { namespace, resourceVersion } = event.object.metadata;\n this.setResourceVersion(namespace, resourceVersion);\n this.setResourceVersion(\"\", resourceVersion);\n break;\n }\n }\n }\n}\n\n\n//# sourceURL=webpack:///./src/common/k8s-api/kube-api.ts?");
|
|
37631
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"forCluster\", function() { return forCluster; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"forRemoteCluster\", function() { return forRemoteCluster; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ensureObjectSelfLink\", function() { return ensureObjectSelfLink; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"KubeApi\", function() { return KubeApi; });\n/* harmony import */ var lodash_merge__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/merge */ \"./node_modules/lodash/merge.js\");\n/* harmony import */ var lodash_merge__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_merge__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var querystring__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! querystring */ \"querystring\");\n/* harmony import */ var querystring__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(querystring__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _common_vars__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../common/vars */ \"./src/common/vars.ts\");\n/* harmony import */ var _main_logger__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../main/logger */ \"./src/main/logger.ts\");\n/* harmony import */ var _api_manager__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./api-manager */ \"./src/common/k8s-api/api-manager.ts\");\n/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./index */ \"./src/common/k8s-api/index.ts\");\n/* harmony import */ var _kube_api_parse__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./kube-api-parse */ \"./src/common/k8s-api/kube-api-parse.ts\");\n/* harmony import */ var _kube_object__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./kube-object */ \"./src/common/k8s-api/kube-object.ts\");\n/* harmony import */ var byline__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! byline */ \"./node_modules/byline/lib/byline.js\");\n/* harmony import */ var byline__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(byline__WEBPACK_IMPORTED_MODULE_9__);\n/* harmony import */ var _kube_json_api__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./kube-json-api */ \"./src/common/k8s-api/kube-json-api.ts\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../utils */ \"./src/common/utils/index.ts\");\n/* harmony import */ var abort_controller__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! abort-controller */ \"./node_modules/abort-controller/browser.js\");\n/* harmony import */ var abort_controller__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(abort_controller__WEBPACK_IMPORTED_MODULE_12__);\n/* harmony import */ var https__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! https */ \"https\");\n/* harmony import */ var https__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(https__WEBPACK_IMPORTED_MODULE_13__);\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n// Base class for building all kubernetes apis\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfunction forCluster(cluster, kubeClass) {\n const url = new URL(_index__WEBPACK_IMPORTED_MODULE_6__[\"apiBase\"].config.serverAddress);\n const request = new _kube_json_api__WEBPACK_IMPORTED_MODULE_10__[\"KubeJsonApi\"]({\n serverAddress: _index__WEBPACK_IMPORTED_MODULE_6__[\"apiBase\"].config.serverAddress,\n apiBase: _common_vars__WEBPACK_IMPORTED_MODULE_3__[\"apiKubePrefix\"],\n debug: _common_vars__WEBPACK_IMPORTED_MODULE_3__[\"isDevelopment\"],\n }, {\n headers: {\n \"Host\": `${cluster.metadata.uid}.localhost:${url.port}`\n }\n });\n return new KubeApi({\n objectConstructor: kubeClass,\n request\n });\n}\nfunction forRemoteCluster(config, kubeClass) {\n const reqInit = {};\n const agentOptions = {};\n if (config.cluster.skipTLSVerify === true) {\n agentOptions.rejectUnauthorized = false;\n }\n if (config.user.clientCertificateData) {\n agentOptions.cert = config.user.clientCertificateData;\n }\n if (config.user.clientKeyData) {\n agentOptions.key = config.user.clientKeyData;\n }\n if (config.cluster.caData) {\n agentOptions.ca = config.cluster.caData;\n }\n if (Object.keys(agentOptions).length > 0) {\n reqInit.agent = new https__WEBPACK_IMPORTED_MODULE_13__[\"Agent\"](agentOptions);\n }\n const token = config.user.token;\n const request = new _kube_json_api__WEBPACK_IMPORTED_MODULE_10__[\"KubeJsonApi\"](Object.assign({ serverAddress: config.cluster.server, apiBase: \"\", debug: _common_vars__WEBPACK_IMPORTED_MODULE_3__[\"isDevelopment\"] }, (token ? {\n getRequestOptions: async () => ({\n headers: {\n \"Authorization\": `Bearer ${Object(lodash__WEBPACK_IMPORTED_MODULE_1__[\"isFunction\"])(token) ? await token() : token}`\n }\n })\n } : {})), reqInit);\n return new KubeApi({\n objectConstructor: kubeClass,\n request\n });\n}\nfunction ensureObjectSelfLink(api, object) {\n if (!object.metadata.selfLink) {\n object.metadata.selfLink = Object(_kube_api_parse__WEBPACK_IMPORTED_MODULE_7__[\"createKubeApiURL\"])({\n apiPrefix: api.apiPrefix,\n apiVersion: api.apiVersionWithGroup,\n resource: api.apiResource,\n namespace: api.isNamespaced ? object.metadata.namespace : undefined,\n name: object.metadata.name,\n });\n }\n}\nclass KubeApi {\n constructor(options) {\n var _a, _b;\n Object.defineProperty(this, \"options\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: options\n });\n Object.defineProperty(this, \"kind\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"apiBase\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"apiPrefix\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"apiGroup\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"apiVersion\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"apiVersionPreferred\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"apiResource\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"isNamespaced\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"objectConstructor\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"request\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"resourceVersions\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: new Map()\n });\n Object.defineProperty(this, \"watchDisposer\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"watchId\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 1\n });\n const { objectConstructor, request = _index__WEBPACK_IMPORTED_MODULE_6__[\"apiKube\"], kind = (_a = options.objectConstructor) === null || _a === void 0 ? void 0 : _a.kind, isNamespaced = (_b = options.objectConstructor) === null || _b === void 0 ? void 0 : _b.namespaced } = options || {};\n if (!options.apiBase) {\n options.apiBase = objectConstructor.apiBase;\n }\n const { apiBase, apiPrefix, apiGroup, apiVersion, resource } = Object(_kube_api_parse__WEBPACK_IMPORTED_MODULE_7__[\"parseKubeApi\"])(options.apiBase);\n this.kind = kind;\n this.isNamespaced = isNamespaced;\n this.apiBase = apiBase;\n this.apiPrefix = apiPrefix;\n this.apiGroup = apiGroup;\n this.apiVersion = apiVersion;\n this.apiResource = resource;\n this.request = request;\n this.objectConstructor = objectConstructor;\n this.parseResponse = this.parseResponse.bind(this);\n _api_manager__WEBPACK_IMPORTED_MODULE_5__[\"apiManager\"].registerApi(apiBase, this);\n }\n get apiVersionWithGroup() {\n var _a;\n return [this.apiGroup, (_a = this.apiVersionPreferred) !== null && _a !== void 0 ? _a : this.apiVersion]\n .filter(Boolean)\n .join(\"/\");\n }\n /**\n * Returns the latest API prefix/group that contains the required resource.\n * First tries options.apiBase, then urls in order from options.fallbackApiBases.\n */\n async getLatestApiPrefixGroup() {\n var _a;\n // Note that this.options.apiBase is the \"full\" url, whereas this.apiBase is parsed\n const apiBases = [this.options.apiBase, ...this.options.fallbackApiBases];\n for (const apiUrl of apiBases) {\n // Split e.g. \"/apis/extensions/v1beta1/ingresses\" to parts\n const { apiPrefix, apiGroup, apiVersionWithGroup, resource } = Object(_kube_api_parse__WEBPACK_IMPORTED_MODULE_7__[\"parseKubeApi\"])(apiUrl);\n // Request available resources\n try {\n const response = await this.request.get(`${apiPrefix}/${apiVersionWithGroup}`);\n // If the resource is found in the group, use this apiUrl\n if ((_a = response.resources) === null || _a === void 0 ? void 0 : _a.find(kubeResource => kubeResource.name === resource)) {\n return { apiPrefix, apiGroup };\n }\n }\n catch (error) {\n // Exception is ignored as we can try the next url\n }\n }\n throw new Error(`Can't find working API for the Kubernetes resource ${this.apiResource}`);\n }\n /**\n * Get the apiPrefix and apiGroup to be used for fetching the preferred version.\n */\n async getPreferredVersionPrefixGroup() {\n if (this.options.fallbackApiBases) {\n try {\n return await this.getLatestApiPrefixGroup();\n }\n catch (error) {\n // If valid API wasn't found, log the error and return defaults below\n _main_logger__WEBPACK_IMPORTED_MODULE_4__[\"default\"].error(error);\n }\n }\n return {\n apiPrefix: this.apiPrefix,\n apiGroup: this.apiGroup\n };\n }\n async checkPreferredVersion() {\n var _a, _b;\n if (this.options.fallbackApiBases && !this.options.checkPreferredVersion) {\n throw new Error(\"checkPreferredVersion must be enabled if fallbackApiBases is set in KubeApi\");\n }\n if (this.options.checkPreferredVersion && this.apiVersionPreferred === undefined) {\n const { apiPrefix, apiGroup } = await this.getPreferredVersionPrefixGroup();\n // The apiPrefix and apiGroup might change due to fallbackApiBases, so we must override them\n Object.defineProperty(this, \"apiPrefix\", {\n value: apiPrefix\n });\n Object.defineProperty(this, \"apiGroup\", {\n value: apiGroup\n });\n const res = await this.request.get(`${this.apiPrefix}/${this.apiGroup}`);\n Object.defineProperty(this, \"apiVersionPreferred\", {\n value: (_b = (_a = res === null || res === void 0 ? void 0 : res.preferredVersion) === null || _a === void 0 ? void 0 : _a.version) !== null && _b !== void 0 ? _b : null,\n });\n if (this.apiVersionPreferred) {\n Object.defineProperty(this, \"apiBase\", { value: this.getUrl() });\n _api_manager__WEBPACK_IMPORTED_MODULE_5__[\"apiManager\"].registerApi(this.apiBase, this);\n }\n }\n }\n setResourceVersion(namespace = \"\", newVersion) {\n this.resourceVersions.set(namespace, newVersion);\n }\n getResourceVersion(namespace = \"\") {\n return this.resourceVersions.get(namespace);\n }\n async refreshResourceVersion(params) {\n return this.list(params, { limit: 1 });\n }\n getUrl({ name = \"\", namespace = \"\" } = {}, query) {\n const resourcePath = Object(_kube_api_parse__WEBPACK_IMPORTED_MODULE_7__[\"createKubeApiURL\"])({\n apiPrefix: this.apiPrefix,\n apiVersion: this.apiVersionWithGroup,\n resource: this.apiResource,\n namespace: this.isNamespaced ? namespace : undefined,\n name,\n });\n return resourcePath + (query ? `?${Object(querystring__WEBPACK_IMPORTED_MODULE_2__[\"stringify\"])(this.normalizeQuery(query))}` : \"\");\n }\n normalizeQuery(query = {}) {\n if (query.labelSelector) {\n query.labelSelector = [query.labelSelector].flat().join(\",\");\n }\n if (query.fieldSelector) {\n query.fieldSelector = [query.fieldSelector].flat().join(\",\");\n }\n return query;\n }\n parseResponse(data, namespace) {\n if (!data)\n return null;\n const KubeObjectConstructor = this.objectConstructor;\n // process items list response, check before single item since there is overlap\n if (_kube_object__WEBPACK_IMPORTED_MODULE_8__[\"KubeObject\"].isJsonApiDataList(data, _kube_object__WEBPACK_IMPORTED_MODULE_8__[\"KubeObject\"].isPartialJsonApiData)) {\n const { apiVersion, items, metadata } = data;\n this.setResourceVersion(namespace, metadata.resourceVersion);\n this.setResourceVersion(\"\", metadata.resourceVersion);\n return items.map((item) => {\n const object = new KubeObjectConstructor(Object.assign({ kind: this.kind, apiVersion }, item));\n ensureObjectSelfLink(this, object);\n return object;\n });\n }\n // process a single item\n if (_kube_object__WEBPACK_IMPORTED_MODULE_8__[\"KubeObject\"].isJsonApiData(data)) {\n const object = new KubeObjectConstructor(data);\n ensureObjectSelfLink(this, object);\n return object;\n }\n // custom apis might return array for list response, e.g. users, groups, etc.\n if (Array.isArray(data)) {\n return data.map(data => new KubeObjectConstructor(data));\n }\n return null;\n }\n async list({ namespace = \"\", reqInit } = {}, query) {\n await this.checkPreferredVersion();\n const url = this.getUrl({ namespace });\n const res = await this.request.get(url, { query }, reqInit);\n const parsed = this.parseResponse(res, namespace);\n if (Array.isArray(parsed)) {\n return parsed;\n }\n if (!parsed) {\n return null;\n }\n throw new Error(`GET multiple request to ${url} returned not an array: ${JSON.stringify(parsed)}`);\n }\n async get({ name = \"\", namespace = \"default\" } = {}, query) {\n await this.checkPreferredVersion();\n const url = this.getUrl({ namespace, name });\n const res = await this.request.get(url, { query });\n const parsed = this.parseResponse(res);\n if (Array.isArray(parsed)) {\n throw new Error(`GET single request to ${url} returned an array: ${JSON.stringify(parsed)}`);\n }\n return parsed;\n }\n async create({ name = \"\", namespace = \"default\" } = {}, data) {\n await this.checkPreferredVersion();\n const apiUrl = this.getUrl({ namespace });\n const res = await this.request.post(apiUrl, {\n data: lodash_merge__WEBPACK_IMPORTED_MODULE_0___default()({\n kind: this.kind,\n apiVersion: this.apiVersionWithGroup,\n metadata: {\n name,\n namespace\n }\n }, data)\n });\n const parsed = this.parseResponse(res);\n if (Array.isArray(parsed)) {\n throw new Error(`POST request to ${apiUrl} returned an array: ${JSON.stringify(parsed)}`);\n }\n return parsed;\n }\n async update({ name = \"\", namespace = \"default\" } = {}, data) {\n await this.checkPreferredVersion();\n const apiUrl = this.getUrl({ namespace, name });\n const res = await this.request.put(apiUrl, { data });\n const parsed = this.parseResponse(res);\n if (Array.isArray(parsed)) {\n throw new Error(`PUT request to ${apiUrl} returned an array: ${JSON.stringify(parsed)}`);\n }\n return parsed;\n }\n async delete({ name = \"\", namespace = \"default\" }) {\n await this.checkPreferredVersion();\n const apiUrl = this.getUrl({ namespace, name });\n return this.request.del(apiUrl);\n }\n getWatchUrl(namespace = \"\", query = {}) {\n return this.getUrl({ namespace }, Object.assign({ watch: 1, resourceVersion: this.getResourceVersion(namespace) }, query));\n }\n watch(opts = { namespace: \"\", retry: false }) {\n let errorReceived = false;\n let timedRetry;\n const { abortController: { abort, signal } = new abort_controller__WEBPACK_IMPORTED_MODULE_12___default.a(), namespace, callback = _utils__WEBPACK_IMPORTED_MODULE_11__[\"noop\"], retry } = opts;\n const { watchId = `${this.kind.toLowerCase()}-${this.watchId++}` } = opts;\n signal.addEventListener(\"abort\", () => {\n _main_logger__WEBPACK_IMPORTED_MODULE_4__[\"default\"].info(`[KUBE-API] watch (${watchId}) aborted ${watchUrl}`);\n clearTimeout(timedRetry);\n });\n const watchUrl = this.getWatchUrl(namespace);\n const responsePromise = this.request.getResponse(watchUrl, null, { signal, timeout: 600000 });\n _main_logger__WEBPACK_IMPORTED_MODULE_4__[\"default\"].info(`[KUBE-API] watch (${watchId}) ${retry === true ? \"retried\" : \"started\"} ${watchUrl}`);\n responsePromise\n .then(response => {\n if (!response.ok) {\n _main_logger__WEBPACK_IMPORTED_MODULE_4__[\"default\"].warn(`[KUBE-API] watch (${watchId}) error response ${watchUrl}`, { status: response.status });\n return callback(null, response);\n }\n [\"end\", \"close\", \"error\"].forEach((eventName) => {\n response.body.on(eventName, () => {\n if (errorReceived)\n return; // kubernetes errors should be handled in a callback\n if (signal.aborted)\n return;\n _main_logger__WEBPACK_IMPORTED_MODULE_4__[\"default\"].info(`[KUBE-API] watch (${watchId}) ${eventName} ${watchUrl}`);\n clearTimeout(timedRetry);\n timedRetry = setTimeout(() => {\n this.watch(Object.assign(Object.assign({}, opts), { namespace, callback, watchId, retry: true }));\n }, 1000);\n });\n });\n byline__WEBPACK_IMPORTED_MODULE_9___default()(response.body).on(\"data\", (line) => {\n try {\n const event = JSON.parse(line);\n if (event.type === \"ERROR\" && event.object.kind === \"Status\") {\n errorReceived = true;\n return callback(null, new _kube_object__WEBPACK_IMPORTED_MODULE_8__[\"KubeStatus\"](event.object));\n }\n this.modifyWatchEvent(event);\n callback(event, null);\n }\n catch (ignore) {\n // ignore parse errors\n }\n });\n })\n .catch(error => {\n _main_logger__WEBPACK_IMPORTED_MODULE_4__[\"default\"].error(`[KUBE-API] watch (${watchId}) throwed ${watchUrl}`, error);\n callback(null, error);\n });\n return abort;\n }\n modifyWatchEvent(event) {\n switch (event.type) {\n case \"ADDED\":\n case \"DELETED\":\n case \"MODIFIED\": {\n ensureObjectSelfLink(this, event.object);\n const { namespace, resourceVersion } = event.object.metadata;\n this.setResourceVersion(namespace, resourceVersion);\n this.setResourceVersion(\"\", resourceVersion);\n break;\n }\n }\n }\n}\n\n\n//# sourceURL=webpack:///./src/common/k8s-api/kube-api.ts?");
|
|
37632
37632
|
|
|
37633
37633
|
/***/ }),
|
|
37634
37634
|
|
|
@@ -37652,7 +37652,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
37652
37652
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
37653
37653
|
|
|
37654
37654
|
"use strict";
|
|
37655
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"KubeObjectStore\", function() { return KubeObjectStore; });\n/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! mobx */ \"./node_modules/mobx/dist/mobx.esm.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils */ \"./src/common/utils/index.ts\");\n/* harmony import */ var _kube_object__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./kube-object */ \"./src/common/k8s-api/kube-object.ts\");\n/* harmony import */ var _item_store__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../item.store */ \"./src/common/item.store.ts\");\n/* harmony import */ var _api_manager__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./api-manager */ \"./src/common/k8s-api/api-manager.ts\");\n/* harmony import */ var _kube_api__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./kube-api */ \"./src/common/k8s-api/kube-api.ts\");\n/* harmony import */ var _kube_api_parse__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./kube-api-parse */ \"./src/common/k8s-api/kube-api-parse.ts\");\n/* harmony import */ var abort_controller__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! abort-controller */ \"./node_modules/abort-controller/browser.js\");\n/* harmony import */ var abort_controller__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(abort_controller__WEBPACK_IMPORTED_MODULE_7__);\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (undefined && undefined.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};\nvar __rest = (undefined && undefined.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\n\n\n\n\n\n\n\n\nclass KubeObjectStore extends _item_store__WEBPACK_IMPORTED_MODULE_3__[\"ItemStore\"] {\n constructor(api) {\n super();\n Object.defineProperty(this, \"api\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"limit\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"bufferSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 50000\n });\n Object.defineProperty(this, \"loadedNamespaces\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // collect items from watch-api events to avoid UI blowing up with huge streams of data\n Object.defineProperty(this, \"eventsBuffer\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: mobx__WEBPACK_IMPORTED_MODULE_0__[\"observable\"].array([], { deep: false })\n });\n if (api)\n this.api = api;\n Object(mobx__WEBPACK_IMPORTED_MODULE_0__[\"makeObservable\"])(this);\n Object(_utils__WEBPACK_IMPORTED_MODULE_1__[\"autoBind\"])(this);\n this.bindWatchEventsUpdater();\n }\n get contextReady() {\n return Object(mobx__WEBPACK_IMPORTED_MODULE_0__[\"when\"])(() => Boolean(this.context));\n }\n get namespacesReady() {\n return Object(mobx__WEBPACK_IMPORTED_MODULE_0__[\"when\"])(() => Boolean(this.loadedNamespaces));\n }\n get context() {\n return KubeObjectStore.defaultContext.get();\n }\n get contextItems() {\n var _a, _b;\n const namespaces = (_b = (_a = this.context) === null || _a === void 0 ? void 0 : _a.contextNamespaces) !== null && _b !== void 0 ? _b : [];\n return this.items.filter(item => {\n const itemNamespace = item.getNs();\n return !itemNamespace /* cluster-wide */ || namespaces.includes(itemNamespace);\n });\n }\n getTotalCount() {\n return this.contextItems.length;\n }\n get query() {\n const { limit } = this;\n if (!limit) {\n return {};\n }\n return { limit };\n }\n getAllByNs(namespace, strict = false) {\n const namespaces = [].concat(namespace);\n if (namespaces.length) {\n return this.items.filter(item => namespaces.includes(item.getNs()));\n }\n if (!strict) {\n return this.items;\n }\n return [];\n }\n getById(id) {\n return this.items.find(item => item.getId() === id);\n }\n getByName(name, namespace) {\n return this.items.find(item => {\n return item.getName() === name && (namespace ? item.getNs() === namespace : true);\n });\n }\n getByPath(path) {\n return this.items.find(item => item.selfLink === path);\n }\n getByLabel(labels) {\n if (Array.isArray(labels)) {\n return this.items.filter((item) => {\n const itemLabels = item.getLabels();\n return labels.every(label => itemLabels.includes(label));\n });\n }\n else {\n return this.items.filter((item) => {\n const itemLabels = item.metadata.labels || {};\n return Object.entries(labels)\n .every(([key, value]) => itemLabels[key] === value);\n });\n }\n }\n async loadItems({ namespaces, api, reqInit }) {\n var _a, _b;\n if ((_a = this.context) === null || _a === void 0 ? void 0 : _a.cluster.isAllowedResource(api.kind)) {\n if (!api.isNamespaced) {\n return api.list({ reqInit }, this.query);\n }\n const isLoadingAll = ((_b = this.context.allNamespaces) === null || _b === void 0 ? void 0 : _b.length) > 1\n && this.context.cluster.accessibleNamespaces.length === 0\n && this.context.allNamespaces.every(ns => namespaces.includes(ns));\n if (isLoadingAll) {\n this.loadedNamespaces = [];\n return api.list({ reqInit }, this.query);\n }\n else {\n this.loadedNamespaces = namespaces;\n return Promise // load resources per namespace\n .all(namespaces.map(namespace => api.list({ namespace, reqInit }, this.query)))\n .then(items => items.flat().filter(Boolean));\n }\n }\n return [];\n }\n filterItemsOnLoad(items) {\n return items;\n }\n async loadAll(options = {}) {\n await this.contextReady;\n this.isLoading = true;\n try {\n const { namespaces = this.context.allNamespaces, // load all namespaces by default\n merge = true, // merge loaded items or return as result\n reqInit, } = options;\n const items = await this.loadItems({ namespaces, api: this.api, reqInit });\n if (merge) {\n this.mergeItems(items, { replace: false });\n }\n else {\n this.mergeItems(items, { replace: true });\n }\n this.isLoaded = true;\n this.failedLoading = false;\n return items;\n }\n catch (error) {\n console.warn(\"[KubeObjectStore] loadAll failed\", this.api.apiBase, error);\n this.resetOnError(error);\n this.failedLoading = true;\n }\n finally {\n this.isLoading = false;\n }\n }\n async reloadAll(opts = {}) {\n const { force = false } = opts, loadingOptions = __rest(opts, [\"force\"]);\n if (this.isLoading || (this.isLoaded && !force)) {\n return;\n }\n return this.loadAll(loadingOptions);\n }\n mergeItems(partialItems, { replace = false, updateStore = true, sort = true, filter = true } = {}) {\n let items = partialItems;\n // update existing items\n if (!replace) {\n const namespaces = partialItems.map(item => item.getNs());\n items = [\n ...this.items.filter(existingItem => !namespaces.includes(existingItem.getNs())),\n ...partialItems,\n ];\n }\n if (filter)\n items = this.filterItemsOnLoad(items);\n if (sort)\n items = this.sortItems(items);\n if (updateStore)\n this.items.replace(items);\n return items;\n }\n resetOnError(error) {\n if (error)\n this.reset();\n }\n async loadItem(params) {\n return this.api.get(params);\n }\n async load(params) {\n const { name, namespace } = params;\n let item = this.getByName(name, namespace);\n if (!item) {\n item = await this.loadItem(params);\n const newItems = this.sortItems([...this.items, item]);\n this.items.replace(newItems);\n }\n return item;\n }\n async loadFromPath(resourcePath) {\n const { namespace, name } = Object(_kube_api_parse__WEBPACK_IMPORTED_MODULE_6__[\"parseKubeApi\"])(resourcePath);\n return this.load({ name, namespace });\n }\n async createItem(params, data) {\n return this.api.create(params, data);\n }\n async create(params, data) {\n const newItem = await this.createItem(params, data);\n const items = this.sortItems([...this.items, newItem]);\n this.items.replace(items);\n return newItem;\n }\n postUpdate(rawItem) {\n const newItem = new this.api.objectConstructor(rawItem);\n const index = this.items.findIndex(item => item.getId() === newItem.getId());\n Object(_kube_api__WEBPACK_IMPORTED_MODULE_5__[\"ensureObjectSelfLink\"])(this.api, newItem);\n if (index < 0) {\n this.items.push(newItem);\n }\n else {\n this.items[index] = newItem;\n }\n return newItem;\n }\n async patch(item, patch) {\n return this.postUpdate(await item.patch(patch));\n }\n async update(item, data) {\n return this.postUpdate(await item.update(data));\n }\n async remove(item) {\n await item.delete();\n this.items.remove(item);\n this.selectedItemsIds.delete(item.getId());\n }\n async removeSelectedItems() {\n return Promise.all(this.selectedItems.map(this.remove));\n }\n bindWatchEventsUpdater(delay = 1000) {\n Object(mobx__WEBPACK_IMPORTED_MODULE_0__[\"reaction\"])(() => this.eventsBuffer.length, this.updateFromEventsBuffer, {\n delay\n });\n }\n subscribe() {\n const abortController = new abort_controller__WEBPACK_IMPORTED_MODULE_7___default.a();\n if (this.api.isNamespaced) {\n Promise.race([Object(_utils__WEBPACK_IMPORTED_MODULE_1__[\"rejectPromiseBy\"])(abortController.signal), Promise.all([this.contextReady, this.namespacesReady])])\n .then(() => {\n if (this.context.cluster.isGlobalWatchEnabled && this.loadedNamespaces.length === 0) {\n return this.watchNamespace(\"\", abortController);\n }\n for (const namespace of this.loadedNamespaces) {\n this.watchNamespace(namespace, abortController);\n }\n })\n .catch(_utils__WEBPACK_IMPORTED_MODULE_1__[\"noop\"]); // ignore DOMExceptions\n }\n else {\n this.watchNamespace(\"\", abortController);\n }\n return () => abortController.abort();\n }\n watchNamespace(namespace, abortController) {\n if (!this.api.getResourceVersion(namespace)) {\n return;\n }\n let timedRetry;\n const watch = () => this.api.watch({\n namespace,\n abortController,\n callback\n });\n const { signal } = abortController;\n const callback = (data, error) => {\n if (!this.isLoaded || (error === null || error === void 0 ? void 0 : error.type) === \"aborted\")\n return;\n if (error instanceof Response) {\n if (error.status === 404 || error.status === 401) {\n // api has gone, or credentials are not permitted, let's not retry\n return;\n }\n // not sure what to do, best to retry\n clearTimeout(timedRetry);\n timedRetry = setTimeout(watch, 5000);\n }\n else if (error instanceof _kube_object__WEBPACK_IMPORTED_MODULE_2__[\"KubeStatus\"] && error.code === 410) {\n clearTimeout(timedRetry);\n // resourceVersion has gone, let's try to reload\n timedRetry = setTimeout(() => {\n (namespace\n ? this.loadAll({ namespaces: [namespace], reqInit: { signal } })\n : this.loadAll({ merge: false, reqInit: { signal } })).then(watch);\n }, 1000);\n }\n else if (error) { // not sure what to do, best to retry\n clearTimeout(timedRetry);\n timedRetry = setTimeout(watch, 5000);\n }\n if (data) {\n this.eventsBuffer.push(data);\n }\n };\n signal.addEventListener(\"abort\", () => clearTimeout(timedRetry));\n watch();\n }\n updateFromEventsBuffer() {\n const items = this.getItems();\n for (const { type, object } of this.eventsBuffer.clear()) {\n const index = items.findIndex(item => { var _a; return item.getId() === ((_a = object.metadata) === null || _a === void 0 ? void 0 : _a.uid); });\n const item = items[index];\n const api = _api_manager__WEBPACK_IMPORTED_MODULE_4__[\"apiManager\"].getApiByKind(object.kind, object.apiVersion);\n switch (type) {\n case \"ADDED\":\n case \"MODIFIED\":\n const newItem = new api.objectConstructor(object);\n if (!item) {\n items.push(newItem);\n }\n else {\n items[index] = newItem;\n }\n break;\n case \"DELETED\":\n if (item) {\n items.splice(index, 1);\n }\n break;\n }\n }\n // update items\n this.items.replace(this.sortItems(items.slice(-this.bufferSize)));\n }\n}\nObject.defineProperty(KubeObjectStore, \"defaultContext\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: mobx__WEBPACK_IMPORTED_MODULE_0__[\"observable\"].box()\n}); // TODO: support multiple cluster contexts\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"observable\"],\n __metadata(\"design:type\", Array)\n], KubeObjectStore.prototype, \"loadedNamespaces\", void 0);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"computed\"],\n __metadata(\"design:type\", Array),\n __metadata(\"design:paramtypes\", [])\n], KubeObjectStore.prototype, \"contextItems\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Object]),\n __metadata(\"design:returntype\", Promise)\n], KubeObjectStore.prototype, \"loadAll\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Object]),\n __metadata(\"design:returntype\", Promise)\n], KubeObjectStore.prototype, \"reloadAll\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Array, Object]),\n __metadata(\"design:returntype\", Array)\n], KubeObjectStore.prototype, \"mergeItems\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Object]),\n __metadata(\"design:returntype\", Promise)\n], KubeObjectStore.prototype, \"load\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [String]),\n __metadata(\"design:returntype\", Promise)\n], KubeObjectStore.prototype, \"loadFromPath\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", []),\n __metadata(\"design:returntype\", void 0)\n], KubeObjectStore.prototype, \"updateFromEventsBuffer\", null);\n\n\n//# sourceURL=webpack:///./src/common/k8s-api/kube-object.store.ts?");
|
|
37655
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"KubeObjectStore\", function() { return KubeObjectStore; });\n/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! mobx */ \"./node_modules/mobx/dist/mobx.esm.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils */ \"./src/common/utils/index.ts\");\n/* harmony import */ var _kube_object__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./kube-object */ \"./src/common/k8s-api/kube-object.ts\");\n/* harmony import */ var _item_store__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../item.store */ \"./src/common/item.store.ts\");\n/* harmony import */ var _kube_api__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./kube-api */ \"./src/common/k8s-api/kube-api.ts\");\n/* harmony import */ var _kube_api_parse__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./kube-api-parse */ \"./src/common/k8s-api/kube-api-parse.ts\");\n/* harmony import */ var abort_controller__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! abort-controller */ \"./node_modules/abort-controller/browser.js\");\n/* harmony import */ var abort_controller__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(abort_controller__WEBPACK_IMPORTED_MODULE_6__);\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (undefined && undefined.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};\nvar __rest = (undefined && undefined.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\n\n\n\n\n\n\n\nclass KubeObjectStore extends _item_store__WEBPACK_IMPORTED_MODULE_3__[\"ItemStore\"] {\n constructor(api) {\n super();\n Object.defineProperty(this, \"api\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"limit\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"bufferSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 50000\n });\n Object.defineProperty(this, \"loadedNamespaces\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // collect items from watch-api events to avoid UI blowing up with huge streams of data\n Object.defineProperty(this, \"eventsBuffer\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: mobx__WEBPACK_IMPORTED_MODULE_0__[\"observable\"].array([], { deep: false })\n });\n if (api)\n this.api = api;\n Object(mobx__WEBPACK_IMPORTED_MODULE_0__[\"makeObservable\"])(this);\n Object(_utils__WEBPACK_IMPORTED_MODULE_1__[\"autoBind\"])(this);\n this.bindWatchEventsUpdater();\n }\n get contextReady() {\n return Object(mobx__WEBPACK_IMPORTED_MODULE_0__[\"when\"])(() => Boolean(this.context));\n }\n get namespacesReady() {\n return Object(mobx__WEBPACK_IMPORTED_MODULE_0__[\"when\"])(() => Boolean(this.loadedNamespaces));\n }\n get context() {\n return KubeObjectStore.defaultContext.get();\n }\n get contextItems() {\n var _a, _b;\n const namespaces = (_b = (_a = this.context) === null || _a === void 0 ? void 0 : _a.contextNamespaces) !== null && _b !== void 0 ? _b : [];\n return this.items.filter(item => {\n const itemNamespace = item.getNs();\n return !itemNamespace /* cluster-wide */ || namespaces.includes(itemNamespace);\n });\n }\n getTotalCount() {\n return this.contextItems.length;\n }\n get query() {\n const { limit } = this;\n if (!limit) {\n return {};\n }\n return { limit };\n }\n getAllByNs(namespace, strict = false) {\n const namespaces = [].concat(namespace);\n if (namespaces.length) {\n return this.items.filter(item => namespaces.includes(item.getNs()));\n }\n if (!strict) {\n return this.items;\n }\n return [];\n }\n getById(id) {\n return this.items.find(item => item.getId() === id);\n }\n getByName(name, namespace) {\n return this.items.find(item => {\n return item.getName() === name && (namespace ? item.getNs() === namespace : true);\n });\n }\n getByPath(path) {\n return this.items.find(item => item.selfLink === path);\n }\n getByLabel(labels) {\n if (Array.isArray(labels)) {\n return this.items.filter((item) => {\n const itemLabels = item.getLabels();\n return labels.every(label => itemLabels.includes(label));\n });\n }\n else {\n return this.items.filter((item) => {\n const itemLabels = item.metadata.labels || {};\n return Object.entries(labels)\n .every(([key, value]) => itemLabels[key] === value);\n });\n }\n }\n async loadItems({ namespaces, api, reqInit }) {\n var _a, _b;\n if ((_a = this.context) === null || _a === void 0 ? void 0 : _a.cluster.isAllowedResource(api.kind)) {\n if (!api.isNamespaced) {\n return api.list({ reqInit }, this.query);\n }\n const isLoadingAll = ((_b = this.context.allNamespaces) === null || _b === void 0 ? void 0 : _b.length) > 1\n && this.context.cluster.accessibleNamespaces.length === 0\n && this.context.allNamespaces.every(ns => namespaces.includes(ns));\n if (isLoadingAll) {\n this.loadedNamespaces = [];\n return api.list({ reqInit }, this.query);\n }\n else {\n this.loadedNamespaces = namespaces;\n return Promise // load resources per namespace\n .all(namespaces.map(namespace => api.list({ namespace, reqInit }, this.query)))\n .then(items => items.flat().filter(Boolean));\n }\n }\n return [];\n }\n filterItemsOnLoad(items) {\n return items;\n }\n async loadAll(options = {}) {\n await this.contextReady;\n this.isLoading = true;\n try {\n const { namespaces = this.context.allNamespaces, // load all namespaces by default\n merge = true, // merge loaded items or return as result\n reqInit, } = options;\n const items = await this.loadItems({ namespaces, api: this.api, reqInit });\n if (merge) {\n this.mergeItems(items, { replace: false });\n }\n else {\n this.mergeItems(items, { replace: true });\n }\n this.isLoaded = true;\n this.failedLoading = false;\n return items;\n }\n catch (error) {\n console.warn(\"[KubeObjectStore] loadAll failed\", this.api.apiBase, error);\n this.resetOnError(error);\n this.failedLoading = true;\n }\n finally {\n this.isLoading = false;\n }\n }\n async reloadAll(opts = {}) {\n const { force = false } = opts, loadingOptions = __rest(opts, [\"force\"]);\n if (this.isLoading || (this.isLoaded && !force)) {\n return;\n }\n return this.loadAll(loadingOptions);\n }\n mergeItems(partialItems, { replace = false, updateStore = true, sort = true, filter = true } = {}) {\n let items = partialItems;\n // update existing items\n if (!replace) {\n const namespaces = partialItems.map(item => item.getNs());\n items = [\n ...this.items.filter(existingItem => !namespaces.includes(existingItem.getNs())),\n ...partialItems,\n ];\n }\n if (filter)\n items = this.filterItemsOnLoad(items);\n if (sort)\n items = this.sortItems(items);\n if (updateStore)\n this.items.replace(items);\n return items;\n }\n resetOnError(error) {\n if (error)\n this.reset();\n }\n async loadItem(params) {\n return this.api.get(params);\n }\n async load(params) {\n const { name, namespace } = params;\n let item = this.getByName(name, namespace);\n if (!item) {\n item = await this.loadItem(params);\n const newItems = this.sortItems([...this.items, item]);\n this.items.replace(newItems);\n }\n return item;\n }\n async loadFromPath(resourcePath) {\n const { namespace, name } = Object(_kube_api_parse__WEBPACK_IMPORTED_MODULE_5__[\"parseKubeApi\"])(resourcePath);\n return this.load({ name, namespace });\n }\n async createItem(params, data) {\n return this.api.create(params, data);\n }\n async create(params, data) {\n const newItem = await this.createItem(params, data);\n const items = this.sortItems([...this.items, newItem]);\n this.items.replace(items);\n return newItem;\n }\n postUpdate(rawItem) {\n const newItem = new this.api.objectConstructor(rawItem);\n const index = this.items.findIndex(item => item.getId() === newItem.getId());\n Object(_kube_api__WEBPACK_IMPORTED_MODULE_4__[\"ensureObjectSelfLink\"])(this.api, newItem);\n if (index < 0) {\n this.items.push(newItem);\n }\n else {\n this.items[index] = newItem;\n }\n return newItem;\n }\n async patch(item, patch) {\n return this.postUpdate(await item.patch(patch));\n }\n async update(item, data) {\n return this.postUpdate(await item.update(data));\n }\n async remove(item) {\n await item.delete();\n this.items.remove(item);\n this.selectedItemsIds.delete(item.getId());\n }\n async removeSelectedItems() {\n return Promise.all(this.selectedItems.map(this.remove));\n }\n bindWatchEventsUpdater(delay = 1000) {\n Object(mobx__WEBPACK_IMPORTED_MODULE_0__[\"reaction\"])(() => this.eventsBuffer.length, this.updateFromEventsBuffer, {\n delay\n });\n }\n subscribe() {\n const abortController = new abort_controller__WEBPACK_IMPORTED_MODULE_6___default.a();\n if (this.api.isNamespaced) {\n Promise.race([Object(_utils__WEBPACK_IMPORTED_MODULE_1__[\"rejectPromiseBy\"])(abortController.signal), Promise.all([this.contextReady, this.namespacesReady])])\n .then(() => {\n if (this.context.cluster.isGlobalWatchEnabled && this.loadedNamespaces.length === 0) {\n return this.watchNamespace(\"\", abortController);\n }\n for (const namespace of this.loadedNamespaces) {\n this.watchNamespace(namespace, abortController);\n }\n })\n .catch(_utils__WEBPACK_IMPORTED_MODULE_1__[\"noop\"]); // ignore DOMExceptions\n }\n else {\n this.watchNamespace(\"\", abortController);\n }\n return () => abortController.abort();\n }\n watchNamespace(namespace, abortController) {\n if (!this.api.getResourceVersion(namespace)) {\n return;\n }\n let timedRetry;\n const watch = () => this.api.watch({\n namespace,\n abortController,\n callback\n });\n const { signal } = abortController;\n const callback = (data, error) => {\n if (!this.isLoaded || (error === null || error === void 0 ? void 0 : error.type) === \"aborted\")\n return;\n if (error instanceof Response) {\n if (error.status === 404 || error.status === 401) {\n // api has gone, or credentials are not permitted, let's not retry\n return;\n }\n // not sure what to do, best to retry\n clearTimeout(timedRetry);\n timedRetry = setTimeout(watch, 5000);\n }\n else if (error instanceof _kube_object__WEBPACK_IMPORTED_MODULE_2__[\"KubeStatus\"] && error.code === 410) {\n clearTimeout(timedRetry);\n // resourceVersion has gone, let's try to reload\n timedRetry = setTimeout(() => {\n (namespace\n ? this.loadAll({ namespaces: [namespace], reqInit: { signal } })\n : this.loadAll({ merge: false, reqInit: { signal } })).then(watch);\n }, 1000);\n }\n else if (error) { // not sure what to do, best to retry\n clearTimeout(timedRetry);\n timedRetry = setTimeout(watch, 5000);\n }\n if (data) {\n this.eventsBuffer.push(data);\n }\n };\n signal.addEventListener(\"abort\", () => clearTimeout(timedRetry));\n watch();\n }\n updateFromEventsBuffer() {\n const items = this.getItems();\n for (const { type, object } of this.eventsBuffer.clear()) {\n const index = items.findIndex(item => { var _a; return item.getId() === ((_a = object.metadata) === null || _a === void 0 ? void 0 : _a.uid); });\n const item = items[index];\n switch (type) {\n case \"ADDED\":\n case \"MODIFIED\":\n const newItem = new this.api.objectConstructor(object);\n if (!item) {\n items.push(newItem);\n }\n else {\n items[index] = newItem;\n }\n break;\n case \"DELETED\":\n if (item) {\n items.splice(index, 1);\n }\n break;\n }\n }\n // update items\n this.items.replace(this.sortItems(items.slice(-this.bufferSize)));\n }\n}\nObject.defineProperty(KubeObjectStore, \"defaultContext\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: mobx__WEBPACK_IMPORTED_MODULE_0__[\"observable\"].box()\n}); // TODO: support multiple cluster contexts\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"observable\"],\n __metadata(\"design:type\", Array)\n], KubeObjectStore.prototype, \"loadedNamespaces\", void 0);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"computed\"],\n __metadata(\"design:type\", Array),\n __metadata(\"design:paramtypes\", [])\n], KubeObjectStore.prototype, \"contextItems\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Object]),\n __metadata(\"design:returntype\", Promise)\n], KubeObjectStore.prototype, \"loadAll\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Object]),\n __metadata(\"design:returntype\", Promise)\n], KubeObjectStore.prototype, \"reloadAll\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Array, Object]),\n __metadata(\"design:returntype\", Array)\n], KubeObjectStore.prototype, \"mergeItems\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Object]),\n __metadata(\"design:returntype\", Promise)\n], KubeObjectStore.prototype, \"load\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [String]),\n __metadata(\"design:returntype\", Promise)\n], KubeObjectStore.prototype, \"loadFromPath\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", []),\n __metadata(\"design:returntype\", void 0)\n], KubeObjectStore.prototype, \"updateFromEventsBuffer\", null);\n\n\n//# sourceURL=webpack:///./src/common/k8s-api/kube-object.store.ts?");
|
|
37656
37656
|
|
|
37657
37657
|
/***/ }),
|
|
37658
37658
|
|
|
@@ -38024,7 +38024,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
38024
38024
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
38025
38025
|
|
|
38026
38026
|
"use strict";
|
|
38027
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"portForwardsRoute\", function() { return portForwardsRoute; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"portForwardsURL\", function() { return portForwardsURL; });\n/* harmony import */ var _utils_buildUrl__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/buildUrl */ \"./src/common/utils/buildUrl.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\nconst portForwardsRoute = {\n path: \"/port-forwards
|
|
38027
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"portForwardsRoute\", function() { return portForwardsRoute; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"portForwardsURL\", function() { return portForwardsURL; });\n/* harmony import */ var _utils_buildUrl__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/buildUrl */ \"./src/common/utils/buildUrl.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\nconst portForwardsRoute = {\n path: \"/port-forwards/:forwardport?\"\n};\nconst portForwardsURL = Object(_utils_buildUrl__WEBPACK_IMPORTED_MODULE_0__[\"buildURL\"])(portForwardsRoute.path);\n\n\n//# sourceURL=webpack:///./src/common/routes/port-forwards.ts?");
|
|
38028
38028
|
|
|
38029
38029
|
/***/ }),
|
|
38030
38030
|
|
|
@@ -39404,7 +39404,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
39404
39404
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
39405
39405
|
|
|
39406
39406
|
"use strict";
|
|
39407
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isLongRunningRequest\", function() { return isLongRunningRequest; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"LensProxy\", function() { return LensProxy; });\n/* harmony import */ var spdy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! spdy */ \"./node_modules/spdy/lib/spdy.js\");\n/* harmony import */ var spdy__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(spdy__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var http_proxy__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! http-proxy */ \"./node_modules/http-proxy/index.js\");\n/* harmony import */ var http_proxy__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(http_proxy__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _common_vars__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/vars */ \"./src/common/vars.ts\");\n/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./logger */ \"./src/main/logger.ts\");\n/* harmony import */ var _common_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/utils */ \"./src/common/utils/index.ts\");\n/* harmony import */ var _common_event_bus__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common/event-bus */ \"./src/common/event-bus.ts\");\n/* harmony import */ var _utils_parse_query__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./utils/parse-query */ \"./src/main/utils/parse-query.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n\n\n\n\n\n\nconst watchParam = \"watch\";\nconst followParam = \"follow\";\nfunction isLongRunningRequest(reqUrl) {\n const url = new URL(reqUrl, \"http://localhost\");\n return Object(_utils_parse_query__WEBPACK_IMPORTED_MODULE_6__[\"getBoolean\"])(url.searchParams, watchParam) || Object(_utils_parse_query__WEBPACK_IMPORTED_MODULE_6__[\"getBoolean\"])(url.searchParams, followParam);\n}\nclass LensProxy extends _common_utils__WEBPACK_IMPORTED_MODULE_4__[\"Singleton\"] {\n constructor(router, functions) {\n super();\n Object.defineProperty(this, \"router\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: router\n });\n Object.defineProperty(this, \"origin\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"proxyServer\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"closed\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: false\n });\n Object.defineProperty(this, \"retryCounters\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: new Map()\n });\n Object.defineProperty(this, \"proxy\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: this.createProxy()\n });\n Object.defineProperty(this, \"getClusterForRequest\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"port\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n const { shellApiRequest, kubeApiRequest } = functions;\n this.getClusterForRequest = functions.getClusterForRequest;\n this.proxyServer = spdy__WEBPACK_IMPORTED_MODULE_0___default.a.createServer({\n spdy: {\n plain: true,\n protocols: [\"http/1.1\", \"spdy/3.1\"]\n }\n }, (req, res) => {\n this.handleRequest(req, res);\n });\n this.proxyServer\n .on(\"upgrade\", (req, socket, head) => {\n const isInternal = req.url.startsWith(`${_common_vars__WEBPACK_IMPORTED_MODULE_2__[\"apiPrefix\"]}?`);\n const reqHandler = isInternal ? shellApiRequest : kubeApiRequest;\n (async () => reqHandler({ req, socket, head }))()\n .catch(error => _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(_logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(`[LENS-PROXY]: failed to handle proxy upgrade: ${error}`)));\n });\n }\n /**\n * Starts the lens proxy.\n * @resolves After the server is listening\n * @rejects if there is an error before that happens\n */\n listen() {\n return new Promise((resolve, reject) => {\n this.proxyServer.listen(0, \"127.0.0.1\");\n this.proxyServer\n .once(\"listening\", () => {\n this.proxyServer.removeAllListeners(\"error\"); // don't reject the promise\n const { address, port } = this.proxyServer.address();\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].info(`[LENS-PROXY]: Proxy server has started at ${address}:${port}`);\n this.proxyServer.on(\"error\", (error) => {\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].info(`[LENS-PROXY]: Subsequent error: ${error}`);\n });\n this.port = port;\n _common_event_bus__WEBPACK_IMPORTED_MODULE_5__[\"appEventBus\"].emit({ name: \"lens-proxy\", action: \"listen\", params: { port } });\n resolve();\n })\n .once(\"error\", (error) => {\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].info(`[LENS-PROXY]: Proxy server failed to start: ${error}`);\n reject(error);\n });\n });\n }\n close() {\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].info(\"Closing proxy server\");\n this.proxyServer.close();\n this.closed = true;\n }\n createProxy() {\n const proxy = http_proxy__WEBPACK_IMPORTED_MODULE_1___default.a.createProxyServer();\n proxy.on(\"proxyRes\", (proxyRes, req, res) => {\n const retryCounterId = this.getRequestId(req);\n if (this.retryCounters.has(retryCounterId)) {\n this.retryCounters.delete(retryCounterId);\n }\n if (!res.headersSent && req.url) {\n const url = new URL(req.url, \"http://localhost\");\n if (url.searchParams.has(\"watch\")) {\n res.statusCode = proxyRes.statusCode;\n res.flushHeaders();\n }\n }\n });\n proxy.on(\"error\", (error, req, res, target) => {\n if (this.closed) {\n return;\n }\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(`[LENS-PROXY]: http proxy errored for cluster: ${error}`, { url: req.url });\n if (target) {\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].debug(`Failed proxy to target: ${JSON.stringify(target, null, 2)}`);\n if (req.method === \"GET\" && (!res.statusCode || res.statusCode >= 500)) {\n const reqId = this.getRequestId(req);\n const retryCount = this.retryCounters.get(reqId) || 0;\n const timeoutMs = retryCount * 250;\n if (retryCount < 20) {\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].debug(`Retrying proxy request to url: ${reqId}`);\n setTimeout(() => {\n this.retryCounters.set(reqId, retryCount + 1);\n this.handleRequest(req, res)\n .catch(error => _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(`[LENS-PROXY]: failed to handle request on proxy error: ${error}`));\n }, timeoutMs);\n }\n }\n }\n try {\n res.writeHead(500).end(`Oops, something went wrong.\\n${error}`);\n }\n catch (e) {\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(`[LENS-PROXY]: Failed to write headers: `, e);\n }\n });\n return proxy;\n }\n async getProxyTarget(req, contextHandler) {\n if (req.url.startsWith(_common_vars__WEBPACK_IMPORTED_MODULE_2__[\"apiKubePrefix\"])) {\n delete req.headers.authorization;\n req.url = req.url.replace(_common_vars__WEBPACK_IMPORTED_MODULE_2__[\"apiKubePrefix\"], \"\");\n return contextHandler.getApiTarget(isLongRunningRequest(req.url));\n }\n }\n getRequestId(req) {\n return req.headers.host + req.url;\n }\n async handleRequest(req, res) {\n const cluster = this.getClusterForRequest(req);\n if (cluster) {\n const proxyTarget = await this.getProxyTarget(req, cluster.contextHandler);\n if (proxyTarget) {\n // allow to fetch apis in \"clusterId.localhost:port\" from \"localhost:port\"\n // this should be safe because we have already validated cluster uuid\n res.setHeader(\"Access-Control-Allow-Origin\", \"*\");\n return this.proxy.web(req, res, proxyTarget);\n }\n }\n this.router.route(cluster, req, res);\n }\n}\n\n\n//# sourceURL=webpack:///./src/main/lens-proxy.ts?");
|
|
39407
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isLongRunningRequest\", function() { return isLongRunningRequest; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"LensProxy\", function() { return LensProxy; });\n/* harmony import */ var spdy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! spdy */ \"./node_modules/spdy/lib/spdy.js\");\n/* harmony import */ var spdy__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(spdy__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var http_proxy__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! http-proxy */ \"./node_modules/http-proxy/index.js\");\n/* harmony import */ var http_proxy__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(http_proxy__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _common_vars__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/vars */ \"./src/common/vars.ts\");\n/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./logger */ \"./src/main/logger.ts\");\n/* harmony import */ var _common_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/utils */ \"./src/common/utils/index.ts\");\n/* harmony import */ var _common_event_bus__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common/event-bus */ \"./src/common/event-bus.ts\");\n/* harmony import */ var _utils_parse_query__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./utils/parse-query */ \"./src/main/utils/parse-query.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n\n\n\n\n\n\nconst watchParam = \"watch\";\nconst followParam = \"follow\";\nfunction isLongRunningRequest(reqUrl) {\n const url = new URL(reqUrl, \"http://localhost\");\n return Object(_utils_parse_query__WEBPACK_IMPORTED_MODULE_6__[\"getBoolean\"])(url.searchParams, watchParam) || Object(_utils_parse_query__WEBPACK_IMPORTED_MODULE_6__[\"getBoolean\"])(url.searchParams, followParam);\n}\nclass LensProxy extends _common_utils__WEBPACK_IMPORTED_MODULE_4__[\"Singleton\"] {\n constructor(router, functions) {\n super();\n Object.defineProperty(this, \"router\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: router\n });\n Object.defineProperty(this, \"origin\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"proxyServer\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"closed\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: false\n });\n Object.defineProperty(this, \"retryCounters\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: new Map()\n });\n Object.defineProperty(this, \"proxy\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: this.createProxy()\n });\n Object.defineProperty(this, \"getClusterForRequest\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"port\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n const { shellApiRequest, kubeApiRequest } = functions;\n this.getClusterForRequest = functions.getClusterForRequest;\n this.proxyServer = spdy__WEBPACK_IMPORTED_MODULE_0___default.a.createServer({\n spdy: {\n plain: true,\n protocols: [\"http/1.1\", \"spdy/3.1\"]\n }\n }, (req, res) => {\n this.handleRequest(req, res);\n });\n this.proxyServer\n .on(\"upgrade\", (req, socket, head) => {\n const isInternal = req.url.startsWith(`${_common_vars__WEBPACK_IMPORTED_MODULE_2__[\"apiPrefix\"]}?`);\n const reqHandler = isInternal ? shellApiRequest : kubeApiRequest;\n (async () => reqHandler({ req, socket, head }))()\n .catch(error => _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(_logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(`[LENS-PROXY]: failed to handle proxy upgrade: ${error}`)));\n });\n }\n /**\n * Starts the lens proxy.\n * @resolves After the server is listening\n * @rejects if there is an error before that happens\n */\n listen() {\n return new Promise((resolve, reject) => {\n this.proxyServer.listen(0, \"127.0.0.1\");\n this.proxyServer\n .once(\"listening\", () => {\n this.proxyServer.removeAllListeners(\"error\"); // don't reject the promise\n const { address, port } = this.proxyServer.address();\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].info(`[LENS-PROXY]: Proxy server has started at ${address}:${port}`);\n this.proxyServer.on(\"error\", (error) => {\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].info(`[LENS-PROXY]: Subsequent error: ${error}`);\n });\n this.port = port;\n _common_event_bus__WEBPACK_IMPORTED_MODULE_5__[\"appEventBus\"].emit({ name: \"lens-proxy\", action: \"listen\", params: { port } });\n resolve();\n })\n .once(\"error\", (error) => {\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].info(`[LENS-PROXY]: Proxy server failed to start: ${error}`);\n reject(error);\n });\n });\n }\n close() {\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].info(\"Closing proxy server\");\n this.proxyServer.close();\n this.closed = true;\n }\n createProxy() {\n const proxy = http_proxy__WEBPACK_IMPORTED_MODULE_1___default.a.createProxyServer();\n proxy.on(\"proxyRes\", (proxyRes, req, res) => {\n const retryCounterId = this.getRequestId(req);\n if (this.retryCounters.has(retryCounterId)) {\n this.retryCounters.delete(retryCounterId);\n }\n if (!res.headersSent && req.url) {\n const url = new URL(req.url, \"http://localhost\");\n if (url.searchParams.has(\"watch\")) {\n res.statusCode = proxyRes.statusCode;\n res.flushHeaders();\n }\n }\n });\n proxy.on(\"error\", (error, req, res, target) => {\n if (this.closed) {\n return;\n }\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(`[LENS-PROXY]: http proxy errored for cluster: ${error}`, { url: req.url });\n if (target) {\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].debug(`Failed proxy to target: ${JSON.stringify(target, null, 2)}`);\n if (req.method === \"GET\" && (!res.statusCode || res.statusCode >= 500)) {\n const reqId = this.getRequestId(req);\n const retryCount = this.retryCounters.get(reqId) || 0;\n const timeoutMs = retryCount * 250;\n if (retryCount < 20) {\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].debug(`Retrying proxy request to url: ${reqId}`);\n setTimeout(() => {\n this.retryCounters.set(reqId, retryCount + 1);\n this.handleRequest(req, res)\n .catch(error => _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(`[LENS-PROXY]: failed to handle request on proxy error: ${error}`));\n }, timeoutMs);\n }\n }\n }\n try {\n res.writeHead(500).end(`Oops, something went wrong.\\n${error}`);\n }\n catch (e) {\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(`[LENS-PROXY]: Failed to write headers: `, e);\n }\n });\n return proxy;\n }\n async getProxyTarget(req, contextHandler) {\n if (req.url.startsWith(_common_vars__WEBPACK_IMPORTED_MODULE_2__[\"apiKubePrefix\"])) {\n delete req.headers.authorization;\n req.url = req.url.replace(_common_vars__WEBPACK_IMPORTED_MODULE_2__[\"apiKubePrefix\"], \"\");\n return contextHandler.getApiTarget(isLongRunningRequest(req.url));\n }\n }\n getRequestId(req) {\n return req.headers.host + req.url;\n }\n async handleRequest(req, res) {\n const cluster = this.getClusterForRequest(req);\n if (cluster) {\n const proxyTarget = await this.getProxyTarget(req, cluster.contextHandler);\n if (proxyTarget) {\n return this.proxy.web(req, res, proxyTarget);\n }\n }\n this.router.route(cluster, req, res);\n }\n}\n\n\n//# sourceURL=webpack:///./src/main/lens-proxy.ts?");
|
|
39408
39408
|
|
|
39409
39409
|
/***/ }),
|
|
39410
39410
|
|
|
@@ -39908,7 +39908,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _nod
|
|
|
39908
39908
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
39909
39909
|
|
|
39910
39910
|
"use strict";
|
|
39911
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CrdResources\", function() { return CrdResources; });\n/* harmony import */ var _crd_resources_scss__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./crd-resources.scss */ \"./src/renderer/components/+custom-resources/crd-resources.scss\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var jsonpath__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! jsonpath */ \"./node_modules/jsonpath/jsonpath.js\");\n/* harmony import */ var jsonpath__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(jsonpath__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var mobx_react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! mobx-react */ \"./node_modules/mobx-react/dist/mobxreact.esm.js\");\n/* harmony import */ var _kube_object_list_layout__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../kube-object-list-layout */ \"./src/renderer/components/kube-object-list-layout/index.ts\");\n/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! mobx */ \"./node_modules/mobx/dist/mobx.esm.js\");\n/* harmony import */ var _crd_store__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./crd.store */ \"./src/renderer/components/+custom-resources/crd.store.ts\");\n/* harmony import */ var _common_k8s_api_api_manager__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../common/k8s-api/api-manager */ \"./src/common/k8s-api/api-manager.ts\");\n/* harmony import */ var _utils_jsonPath__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../utils/jsonPath */ \"./src/renderer/utils/jsonPath.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (undefined && undefined.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};\nvar __rest = (undefined && undefined.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\n\n\n\n\n\n\n\n\n\nvar columnId;\n(function (columnId) {\n columnId[\"name\"] = \"name\";\n columnId[\"namespace\"] = \"namespace\";\n columnId[\"age\"] = \"age\";\n})(columnId || (columnId = {}));\nlet CrdResources = class CrdResources extends react__WEBPACK_IMPORTED_MODULE_1___default.a.Component {\n constructor(props) {\n super(props);\n Object(mobx__WEBPACK_IMPORTED_MODULE_5__[\"makeObservable\"])(this);\n }\n get crd() {\n const { group, name } = this.props.match.params;\n return _crd_store__WEBPACK_IMPORTED_MODULE_6__[\"crdStore\"].getByGroup(group, name);\n }\n get store() {\n if (!this.crd)\n return null;\n return _common_k8s_api_api_manager__WEBPACK_IMPORTED_MODULE_7__[\"apiManager\"].getStore(this.crd.getResourceApiBase());\n }\n render() {\n const { crd, store } = this;\n if (!crd)\n return null;\n const isNamespaced = crd.isNamespaced();\n const extraColumns = crd.getPrinterColumns(false); // Cols with priority bigger than 0 are shown in details\n const sortingCallbacks = {\n [columnId.name]: item => item.getName(),\n [columnId.namespace]: item => item.getNs(),\n [columnId.age]: item => item.getTimeDiffFromNow(),\n };\n extraColumns.forEach(column => {\n sortingCallbacks[column.name] = item => jsonpath__WEBPACK_IMPORTED_MODULE_2___default.a.value(item, Object(_utils_jsonPath__WEBPACK_IMPORTED_MODULE_8__[\"parseJsonPath\"])(column.jsonPath.slice(1)));\n });\n return (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_kube_object_list_layout__WEBPACK_IMPORTED_MODULE_4__[\"KubeObjectListLayout\"], { isConfigurable: true, key: `crd_resources_${crd.getResourceApiBase()}`, tableId: \"crd_resources\", className: \"CrdResources\", store: store, sortingCallbacks: sortingCallbacks, searchFilters: [\n item => item.getSearchFields(),\n ], renderHeaderTitle: crd.
|
|
39911
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CrdResources\", function() { return CrdResources; });\n/* harmony import */ var _crd_resources_scss__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./crd-resources.scss */ \"./src/renderer/components/+custom-resources/crd-resources.scss\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var jsonpath__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! jsonpath */ \"./node_modules/jsonpath/jsonpath.js\");\n/* harmony import */ var jsonpath__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(jsonpath__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var mobx_react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! mobx-react */ \"./node_modules/mobx-react/dist/mobxreact.esm.js\");\n/* harmony import */ var _kube_object_list_layout__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../kube-object-list-layout */ \"./src/renderer/components/kube-object-list-layout/index.ts\");\n/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! mobx */ \"./node_modules/mobx/dist/mobx.esm.js\");\n/* harmony import */ var _crd_store__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./crd.store */ \"./src/renderer/components/+custom-resources/crd.store.ts\");\n/* harmony import */ var _common_k8s_api_api_manager__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../common/k8s-api/api-manager */ \"./src/common/k8s-api/api-manager.ts\");\n/* harmony import */ var _utils_jsonPath__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../utils/jsonPath */ \"./src/renderer/utils/jsonPath.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (undefined && undefined.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};\nvar __rest = (undefined && undefined.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\n\n\n\n\n\n\n\n\n\nvar columnId;\n(function (columnId) {\n columnId[\"name\"] = \"name\";\n columnId[\"namespace\"] = \"namespace\";\n columnId[\"age\"] = \"age\";\n})(columnId || (columnId = {}));\nlet CrdResources = class CrdResources extends react__WEBPACK_IMPORTED_MODULE_1___default.a.Component {\n constructor(props) {\n super(props);\n Object(mobx__WEBPACK_IMPORTED_MODULE_5__[\"makeObservable\"])(this);\n }\n get crd() {\n const { group, name } = this.props.match.params;\n return _crd_store__WEBPACK_IMPORTED_MODULE_6__[\"crdStore\"].getByGroup(group, name);\n }\n get store() {\n if (!this.crd)\n return null;\n return _common_k8s_api_api_manager__WEBPACK_IMPORTED_MODULE_7__[\"apiManager\"].getStore(this.crd.getResourceApiBase());\n }\n render() {\n const { crd, store } = this;\n if (!crd)\n return null;\n const isNamespaced = crd.isNamespaced();\n const extraColumns = crd.getPrinterColumns(false); // Cols with priority bigger than 0 are shown in details\n const sortingCallbacks = {\n [columnId.name]: item => item.getName(),\n [columnId.namespace]: item => item.getNs(),\n [columnId.age]: item => item.getTimeDiffFromNow(),\n };\n extraColumns.forEach(column => {\n sortingCallbacks[column.name] = item => jsonpath__WEBPACK_IMPORTED_MODULE_2___default.a.value(item, Object(_utils_jsonPath__WEBPACK_IMPORTED_MODULE_8__[\"parseJsonPath\"])(column.jsonPath.slice(1)));\n });\n return (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_kube_object_list_layout__WEBPACK_IMPORTED_MODULE_4__[\"KubeObjectListLayout\"], { isConfigurable: true, key: `crd_resources_${crd.getResourceApiBase()}`, tableId: \"crd_resources\", className: \"CrdResources\", store: store, sortingCallbacks: sortingCallbacks, searchFilters: [\n item => item.getSearchFields(),\n ], renderHeaderTitle: crd.getResourceKind(), customizeHeader: (_a) => {\n var { searchProps } = _a, headerPlaceholders = __rest(_a, [\"searchProps\"]);\n return (Object.assign({ searchProps: Object.assign(Object.assign({}, searchProps), { placeholder: `${crd.getResourceKind()} search ...` }) }, headerPlaceholders));\n }, renderTableHeader: [\n { title: \"Name\", className: \"name\", sortBy: columnId.name, id: columnId.name },\n isNamespaced && { title: \"Namespace\", className: \"namespace\", sortBy: columnId.namespace, id: columnId.namespace },\n ...extraColumns.map(column => {\n const { name } = column;\n return {\n title: name,\n className: name.toLowerCase(),\n sortBy: name,\n id: name\n };\n }),\n { title: \"Age\", className: \"age\", sortBy: columnId.age, id: columnId.age },\n ], renderTableContents: crdInstance => [\n crdInstance.getName(),\n isNamespaced && crdInstance.getNs(),\n ...extraColumns.map((column) => {\n let value = jsonpath__WEBPACK_IMPORTED_MODULE_2___default.a.value(crdInstance, Object(_utils_jsonPath__WEBPACK_IMPORTED_MODULE_8__[\"parseJsonPath\"])(column.jsonPath.slice(1)));\n if (Array.isArray(value) || typeof value === \"object\") {\n value = JSON.stringify(value);\n }\n return {\n renderBoolean: true,\n children: value,\n };\n }),\n crdInstance.getAge(),\n ] }));\n }\n};\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_5__[\"computed\"],\n __metadata(\"design:type\", Object),\n __metadata(\"design:paramtypes\", [])\n], CrdResources.prototype, \"crd\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_5__[\"computed\"],\n __metadata(\"design:type\", Object),\n __metadata(\"design:paramtypes\", [])\n], CrdResources.prototype, \"store\", null);\nCrdResources = __decorate([\n mobx_react__WEBPACK_IMPORTED_MODULE_3__[\"observer\"],\n __metadata(\"design:paramtypes\", [Object])\n], CrdResources);\n\n\n\n//# sourceURL=webpack:///./src/renderer/components/+custom-resources/crd-resources.tsx?");
|
|
39912
39912
|
|
|
39913
39913
|
/***/ }),
|
|
39914
39914
|
|
|
@@ -40052,7 +40052,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _nod
|
|
|
40052
40052
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
40053
40053
|
|
|
40054
40054
|
"use strict";
|
|
40055
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PodDetailsList\", function() { return PodDetailsList; });\n/* harmony import */ var _pod_details_list_scss__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./pod-details-list.scss */ \"./src/renderer/components/+workloads-pods/pod-details-list.scss\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var lodash_kebabCase__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash/kebabCase */ \"./node_modules/lodash/kebabCase.js\");\n/* harmony import */ var lodash_kebabCase__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_kebabCase__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! mobx */ \"./node_modules/mobx/dist/mobx.esm.js\");\n/* harmony import */ var mobx_react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! mobx-react */ \"./node_modules/mobx-react/dist/mobxreact.esm.js\");\n/* harmony import */ var _pods_store__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./pods.store */ \"./src/renderer/components/+workloads-pods/pods.store.ts\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../utils */ \"./src/renderer/utils/index.ts\");\n/* harmony import */ var _line_progress__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../line-progress */ \"./src/renderer/components/line-progress/index.ts\");\n/* harmony import */ var _table__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../table */ \"./src/renderer/components/table/index.ts\");\n/* harmony import */ var _spinner__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../spinner */ \"./src/renderer/components/spinner/index.ts\");\n/* harmony import */ var _drawer__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../drawer */ \"./src/renderer/components/drawer/index.ts\");\n/* harmony import */ var _kube_object_status_icon__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../kube-object-status-icon */ \"./src/renderer/components/kube-object-status-icon/index.ts\");\n/* harmony import */ var _kube_detail_params__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../kube-detail-params */ \"./src/renderer/components/kube-detail-params/index.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (undefined && undefined.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar sortBy;\n(function (sortBy) {\n sortBy[\"name\"] = \"name\";\n sortBy[\"namespace\"] = \"namespace\";\n sortBy[\"cpu\"] = \"cpu\";\n sortBy[\"memory\"] = \"memory\";\n})(sortBy || (sortBy = {}));\nlet PodDetailsList = class PodDetailsList extends react__WEBPACK_IMPORTED_MODULE_1___default.a.Component {\n constructor() {\n super(...arguments);\n Object.defineProperty(this, \"metricsWatcher\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: Object(_utils__WEBPACK_IMPORTED_MODULE_6__[\"interval\"])(120, () => {\n _pods_store__WEBPACK_IMPORTED_MODULE_5__[\"podsStore\"].loadKubeMetrics(this.props.owner.getNs());\n })\n });\n Object.defineProperty(this, \"sortingCallbacks\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {\n [sortBy.name]: (pod) => pod.getName(),\n [sortBy.namespace]: (pod) => pod.getNs(),\n [sortBy.cpu]: (pod) => _pods_store__WEBPACK_IMPORTED_MODULE_5__[\"podsStore\"].getPodKubeMetrics(pod).cpu,\n [sortBy.memory]: (pod) => _pods_store__WEBPACK_IMPORTED_MODULE_5__[\"podsStore\"].getPodKubeMetrics(pod).memory,\n }\n });\n }\n componentDidMount() {\n this.metricsWatcher.start(true);\n Object(mobx_react__WEBPACK_IMPORTED_MODULE_4__[\"disposeOnUnmount\"])(this, [\n Object(mobx__WEBPACK_IMPORTED_MODULE_3__[\"reaction\"])(() => this.props.owner, () => this.metricsWatcher.restart(true))\n ]);\n }\n componentWillUnmount() {\n this.metricsWatcher.stop();\n }\n renderCpuUsage(id, usage) {\n const { maxCpu } = this.props;\n const value = usage.toFixed(3);\n const tooltip = (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"p\", null,\n \"CPU: \",\n Math.ceil(usage * 100) / maxCpu,\n \"%\",\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"br\", null),\n usage.toFixed(3)));\n if (!maxCpu) {\n if (parseFloat(value) === 0)\n return 0;\n return value;\n }\n return (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_line_progress__WEBPACK_IMPORTED_MODULE_7__[\"LineProgress\"], { max: maxCpu, value: usage, tooltip: parseFloat(value) !== 0 ? tooltip : null }));\n }\n renderMemoryUsage(id, usage) {\n const { maxMemory } = this.props;\n const tooltip = (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"p\", null,\n \"Memory: \",\n Math.ceil(usage * 100 / maxMemory),\n \"%\",\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"br\", null),\n Object(_utils__WEBPACK_IMPORTED_MODULE_6__[\"bytesToUnits\"])(usage, 3)));\n if (!maxMemory)\n return usage ? Object(_utils__WEBPACK_IMPORTED_MODULE_6__[\"bytesToUnits\"])(usage) : 0;\n return (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_line_progress__WEBPACK_IMPORTED_MODULE_7__[\"LineProgress\"], { max: maxMemory, value: usage, tooltip: usage != 0 ? tooltip : null }));\n }\n getTableRow(uid) {\n const { pods } = this.props;\n const pod = pods.find(pod => pod.getId() == uid);\n const metrics = _pods_store__WEBPACK_IMPORTED_MODULE_5__[\"podsStore\"].getPodKubeMetrics(pod);\n return (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_table__WEBPACK_IMPORTED_MODULE_8__[\"TableRow\"], { key: pod.getId(), sortItem: pod, nowrap: true, onClick: Object(_utils__WEBPACK_IMPORTED_MODULE_6__[\"prevDefault\"])(() => Object(_kube_detail_params__WEBPACK_IMPORTED_MODULE_12__[\"showDetails\"])(pod.selfLink, false)) },\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_table__WEBPACK_IMPORTED_MODULE_8__[\"TableCell\"], { className: \"name\" }, pod.getName()),\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_table__WEBPACK_IMPORTED_MODULE_8__[\"TableCell\"], { className: \"warning\" },\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_kube_object_status_icon__WEBPACK_IMPORTED_MODULE_11__[\"KubeObjectStatusIcon\"], { key: \"icon\", object: pod })),\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_table__WEBPACK_IMPORTED_MODULE_8__[\"TableCell\"], { className: \"namespace\" }, pod.getNs()),\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_table__WEBPACK_IMPORTED_MODULE_8__[\"TableCell\"], { className: \"ready\" },\n pod.getRunningContainers().length,\n \"/\",\n pod.getContainers().length),\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_table__WEBPACK_IMPORTED_MODULE_8__[\"TableCell\"], { className: \"cpu\" }, this.renderCpuUsage(`cpu-${pod.getId()}`, metrics.cpu)),\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_table__WEBPACK_IMPORTED_MODULE_8__[\"TableCell\"], { className: \"memory\" }, this.renderMemoryUsage(`memory-${pod.getId()}`, metrics.memory)),\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_table__WEBPACK_IMPORTED_MODULE_8__[\"TableCell\"], { className: Object(_utils__WEBPACK_IMPORTED_MODULE_6__[\"cssNames\"])(\"status\", lodash_kebabCase__WEBPACK_IMPORTED_MODULE_2___default()(pod.getStatusMessage())) }, pod.getStatusMessage())));\n }\n render() {\n const { pods, showTitle } = this.props;\n const virtual = pods.length > 100;\n if (!pods.length && !_pods_store__WEBPACK_IMPORTED_MODULE_5__[\"podsStore\"].isLoaded)\n return (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"div\", { className: \"PodDetailsList flex justify-center\" },\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_spinner__WEBPACK_IMPORTED_MODULE_9__[\"Spinner\"], null)));\n if (!pods.length)\n return null;\n return (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"div\", { className: \"PodDetailsList flex column\" },\n showTitle && react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_drawer__WEBPACK_IMPORTED_MODULE_10__[\"DrawerTitle\"], { title: \"Pods\" }),\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_table__WEBPACK_IMPORTED_MODULE_8__[\"Table\"], { tableId: \"workloads_pod_details_list\", items: pods, selectable: true, virtual: virtual, scrollable: false, sortable: this.sortingCallbacks, sortByDefault: { sortBy: sortBy.cpu, orderBy: \"desc\" }, sortSyncWithUrl: false, getTableRow: this.getTableRow, className: \"box grow\" },\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_table__WEBPACK_IMPORTED_MODULE_8__[\"TableHead\"], null,\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_table__WEBPACK_IMPORTED_MODULE_8__[\"TableCell\"], { className: \"name\", sortBy: sortBy.name }, \"Name\"),\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_table__WEBPACK_IMPORTED_MODULE_8__[\"TableCell\"], { className: \"warning\" }),\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_table__WEBPACK_IMPORTED_MODULE_8__[\"TableCell\"], { className: \"namespace\", sortBy: sortBy.namespace }, \"Namespace\"),\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_table__WEBPACK_IMPORTED_MODULE_8__[\"TableCell\"], { className: \"ready\" }, \"Ready\"),\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_table__WEBPACK_IMPORTED_MODULE_8__[\"TableCell\"], { className: \"cpu\", sortBy: sortBy.cpu }, \"CPU\"),\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_table__WEBPACK_IMPORTED_MODULE_8__[\"TableCell\"], { className: \"memory\", sortBy: sortBy.memory }, \"Memory\"),\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_table__WEBPACK_IMPORTED_MODULE_8__[\"TableCell\"], { className: \"status\" }, \"Status\")),\n !virtual && pods.map(pod => this.getTableRow(pod.getId())))));\n }\n};\nObject.defineProperty(PodDetailsList, \"defaultProps\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {\n showTitle: true\n }\n});\n__decorate([\n _utils__WEBPACK_IMPORTED_MODULE_6__[\"boundMethod\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [String]),\n __metadata(\"design:returntype\", void 0)\n], PodDetailsList.prototype, \"getTableRow\", null);\nPodDetailsList = __decorate([\n mobx_react__WEBPACK_IMPORTED_MODULE_4__[\"observer\"]\n], PodDetailsList);\n\n\n\n//# sourceURL=webpack:///./src/renderer/components/+workloads-pods/pod-details-list.tsx?");
|
|
40055
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PodDetailsList\", function() { return PodDetailsList; });\n/* harmony import */ var _pod_details_list_scss__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./pod-details-list.scss */ \"./src/renderer/components/+workloads-pods/pod-details-list.scss\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var lodash_kebabCase__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash/kebabCase */ \"./node_modules/lodash/kebabCase.js\");\n/* harmony import */ var lodash_kebabCase__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_kebabCase__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! mobx */ \"./node_modules/mobx/dist/mobx.esm.js\");\n/* harmony import */ var mobx_react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! mobx-react */ \"./node_modules/mobx-react/dist/mobxreact.esm.js\");\n/* harmony import */ var _pods_store__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./pods.store */ \"./src/renderer/components/+workloads-pods/pods.store.ts\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../utils */ \"./src/renderer/utils/index.ts\");\n/* harmony import */ var _line_progress__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../line-progress */ \"./src/renderer/components/line-progress/index.ts\");\n/* harmony import */ var _table__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../table */ \"./src/renderer/components/table/index.ts\");\n/* harmony import */ var _spinner__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../spinner */ \"./src/renderer/components/spinner/index.ts\");\n/* harmony import */ var _drawer__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../drawer */ \"./src/renderer/components/drawer/index.ts\");\n/* harmony import */ var _kube_object_status_icon__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../kube-object-status-icon */ \"./src/renderer/components/kube-object-status-icon/index.ts\");\n/* harmony import */ var _kube_detail_params__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../kube-detail-params */ \"./src/renderer/components/kube-detail-params/index.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (undefined && undefined.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar sortBy;\n(function (sortBy) {\n sortBy[\"name\"] = \"name\";\n sortBy[\"namespace\"] = \"namespace\";\n sortBy[\"cpu\"] = \"cpu\";\n sortBy[\"memory\"] = \"memory\";\n})(sortBy || (sortBy = {}));\nlet PodDetailsList = class PodDetailsList extends react__WEBPACK_IMPORTED_MODULE_1___default.a.Component {\n constructor() {\n super(...arguments);\n Object.defineProperty(this, \"metricsWatcher\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: Object(_utils__WEBPACK_IMPORTED_MODULE_6__[\"interval\"])(120, () => {\n _pods_store__WEBPACK_IMPORTED_MODULE_5__[\"podsStore\"].loadKubeMetrics(this.props.owner.getNs());\n })\n });\n }\n componentDidMount() {\n this.metricsWatcher.start(true);\n Object(mobx_react__WEBPACK_IMPORTED_MODULE_4__[\"disposeOnUnmount\"])(this, [\n Object(mobx__WEBPACK_IMPORTED_MODULE_3__[\"reaction\"])(() => this.props.owner, () => this.metricsWatcher.restart(true))\n ]);\n }\n componentWillUnmount() {\n this.metricsWatcher.stop();\n }\n renderCpuUsage(id, usage) {\n const { maxCpu } = this.props;\n const value = usage.toFixed(3);\n const tooltip = (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"p\", null,\n \"CPU: \",\n Math.ceil(usage * 100) / maxCpu,\n \"%\",\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"br\", null),\n usage.toFixed(3)));\n if (!maxCpu) {\n if (parseFloat(value) === 0)\n return 0;\n return value;\n }\n return (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_line_progress__WEBPACK_IMPORTED_MODULE_7__[\"LineProgress\"], { max: maxCpu, value: usage, tooltip: parseFloat(value) !== 0 ? tooltip : null }));\n }\n renderMemoryUsage(id, usage) {\n const { maxMemory } = this.props;\n const tooltip = (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"p\", null,\n \"Memory: \",\n Math.ceil(usage * 100 / maxMemory),\n \"%\",\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"br\", null),\n Object(_utils__WEBPACK_IMPORTED_MODULE_6__[\"bytesToUnits\"])(usage, 3)));\n if (!maxMemory)\n return usage ? Object(_utils__WEBPACK_IMPORTED_MODULE_6__[\"bytesToUnits\"])(usage) : 0;\n return (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_line_progress__WEBPACK_IMPORTED_MODULE_7__[\"LineProgress\"], { max: maxMemory, value: usage, tooltip: usage != 0 ? tooltip : null }));\n }\n getTableRow(uid) {\n const { pods } = this.props;\n const pod = pods.find(pod => pod.getId() == uid);\n const metrics = _pods_store__WEBPACK_IMPORTED_MODULE_5__[\"podsStore\"].getPodKubeMetrics(pod);\n return (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_table__WEBPACK_IMPORTED_MODULE_8__[\"TableRow\"], { key: pod.getId(), sortItem: pod, nowrap: true, onClick: Object(_utils__WEBPACK_IMPORTED_MODULE_6__[\"prevDefault\"])(() => Object(_kube_detail_params__WEBPACK_IMPORTED_MODULE_12__[\"showDetails\"])(pod.selfLink, false)) },\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_table__WEBPACK_IMPORTED_MODULE_8__[\"TableCell\"], { className: \"name\" }, pod.getName()),\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_table__WEBPACK_IMPORTED_MODULE_8__[\"TableCell\"], { className: \"warning\" },\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_kube_object_status_icon__WEBPACK_IMPORTED_MODULE_11__[\"KubeObjectStatusIcon\"], { key: \"icon\", object: pod })),\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_table__WEBPACK_IMPORTED_MODULE_8__[\"TableCell\"], { className: \"namespace\" }, pod.getNs()),\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_table__WEBPACK_IMPORTED_MODULE_8__[\"TableCell\"], { className: \"ready\" },\n pod.getRunningContainers().length,\n \"/\",\n pod.getContainers().length),\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_table__WEBPACK_IMPORTED_MODULE_8__[\"TableCell\"], { className: \"cpu\" }, this.renderCpuUsage(`cpu-${pod.getId()}`, metrics.cpu)),\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_table__WEBPACK_IMPORTED_MODULE_8__[\"TableCell\"], { className: \"memory\" }, this.renderMemoryUsage(`memory-${pod.getId()}`, metrics.memory)),\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_table__WEBPACK_IMPORTED_MODULE_8__[\"TableCell\"], { className: Object(_utils__WEBPACK_IMPORTED_MODULE_6__[\"cssNames\"])(\"status\", lodash_kebabCase__WEBPACK_IMPORTED_MODULE_2___default()(pod.getStatusMessage())) }, pod.getStatusMessage())));\n }\n render() {\n const { pods } = this.props;\n if (!_pods_store__WEBPACK_IMPORTED_MODULE_5__[\"podsStore\"].isLoaded) {\n return (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"div\", { className: \"PodDetailsList flex justify-center\" },\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_spinner__WEBPACK_IMPORTED_MODULE_9__[\"Spinner\"], null)));\n }\n if (!pods.length) {\n return null;\n }\n const virtual = pods.length > 20;\n return (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"div\", { className: \"PodDetailsList flex column\" },\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_drawer__WEBPACK_IMPORTED_MODULE_10__[\"DrawerTitle\"], { title: \"Pods\" }),\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_table__WEBPACK_IMPORTED_MODULE_8__[\"Table\"], { tableId: \"workloads_pod_details_list\", items: pods, selectable: true, scrollable: false, virtual: virtual, \n // 660 is the exact hight required for 20 items with the default paddings\n virtualHeight: 660, sortable: {\n [sortBy.name]: pod => pod.getName(),\n [sortBy.namespace]: pod => pod.getNs(),\n [sortBy.cpu]: pod => _pods_store__WEBPACK_IMPORTED_MODULE_5__[\"podsStore\"].getPodKubeMetrics(pod).cpu,\n [sortBy.memory]: pod => _pods_store__WEBPACK_IMPORTED_MODULE_5__[\"podsStore\"].getPodKubeMetrics(pod).memory,\n }, sortByDefault: { sortBy: sortBy.cpu, orderBy: \"desc\" }, sortSyncWithUrl: false, getTableRow: this.getTableRow, renderRow: !virtual && (pod => this.getTableRow(pod.getId())), className: \"box grow\" },\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_table__WEBPACK_IMPORTED_MODULE_8__[\"TableHead\"], null,\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_table__WEBPACK_IMPORTED_MODULE_8__[\"TableCell\"], { className: \"name\", sortBy: sortBy.name }, \"Name\"),\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_table__WEBPACK_IMPORTED_MODULE_8__[\"TableCell\"], { className: \"warning\" }),\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_table__WEBPACK_IMPORTED_MODULE_8__[\"TableCell\"], { className: \"namespace\", sortBy: sortBy.namespace }, \"Namespace\"),\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_table__WEBPACK_IMPORTED_MODULE_8__[\"TableCell\"], { className: \"ready\" }, \"Ready\"),\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_table__WEBPACK_IMPORTED_MODULE_8__[\"TableCell\"], { className: \"cpu\", sortBy: sortBy.cpu }, \"CPU\"),\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_table__WEBPACK_IMPORTED_MODULE_8__[\"TableCell\"], { className: \"memory\", sortBy: sortBy.memory }, \"Memory\"),\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_table__WEBPACK_IMPORTED_MODULE_8__[\"TableCell\"], { className: \"status\" }, \"Status\")))));\n }\n};\n__decorate([\n _utils__WEBPACK_IMPORTED_MODULE_6__[\"boundMethod\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [String]),\n __metadata(\"design:returntype\", void 0)\n], PodDetailsList.prototype, \"getTableRow\", null);\nPodDetailsList = __decorate([\n mobx_react__WEBPACK_IMPORTED_MODULE_4__[\"observer\"]\n], PodDetailsList);\n\n\n\n//# sourceURL=webpack:///./src/renderer/components/+workloads-pods/pod-details-list.tsx?");
|
|
40056
40056
|
|
|
40057
40057
|
/***/ }),
|
|
40058
40058
|
|
|
@@ -41143,7 +41143,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _nod
|
|
|
41143
41143
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
41144
41144
|
|
|
41145
41145
|
"use strict";
|
|
41146
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MainLayout\", function() { return MainLayout; });\n/* harmony import */ var _main_layout_module_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./main-layout.module.css */ \"./src/renderer/components/layout/main-layout.module.css\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var mobx_react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! mobx-react */ \"./node_modules/mobx-react/dist/mobxreact.esm.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../utils */ \"./src/renderer/utils/index.ts\");\n/* harmony import */ var _error_boundary__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../error-boundary */ \"./src/renderer/components/error-boundary/index.ts\");\n/* harmony import */ var _resizing_anchor__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../resizing-anchor */ \"./src/renderer/components/resizing-anchor/index.ts\");\n/* harmony import */ var _sidebar_storage__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./sidebar-storage */ \"./src/renderer/components/layout/sidebar-storage.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\n\n\n\n\n\n\n\n/**\n * Main layout is commonly used as a wrapper for \"global pages\"\n *\n * @link https://api-docs.k8slens.dev/master/extensions/capabilities/common-capabilities/#global-pages\n */\nlet MainLayout = class MainLayout extends react__WEBPACK_IMPORTED_MODULE_1___default.a.Component {\n constructor() {\n super(...arguments);\n Object.defineProperty(this, \"onSidebarResize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: (width) => {\n _sidebar_storage__WEBPACK_IMPORTED_MODULE_6__[\"sidebarStorage\"].merge({ width });\n }\n });\n }\n render() {\n const {
|
|
41146
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MainLayout\", function() { return MainLayout; });\n/* harmony import */ var _main_layout_module_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./main-layout.module.css */ \"./src/renderer/components/layout/main-layout.module.css\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var mobx_react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! mobx-react */ \"./node_modules/mobx-react/dist/mobxreact.esm.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../utils */ \"./src/renderer/utils/index.ts\");\n/* harmony import */ var _error_boundary__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../error-boundary */ \"./src/renderer/components/error-boundary/index.ts\");\n/* harmony import */ var _resizing_anchor__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../resizing-anchor */ \"./src/renderer/components/resizing-anchor/index.ts\");\n/* harmony import */ var _sidebar_storage__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./sidebar-storage */ \"./src/renderer/components/layout/sidebar-storage.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\n\n\n\n\n\n\n\n/**\n * Main layout is commonly used as a wrapper for \"global pages\"\n *\n * @link https://api-docs.k8slens.dev/master/extensions/capabilities/common-capabilities/#global-pages\n */\nlet MainLayout = class MainLayout extends react__WEBPACK_IMPORTED_MODULE_1___default.a.Component {\n constructor() {\n super(...arguments);\n Object.defineProperty(this, \"onSidebarResize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: (width) => {\n _sidebar_storage__WEBPACK_IMPORTED_MODULE_6__[\"sidebarStorage\"].merge({ width });\n }\n });\n }\n render() {\n const { className, footer, children, sidebar } = this.props;\n const { width: sidebarWidth } = _sidebar_storage__WEBPACK_IMPORTED_MODULE_6__[\"sidebarStorage\"].get();\n const style = { \"--sidebar-width\": `${sidebarWidth}px` };\n return (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"div\", { className: Object(_utils__WEBPACK_IMPORTED_MODULE_3__[\"cssNames\"])(_main_layout_module_css__WEBPACK_IMPORTED_MODULE_0__[\"default\"].mainLayout, className), style: style },\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"div\", { className: _main_layout_module_css__WEBPACK_IMPORTED_MODULE_0__[\"default\"].sidebar },\n sidebar,\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_resizing_anchor__WEBPACK_IMPORTED_MODULE_5__[\"ResizingAnchor\"], { direction: _resizing_anchor__WEBPACK_IMPORTED_MODULE_5__[\"ResizeDirection\"].HORIZONTAL, placement: _resizing_anchor__WEBPACK_IMPORTED_MODULE_5__[\"ResizeSide\"].TRAILING, growthDirection: _resizing_anchor__WEBPACK_IMPORTED_MODULE_5__[\"ResizeGrowthDirection\"].LEFT_TO_RIGHT, getCurrentExtent: () => sidebarWidth, onDrag: this.onSidebarResize, onDoubleClick: () => this.onSidebarResize(_sidebar_storage__WEBPACK_IMPORTED_MODULE_6__[\"defaultSidebarWidth\"]), minExtent: 120, maxExtent: 400 })),\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"div\", { className: _main_layout_module_css__WEBPACK_IMPORTED_MODULE_0__[\"default\"].contents },\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_error_boundary__WEBPACK_IMPORTED_MODULE_4__[\"ErrorBoundary\"], null, children)),\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"div\", { className: _main_layout_module_css__WEBPACK_IMPORTED_MODULE_0__[\"default\"].footer }, footer)));\n }\n};\nMainLayout = __decorate([\n mobx_react__WEBPACK_IMPORTED_MODULE_2__[\"observer\"]\n], MainLayout);\n\n\n\n//# sourceURL=webpack:///./src/renderer/components/layout/main-layout.tsx?");
|
|
41147
41147
|
|
|
41148
41148
|
/***/ }),
|
|
41149
41149
|
|
|
@@ -41187,11 +41187,11 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
41187
41187
|
/*!***********************************************************!*\
|
|
41188
41188
|
!*** ./src/renderer/components/layout/sidebar-storage.ts ***!
|
|
41189
41189
|
\***********************************************************/
|
|
41190
|
-
/*! exports provided: sidebarStorage */
|
|
41190
|
+
/*! exports provided: defaultSidebarWidth, sidebarStorage */
|
|
41191
41191
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
41192
41192
|
|
|
41193
41193
|
"use strict";
|
|
41194
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"sidebarStorage\", function() { return sidebarStorage; });\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utils */ \"./src/renderer/utils/index.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\nconst sidebarStorage = Object(_utils__WEBPACK_IMPORTED_MODULE_0__[\"createStorage\"])(\"sidebar\", {\n width:
|
|
41194
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"defaultSidebarWidth\", function() { return defaultSidebarWidth; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"sidebarStorage\", function() { return sidebarStorage; });\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utils */ \"./src/renderer/utils/index.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\nconst defaultSidebarWidth = 200;\nconst sidebarStorage = Object(_utils__WEBPACK_IMPORTED_MODULE_0__[\"createStorage\"])(\"sidebar\", {\n width: defaultSidebarWidth,\n expanded: {},\n});\n\n\n//# sourceURL=webpack:///./src/renderer/components/layout/sidebar-storage.ts?");
|
|
41195
41195
|
|
|
41196
41196
|
/***/ }),
|
|
41197
41197
|
|
|
@@ -41911,7 +41911,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
41911
41911
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
41912
41912
|
|
|
41913
41913
|
"use strict";
|
|
41914
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"sortByUrlParam\", function() { return sortByUrlParam; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"orderByUrlParam\", function() { return orderByUrlParam; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Table\", function() { return Table; });\n/* harmony import */ var _table_scss__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./table.scss */ \"./src/renderer/components/table/table.scss\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var mobx_react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! mobx-react */ \"./node_modules/mobx-react/dist/mobxreact.esm.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../utils */ \"./src/renderer/utils/index.ts\");\n/* harmony import */ var _table_row__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./table-row */ \"./src/renderer/components/table/table-row.tsx\");\n/* harmony import */ var _table_head__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./table-head */ \"./src/renderer/components/table/table-head.tsx\");\n/* harmony import */ var _virtual_list__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../virtual-list */ \"./src/renderer/components/virtual-list/index.ts\");\n/* harmony import */ var _navigation__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../navigation */ \"./src/renderer/navigation/index.ts\");\n/* harmony import */ var _table_storage__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./table.storage */ \"./src/renderer/components/table/table.storage.ts\");\n/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! mobx */ \"./node_modules/mobx/dist/mobx.esm.js\");\n/* harmony import */ var _sorting__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./sorting */ \"./src/renderer/components/table/sorting.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (undefined && undefined.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};\n\n\n\n\n\n\n\n\n\n\n\nconst sortByUrlParam = Object(_navigation__WEBPACK_IMPORTED_MODULE_7__[\"createPageParam\"])({\n name: \"sort\",\n});\nconst orderByUrlParam = Object(_navigation__WEBPACK_IMPORTED_MODULE_7__[\"createPageParam\"])({\n name: \"order\",\n});\nlet Table = class Table extends react__WEBPACK_IMPORTED_MODULE_1___default.a.Component {\n constructor(props) {\n super(props);\n Object(mobx__WEBPACK_IMPORTED_MODULE_9__[\"makeObservable\"])(this);\n }\n componentDidMount() {\n const { sortable, tableId } = this.props;\n if (sortable && !tableId) {\n console.error(\"Table must have props.tableId if props.sortable is specified\");\n }\n }\n get isSortable() {\n const { sortable, tableId } = this.props;\n return Boolean(sortable && tableId);\n }\n get sortParams() {\n return Object.assign({}, this.props.sortByDefault, Object(_table_storage__WEBPACK_IMPORTED_MODULE_8__[\"getSortParams\"])(this.props.tableId));\n }\n renderHead() {\n const { children } = this.props;\n const content = react__WEBPACK_IMPORTED_MODULE_1___default.a.Children.toArray(children);\n const headElem = content.find(elem => elem.type === _table_head__WEBPACK_IMPORTED_MODULE_5__[\"TableHead\"]);\n if (!headElem) {\n return null;\n }\n if (this.isSortable) {\n const columns = react__WEBPACK_IMPORTED_MODULE_1___default.a.Children.toArray(headElem.props.children);\n return react__WEBPACK_IMPORTED_MODULE_1___default.a.cloneElement(headElem, {\n children: columns.map(elem => {\n if (elem.props.checkbox) {\n return elem;\n }\n const title = elem.props.title || (\n // copy cell content to title if it's a string\n // usable if part of TableCell's content is hidden when there is not enough space\n typeof elem.props.children === \"string\" ? elem.props.children : undefined);\n return react__WEBPACK_IMPORTED_MODULE_1___default.a.cloneElement(elem, {\n title,\n _sort: this.sort,\n _sorting: this.sortParams,\n _nowrap: headElem.props.nowrap,\n });\n })\n });\n }\n return headElem;\n }\n getSorted(rawItems) {\n const { sortBy, orderBy: orderByRaw } = this.sortParams;\n return Object(_sorting__WEBPACK_IMPORTED_MODULE_10__[\"getSorted\"])(rawItems, this.props.sortable[sortBy], orderByRaw);\n }\n onSort({ sortBy, orderBy }) {\n Object(_table_storage__WEBPACK_IMPORTED_MODULE_8__[\"setSortParams\"])(this.props.tableId, { sortBy, orderBy });\n const { sortSyncWithUrl, onSort } = this.props;\n if (sortSyncWithUrl) {\n sortByUrlParam.set(sortBy);\n orderByUrlParam.set(orderBy);\n }\n onSort === null || onSort === void 0 ? void 0 : onSort({ sortBy, orderBy });\n }\n sort(colName) {\n const { sortBy, orderBy } = this.sortParams;\n const sameColumn = sortBy == colName;\n const newSortBy = colName;\n const newOrderBy = (!orderBy || !sameColumn || orderBy === \"desc\") ? \"asc\" : \"desc\";\n this.onSort({\n sortBy: String(newSortBy),\n orderBy: newOrderBy,\n });\n }\n getContent() {\n const { items, renderRow, children } = this.props;\n const content = react__WEBPACK_IMPORTED_MODULE_1___default.a.Children.toArray(children);\n if (renderRow) {\n content.push(...items.map(renderRow));\n }\n return content;\n }\n renderRows() {\n const { noItems, virtual, customRowHeights, rowLineHeight, rowPadding, items, getTableRow, selectedItemId, className } = this.props;\n const content = this.getContent();\n let rows = content.filter(elem => elem.type === _table_row__WEBPACK_IMPORTED_MODULE_4__[\"TableRow\"]);\n let sortedItems = rows.length ? rows.map(row => row.props.sortItem) : [...items];\n if (this.isSortable) {\n sortedItems = this.getSorted(sortedItems);\n if (rows.length) {\n rows = sortedItems.map(item => rows.find(row => {\n return item == row.props.sortItem;\n }));\n }\n }\n if (!rows.length && !items.length && noItems) {\n return noItems;\n }\n if (virtual) {\n const lineHeight = parseFloat(rowLineHeight);\n const padding = parseFloat(rowPadding);\n let rowHeights = Array(items.length).fill(lineHeight + padding * 2);\n if (customRowHeights) {\n rowHeights = sortedItems.map(item => {\n return customRowHeights(item, lineHeight, padding * 2);\n });\n }\n return (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_virtual_list__WEBPACK_IMPORTED_MODULE_6__[\"VirtualList\"], { items: sortedItems, rowHeights: rowHeights, getRow: getTableRow, selectedItemId: selectedItemId, className: className }));\n }\n return rows;\n }\n render() {\n const { selectable, scrollable, autoSize, virtual, className } = this.props;\n const classNames = Object(_utils__WEBPACK_IMPORTED_MODULE_3__[\"cssNames\"])(\"Table flex column\", className, {\n selectable, scrollable, sortable: this.isSortable, autoSize, virtual,\n });\n return (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"div\", { className: classNames },\n this.renderHead(),\n this.renderRows()));\n }\n};\nObject.defineProperty(Table, \"defaultProps\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {\n scrollable: true,\n autoSize: true,\n rowPadding: \"8px\",\n rowLineHeight: \"17px\",\n sortSyncWithUrl: true,\n }\n});\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_9__[\"computed\"],\n __metadata(\"design:type\", Object),\n __metadata(\"design:paramtypes\", [])\n], Table.prototype, \"isSortable\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_9__[\"computed\"],\n __metadata(\"design:type\", Object),\n __metadata(\"design:paramtypes\", [])\n], Table.prototype, \"sortParams\", null);\n__decorate([\n _utils__WEBPACK_IMPORTED_MODULE_3__[\"boundMethod\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [String]),\n __metadata(\"design:returntype\", void 0)\n], Table.prototype, \"sort\", null);\nTable = __decorate([\n mobx_react__WEBPACK_IMPORTED_MODULE_2__[\"observer\"],\n __metadata(\"design:paramtypes\", [Object])\n], Table);\n\n\n\n//# sourceURL=webpack:///./src/renderer/components/table/table.tsx?");
|
|
41914
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"sortByUrlParam\", function() { return sortByUrlParam; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"orderByUrlParam\", function() { return orderByUrlParam; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Table\", function() { return Table; });\n/* harmony import */ var _table_scss__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./table.scss */ \"./src/renderer/components/table/table.scss\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var mobx_react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! mobx-react */ \"./node_modules/mobx-react/dist/mobxreact.esm.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../utils */ \"./src/renderer/utils/index.ts\");\n/* harmony import */ var _table_row__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./table-row */ \"./src/renderer/components/table/table-row.tsx\");\n/* harmony import */ var _table_head__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./table-head */ \"./src/renderer/components/table/table-head.tsx\");\n/* harmony import */ var _virtual_list__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../virtual-list */ \"./src/renderer/components/virtual-list/index.ts\");\n/* harmony import */ var _navigation__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../navigation */ \"./src/renderer/navigation/index.ts\");\n/* harmony import */ var _table_storage__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./table.storage */ \"./src/renderer/components/table/table.storage.ts\");\n/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! mobx */ \"./node_modules/mobx/dist/mobx.esm.js\");\n/* harmony import */ var _sorting__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./sorting */ \"./src/renderer/components/table/sorting.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (undefined && undefined.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};\n\n\n\n\n\n\n\n\n\n\n\nconst sortByUrlParam = Object(_navigation__WEBPACK_IMPORTED_MODULE_7__[\"createPageParam\"])({\n name: \"sort\",\n});\nconst orderByUrlParam = Object(_navigation__WEBPACK_IMPORTED_MODULE_7__[\"createPageParam\"])({\n name: \"order\",\n});\nlet Table = class Table extends react__WEBPACK_IMPORTED_MODULE_1___default.a.Component {\n constructor(props) {\n super(props);\n Object(mobx__WEBPACK_IMPORTED_MODULE_9__[\"makeObservable\"])(this);\n }\n componentDidMount() {\n const { sortable, tableId } = this.props;\n if (sortable && !tableId) {\n console.error(\"Table must have props.tableId if props.sortable is specified\");\n }\n }\n get isSortable() {\n const { sortable, tableId } = this.props;\n return Boolean(sortable && tableId);\n }\n get sortParams() {\n return Object.assign({}, this.props.sortByDefault, Object(_table_storage__WEBPACK_IMPORTED_MODULE_8__[\"getSortParams\"])(this.props.tableId));\n }\n renderHead() {\n const { children } = this.props;\n const content = react__WEBPACK_IMPORTED_MODULE_1___default.a.Children.toArray(children);\n const headElem = content.find(elem => elem.type === _table_head__WEBPACK_IMPORTED_MODULE_5__[\"TableHead\"]);\n if (!headElem) {\n return null;\n }\n if (this.isSortable) {\n const columns = react__WEBPACK_IMPORTED_MODULE_1___default.a.Children.toArray(headElem.props.children);\n return react__WEBPACK_IMPORTED_MODULE_1___default.a.cloneElement(headElem, {\n children: columns.map(elem => {\n if (elem.props.checkbox) {\n return elem;\n }\n const title = elem.props.title || (\n // copy cell content to title if it's a string\n // usable if part of TableCell's content is hidden when there is not enough space\n typeof elem.props.children === \"string\" ? elem.props.children : undefined);\n return react__WEBPACK_IMPORTED_MODULE_1___default.a.cloneElement(elem, {\n title,\n _sort: this.sort,\n _sorting: this.sortParams,\n _nowrap: headElem.props.nowrap,\n });\n })\n });\n }\n return headElem;\n }\n getSorted(rawItems) {\n const { sortBy, orderBy: orderByRaw } = this.sortParams;\n return Object(_sorting__WEBPACK_IMPORTED_MODULE_10__[\"getSorted\"])(rawItems, this.props.sortable[sortBy], orderByRaw);\n }\n onSort({ sortBy, orderBy }) {\n Object(_table_storage__WEBPACK_IMPORTED_MODULE_8__[\"setSortParams\"])(this.props.tableId, { sortBy, orderBy });\n const { sortSyncWithUrl, onSort } = this.props;\n if (sortSyncWithUrl) {\n sortByUrlParam.set(sortBy);\n orderByUrlParam.set(orderBy);\n }\n onSort === null || onSort === void 0 ? void 0 : onSort({ sortBy, orderBy });\n }\n sort(colName) {\n const { sortBy, orderBy } = this.sortParams;\n const sameColumn = sortBy == colName;\n const newSortBy = colName;\n const newOrderBy = (!orderBy || !sameColumn || orderBy === \"desc\") ? \"asc\" : \"desc\";\n this.onSort({\n sortBy: String(newSortBy),\n orderBy: newOrderBy,\n });\n }\n getContent() {\n const { items, renderRow, children } = this.props;\n const content = react__WEBPACK_IMPORTED_MODULE_1___default.a.Children.toArray(children);\n if (renderRow) {\n content.push(...items.map(renderRow));\n }\n return content;\n }\n renderRows() {\n const { noItems, virtual, customRowHeights, rowLineHeight, rowPadding, items, getTableRow, selectedItemId, className, virtualHeight } = this.props;\n const content = this.getContent();\n let rows = content.filter(elem => elem.type === _table_row__WEBPACK_IMPORTED_MODULE_4__[\"TableRow\"]);\n let sortedItems = rows.length ? rows.map(row => row.props.sortItem) : [...items];\n if (this.isSortable) {\n sortedItems = this.getSorted(sortedItems);\n if (rows.length) {\n rows = sortedItems.map(item => rows.find(row => item == row.props.sortItem));\n }\n }\n if (!rows.length && !items.length && noItems) {\n return noItems;\n }\n if (virtual) {\n const rowHeights = sortedItems.map(item => customRowHeights(item, rowLineHeight, rowPadding * 2));\n return (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_virtual_list__WEBPACK_IMPORTED_MODULE_6__[\"VirtualList\"], { items: sortedItems, rowHeights: rowHeights, getRow: getTableRow, selectedItemId: selectedItemId, className: className, fixedHeight: virtualHeight }));\n }\n return rows;\n }\n render() {\n const { selectable, scrollable, autoSize, virtual, className } = this.props;\n const classNames = Object(_utils__WEBPACK_IMPORTED_MODULE_3__[\"cssNames\"])(\"Table flex column\", className, {\n selectable, scrollable, sortable: this.isSortable, autoSize, virtual,\n });\n return (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"div\", { className: classNames },\n this.renderHead(),\n this.renderRows()));\n }\n};\nObject.defineProperty(Table, \"defaultProps\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {\n scrollable: true,\n autoSize: true,\n rowPadding: 8,\n rowLineHeight: 17,\n sortSyncWithUrl: true,\n customRowHeights: (item, lineHeight, paddings) => lineHeight + paddings,\n }\n});\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_9__[\"computed\"],\n __metadata(\"design:type\", Object),\n __metadata(\"design:paramtypes\", [])\n], Table.prototype, \"isSortable\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_9__[\"computed\"],\n __metadata(\"design:type\", Object),\n __metadata(\"design:paramtypes\", [])\n], Table.prototype, \"sortParams\", null);\n__decorate([\n _utils__WEBPACK_IMPORTED_MODULE_3__[\"boundMethod\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [String]),\n __metadata(\"design:returntype\", void 0)\n], Table.prototype, \"sort\", null);\nTable = __decorate([\n mobx_react__WEBPACK_IMPORTED_MODULE_2__[\"observer\"],\n __metadata(\"design:paramtypes\", [Object])\n], Table);\n\n\n\n//# sourceURL=webpack:///./src/renderer/components/table/table.tsx?");
|
|
41915
41915
|
|
|
41916
41916
|
/***/ }),
|
|
41917
41917
|
|
|
@@ -42031,7 +42031,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _nod
|
|
|
42031
42031
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
42032
42032
|
|
|
42033
42033
|
"use strict";
|
|
42034
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VirtualList\", function() { return VirtualList; });\n/* harmony import */ var _virtual_list_scss__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./virtual-list.scss */ \"./src/renderer/components/virtual-list/virtual-list.scss\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var mobx_react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! mobx-react */ \"./node_modules/mobx-react/dist/mobxreact.esm.js\");\n/* harmony import */ var react_window__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react-window */ \"./node_modules/react-window/dist/index.esm.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils */ \"./src/renderer/utils/index.ts\");\n/* harmony import */ var lodash_debounce__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! lodash/debounce */ \"./node_modules/lodash/debounce.js\");\n/* harmony import */ var lodash_debounce__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(lodash_debounce__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var lodash_isEqual__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! lodash/isEqual */ \"./node_modules/lodash/isEqual.js\");\n/* harmony import */ var lodash_isEqual__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(lodash_isEqual__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var react_virtualized_auto_sizer__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! react-virtualized-auto-sizer */ \"./node_modules/react-virtualized-auto-sizer/dist/index.esm.js\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n// Wrapper for \"react-window\" component\n// API docs: https://react-window.now.sh\n\n\n\n\n\n\n\n\nconst defaultProps = {\n width: \"100%\",\n initialOffset: 1,\n readyOffset: 10,\n onScroll: _utils__WEBPACK_IMPORTED_MODULE_4__[\"noop\"]\n};\nclass VirtualList extends react__WEBPACK_IMPORTED_MODULE_1__[\"Component\"] {\n constructor() {\n super(...arguments);\n Object.defineProperty(this, \"listRef\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: react__WEBPACK_IMPORTED_MODULE_1___default.a.createRef()\n });\n Object.defineProperty(this, \"state\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {\n overscanCount: this.props.initialOffset,\n }\n });\n Object.defineProperty(this, \"getItemSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: (index) => this.props.rowHeights[index]\n });\n Object.defineProperty(this, \"scrollToSelectedItem\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: lodash_debounce__WEBPACK_IMPORTED_MODULE_5___default()(() => {\n var _a;\n if (!this.props.selectedItemId) {\n return;\n }\n const { items, selectedItemId } = this.props;\n const index = items.findIndex(item => item.getId() == selectedItemId);\n if (index >= 0) {\n (_a = this.listRef.current) === null || _a === void 0 ? void 0 : _a.scrollToItem(index, \"start\");\n }\n })\n });\n Object.defineProperty(this, \"scrollToItem\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: (index, align) => {\n var _a;\n (_a = this.listRef.current) === null || _a === void 0 ? void 0 : _a.scrollToItem(index, align);\n }\n });\n }\n componentDidMount() {\n this.scrollToSelectedItem();\n this.setState({ overscanCount: this.props.readyOffset });\n }\n componentDidUpdate(prevProps) {\n var _a;\n const { items, rowHeights } = this.props;\n if (prevProps.items.length !== items.length || !lodash_isEqual__WEBPACK_IMPORTED_MODULE_6___default()(prevProps.rowHeights, rowHeights)) {\n (_a = this.listRef.current) === null || _a === void 0 ? void 0 : _a.resetAfterIndex(0, false);\n }\n }\n
|
|
42034
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VirtualList\", function() { return VirtualList; });\n/* harmony import */ var _virtual_list_scss__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./virtual-list.scss */ \"./src/renderer/components/virtual-list/virtual-list.scss\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var mobx_react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! mobx-react */ \"./node_modules/mobx-react/dist/mobxreact.esm.js\");\n/* harmony import */ var react_window__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react-window */ \"./node_modules/react-window/dist/index.esm.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils */ \"./src/renderer/utils/index.ts\");\n/* harmony import */ var lodash_debounce__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! lodash/debounce */ \"./node_modules/lodash/debounce.js\");\n/* harmony import */ var lodash_debounce__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(lodash_debounce__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var lodash_isEqual__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! lodash/isEqual */ \"./node_modules/lodash/isEqual.js\");\n/* harmony import */ var lodash_isEqual__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(lodash_isEqual__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var react_virtualized_auto_sizer__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! react-virtualized-auto-sizer */ \"./node_modules/react-virtualized-auto-sizer/dist/index.esm.js\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n// Wrapper for \"react-window\" component\n// API docs: https://react-window.now.sh\n\n\n\n\n\n\n\n\nconst defaultProps = {\n width: \"100%\",\n initialOffset: 1,\n readyOffset: 10,\n onScroll: _utils__WEBPACK_IMPORTED_MODULE_4__[\"noop\"]\n};\nclass VirtualList extends react__WEBPACK_IMPORTED_MODULE_1__[\"Component\"] {\n constructor() {\n super(...arguments);\n Object.defineProperty(this, \"listRef\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: react__WEBPACK_IMPORTED_MODULE_1___default.a.createRef()\n });\n Object.defineProperty(this, \"state\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {\n overscanCount: this.props.initialOffset,\n }\n });\n Object.defineProperty(this, \"getItemSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: (index) => this.props.rowHeights[index]\n });\n Object.defineProperty(this, \"scrollToSelectedItem\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: lodash_debounce__WEBPACK_IMPORTED_MODULE_5___default()(() => {\n var _a;\n if (!this.props.selectedItemId) {\n return;\n }\n const { items, selectedItemId } = this.props;\n const index = items.findIndex(item => item.getId() == selectedItemId);\n if (index >= 0) {\n (_a = this.listRef.current) === null || _a === void 0 ? void 0 : _a.scrollToItem(index, \"start\");\n }\n })\n });\n Object.defineProperty(this, \"scrollToItem\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: (index, align) => {\n var _a;\n (_a = this.listRef.current) === null || _a === void 0 ? void 0 : _a.scrollToItem(index, align);\n }\n });\n }\n componentDidMount() {\n this.scrollToSelectedItem();\n this.setState({ overscanCount: this.props.readyOffset });\n }\n componentDidUpdate(prevProps) {\n var _a;\n const { items, rowHeights } = this.props;\n if (prevProps.items.length !== items.length || !lodash_isEqual__WEBPACK_IMPORTED_MODULE_6___default()(prevProps.rowHeights, rowHeights)) {\n (_a = this.listRef.current) === null || _a === void 0 ? void 0 : _a.resetAfterIndex(0, false);\n }\n }\n renderList(height) {\n const { width, items, getRow, onScroll, outerRef } = this.props;\n const { overscanCount } = this.state;\n return (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(react_window__WEBPACK_IMPORTED_MODULE_3__[\"VariableSizeList\"], { className: \"list\", width: width, height: height, itemSize: this.getItemSize, itemCount: items.length, itemData: {\n items,\n getRow\n }, overscanCount: overscanCount, ref: this.listRef, outerRef: outerRef, onScroll: onScroll }, Row));\n }\n render() {\n const { className, fixedHeight } = this.props;\n return (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"div\", { className: Object(_utils__WEBPACK_IMPORTED_MODULE_4__[\"cssNames\"])(\"VirtualList\", className) }, typeof fixedHeight === \"number\"\n ? this.renderList(fixedHeight)\n : (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(react_virtualized_auto_sizer__WEBPACK_IMPORTED_MODULE_7__[\"default\"], { disableWidth: true }, ({ height }) => this.renderList(height)))));\n }\n}\nObject.defineProperty(VirtualList, \"defaultProps\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: defaultProps\n});\nconst Row = Object(mobx_react__WEBPACK_IMPORTED_MODULE_2__[\"observer\"])((props) => {\n const { index, style, data } = props;\n const { items, getRow } = data;\n const item = items[index];\n const uid = typeof item == \"string\" ? index : items[index].getId();\n const row = getRow(uid);\n if (!row)\n return null;\n return react__WEBPACK_IMPORTED_MODULE_1___default.a.cloneElement(row, {\n style: Object.assign({}, row.props.style, style)\n });\n});\n\n\n//# sourceURL=webpack:///./src/renderer/components/virtual-list/virtual-list.tsx?");
|
|
42035
42035
|
|
|
42036
42036
|
/***/ }),
|
|
42037
42037
|
|
|
@@ -42185,7 +42185,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
42185
42185
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
42186
42186
|
|
|
42187
42187
|
"use strict";
|
|
42188
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"createStorage\", function() { return createStorage; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"createAppStorage\", function() { return createAppStorage; });\n/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! path */ \"path\");\n/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! mobx */ \"./node_modules/mobx/dist/mobx.esm.js\");\n/* harmony import */ var fs_extra__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! fs-extra */ \"./node_modules/fs-extra/lib/index.js\");\n/* harmony import */ var fs_extra__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(fs_extra__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _storageHelper__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./storageHelper */ \"./src/renderer/utils/storageHelper.ts\");\n/* harmony import */ var
|
|
42188
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"createStorage\", function() { return createStorage; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"createAppStorage\", function() { return createAppStorage; });\n/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! path */ \"path\");\n/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! mobx */ \"./node_modules/mobx/dist/mobx.esm.js\");\n/* harmony import */ var fs_extra__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! fs-extra */ \"./node_modules/fs-extra/lib/index.js\");\n/* harmony import */ var fs_extra__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(fs_extra__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _storageHelper__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./storageHelper */ \"./src/renderer/utils/storageHelper.ts\");\n/* harmony import */ var _main_logger__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../main/logger */ \"./src/main/logger.ts\");\n/* harmony import */ var _common_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../common/utils */ \"./src/common/utils/index.ts\");\n/* harmony import */ var _common_vars__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../common/vars */ \"./src/common/vars.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n// Keeps window.localStorage state in external JSON-files.\n// Because app creates random port between restarts => storage session wiped out each time.\n\n\n\n\n\n\n\nconst storage = Object(mobx__WEBPACK_IMPORTED_MODULE_1__[\"observable\"])({\n initialized: false,\n loaded: false,\n data: {}, // json-serializable\n});\n/**\n * Creates a helper for saving data under the \"key\" intended for window.localStorage\n * @param key\n * @param defaultValue\n */\nfunction createStorage(key, defaultValue) {\n return createAppStorage(key, defaultValue, Object(_common_utils__WEBPACK_IMPORTED_MODULE_5__[\"getHostedClusterId\"])());\n}\nfunction createAppStorage(key, defaultValue, clusterId) {\n const { logPrefix } = _storageHelper__WEBPACK_IMPORTED_MODULE_3__[\"StorageHelper\"];\n const folder = path__WEBPACK_IMPORTED_MODULE_0___default.a.resolve(Object(_common_utils__WEBPACK_IMPORTED_MODULE_5__[\"getPath\"])(\"userData\"), \"lens-local-storage\");\n const fileName = `${clusterId !== null && clusterId !== void 0 ? clusterId : \"app\"}.json`;\n const filePath = path__WEBPACK_IMPORTED_MODULE_0___default.a.resolve(folder, fileName);\n if (!storage.initialized) {\n init(); // called once per cluster-view\n }\n function init() {\n storage.initialized = true;\n // read previously saved state (if any)\n fs_extra__WEBPACK_IMPORTED_MODULE_2___default.a.readJson(filePath)\n .then(data => storage.data = data)\n .catch(() => null) // ignore empty / non-existing / invalid json files\n .finally(() => {\n if (!_common_vars__WEBPACK_IMPORTED_MODULE_6__[\"isTestEnv\"]) {\n _main_logger__WEBPACK_IMPORTED_MODULE_4__[\"default\"].info(`${logPrefix} loading finished for ${filePath}`);\n }\n storage.loaded = true;\n });\n // bind auto-saving data changes to %storage-file.json\n Object(mobx__WEBPACK_IMPORTED_MODULE_1__[\"reaction\"])(() => Object(mobx__WEBPACK_IMPORTED_MODULE_1__[\"toJS\"])(storage.data), saveFile, {\n delay: 250,\n equals: mobx__WEBPACK_IMPORTED_MODULE_1__[\"comparer\"].structural, // save only when something really changed\n });\n async function saveFile(state = {}) {\n _main_logger__WEBPACK_IMPORTED_MODULE_4__[\"default\"].info(`${logPrefix} saving ${filePath}`);\n try {\n await fs_extra__WEBPACK_IMPORTED_MODULE_2___default.a.ensureDir(folder, { mode: 0o755 });\n await fs_extra__WEBPACK_IMPORTED_MODULE_2___default.a.writeJson(filePath, state, { spaces: 2 });\n }\n catch (error) {\n _main_logger__WEBPACK_IMPORTED_MODULE_4__[\"default\"].error(`${logPrefix} saving failed: ${error}`, {\n json: state, jsonFilePath: filePath\n });\n }\n }\n }\n return new _storageHelper__WEBPACK_IMPORTED_MODULE_3__[\"StorageHelper\"](key, {\n autoInit: true,\n defaultValue,\n storage: {\n async getItem(key) {\n await Object(mobx__WEBPACK_IMPORTED_MODULE_1__[\"when\"])(() => storage.loaded);\n return storage.data[key];\n },\n setItem(key, value) {\n storage.data[key] = value;\n },\n removeItem(key) {\n delete storage.data[key];\n }\n },\n });\n}\n\n\n//# sourceURL=webpack:///./src/renderer/utils/createStorage.ts?");
|
|
42189
42189
|
|
|
42190
42190
|
/***/ }),
|
|
42191
42191
|
|
|
@@ -42353,7 +42353,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
42353
42353
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
42354
42354
|
|
|
42355
42355
|
"use strict";
|
|
42356
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StorageHelper\", function() { return StorageHelper; });\n/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! mobx */ \"./node_modules/mobx/dist/mobx.esm.js\");\n/* harmony import */ var immer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! immer */ \"./node_modules/immer/dist/immer.esm.js\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _main_logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../main/logger */ \"./src/main/logger.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (undefined && undefined.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};\n// Helper for working with storages (e.g. window.localStorage, NodeJS/file-system, etc.)\n\n\n\n\nclass StorageHelper {\n constructor(key, options) {\n Object.defineProperty(this, \"key\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: key\n });\n Object.defineProperty(this, \"options\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: options\n });\n Object.defineProperty(this, \"storage\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"data\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: mobx__WEBPACK_IMPORTED_MODULE_0__[\"observable\"].box(undefined, {\n deep: true,\n equals: mobx__WEBPACK_IMPORTED_MODULE_0__[\"comparer\"].structural,\n })\n });\n Object.defineProperty(this, \"initialized\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: false\n });\n Object.defineProperty(this, \"onData\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: (data) => {\n const notEmpty = data != null;\n const notDefault = !this.isDefaultValue(data);\n if (notEmpty && notDefault) {\n this.
|
|
42356
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StorageHelper\", function() { return StorageHelper; });\n/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! mobx */ \"./node_modules/mobx/dist/mobx.esm.js\");\n/* harmony import */ var immer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! immer */ \"./node_modules/immer/dist/immer.esm.js\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _main_logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../main/logger */ \"./src/main/logger.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (undefined && undefined.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};\n// Helper for working with storages (e.g. window.localStorage, NodeJS/file-system, etc.)\n\n\n\n\nclass StorageHelper {\n constructor(key, options) {\n Object.defineProperty(this, \"key\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: key\n });\n Object.defineProperty(this, \"options\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: options\n });\n Object.defineProperty(this, \"storage\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"data\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: mobx__WEBPACK_IMPORTED_MODULE_0__[\"observable\"].box(undefined, {\n deep: true,\n equals: mobx__WEBPACK_IMPORTED_MODULE_0__[\"comparer\"].structural,\n })\n });\n Object.defineProperty(this, \"initialized\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: false\n });\n Object.defineProperty(this, \"onData\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: (data) => {\n const notEmpty = data != null;\n const notDefault = !this.isDefaultValue(data);\n if (notEmpty && notDefault) {\n this.set(data);\n }\n this.initialized = true;\n }\n });\n Object.defineProperty(this, \"onError\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: (error) => {\n _main_logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(`${StorageHelper.logPrefix} loading error: ${error}`, this);\n }\n });\n Object(mobx__WEBPACK_IMPORTED_MODULE_0__[\"makeObservable\"])(this);\n const { storage, autoInit = true } = options;\n this.storage = storage;\n this.data.observe_(({ newValue, oldValue }) => {\n this.onChange(newValue, oldValue);\n });\n if (autoInit) {\n this.init();\n }\n }\n get whenReady() {\n return Object(mobx__WEBPACK_IMPORTED_MODULE_0__[\"when\"])(() => this.initialized);\n }\n get defaultValue() {\n // return as-is since options.defaultValue might be a getter too\n return this.options.defaultValue;\n }\n init({ force = false } = {}) {\n if (this.initialized && !force) {\n return;\n }\n try {\n const data = this.storage.getItem(this.key);\n if (data instanceof Promise) {\n data.then(this.onData, this.onError);\n }\n else {\n this.onData(data);\n }\n }\n catch (error) {\n this.onError(error);\n }\n }\n isDefaultValue(value) {\n return Object(lodash__WEBPACK_IMPORTED_MODULE_2__[\"isEqual\"])(value, this.defaultValue);\n }\n onChange(value, oldValue) {\n var _a, _b;\n if (!this.initialized)\n return;\n try {\n if (value == null) {\n this.storage.removeItem(this.key);\n }\n else {\n this.storage.setItem(this.key, value);\n }\n (_b = (_a = this.storage).onChange) === null || _b === void 0 ? void 0 : _b.call(_a, { value, oldValue, key: this.key });\n }\n catch (error) {\n _main_logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(`${StorageHelper.logPrefix} updating storage: ${error}`, this, { value, oldValue });\n }\n }\n get() {\n var _a;\n return (_a = this.data.get()) !== null && _a !== void 0 ? _a : this.defaultValue;\n }\n set(value) {\n if (this.isDefaultValue(value)) {\n this.reset();\n }\n else {\n this.data.set(value);\n }\n }\n reset() {\n this.data.set(undefined);\n }\n merge(value) {\n const nextValue = Object(immer__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(this.toJSON(), (draft) => {\n if (typeof value == \"function\") {\n const newValue = value(draft);\n // merge returned plain objects from `value-as-callback` usage\n // otherwise `draft` can be just modified inside a callback without returning any value (void)\n if (newValue && !Object(immer__WEBPACK_IMPORTED_MODULE_1__[\"isDraft\"])(newValue)) {\n Object.assign(draft, newValue);\n }\n }\n else if (Object(lodash__WEBPACK_IMPORTED_MODULE_2__[\"isPlainObject\"])(value)) {\n Object.assign(draft, value);\n }\n return draft;\n });\n this.set(nextValue);\n }\n toJSON() {\n return Object(mobx__WEBPACK_IMPORTED_MODULE_0__[\"toJS\"])(this.get());\n }\n}\nObject.defineProperty(StorageHelper, \"logPrefix\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"[StorageHelper]:\"\n});\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"observable\"],\n __metadata(\"design:type\", Object)\n], StorageHelper.prototype, \"initialized\", void 0);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Object]),\n __metadata(\"design:returntype\", void 0)\n], StorageHelper.prototype, \"init\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Object]),\n __metadata(\"design:returntype\", void 0)\n], StorageHelper.prototype, \"set\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", []),\n __metadata(\"design:returntype\", void 0)\n], StorageHelper.prototype, \"reset\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Object]),\n __metadata(\"design:returntype\", void 0)\n], StorageHelper.prototype, \"merge\", null);\n\n\n//# sourceURL=webpack:///./src/renderer/utils/storageHelper.ts?");
|
|
42357
42357
|
|
|
42358
42358
|
/***/ }),
|
|
42359
42359
|
|