mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Compare commits
No commits in common. "master" and "v6.5.0-alpha.9" have entirely different histories.
master
...
v6.5.0-alp
2
.github/workflows/check-docs.yml
vendored
2
.github/workflows/check-docs.yml
vendored
@ -23,7 +23,7 @@ jobs:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- name: Install specific npm version
|
||||
run: npm install -g npm@^9.6.7
|
||||
run: npm install -g npm@9.6.5
|
||||
|
||||
- name: Generate Extensions API Reference using typedocs
|
||||
run: |
|
||||
|
||||
2
.github/workflows/cron-test.yaml
vendored
2
.github/workflows/cron-test.yaml
vendored
@ -28,7 +28,7 @@ jobs:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- name: Install specific npm version
|
||||
run: npm install -g npm@^9.6.7
|
||||
run: npm install -g npm@9.6.5
|
||||
|
||||
- name: Get npm cache directory path
|
||||
if: ${{ runner.os != 'Windows' }}
|
||||
|
||||
4
.github/workflows/daily-alpha.yml
vendored
4
.github/workflows/daily-alpha.yml
vendored
@ -10,7 +10,6 @@ jobs:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
@ -19,7 +18,7 @@ jobs:
|
||||
registry-url: "https://npm.pkg.github.com"
|
||||
|
||||
- name: Install specific npm version
|
||||
run: npm install -g npm@^9.6.7
|
||||
run: npm install -g npm@9.6.5
|
||||
|
||||
- name: Install deps
|
||||
run: |
|
||||
@ -35,5 +34,4 @@ jobs:
|
||||
env:
|
||||
BUMP_PACKAGE_ARGS: -- --conventional-commits --conventional-prerelease --yes
|
||||
PICK_ALL_PRS: "true"
|
||||
FAIL_ON_NO_CHANGES: "false"
|
||||
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||
|
||||
5
.github/workflows/linter.yml
vendored
5
.github/workflows/linter.yml
vendored
@ -23,7 +23,7 @@ jobs:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- name: Install specific npm version
|
||||
run: npm install -g npm@^9.6.7
|
||||
run: npm install -g npm@9.6.5
|
||||
|
||||
- name: Install deps
|
||||
run: npm install
|
||||
@ -33,6 +33,3 @@ jobs:
|
||||
|
||||
- name: Verify Publish Configurations
|
||||
run: ./scripts/lint-publish-configs.sh
|
||||
|
||||
- name: Verify No Duplicate Dependencies
|
||||
run: ./scripts/lint-package-dependencies.sh
|
||||
|
||||
2
.github/workflows/mkdocs-manual.yml
vendored
2
.github/workflows/mkdocs-manual.yml
vendored
@ -36,7 +36,7 @@ jobs:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- name: Install specific npm version
|
||||
run: npm install -g npm@^9.6.7
|
||||
run: npm install -g npm@9.6.5
|
||||
|
||||
- name: Generate Extensions API Reference using typedocs
|
||||
run: |
|
||||
|
||||
4
.github/workflows/publish-docs.yml
vendored
4
.github/workflows/publish-docs.yml
vendored
@ -33,7 +33,7 @@ jobs:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- name: Install specific npm version
|
||||
run: npm install -g npm@^9.6.7
|
||||
run: npm install -g npm@9.6.5
|
||||
|
||||
- name: Generate Extensions API Reference using typedocs
|
||||
run: |
|
||||
@ -79,7 +79,7 @@ jobs:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- name: Install specific npm version
|
||||
run: npm install -g npm@^9.6.7
|
||||
run: npm install -g npm@9.6.5
|
||||
|
||||
- name: Generate Extensions API Reference using typedocs
|
||||
run: |
|
||||
|
||||
2
.github/workflows/publish-release-npm.yml
vendored
2
.github/workflows/publish-release-npm.yml
vendored
@ -31,7 +31,7 @@ jobs:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- name: Install specific npm version
|
||||
run: npm install -g npm@^9.6.7
|
||||
run: npm install -g npm@9.6.5
|
||||
|
||||
- name: Generate NPM packages
|
||||
run: |
|
||||
|
||||
4
.github/workflows/test.yml
vendored
4
.github/workflows/test.yml
vendored
@ -35,7 +35,7 @@ jobs:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- name: Install specific npm version
|
||||
run: npm install -g npm@^9.6.7
|
||||
run: npm install -g npm@9.6.5
|
||||
|
||||
- name: Get npm cache directory path
|
||||
if: ${{ runner.os != 'Windows' }}
|
||||
@ -105,7 +105,7 @@ jobs:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- name: Install specific npm version
|
||||
run: npm install -g npm@^9.6.7
|
||||
run: npm install -g npm@9.6.5
|
||||
|
||||
- name: Get npm cache directory path
|
||||
if: ${{ runner.os != 'Windows' }}
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@ -9,6 +9,3 @@ lerna-debug.log
|
||||
coverage
|
||||
dist
|
||||
node_modules
|
||||
.linkable.json
|
||||
yalc.lock
|
||||
.yalc
|
||||
|
||||
@ -1,7 +1,3 @@
|
||||
open-lens/dist
|
||||
open-lens/static/build
|
||||
open-lens/static/webpack
|
||||
open-lens/binaries
|
||||
packages/**/dist
|
||||
packages/**/static/build
|
||||
packages/**/build/webpack
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
# Contributing to Lens
|
||||
|
||||
See [Contributing to Lens](https://docs.k8slens.dev/contributing/contribute-to-lens/) documentation.
|
||||
See [Contributing to Lens](https://docs.k8slens.dev/contributing/) documentation.
|
||||
|
||||
23
nx.json
23
nx.json
@ -4,7 +4,9 @@
|
||||
"runner": "nx/tasks-runners/default",
|
||||
"options": {
|
||||
"cacheableOperations": [
|
||||
"build"
|
||||
"build",
|
||||
"prepare:dev",
|
||||
"prepare:lint"
|
||||
]
|
||||
}
|
||||
}
|
||||
@ -15,29 +17,24 @@
|
||||
"^build"
|
||||
]
|
||||
},
|
||||
"build:app": {
|
||||
"dependsOn": [
|
||||
"^build"
|
||||
]
|
||||
},
|
||||
"test:integration": {
|
||||
"dependsOn": [
|
||||
"^build"
|
||||
]
|
||||
},
|
||||
"build:docs": {
|
||||
"dependsOn": [
|
||||
"^build"
|
||||
]
|
||||
},
|
||||
"dev": {
|
||||
"dependsOn": [
|
||||
"prepare:dev"
|
||||
]
|
||||
},
|
||||
"lint": {
|
||||
"dependsOn": [
|
||||
"^build"
|
||||
"^prepare:test"
|
||||
]
|
||||
},
|
||||
"test:unit": {
|
||||
"dependsOn": [
|
||||
"^build"
|
||||
"^prepare:test"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,434 +0,0 @@
|
||||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# 6.5.0 (2023-05-26)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.16 (2023-05-25)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Make application size not blow up by consolidating dependencies in core package to peerDependencies ([738985c](https://github.com/lensapp/lens/commit/738985c9b7406ef0722c3994c560f0337e3c5b7c))
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.15 (2023-05-23)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.14 (2023-05-23)
|
||||
|
||||
|
||||
### Reverts
|
||||
|
||||
* Revert "chore: Extract sidebar item injection token into separate package" ([8f4aa49](https://github.com/lensapp/lens/commit/8f4aa497cc54655f83813d57c224f77dd1472141))
|
||||
* Revert "chore: Update integration tests to new testid format" ([be1fbcf](https://github.com/lensapp/lens/commit/be1fbcf8c3642fbf5a5ee06c3b03ac1756e4b1dd))
|
||||
* Revert "chore: Improve title formatting for Horizontal/Vertical Pod Autoscalers" ([d4c12be](https://github.com/lensapp/lens/commit/d4c12becfc9020009d64f48e4c8f9dd3b7725bb6))
|
||||
* Revert "chore: Fix integration tests failing due to helm testid's changing" ([96b7ecb](https://github.com/lensapp/lens/commit/96b7ecbaddedd45cc667cc2d6c25fdc0813557ec))
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.13 (2023-05-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Copy fonts from @k8slens/core to open-lens correctly ([33a9f3e](https://github.com/lensapp/lens/commit/33a9f3ea3501c04738c8d74b82725bbe83e148bb))
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.12 (2023-05-16)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.11 (2023-05-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Add missing styles to fix terminal resizing ([6902851](https://github.com/lensapp/lens/commit/6902851026e74428f515fc5f3e01e6dc8a4c2d50))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.17 (2023-05-25)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Make application size not blow up by consolidating dependencies in core package to peerDependencies ([738985c](https://github.com/lensapp/lens/commit/738985c9b7406ef0722c3994c560f0337e3c5b7c))
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.15 (2023-05-23)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.14 (2023-05-23)
|
||||
|
||||
|
||||
### Reverts
|
||||
|
||||
* Revert "chore: Extract sidebar item injection token into separate package" ([8f4aa49](https://github.com/lensapp/lens/commit/8f4aa497cc54655f83813d57c224f77dd1472141))
|
||||
* Revert "chore: Update integration tests to new testid format" ([be1fbcf](https://github.com/lensapp/lens/commit/be1fbcf8c3642fbf5a5ee06c3b03ac1756e4b1dd))
|
||||
* Revert "chore: Improve title formatting for Horizontal/Vertical Pod Autoscalers" ([d4c12be](https://github.com/lensapp/lens/commit/d4c12becfc9020009d64f48e4c8f9dd3b7725bb6))
|
||||
* Revert "chore: Fix integration tests failing due to helm testid's changing" ([96b7ecb](https://github.com/lensapp/lens/commit/96b7ecbaddedd45cc667cc2d6c25fdc0813557ec))
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.13 (2023-05-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Copy fonts from @k8slens/core to open-lens correctly ([33a9f3e](https://github.com/lensapp/lens/commit/33a9f3ea3501c04738c8d74b82725bbe83e148bb))
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.12 (2023-05-16)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.11 (2023-05-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Add missing styles to fix terminal resizing ([6902851](https://github.com/lensapp/lens/commit/6902851026e74428f515fc5f3e01e6dc8a4c2d50))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.16 (2023-05-23)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.14 (2023-05-23)
|
||||
|
||||
|
||||
### Reverts
|
||||
|
||||
* Revert "chore: Extract sidebar item injection token into separate package" ([8f4aa49](https://github.com/lensapp/lens/commit/8f4aa497cc54655f83813d57c224f77dd1472141))
|
||||
* Revert "chore: Update integration tests to new testid format" ([be1fbcf](https://github.com/lensapp/lens/commit/be1fbcf8c3642fbf5a5ee06c3b03ac1756e4b1dd))
|
||||
* Revert "chore: Improve title formatting for Horizontal/Vertical Pod Autoscalers" ([d4c12be](https://github.com/lensapp/lens/commit/d4c12becfc9020009d64f48e4c8f9dd3b7725bb6))
|
||||
* Revert "chore: Fix integration tests failing due to helm testid's changing" ([96b7ecb](https://github.com/lensapp/lens/commit/96b7ecbaddedd45cc667cc2d6c25fdc0813557ec))
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.13 (2023-05-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Copy fonts from @k8slens/core to open-lens correctly ([33a9f3e](https://github.com/lensapp/lens/commit/33a9f3ea3501c04738c8d74b82725bbe83e148bb))
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.12 (2023-05-16)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.11 (2023-05-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Add missing styles to fix terminal resizing ([6902851](https://github.com/lensapp/lens/commit/6902851026e74428f515fc5f3e01e6dc8a4c2d50))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.15 (2023-05-23)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.14 (2023-05-23)
|
||||
|
||||
|
||||
### Reverts
|
||||
|
||||
* Revert "chore: Extract sidebar item injection token into separate package" ([8f4aa49](https://github.com/lensapp/lens/commit/8f4aa497cc54655f83813d57c224f77dd1472141))
|
||||
* Revert "chore: Update integration tests to new testid format" ([be1fbcf](https://github.com/lensapp/lens/commit/be1fbcf8c3642fbf5a5ee06c3b03ac1756e4b1dd))
|
||||
* Revert "chore: Improve title formatting for Horizontal/Vertical Pod Autoscalers" ([d4c12be](https://github.com/lensapp/lens/commit/d4c12becfc9020009d64f48e4c8f9dd3b7725bb6))
|
||||
* Revert "chore: Fix integration tests failing due to helm testid's changing" ([96b7ecb](https://github.com/lensapp/lens/commit/96b7ecbaddedd45cc667cc2d6c25fdc0813557ec))
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.13 (2023-05-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Copy fonts from @k8slens/core to open-lens correctly ([33a9f3e](https://github.com/lensapp/lens/commit/33a9f3ea3501c04738c8d74b82725bbe83e148bb))
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.12 (2023-05-16)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.11 (2023-05-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Add missing styles to fix terminal resizing ([6902851](https://github.com/lensapp/lens/commit/6902851026e74428f515fc5f3e01e6dc8a4c2d50))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.13 (2023-05-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Copy fonts from @k8slens/core to open-lens correctly ([33a9f3e](https://github.com/lensapp/lens/commit/33a9f3ea3501c04738c8d74b82725bbe83e148bb))
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.12 (2023-05-16)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.11 (2023-05-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Add missing styles to fix terminal resizing ([6902851](https://github.com/lensapp/lens/commit/6902851026e74428f515fc5f3e01e6dc8a4c2d50))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.12 (2023-05-16)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.11 (2023-05-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Add missing styles to fix terminal resizing ([6902851](https://github.com/lensapp/lens/commit/6902851026e74428f515fc5f3e01e6dc8a4c2d50))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.11 (2023-05-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Add missing styles to fix terminal resizing ([6902851](https://github.com/lensapp/lens/commit/6902851026e74428f515fc5f3e01e6dc8a4c2d50))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.10 (2023-05-09)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.9 (2023-05-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Add new packages to open-lens to fix build ([f2f6cc5](https://github.com/lensapp/lens/commit/f2f6cc500c38cdeb4d6e8bd1da16e36c61a07aea))
|
||||
* Disable cycle detection due to bug in ogre-tools ([d4e8b48](https://github.com/lensapp/lens/commit/d4e8b48b4a166e2aabeab76355765d78a445c43c))
|
||||
* Fix generating tray icons and downloading binaries on windows ([289d62c](https://github.com/lensapp/lens/commit/289d62caaadcf4899719c6a8b8c2ee4b7e725e9c))
|
||||
* Fix paths provided as parameters to workspace scripts ([d5acd57](https://github.com/lensapp/lens/commit/d5acd57584887f8eed544650761ef4408481a6a2))
|
||||
* Readd run-script-os to open-lens to fix build:app ([430beba](https://github.com/lensapp/lens/commit/430bebaa6f90941d0b7e2c88d59aaac0a9260d7f))
|
||||
* Revise paths for generating tray icons ([58b8b4f](https://github.com/lensapp/lens/commit/58b8b4f1f9113aaedb136ebbf00c568abea0173c))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Compute the kubectl download version map at build time ([0bd7b1f](https://github.com/lensapp/lens/commit/0bd7b1fe92a173379c8a5a1ab7e13cf9e4f8223b))
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.6 (2023-04-12)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.5 (2023-04-12)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.4 (2023-04-12)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* remove platform specific injectable file names ([9b0318b](https://github.com/lensapp/lens/commit/9b0318b493fe2e49a34b8a4cb3d0bef1600759b8))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Allow built versions to specify an environment ([#7495](https://github.com/lensapp/lens/issues/7495)) ([128b05d](https://github.com/lensapp/lens/commit/128b05d4d46344a511398f654865c133c6e36514))
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.3 (2023-03-15)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.2 (2023-03-14)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.1 (2023-03-14)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.13 (2023-02-03)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.12 (2023-02-01)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.11 (2023-02-01)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.10 (2023-01-27)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.9 (2023-01-27)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.8 (2023-01-27)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.7 (2023-01-27)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.6 (2023-01-26)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.5 (2023-01-26)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.4 (2023-01-26)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.3 (2023-01-26)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.9 (2023-05-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Add new packages to open-lens to fix build ([f2f6cc5](https://github.com/lensapp/lens/commit/f2f6cc500c38cdeb4d6e8bd1da16e36c61a07aea))
|
||||
* Disable cycle detection due to bug in ogre-tools ([d4e8b48](https://github.com/lensapp/lens/commit/d4e8b48b4a166e2aabeab76355765d78a445c43c))
|
||||
* Fix generating tray icons and downloading binaries on windows ([289d62c](https://github.com/lensapp/lens/commit/289d62caaadcf4899719c6a8b8c2ee4b7e725e9c))
|
||||
* Fix paths provided as parameters to workspace scripts ([d5acd57](https://github.com/lensapp/lens/commit/d5acd57584887f8eed544650761ef4408481a6a2))
|
||||
* Readd run-script-os to open-lens to fix build:app ([430beba](https://github.com/lensapp/lens/commit/430bebaa6f90941d0b7e2c88d59aaac0a9260d7f))
|
||||
* Revise paths for generating tray icons ([58b8b4f](https://github.com/lensapp/lens/commit/58b8b4f1f9113aaedb136ebbf00c568abea0173c))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Compute the kubectl download version map at build time ([0bd7b1f](https://github.com/lensapp/lens/commit/0bd7b1fe92a173379c8a5a1ab7e13cf9e4f8223b))
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.6 (2023-04-12)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.5 (2023-04-12)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.4 (2023-04-12)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* remove platform specific injectable file names ([9b0318b](https://github.com/lensapp/lens/commit/9b0318b493fe2e49a34b8a4cb3d0bef1600759b8))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Allow built versions to specify an environment ([#7495](https://github.com/lensapp/lens/issues/7495)) ([128b05d](https://github.com/lensapp/lens/commit/128b05d4d46344a511398f654865c133c6e36514))
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.3 (2023-03-15)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.2 (2023-03-14)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.1 (2023-03-14)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.13 (2023-02-03)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.12 (2023-02-01)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.11 (2023-02-01)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.10 (2023-01-27)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.9 (2023-01-27)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.8 (2023-01-27)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.7 (2023-01-27)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.6 (2023-01-26)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.5 (2023-01-26)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.4 (2023-01-26)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.3 (2023-01-26)
|
||||
@ -1,200 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import path from "path";
|
||||
import type webpack from "webpack";
|
||||
import HtmlWebpackPlugin from "html-webpack-plugin";
|
||||
import MiniCssExtractPlugin from "mini-css-extract-plugin";
|
||||
import ForkTsCheckerPlugin from "fork-ts-checker-webpack-plugin";
|
||||
import MonacoWebpackPlugin from "monaco-editor-webpack-plugin";
|
||||
import CircularDependencyPlugin from "circular-dependency-plugin";
|
||||
import ReactRefreshWebpackPlugin from "@pmmmwh/react-refresh-webpack-plugin";
|
||||
import CopyPlugin from "copy-webpack-plugin";
|
||||
import type { WebpackPluginInstance } from "webpack";
|
||||
import { DefinePlugin } from "webpack";
|
||||
import {
|
||||
assetsFolderName,
|
||||
isDevelopment,
|
||||
rendererDir,
|
||||
buildDir,
|
||||
htmlTemplate,
|
||||
publicPath,
|
||||
} from "./vars";
|
||||
import corePackageJson from "@k8slens/core/package.json";
|
||||
|
||||
const renderer: webpack.Configuration = {
|
||||
target: "electron-renderer",
|
||||
name: "lens-app-renderer",
|
||||
mode: isDevelopment ? "development" : "production",
|
||||
// https://webpack.js.org/configuration/devtool/ (see description of each option)
|
||||
devtool: isDevelopment ? "cheap-module-source-map" : "source-map",
|
||||
cache: isDevelopment ? { type: "filesystem" } : false,
|
||||
entry: {
|
||||
lens: path.resolve(rendererDir, "index.ts"),
|
||||
},
|
||||
output: {
|
||||
libraryTarget: "global",
|
||||
globalObject: "this",
|
||||
publicPath,
|
||||
path: buildDir,
|
||||
filename: "[name].js",
|
||||
chunkFilename: "chunks/[name].js",
|
||||
assetModuleFilename: `${assetsFolderName}/[name][ext][query]`,
|
||||
},
|
||||
watchOptions: {
|
||||
ignored: /node_modules/, // https://webpack.js.org/configuration/watch/
|
||||
},
|
||||
ignoreWarnings: [
|
||||
/Critical dependency: the request of a dependency is an expression/,
|
||||
/require.extensions is not supported by webpack./, // handlebars
|
||||
/\[ReactRefreshPlugin] .*?HMR.*? is not enabled/, // enabled in webpack.dev-server
|
||||
],
|
||||
resolve: {
|
||||
extensions: [".js", ".jsx", ".json", ".ts", ".tsx"],
|
||||
},
|
||||
externals: ["npm", "win-ca"],
|
||||
optimization: {
|
||||
minimize: false,
|
||||
},
|
||||
module: {
|
||||
parser: {
|
||||
javascript: {
|
||||
commonjsMagicComments: true,
|
||||
},
|
||||
},
|
||||
rules: [
|
||||
{
|
||||
test: /\.node$/,
|
||||
use: "node-loader",
|
||||
},
|
||||
{
|
||||
test: /\.tsx?$/,
|
||||
loader: "ts-loader",
|
||||
options: {},
|
||||
},
|
||||
cssModulesWebpackRule(),
|
||||
...iconsAndImagesWebpackRules(),
|
||||
...fontsLoaderWebpackRules(),
|
||||
],
|
||||
},
|
||||
|
||||
plugins: [
|
||||
new DefinePlugin({
|
||||
CONTEXT_MATCHER_FOR_NON_FEATURES: `/\\.injectable\\.tsx?$/`,
|
||||
CONTEXT_MATCHER_FOR_FEATURES: `/\\/(renderer|common)\\/.+\\.injectable\\.tsx?$/`,
|
||||
}),
|
||||
new ForkTsCheckerPlugin(),
|
||||
|
||||
// see also: https://github.com/Microsoft/monaco-editor-webpack-plugin#options
|
||||
new MonacoWebpackPlugin({
|
||||
// publicPath: "/",
|
||||
// filename: "[name].worker.js",
|
||||
languages: ["json", "yaml"],
|
||||
globalAPI: isDevelopment,
|
||||
}),
|
||||
|
||||
new HtmlWebpackPlugin({
|
||||
filename: "index.html",
|
||||
template: htmlTemplate,
|
||||
inject: true,
|
||||
hash: true,
|
||||
templateParameters: {
|
||||
assetPath: `${publicPath}${assetsFolderName}`,
|
||||
},
|
||||
}),
|
||||
|
||||
new CircularDependencyPlugin({
|
||||
cwd: __dirname,
|
||||
exclude: /node_modules/,
|
||||
failOnError: true,
|
||||
}) as unknown as WebpackPluginInstance,
|
||||
|
||||
new MiniCssExtractPlugin({
|
||||
filename: "[name].css",
|
||||
}),
|
||||
|
||||
new CopyPlugin({
|
||||
patterns: [
|
||||
{
|
||||
from: path.resolve(
|
||||
path.dirname(require.resolve("@k8slens/core/package.json")),
|
||||
corePackageJson.exports["./fonts"]
|
||||
),
|
||||
to: "fonts/[name][ext]",
|
||||
},
|
||||
],
|
||||
}),
|
||||
|
||||
...(isDevelopment ? [new ReactRefreshWebpackPlugin()] : []),
|
||||
],
|
||||
};
|
||||
|
||||
/**
|
||||
* Import icons and image files.
|
||||
* Read more about asset types: https://webpack.js.org/guides/asset-modules/
|
||||
*/
|
||||
export function iconsAndImagesWebpackRules(): webpack.RuleSetRule[] {
|
||||
return [
|
||||
{
|
||||
test: /\.svg$/,
|
||||
type: "asset/source", // exports the source code of the asset, so we get XML
|
||||
},
|
||||
{
|
||||
test: /\.(jpg|png|ico)$/,
|
||||
type: "asset/resource",
|
||||
generator: {
|
||||
filename: "images/[name][ext]",
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Import custom fonts as URL.
|
||||
*/
|
||||
export function fontsLoaderWebpackRules(): webpack.RuleSetRule[] {
|
||||
return [
|
||||
{
|
||||
test: /\.(ttf|eot|woff2?)$/,
|
||||
type: "asset/resource",
|
||||
generator: {
|
||||
filename: "fonts/[name][ext]",
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
export interface CssModulesWebpackRuleOptions {
|
||||
styleLoader?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Import CSS or SASS styles with modules support (*.module.scss)
|
||||
*/
|
||||
export function cssModulesWebpackRule({
|
||||
styleLoader,
|
||||
}: CssModulesWebpackRuleOptions = {}): webpack.RuleSetRule {
|
||||
styleLoader ??= isDevelopment ? "style-loader" : MiniCssExtractPlugin.loader;
|
||||
|
||||
return {
|
||||
test: /\.s?css$/,
|
||||
use: [
|
||||
styleLoader,
|
||||
{
|
||||
loader: "css-loader",
|
||||
options: {
|
||||
sourceMap: isDevelopment,
|
||||
modules: {
|
||||
auto: /\.module\./i, // https://github.com/webpack-contrib/css-loader#auto
|
||||
mode: "local", // :local(.selector) by default
|
||||
localIdentName: "[name]__[local]--[hash:base64:5]",
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export default renderer;
|
||||
13630
package-lock.json
generated
13630
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
18
package.json
18
package.json
@ -1,13 +1,14 @@
|
||||
{
|
||||
"name": "lens-monorepo",
|
||||
"private": true,
|
||||
|
||||
"workspaces": [
|
||||
"packages/**/*",
|
||||
"open-lens"
|
||||
"packages/**/*"
|
||||
],
|
||||
|
||||
"scripts": {
|
||||
"all:reinstall": "npm run clean:node_modules && npm run all:install",
|
||||
"all:install": "npx --yes --package npm@^9.6.7 npm install",
|
||||
"all:install": "npx --yes --package npm@9.6.5 npm install",
|
||||
"adr:create": "echo \"What is the title?\"; read title; adr new \"$title\"",
|
||||
"adr:change-status": "echo \"Decision number?:\"; read decision; adr status $decision",
|
||||
"adr:update-readme": "adr update",
|
||||
@ -18,16 +19,14 @@
|
||||
"clean": "lerna run clean --stream",
|
||||
"clean:node_modules": "lerna clean -y && rimraf node_modules",
|
||||
"dev": "cross-env NODE_ENV=development lerna run build --stream --skip-nx-cache",
|
||||
"postdev": "lerna watch -- lerna run build --stream --include-dependents --scope \\$LERNA_PACKAGE_NAME",
|
||||
"prestart-dev": "cd ./open-lens && npm run build:tray-icons && npm run download:binaries",
|
||||
"postdev": "lerna watch -- lerna run build --stream --scope \\$LERNA_PACKAGE_NAME",
|
||||
"prestart-dev": "cd packages/open-lens && rimraf static/build/ && npm run build:tray-icons && npm run download:binaries",
|
||||
"start-dev": "lerna run start",
|
||||
"postinstall": "linkable",
|
||||
"lint": "lerna run lint --stream --no-bail",
|
||||
"lint:fix": "lerna run lint:fix --stream",
|
||||
"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",
|
||||
"mkdocs:verify": "docker build -t mkdocs-serve-local:latest mkdocs/ && docker run --rm -v ${PWD}:/docs mkdocs-serve-local:latest build --strict",
|
||||
"test:unit": "lerna run --stream test:unit --no-bail",
|
||||
"test:unit:updatesnapshot": "lerna run --stream test:unit --no-bail -- -u",
|
||||
"test:unit:watch": "jest --watch",
|
||||
"test:integration": "lerna run --stream test:integration --no-bail",
|
||||
"bump-version": "lerna version --no-git-tag-version --no-push",
|
||||
@ -40,14 +39,13 @@
|
||||
"@types/react": "^17"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ogre-tools/linkable": "^17.2.0",
|
||||
"@ogre-tools/linkable": "^15.8.1",
|
||||
"adr": "^1.4.3",
|
||||
"cross-env": "^7.0.3",
|
||||
"lerna": "^6.6.1",
|
||||
"npm": "^9.6.7",
|
||||
"rimraf": "^4.4.1"
|
||||
},
|
||||
"engines": {
|
||||
"npm": "^9.6.7"
|
||||
"npm": "9.6.5"
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,123 +3,6 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# 1.0.0 (2023-05-26)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.14 (2023-05-23)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.13 (2023-05-16)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.12 (2023-05-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Don't crash when hovering hotbar menu index ([9d51ef2](https://github.com/lensapp/lens/commit/9d51ef2aa69c6c9df0fd57281b25131a10efd27a))
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.11 (2023-05-11)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.9 (2023-05-04)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.5 (2023-04-12)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.4 (2023-04-12)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 1.0.0-alpha.7 (2023-05-16)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.12 (2023-05-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Don't crash when hovering hotbar menu index ([9d51ef2](https://github.com/lensapp/lens/commit/9d51ef2aa69c6c9df0fd57281b25131a10efd27a))
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.11 (2023-05-11)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.9 (2023-05-04)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.5 (2023-04-12)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.4 (2023-04-12)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 1.0.0-alpha.6 (2023-05-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Don't crash when hovering hotbar menu index ([9d51ef2](https://github.com/lensapp/lens/commit/9d51ef2aa69c6c9df0fd57281b25131a10efd27a))
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.11 (2023-05-11)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.9 (2023-05-04)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.5 (2023-04-12)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.4 (2023-04-12)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 1.0.0-alpha.5 (2023-05-11)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.9 (2023-05-04)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.5 (2023-04-12)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.4 (2023-04-12)
|
||||
|
||||
**Note:** Version bump only for package @k8slens/keyboard-shortcuts
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 1.0.0-alpha.4 (2023-05-04)
|
||||
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@k8slens/keyboard-shortcuts",
|
||||
"private": false,
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.0-alpha.4",
|
||||
"description": "Keyboard shortcuts for Lens",
|
||||
"type": "commonjs",
|
||||
"files": [
|
||||
@ -33,17 +33,17 @@
|
||||
"peerDependencies": {
|
||||
"@k8slens/feature-core": "^6.5.0-alpha.0",
|
||||
"@k8slens/react-application": "^1.0.0-alpha.0",
|
||||
"@ogre-tools/fp": "^17.2.0",
|
||||
"@ogre-tools/injectable": "^17.2.0",
|
||||
"@ogre-tools/injectable-extension-for-auto-registration": "^17.2.0",
|
||||
"@ogre-tools/injectable-react": "^17.2.0",
|
||||
"@ogre-tools/fp": "^15.8.1",
|
||||
"@ogre-tools/injectable": "^15.8.1",
|
||||
"@ogre-tools/injectable-extension-for-auto-registration": "^15.8.1",
|
||||
"@ogre-tools/injectable-react": "^15.8.1",
|
||||
"lodash": "^4.17.21",
|
||||
"react": "^17 || ^18"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@async-fn/jest": "^1.6.4",
|
||||
"@k8slens/eslint-config": "^6.5.0",
|
||||
"@k8slens/react-testing-library-discovery": "^1.0.0",
|
||||
"@k8slens/webpack": "^6.5.0"
|
||||
"@k8slens/eslint-config": "^6.5.0-alpha.3",
|
||||
"@k8slens/react-testing-library-discovery": "^1.0.0-alpha.4",
|
||||
"@k8slens/webpack": "^6.5.0-alpha.5"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,11 +1,10 @@
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||
import React, { useEffect } from "react";
|
||||
|
||||
import invokeShortcutInjectable, { InvokeShortcut } from "./invoke-shortcut.injectable";
|
||||
|
||||
export interface KeyboardShortcutListenerProps {
|
||||
children: StrictReactNode;
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
interface Dependencies {
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import React from "react";
|
||||
|
||||
export interface KeyboardShortcutScopeProps {
|
||||
id: string;
|
||||
children: StrictReactNode;
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
export const KeyboardShortcutScope = ({ id, children }: KeyboardShortcutScopeProps) => (
|
||||
|
||||
@ -3,110 +3,6 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# 6.5.0 (2023-05-26)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.14 (2023-05-23)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.13 (2023-05-16)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.12 (2023-05-16)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.11 (2023-05-11)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.9 (2023-05-04)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Compute the kubectl download version map at build time ([0bd7b1f](https://github.com/lensapp/lens/commit/0bd7b1fe92a173379c8a5a1ab7e13cf9e4f8223b))
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.4 (2023-04-12)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.7 (2023-05-16)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.12 (2023-05-16)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.11 (2023-05-11)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.9 (2023-05-04)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Compute the kubectl download version map at build time ([0bd7b1f](https://github.com/lensapp/lens/commit/0bd7b1fe92a173379c8a5a1ab7e13cf9e4f8223b))
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.4 (2023-04-12)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.6 (2023-05-16)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.11 (2023-05-11)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.9 (2023-05-04)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Compute the kubectl download version map at build time ([0bd7b1f](https://github.com/lensapp/lens/commit/0bd7b1fe92a173379c8a5a1ab7e13cf9e4f8223b))
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.4 (2023-04-12)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.5 (2023-05-11)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.9 (2023-05-04)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Compute the kubectl download version map at build time ([0bd7b1f](https://github.com/lensapp/lens/commit/0bd7b1fe92a173379c8a5a1ab7e13cf9e4f8223b))
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.4 (2023-04-12)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.4 (2023-05-04)
|
||||
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@k8slens/cluster-settings",
|
||||
"version": "6.5.0",
|
||||
"version": "6.5.0-alpha.4",
|
||||
"description": "Injection token exporter for cluster settings configuration",
|
||||
"license": "MIT",
|
||||
"type": "commonjs",
|
||||
@ -19,10 +19,10 @@
|
||||
"build": "lens-webpack-build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@k8slens/webpack": "^6.5.0",
|
||||
"@k8slens/webpack": "^6.5.0-alpha.5",
|
||||
"rimraf": "^4.4.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@ogre-tools/injectable": "^17.2.0"
|
||||
"@ogre-tools/injectable": "^15.8.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +0,0 @@
|
||||
module.exports = {
|
||||
extends: "@k8slens/eslint-config/eslint",
|
||||
parserOptions: {
|
||||
project: "./tsconfig.json",
|
||||
},
|
||||
};
|
||||
@ -1 +0,0 @@
|
||||
"@k8slens/eslint-config/prettier"
|
||||
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
export * from "./src/tokens";
|
||||
export * from "./src/feature";
|
||||
export { default as sidebarItemsInjectable } from "./src/sidebar-items.injectable";
|
||||
@ -1 +0,0 @@
|
||||
module.exports = require("@k8slens/jest").monorepoPackageConfig(__dirname).configForReact;
|
||||
@ -1,48 +0,0 @@
|
||||
{
|
||||
"name": "@k8slens/cluster-sidebar",
|
||||
"private": false,
|
||||
"version": "1.0.0",
|
||||
"description": "Injection tokens for adding new sidebar items within the Cluster View",
|
||||
"type": "commonjs",
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"registry": "https://registry.npmjs.org/"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/lensapp/lens.git"
|
||||
},
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"author": {
|
||||
"name": "OpenLens Authors",
|
||||
"email": "info@k8slens.dev"
|
||||
},
|
||||
"license": "MIT",
|
||||
"homepage": "https://github.com/lensapp/lens",
|
||||
"scripts": {
|
||||
"build": "lens-webpack-build",
|
||||
"clean": "rimraf dist/",
|
||||
"test": "jest --coverage --runInBand",
|
||||
"lint": "lens-lint",
|
||||
"lint:fix": "lens-lint --fix"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@k8slens/feature-core": "^6.5.0-alpha.4",
|
||||
"@k8slens/utilities": "^1.0.0-alpha.3",
|
||||
"@ogre-tools/injectable": "^17.2.0",
|
||||
"@ogre-tools/injectable-extension-for-auto-registration": "^17.2.0",
|
||||
"@ogre-tools/injectable-extension-for-mobx": "^17.2.0",
|
||||
"mobx": "^6.9.0",
|
||||
"react": "^17.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@k8slens/eslint-config": "^6.5.0-alpha.3",
|
||||
"@k8slens/jest": "^6.5.0-alpha.5",
|
||||
"@k8slens/typescript": "^6.5.0-alpha.2",
|
||||
"@k8slens/webpack": "^6.5.0-alpha.5"
|
||||
}
|
||||
}
|
||||
@ -1,14 +0,0 @@
|
||||
import { getFeature } from "@k8slens/feature-core";
|
||||
import { autoRegister } from "@ogre-tools/injectable-extension-for-auto-registration";
|
||||
|
||||
export const clusterSidebarFeature = getFeature({
|
||||
id: "cluster-side-feature",
|
||||
|
||||
register: (di) => {
|
||||
autoRegister({
|
||||
di,
|
||||
targetModule: module,
|
||||
getRequireContexts: () => [require.context("./", true, /\.injectable\.(ts|tsx)$/)],
|
||||
});
|
||||
},
|
||||
});
|
||||
@ -1,174 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { createContainer, DiContainer, getInjectable } from "@ogre-tools/injectable";
|
||||
import { computed, IComputedValue } from "mobx";
|
||||
import { noop } from "lodash/fp";
|
||||
import sidebarItemsInjectable from "./sidebar-items.injectable";
|
||||
import { SidebarItemDeclaration, sidebarItemInjectionToken } from "./tokens";
|
||||
import { registerMobX } from "@ogre-tools/injectable-extension-for-mobx";
|
||||
import { clusterSidebarFeature } from "./feature";
|
||||
|
||||
const someParentSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-some-parent",
|
||||
instantiate: () => ({
|
||||
parentId: null,
|
||||
title: "Some parent",
|
||||
onClick: noop,
|
||||
orderNumber: 42,
|
||||
}),
|
||||
injectionToken: sidebarItemInjectionToken,
|
||||
});
|
||||
|
||||
const someOtherParentSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-some-other-parent",
|
||||
instantiate: () => ({
|
||||
parentId: null,
|
||||
title: "Some other parent",
|
||||
onClick: noop,
|
||||
orderNumber: 126,
|
||||
}),
|
||||
injectionToken: sidebarItemInjectionToken,
|
||||
});
|
||||
|
||||
const someAnotherParentSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-some-another-parent",
|
||||
instantiate: () => ({
|
||||
parentId: null,
|
||||
title: "Some another parent",
|
||||
onClick: noop,
|
||||
orderNumber: 84,
|
||||
}),
|
||||
injectionToken: sidebarItemInjectionToken,
|
||||
});
|
||||
|
||||
const someForthParentSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-some-forth-parent",
|
||||
instantiate: () => ({
|
||||
parentId: null,
|
||||
title: "Some another parent",
|
||||
onClick: noop,
|
||||
orderNumber: 84,
|
||||
isVisible: computed(() => false),
|
||||
isActive: computed(() => true),
|
||||
}),
|
||||
injectionToken: sidebarItemInjectionToken,
|
||||
});
|
||||
|
||||
const someChildSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-some-child",
|
||||
instantiate: () => ({
|
||||
parentId: someParentSidebarItemInjectable.id,
|
||||
title: "Some child",
|
||||
onClick: noop,
|
||||
orderNumber: 168,
|
||||
}),
|
||||
injectionToken: sidebarItemInjectionToken,
|
||||
});
|
||||
|
||||
const someOtherChildSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-some-other-child",
|
||||
instantiate: () => ({
|
||||
parentId: someParentSidebarItemInjectable.id,
|
||||
title: "Some other child",
|
||||
onClick: noop,
|
||||
orderNumber: 252,
|
||||
}),
|
||||
injectionToken: sidebarItemInjectionToken,
|
||||
});
|
||||
|
||||
const someAnotherChildSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-some-another-child",
|
||||
instantiate: () => ({
|
||||
parentId: someParentSidebarItemInjectable.id,
|
||||
title: "Some another child",
|
||||
onClick: noop,
|
||||
orderNumber: 210,
|
||||
}),
|
||||
injectionToken: sidebarItemInjectionToken,
|
||||
});
|
||||
|
||||
describe("order of sidebar items", () => {
|
||||
let di: DiContainer;
|
||||
let sidebarItems: IComputedValue<SidebarItemDeclaration[]>;
|
||||
|
||||
beforeEach(() => {
|
||||
di = createContainer("test");
|
||||
|
||||
di.register(
|
||||
someParentSidebarItemInjectable,
|
||||
someOtherParentSidebarItemInjectable,
|
||||
someAnotherParentSidebarItemInjectable,
|
||||
someChildSidebarItemInjectable,
|
||||
someOtherChildSidebarItemInjectable,
|
||||
someAnotherChildSidebarItemInjectable,
|
||||
someForthParentSidebarItemInjectable,
|
||||
);
|
||||
|
||||
clusterSidebarFeature.register(di);
|
||||
registerMobX(di);
|
||||
|
||||
sidebarItems = di.inject(sidebarItemsInjectable);
|
||||
});
|
||||
|
||||
it("has parent items in order", () => {
|
||||
const actual = sidebarItems.get().map((item) => item.id);
|
||||
|
||||
expect(actual).toEqual([
|
||||
"sidebar-item-some-parent",
|
||||
"sidebar-item-some-another-parent",
|
||||
"sidebar-item-some-forth-parent",
|
||||
"sidebar-item-some-other-parent",
|
||||
]);
|
||||
});
|
||||
|
||||
it("an item with no children and no isVisible configuration by default is visible", () => {
|
||||
const item = sidebarItems.get().find((item) => item.id === someAnotherParentSidebarItemInjectable.id);
|
||||
|
||||
expect(item?.isVisible.get()).toBe(true);
|
||||
});
|
||||
|
||||
it("an item with no children and an isVisible configuration is whatever the configuration specifies", () => {
|
||||
const item = sidebarItems.get().find((item) => item.id === someForthParentSidebarItemInjectable.id);
|
||||
|
||||
expect(item?.isVisible.get()).toBe(false);
|
||||
});
|
||||
|
||||
it("an item with children is visible if at least one of the children is visible", () => {
|
||||
const item = sidebarItems.get().find((item) => item.id === "sidebar-item-some-parent");
|
||||
|
||||
expect(item?.isVisible.get()).toBe(true);
|
||||
});
|
||||
|
||||
it("an item with no children and no isActive configuration by default is not active", () => {
|
||||
const item = sidebarItems.get().find((item) => item.id === someAnotherParentSidebarItemInjectable.id);
|
||||
|
||||
expect(item?.isActive.get()).toBe(false);
|
||||
});
|
||||
|
||||
it("an item with no children and an isActive configuration is whatever the configuration specifies", () => {
|
||||
const item = sidebarItems.get().find((item) => item.id === someForthParentSidebarItemInjectable.id);
|
||||
|
||||
expect(item?.isActive.get()).toBe(true);
|
||||
});
|
||||
|
||||
it("an item with children is active if at least one of the children is active", () => {
|
||||
const item = sidebarItems.get().find((item) => item.id === "sidebar-item-some-parent");
|
||||
|
||||
expect(item?.isActive.get()).toBe(false);
|
||||
});
|
||||
|
||||
it("has child items in order", () => {
|
||||
const actual = sidebarItems
|
||||
.get()
|
||||
.find((item) => item.id === "sidebar-item-some-parent")
|
||||
?.children.map((item) => item.id);
|
||||
|
||||
expect(actual).toEqual([
|
||||
"sidebar-item-some-child",
|
||||
"sidebar-item-some-another-child",
|
||||
"sidebar-item-some-other-child",
|
||||
]);
|
||||
});
|
||||
});
|
||||
@ -1,60 +0,0 @@
|
||||
import { getInjectable, InjectionInstanceWithMeta } from "@ogre-tools/injectable";
|
||||
import { computedInjectManyInjectable } from "@ogre-tools/injectable-extension-for-mobx";
|
||||
import { SidebarItemDeclaration, sidebarItemInjectionToken, SidebarItemRegistration } from "./tokens";
|
||||
import { computed } from "mobx";
|
||||
import { byOrderNumber } from "@k8slens/utilities";
|
||||
|
||||
const getSidebarItemsHierarchy = (
|
||||
registrations: InjectionInstanceWithMeta<SidebarItemRegistration>[],
|
||||
parentId: string | null,
|
||||
): SidebarItemDeclaration[] =>
|
||||
registrations
|
||||
.filter(({ instance }) => instance.parentId === parentId)
|
||||
.map(({ instance: { isActive, isVisible, ...registration }, meta: { id } }) => {
|
||||
const children = getSidebarItemsHierarchy(registrations, id);
|
||||
|
||||
return {
|
||||
...registration,
|
||||
id,
|
||||
children,
|
||||
isVisible: computed(() => {
|
||||
if (children.length === 0) {
|
||||
if (isVisible) {
|
||||
return isVisible.get();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return children.some((child) => child.isVisible.get());
|
||||
}),
|
||||
isActive: computed(() => {
|
||||
if (children.length === 0) {
|
||||
if (isActive) {
|
||||
return isActive.get();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return children.some((child) => child.isActive.get());
|
||||
}),
|
||||
};
|
||||
})
|
||||
.sort(byOrderNumber);
|
||||
|
||||
const sidebarItemsInjectable = getInjectable({
|
||||
id: "sidebar-items",
|
||||
instantiate: (di) => {
|
||||
const computedInjectMany = di.inject(computedInjectManyInjectable);
|
||||
const sidebarItemRegistrations = computedInjectMany(sidebarItemInjectionToken);
|
||||
|
||||
return computed(() => {
|
||||
void sidebarItemRegistrations.get();
|
||||
|
||||
return getSidebarItemsHierarchy(di.injectManyWithMeta(sidebarItemInjectionToken), null);
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
export default sidebarItemsInjectable;
|
||||
@ -1,34 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import { getInjectionToken } from "@ogre-tools/injectable";
|
||||
import type { IComputedValue } from "mobx";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
|
||||
export interface SidebarItemRegistration {
|
||||
id?: undefined;
|
||||
parentId: string | null;
|
||||
title: StrictReactNode;
|
||||
onClick: () => void;
|
||||
getIcon?: () => StrictReactNode;
|
||||
isActive?: IComputedValue<boolean>;
|
||||
isVisible?: IComputedValue<boolean>;
|
||||
orderNumber: number;
|
||||
}
|
||||
|
||||
export interface SidebarItemDeclaration {
|
||||
id: string;
|
||||
parentId: string | null;
|
||||
title: StrictReactNode;
|
||||
onClick: () => void;
|
||||
getIcon?: () => StrictReactNode;
|
||||
isActive: IComputedValue<boolean>;
|
||||
isVisible: IComputedValue<boolean>;
|
||||
children: SidebarItemDeclaration[];
|
||||
}
|
||||
|
||||
export const sidebarItemInjectionToken = getInjectionToken<SidebarItemRegistration>({
|
||||
id: "sidebar-item-injection-token",
|
||||
});
|
||||
@ -1,4 +0,0 @@
|
||||
{
|
||||
"extends": "@k8slens/typescript/config/base.json",
|
||||
"include": ["**/*.ts"]
|
||||
}
|
||||
@ -1 +0,0 @@
|
||||
module.exports = require("@k8slens/webpack").configForReact;
|
||||
File diff suppressed because it is too large
Load Diff
@ -3,7 +3,7 @@
|
||||
"productName": "",
|
||||
"description": "Lens Desktop Core",
|
||||
"homepage": "https://github.com/lensapp/lens",
|
||||
"version": "6.5.0",
|
||||
"version": "6.5.0-alpha.9",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/lensapp/lens.git"
|
||||
@ -18,13 +18,9 @@
|
||||
},
|
||||
"main": "static/build/main.js",
|
||||
"exports": {
|
||||
"./package.json": "./package.json",
|
||||
"./main": "./static/build/library/main.js",
|
||||
"./renderer": "./static/build/library/renderer.js",
|
||||
"./styles": "./static/build/library/renderer.css",
|
||||
"./template.html": "./src/renderer/template.html",
|
||||
"./vars.scss": "./src/renderer/components/vars.scss",
|
||||
"./fonts": "./static/build/library/fonts"
|
||||
"./styles": "./static/build/library/renderer.css"
|
||||
},
|
||||
"typesVersions": {
|
||||
"*": {
|
||||
@ -42,7 +38,7 @@
|
||||
"build/notarize.js",
|
||||
"static/build/library/**/*",
|
||||
"src/renderer/template.html",
|
||||
"src/renderer/components/vars.scss",
|
||||
"templates/**/*",
|
||||
"types/*",
|
||||
"tsconfig.json"
|
||||
],
|
||||
@ -100,14 +96,97 @@
|
||||
],
|
||||
"runtime": "@side/jest-runtime"
|
||||
},
|
||||
"nx": {
|
||||
"targets": {
|
||||
"build": {
|
||||
"dependsOn": [
|
||||
"^build"
|
||||
],
|
||||
"outputs": [
|
||||
"{workspaceRoot}/static/build/"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@astronautlabs/jsonpath": "^1.1.0",
|
||||
"@hapi/call": "^9.0.1",
|
||||
"@hapi/subtext": "^7.1.0",
|
||||
"@k8slens/list-layout": "^1.0.0-alpha.2",
|
||||
"@k8slens/metrics": "^6.5.0-alpha.5",
|
||||
"@k8slens/node-fetch": "^6.5.0-alpha.3",
|
||||
"@k8slens/react-application": "^1.0.0-alpha.3",
|
||||
"@k8slens/resource-templates": "^1.0.0-alpha.1",
|
||||
"@kubernetes/client-node": "^0.18.1",
|
||||
"@material-ui/styles": "^4.11.5",
|
||||
"@sentry/electron": "^3.0.8",
|
||||
"@sentry/integrations": "^6.19.3",
|
||||
"@side/jest-runtime": "^1.1.0",
|
||||
"auto-bind": "^4.0.0",
|
||||
"await-lock": "^2.2.2",
|
||||
"byline": "^5.0.0",
|
||||
"chokidar": "^3.5.3",
|
||||
"conf": "^10.2.0",
|
||||
"crypto-js": "^4.1.1",
|
||||
"electron-devtools-installer": "^3.2.0",
|
||||
"electron-updater": "^4.6.5",
|
||||
"electron-window-state": "^5.0.3",
|
||||
"filehound": "^1.17.6",
|
||||
"fs-extra": "^9.0.1",
|
||||
"glob-to-regexp": "^0.4.1",
|
||||
"grapheme-splitter": "^1.0.4",
|
||||
"handlebars": "^4.7.7",
|
||||
"history": "^4.10.1",
|
||||
"hpagent": "^1.2.0",
|
||||
"http-proxy": "^1.18.1",
|
||||
"immer": "^9.0.21",
|
||||
"joi": "^17.9.1",
|
||||
"js-yaml": "^4.1.0",
|
||||
"lodash": "^4.17.15",
|
||||
"marked": "^4.2.12",
|
||||
"md5-file": "^5.0.0",
|
||||
"mobx": "^6.8.0",
|
||||
"mobx-observable-history": "^2.0.3",
|
||||
"mobx-react": "^7.6.0",
|
||||
"mobx-utils": "^6.0.4",
|
||||
"moment": "^2.29.4",
|
||||
"moment-timezone": "^0.5.40",
|
||||
"node-pty": "0.10.1",
|
||||
"npm": "^9.6.5",
|
||||
"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.11",
|
||||
"react-router": "^5.3.4",
|
||||
"react-virtualized-auto-sizer": "^1.0.7",
|
||||
"readable-stream": "^3.6.0",
|
||||
"rfc6902": "^5.0.1",
|
||||
"selfsigned": "^2.1.1",
|
||||
"semver": "^7.3.8",
|
||||
"stoppable": "^1.1.0",
|
||||
"tar": "^6.1.13",
|
||||
"tcp-port-used": "^1.0.2",
|
||||
"tempy": "1.0.1",
|
||||
"typed-regex": "^0.0.8",
|
||||
"url-parse": "^1.5.10",
|
||||
"uuid": "^8.3.2",
|
||||
"win-ca": "^3.5.0",
|
||||
"winston": "^3.8.2",
|
||||
"winston-transport-browserconsole": "^1.0.5",
|
||||
"ws": "^8.12.1",
|
||||
"xterm-link-provider": "^1.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@async-fn/jest": "1.6.4",
|
||||
"@k8slens/messaging-fake-bridge": "^1.0.0",
|
||||
"@k8slens/react-testing-library-discovery": "^1.0.0",
|
||||
"@k8slens/test-utils": "^1.0.0",
|
||||
"@ogre-tools/linkable": "^17.2.0",
|
||||
"@k8slens/messaging-fake-bridge": "^1.0.0-alpha.4",
|
||||
"@k8slens/react-testing-library-discovery": "^1.0.0-alpha.4",
|
||||
"@material-ui/core": "^4.12.3",
|
||||
"@material-ui/icons": "^4.11.2",
|
||||
"@material-ui/lab": "^4.0.0-alpha.60",
|
||||
"@ogre-tools/linkable": "^15.8.1",
|
||||
"@sentry/types": "^6.19.7",
|
||||
"@side/jest-runtime": "^1.1.0",
|
||||
"@swc/cli": "^0.1.62",
|
||||
"@swc/core": "^1.3.53",
|
||||
"@swc/jest": "^0.2.26",
|
||||
@ -155,14 +234,24 @@
|
||||
"@types/url-parse": "^1.4.8",
|
||||
"@types/uuid": "^8.3.4",
|
||||
"@types/webpack": "^5.28.1",
|
||||
"@types/webpack-dev-server": "^4.7.2",
|
||||
"@types/webpack-env": "^1.18.0",
|
||||
"@types/webpack-node-externals": "^2.5.3",
|
||||
"@typescript-eslint/eslint-plugin": "^5.59.1",
|
||||
"@typescript-eslint/parser": "^5.59.1",
|
||||
"adr": "^1.4.3",
|
||||
"ansi_up": "^5.2.1",
|
||||
"chalk": "^4.1.2",
|
||||
"chart.js": "^2.9.4",
|
||||
"circular-dependency-plugin": "^5.2.2",
|
||||
"color": "^3.2.1",
|
||||
"command-line-args": "^5.2.1",
|
||||
"concurrently": "^7.6.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"css-loader": "^6.7.3",
|
||||
"deepdash": "^5.3.9",
|
||||
"dompurify": "^2.4.4",
|
||||
"electron": "^22.3.7",
|
||||
"electron-builder": "^23.6.0",
|
||||
"esbuild": "^0.17.8",
|
||||
"esbuild-loader": "^2.21.0",
|
||||
@ -174,151 +263,98 @@
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"eslint-plugin-unused-imports": "^2.0.0",
|
||||
"fork-ts-checker-webpack-plugin": "^7.3.0",
|
||||
"identity-obj-proxy": "^3.0.0",
|
||||
"ignore-loader": "^0.1.2",
|
||||
"include-media": "^1.4.10",
|
||||
"include-media": "^1.4.9",
|
||||
"jest": "^29.5.0",
|
||||
"jest-canvas-mock": "^2.3.1",
|
||||
"jest-environment-jsdom": "^28.1.3",
|
||||
"jest-mock-extended": "^2.0.9",
|
||||
"make-plural": "^6.2.2",
|
||||
"memfs": "^3.5.1",
|
||||
"memorystream": "^0.3.1",
|
||||
"mini-css-extract-plugin": "^2.7.2",
|
||||
"mock-http": "^1.1.0",
|
||||
"monaco-editor": "^0.37.1",
|
||||
"monaco-editor-webpack-plugin": "^7.0.1",
|
||||
"node-gyp": "^8.3.0",
|
||||
"node-loader": "^2.0.0",
|
||||
"nodemon": "^2.0.20",
|
||||
"postcss": "^8.4.23",
|
||||
"postcss-loader": "^6.2.1",
|
||||
"query-string": "^7.1.3",
|
||||
"randomcolor": "^0.6.2",
|
||||
"react-beautiful-dnd": "^13.1.1",
|
||||
"react-refresh": "^0.14.0",
|
||||
"react-refresh-typescript": "^2.0.7",
|
||||
"react-router-dom": "^5.3.4",
|
||||
"react-select": "^5.7.0",
|
||||
"react-select-event": "^5.5.1",
|
||||
"react-table": "^7.8.0",
|
||||
"react-window": "^1.8.8",
|
||||
"rimraf": "^4.4.1",
|
||||
"sass": "^1.62.1",
|
||||
"sass-loader": "^12.6.0",
|
||||
"style-loader": "^3.3.1",
|
||||
"tailwindcss": "^3.3.2",
|
||||
"ts-loader": "^9.4.2",
|
||||
"ts-node": "^10.9.1",
|
||||
"type-fest": "^2.14.0",
|
||||
"typed-emitter": "^1.4.0",
|
||||
"typedoc": "^0.24.6",
|
||||
"typedoc-plugin-markdown": "^3.15.1",
|
||||
"typescript": "^4.9.5",
|
||||
"typescript-plugin-css-modules": "^5.0.1",
|
||||
"typescript-plugin-css-modules": "^3.4.0",
|
||||
"webpack": "^5.81.0",
|
||||
"webpack-cli": "^4.9.2",
|
||||
"webpack-dev-server": "^4.13.3",
|
||||
"webpack-node-externals": "^3.0.0"
|
||||
"webpack-node-externals": "^3.0.0",
|
||||
"xterm": "4.17.0",
|
||||
"xterm-addon-fit": "^0.5.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@hapi/call": "^9.0.1",
|
||||
"@hapi/subtext": "^7.1.0",
|
||||
"@k8slens/animate": "^1.0.0-alpha.0",
|
||||
"@k8slens/notifications": "^1.0.0",
|
||||
"@k8slens/application": "^6.5.0-alpha.0",
|
||||
"@k8slens/application-for-electron-main": "^6.5.0-alpha.0",
|
||||
"@k8slens/button": "^1.0.0-alpha.5",
|
||||
"@k8slens/cluster-settings": "^6.5.0-alpha.1",
|
||||
"@k8slens/cluster-sidebar": "^1.0.0",
|
||||
"@k8slens/error-boundary": "^1.0.0-alpha.5",
|
||||
"@k8slens/event-emitter": "^1.0.0-alpha.1",
|
||||
"@k8slens/icon": "^1.0.0-alpha.7",
|
||||
"@k8slens/kube-api": "^1.0.0-alpha.1",
|
||||
"@k8slens/kube-api-specifics": "^1.0.0-alpha.1",
|
||||
"@k8slens/kube-object": "^1.0.0-alpha.5",
|
||||
"@k8slens/kubectl-versions": "^1.0.0-alpha.0",
|
||||
"@k8slens/legacy-extensions": "^1.0.0-alpha.0",
|
||||
"@k8slens/legacy-global-di": "^1.0.0-alpha.0",
|
||||
"@k8slens/list-layout": "^1.0.0-alpha.4",
|
||||
"@k8slens/logger": "^1.0.0-alpha.5",
|
||||
"@k8slens/messaging": "^1.0.0-alpha.1",
|
||||
"@k8slens/messaging-for-main": "^1.0.0-alpha.1",
|
||||
"@k8slens/messaging-for-renderer": "^1.0.0-alpha.1",
|
||||
"@k8slens/metrics": "^6.5.0-alpha.7",
|
||||
"@k8slens/node-fetch": "^6.5.0-alpha.3",
|
||||
"@k8slens/prometheus": "^1.0.0",
|
||||
"@k8slens/react-application": "^1.0.0-alpha.5",
|
||||
"@k8slens/random": "^1.0.0",
|
||||
"@k8slens/resizing-anchor": "^1.0.0-alpha.5",
|
||||
"@k8slens/resource-templates": "^1.0.0-alpha.1",
|
||||
"@k8slens/routing": "^1.0.0-alpha.5",
|
||||
"@k8slens/run-many": "^1.0.0-alpha.1",
|
||||
"@k8slens/spinner": "^1.0.0",
|
||||
"@k8slens/startable-stoppable": "^1.0.0-alpha.1",
|
||||
"@k8slens/test-utils": "^1.0.0-alpha.3",
|
||||
"@k8slens/tooltip": "^1.0.0-alpha.5",
|
||||
"@k8slens/utilities": "^1.0.0-alpha.1",
|
||||
"@kubernetes/client-node": "^0.18.1",
|
||||
"@material-ui/core": "^4.12.3",
|
||||
"@material-ui/lab": "^4.0.0-alpha.60",
|
||||
"@ogre-tools/fp": "^17.2.0",
|
||||
"@ogre-tools/injectable": "^17.2.0",
|
||||
"@ogre-tools/injectable-extension-for-auto-registration": "^17.2.0",
|
||||
"@ogre-tools/injectable-extension-for-mobx": "^17.2.0",
|
||||
"@ogre-tools/injectable-react": "^17.2.0",
|
||||
"@sentry/electron": "^3.0.8",
|
||||
"@sentry/integrations": "^6.19.3",
|
||||
"ansi_up": "^5.2.1",
|
||||
"auto-bind": "^4.0.0",
|
||||
"await-lock": "^2.2.2",
|
||||
"byline": "^5.0.0",
|
||||
"chalk": "^4.1.2",
|
||||
"chart.js": "^2.9.4",
|
||||
"chokidar": "^3.5.3",
|
||||
"color": "^3.2.1",
|
||||
"conf": "^10.2.0",
|
||||
"crypto-js": "^4.1.1",
|
||||
"dompurify": "^2.4.4",
|
||||
"electron": "^22.3.10",
|
||||
"electron-devtools-installer": "^3.2.0",
|
||||
"electron-updater": "^4.6.5",
|
||||
"electron-window-state": "^5.0.3",
|
||||
"fs-extra": "^9.0.1",
|
||||
"glob-to-regexp": "^0.4.1",
|
||||
"grapheme-splitter": "^1.0.4",
|
||||
"handlebars": "^4.7.7",
|
||||
"history": "^4.10.1",
|
||||
"hpagent": "^1.2.0",
|
||||
"http-proxy": "^1.18.1",
|
||||
"immer": "^9.0.21",
|
||||
"joi": "^17.9.1",
|
||||
"js-yaml": "^4.1.0",
|
||||
"lodash": "^4.17.15",
|
||||
"marked": "^4.2.12",
|
||||
"mobx": "^6.9.0",
|
||||
"mobx-observable-history": "^2.0.3",
|
||||
"mobx-react": "^7.6.0",
|
||||
"mobx-utils": "^6.0.4",
|
||||
"moment": "^2.29.4",
|
||||
"moment-timezone": "^0.5.40",
|
||||
"monaco-editor": "^0.38.0",
|
||||
"node-pty": "0.10.1",
|
||||
"npm": "^9.6.7",
|
||||
"path-to-regexp": "^6.2.0",
|
||||
"proper-lockfile": "^4.1.2",
|
||||
"query-string": "^7.1.3",
|
||||
"randomcolor": "^0.6.2",
|
||||
"react": "^17.0.2",
|
||||
"react-beautiful-dnd": "^13.1.1",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-material-ui-carousel": "^2.3.11",
|
||||
"react-router": "^5.3.4",
|
||||
"react-router-dom": "^5.3.4",
|
||||
"@ogre-tools/fp": "^15.8.1",
|
||||
"@ogre-tools/injectable": "^15.8.1",
|
||||
"@ogre-tools/injectable-extension-for-auto-registration": "^15.8.1",
|
||||
"@ogre-tools/injectable-extension-for-mobx": "^15.8.1",
|
||||
"@ogre-tools/injectable-react": "^15.8.1",
|
||||
"@types/byline": "^4.2.33",
|
||||
"@types/chart.js": "^2.9.36",
|
||||
"@types/color": "^3.0.3",
|
||||
"@types/crypto-js": "^3.1.47",
|
||||
"@types/lodash": "^4.14.191",
|
||||
"@types/proper-lockfile": "^4.1.2",
|
||||
"@types/react-dom": "^17.0.16",
|
||||
"@types/react-router-dom": "^5.3.3",
|
||||
"@types/react-virtualized-auto-sizer": "^1.0.1",
|
||||
"@types/react-window": "^1.8.5",
|
||||
"@types/tar": "^6.1.4",
|
||||
"@types/tcp-port-used": "^1.0.1",
|
||||
"@types/url-parse": "^1.4.8",
|
||||
"@types/uuid": "^8.3.4",
|
||||
"monaco-editor": "^0.37.1",
|
||||
"react-select": "^5.7.0",
|
||||
"react-select-event": "^5.5.1",
|
||||
"react-table": "^7.8.0",
|
||||
"react-virtualized-auto-sizer": "^1.0.7",
|
||||
"react-window": "^1.8.8",
|
||||
"rfc6902": "^5.0.1",
|
||||
"selfsigned": "^2.1.1",
|
||||
"semver": "^7.3.8",
|
||||
"stoppable": "^1.1.0",
|
||||
"tar": "^6.1.13",
|
||||
"tcp-port-used": "^1.0.2",
|
||||
"tempy": "1.0.1",
|
||||
"type-fest": "^2.14.0",
|
||||
"typed-emitter": "^1.4.0",
|
||||
"typed-regex": "^0.0.8",
|
||||
"url-parse": "^1.5.10",
|
||||
"uuid": "^8.3.2",
|
||||
"win-ca": "^3.5.0",
|
||||
"winston": "^3.8.2",
|
||||
"winston-transport-browserconsole": "^1.0.5",
|
||||
"ws": "^8.12.1",
|
||||
"xterm": "^4.19.0",
|
||||
"xterm-addon-fit": "^0.5.0",
|
||||
"xterm-link-provider": "^1.3.1"
|
||||
"xterm-addon-fit": "^0.5.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ const welcomeCatalogEntityInjectable = getInjectable({
|
||||
spec: {
|
||||
path: url,
|
||||
icon: {
|
||||
material: "home",
|
||||
material: "meeting_room",
|
||||
background: "#3d90ce",
|
||||
},
|
||||
},
|
||||
|
||||
@ -7,7 +7,7 @@ import EventEmitter from "events";
|
||||
import type TypedEmitter from "typed-emitter";
|
||||
import { observable, makeObservable } from "mobx";
|
||||
import { once } from "lodash";
|
||||
import type { Disposer, StrictReactNode } from "@k8slens/utilities";
|
||||
import type { Disposer } from "@k8slens/utilities";
|
||||
import { iter } from "@k8slens/utilities";
|
||||
import type { CategoryColumnRegistration, TitleCellProps } from "../../renderer/components/catalog/custom-category-columns";
|
||||
|
||||
@ -201,7 +201,7 @@ export abstract class CatalogCategory extends (EventEmitter as new () => TypedEm
|
||||
* Defaults to no badge.
|
||||
* The badge is displayed next to the Category name in the Catalog Category menu
|
||||
*/
|
||||
public getBadge(): StrictReactNode {
|
||||
public getBadge(): React.ReactNode {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { computed } from "mobx";
|
||||
import { frontEndRouteInjectionToken } from "../../../../front-end-route-injection-token";
|
||||
|
||||
const crdListRouteInjectable = getInjectable({
|
||||
id: "crd-list-route",
|
||||
|
||||
instantiate: () => ({
|
||||
path: "/crd/definitions",
|
||||
clusterFrame: true,
|
||||
isEnabled: computed(() => true),
|
||||
}),
|
||||
|
||||
injectionToken: frontEndRouteInjectionToken,
|
||||
});
|
||||
|
||||
export default crdListRouteInjectable;
|
||||
@ -3,11 +3,11 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { navigateToRouteInjectionToken } from "../../../navigate-to-route-injection-token";
|
||||
import crdListRouteInjectable from "./custom-resource-definitions.injectable";
|
||||
import crdListRouteInjectable from "./crd-list-route.injectable";
|
||||
import { navigateToRouteInjectionToken } from "../../../../navigate-to-route-injection-token";
|
||||
|
||||
const navigateToCustomResourceDefinitionsInjectable = getInjectable({
|
||||
id: "navigate-to-custom-resource-definitions",
|
||||
const navigateToCrdListInjectable = getInjectable({
|
||||
id: "navigate-to-crd-list",
|
||||
|
||||
instantiate: (di) => {
|
||||
const navigateToRoute = di.inject(navigateToRouteInjectionToken);
|
||||
@ -17,4 +17,4 @@ const navigateToCustomResourceDefinitionsInjectable = getInjectable({
|
||||
},
|
||||
});
|
||||
|
||||
export default navigateToCustomResourceDefinitionsInjectable;
|
||||
export default navigateToCrdListInjectable;
|
||||
@ -1,24 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { shouldShowResourceInjectionToken } from "../../../../../features/cluster/showing-kube-resources/common/allowed-resources-injection-token";
|
||||
import { frontEndRouteInjectionToken } from "../../../front-end-route-injection-token";
|
||||
|
||||
const customResourceDefinitionsRouteInjectable = getInjectable({
|
||||
id: "custom-resource-definitions-route",
|
||||
|
||||
instantiate: (di) => ({
|
||||
path: "/crd/definitions",
|
||||
clusterFrame: true,
|
||||
isEnabled: di.inject(shouldShowResourceInjectionToken, {
|
||||
group: "apiextensions.k8s.io",
|
||||
apiName: "customresourcedefinitions",
|
||||
}),
|
||||
}),
|
||||
|
||||
injectionToken: frontEndRouteInjectionToken,
|
||||
});
|
||||
|
||||
export default customResourceDefinitionsRouteInjectable;
|
||||
@ -4,19 +4,19 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { computed } from "mobx";
|
||||
import type { Route } from "../../../front-end-route-injection-token";
|
||||
import { frontEndRouteInjectionToken } from "../../../front-end-route-injection-token";
|
||||
import type { Route } from "../../../../front-end-route-injection-token";
|
||||
import { frontEndRouteInjectionToken } from "../../../../front-end-route-injection-token";
|
||||
|
||||
export interface CustomResourcesPathParameters {
|
||||
group: string;
|
||||
name: string;
|
||||
group?: string;
|
||||
name?: string;
|
||||
}
|
||||
|
||||
const customResourcesRouteInjectable = getInjectable({
|
||||
id: "custom-resources-route",
|
||||
|
||||
instantiate: (): Route<CustomResourcesPathParameters> => ({
|
||||
path: "/crd/:group/:name",
|
||||
path: "/crd/:group?/:name?",
|
||||
clusterFrame: true,
|
||||
isEnabled: computed(() => true),
|
||||
}),
|
||||
@ -3,20 +3,19 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { navigateToRouteInjectionToken } from "../../../navigate-to-route-injection-token";
|
||||
import type { CustomResourcesPathParameters } from "./custom-resources-route.injectable";
|
||||
import customResourcesRouteInjectable from "./custom-resources-route.injectable";
|
||||
|
||||
export type NavigateToCustomResources = (parameters: CustomResourcesPathParameters) => void;
|
||||
import { navigateToRouteInjectionToken } from "../../../../navigate-to-route-injection-token";
|
||||
|
||||
const navigateToCustomResourcesInjectable = getInjectable({
|
||||
id: "navigate-to-custom-resources",
|
||||
|
||||
instantiate: (di): NavigateToCustomResources => {
|
||||
instantiate: (di) => {
|
||||
const navigateToRoute = di.inject(navigateToRouteInjectionToken);
|
||||
const route = di.inject(customResourcesRouteInjectable);
|
||||
|
||||
return (parameters) => navigateToRoute(route, { parameters });
|
||||
return (parameters?: CustomResourcesPathParameters) =>
|
||||
navigateToRoute(route, { parameters });
|
||||
},
|
||||
});
|
||||
|
||||
@ -1,24 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { frontEndRouteInjectionToken } from "../../../../front-end-route-injection-token";
|
||||
import { shouldShowResourceInjectionToken } from "../../../../../../features/cluster/showing-kube-resources/common/allowed-resources-injection-token";
|
||||
|
||||
const ingressClassesRouteInjectable = getInjectable({
|
||||
id: "ingress-classes-route",
|
||||
|
||||
instantiate: (di) => ({
|
||||
path: "/ingress-classes",
|
||||
clusterFrame: true,
|
||||
isEnabled: di.inject(shouldShowResourceInjectionToken, {
|
||||
apiName: "ingressclasses",
|
||||
group: "networking.k8s.io",
|
||||
}),
|
||||
}),
|
||||
|
||||
injectionToken: frontEndRouteInjectionToken,
|
||||
});
|
||||
|
||||
export default ingressClassesRouteInjectable;
|
||||
@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { frontEndRouteInjectionToken } from "../../../../front-end-route-injection-token";
|
||||
import {
|
||||
shouldShowResourceInjectionToken,
|
||||
} from "../../../../../../features/cluster/showing-kube-resources/common/allowed-resources-injection-token";
|
||||
|
||||
const ingressClassesesRouteInjectable = getInjectable({
|
||||
id: "ingress-classes-route",
|
||||
|
||||
instantiate: (di) => {
|
||||
const isEnabled = di.inject(shouldShowResourceInjectionToken, {
|
||||
apiName: "ingressclasses",
|
||||
group: "networking.k8s.io",
|
||||
});
|
||||
|
||||
return {
|
||||
path: "/ingress-classes",
|
||||
clusterFrame: true,
|
||||
isEnabled,
|
||||
};
|
||||
},
|
||||
|
||||
injectionToken: frontEndRouteInjectionToken,
|
||||
});
|
||||
|
||||
export default ingressClassesesRouteInjectable;
|
||||
@ -4,14 +4,14 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { navigateToRouteInjectionToken } from "../../../../navigate-to-route-injection-token";
|
||||
import ingressClassesRouteInjectable from "./ingress-classes-route.injectable";
|
||||
import ingressClassesesRouteInjectable from "./ingress-classeses-route.injectable";
|
||||
|
||||
const navigateToIngressesInjectable = getInjectable({
|
||||
id: "navigate-to-ingress-classes",
|
||||
|
||||
instantiate: (di) => {
|
||||
const navigateToRoute = di.inject(navigateToRouteInjectionToken);
|
||||
const route = di.inject(ingressClassesRouteInjectable);
|
||||
const route = di.inject(ingressClassesesRouteInjectable);
|
||||
|
||||
return () => navigateToRoute(route);
|
||||
},
|
||||
|
||||
@ -26,11 +26,12 @@ export type ImplInitializableInjectionTokensArgs<T> = {
|
||||
token: Initializable<T>;
|
||||
init: (di: DiContainerForInjection) => T | Promise<T>;
|
||||
} & (
|
||||
| {
|
||||
{
|
||||
phase: InjectionToken<Runnable<void>, void>;
|
||||
runAfter?: Injectable<Runnable<void>, Runnable<void>, void>[];
|
||||
}
|
||||
| {
|
||||
|
|
||||
{
|
||||
runAfter: Injectable<Runnable<void>, Runnable<void>, void>;
|
||||
phase?: undefined;
|
||||
}
|
||||
|
||||
@ -11,12 +11,13 @@ import { getDiForUnitTesting } from "../../../renderer/getDiForUnitTesting";
|
||||
import storesAndApisCanBeCreatedInjectable from "../../../renderer/stores-apis-can-be-created.injectable";
|
||||
import directoryForKubeConfigsInjectable from "../../app-paths/directory-for-kube-configs/directory-for-kube-configs.injectable";
|
||||
import directoryForUserDataInjectable from "../../app-paths/directory-for-user-data/directory-for-user-data.injectable";
|
||||
import { logErrorInjectionToken, loggerInjectionToken, logInfoInjectionToken, logWarningInjectionToken } from "@k8slens/logger";
|
||||
import { loggerInjectionToken } from "@k8slens/logger";
|
||||
import type { ApiManager } from "../api-manager";
|
||||
import apiManagerInjectable from "../api-manager/manager.injectable";
|
||||
import { KubeApi } from "@k8slens/kube-api";
|
||||
import { KubeApi } from "../kube-api";
|
||||
import { KubeObject } from "@k8slens/kube-object";
|
||||
import { KubeObjectStore } from "../kube-object.store";
|
||||
import maybeKubeApiInjectable from "../maybe-kube-api.injectable";
|
||||
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import { KubeApi as ExternalKubeApi } from "../../../extensions/common-api/k8s-api";
|
||||
@ -24,7 +25,6 @@ import { Cluster } from "../../cluster/cluster";
|
||||
import { runInAction } from "mobx";
|
||||
import { customResourceDefinitionApiInjectionToken } from "../api-manager/crd-api-token";
|
||||
import assert from "assert";
|
||||
import { maybeKubeApiInjectable } from "@k8slens/kube-api-specifics";
|
||||
|
||||
class TestApi extends KubeApi<KubeObject> {
|
||||
protected checkPreferredVersion() {
|
||||
@ -58,12 +58,10 @@ describe("ApiManager", () => {
|
||||
|
||||
describe("registerApi", () => {
|
||||
it("re-register store if apiBase changed", () => {
|
||||
const apiBase = "api/v1/foo";
|
||||
const apiBase = "apis/v1/foo";
|
||||
const fallbackApiBase = "/apis/extensions/v1beta1/foo";
|
||||
const kubeApi = new TestApi({
|
||||
logError: di.inject(logErrorInjectionToken),
|
||||
logInfo: di.inject(logInfoInjectionToken),
|
||||
logWarn: di.inject(logWarningInjectionToken),
|
||||
logger: di.inject(loggerInjectionToken),
|
||||
maybeKubeApi: di.inject(maybeKubeApiInjectable),
|
||||
}, {
|
||||
objectConstructor: KubeObject,
|
||||
@ -138,9 +136,7 @@ describe("ApiManager", () => {
|
||||
|
||||
return Object.assign(
|
||||
new KubeApi({
|
||||
logError: di.inject(logErrorInjectionToken),
|
||||
logInfo: di.inject(logInfoInjectionToken),
|
||||
logWarn: di.inject(logWarningInjectionToken),
|
||||
logger: di.inject(loggerInjectionToken),
|
||||
maybeKubeApi: di.inject(maybeKubeApiInjectable),
|
||||
}, { objectConstructor }),
|
||||
{
|
||||
|
||||
@ -0,0 +1,52 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import { getDiForUnitTesting } from "../../../renderer/getDiForUnitTesting";
|
||||
import storesAndApisCanBeCreatedInjectable from "../../../renderer/stores-apis-can-be-created.injectable";
|
||||
import apiKubeInjectable from "../../../renderer/k8s/api-kube.injectable";
|
||||
import type { DeploymentApi } from "../endpoints/deployment.api";
|
||||
import deploymentApiInjectable from "../endpoints/deployment.api.injectable";
|
||||
import type { KubeJsonApi } from "../kube-json-api";
|
||||
|
||||
describe("DeploymentApi", () => {
|
||||
let deploymentApi: DeploymentApi;
|
||||
let kubeJsonApi: jest.Mocked<KubeJsonApi>;
|
||||
|
||||
beforeEach(() => {
|
||||
const di = getDiForUnitTesting();
|
||||
|
||||
di.override(storesAndApisCanBeCreatedInjectable, () => true);
|
||||
kubeJsonApi = {
|
||||
getResponse: jest.fn(),
|
||||
get: jest.fn(),
|
||||
post: jest.fn(),
|
||||
put: jest.fn(),
|
||||
patch: jest.fn(),
|
||||
del: jest.fn(),
|
||||
} as never;
|
||||
di.override(apiKubeInjectable, () => kubeJsonApi);
|
||||
|
||||
deploymentApi = di.inject(deploymentApiInjectable);
|
||||
});
|
||||
|
||||
describe("scale", () => {
|
||||
it("requests Kubernetes API with PATCH verb and correct amount of replicas", async () => {
|
||||
await deploymentApi.scale({ namespace: "default", name: "deployment-1" }, 5);
|
||||
|
||||
expect(kubeJsonApi.patch).toHaveBeenCalledWith("/apis/apps/v1/namespaces/default/deployments/deployment-1/scale", {
|
||||
data: {
|
||||
spec: {
|
||||
replicas: 5,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
"content-type": "application/merge-patch+json",
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,130 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
jest.mock("../kube-api");
|
||||
jest.mock("../api-manager", () => ({
|
||||
apiManager() {
|
||||
return {
|
||||
registerStore: jest.fn(),
|
||||
};
|
||||
},
|
||||
}));
|
||||
|
||||
import type { IKubeApiParsed } from "../kube-api-parse";
|
||||
import { parseKubeApi } from "../kube-api-parse";
|
||||
|
||||
/**
|
||||
* [<input-url>, <expected-result>]
|
||||
*/
|
||||
type KubeApiParseTestData = [string, IKubeApiParsed];
|
||||
|
||||
const tests: KubeApiParseTestData[] = [
|
||||
["/apis/apiextensions.k8s.io/v1beta1/customresourcedefinitions/prometheuses.monitoring.coreos.com", {
|
||||
apiBase: "/apis/apiextensions.k8s.io/v1beta1/customresourcedefinitions",
|
||||
apiPrefix: "/apis",
|
||||
apiGroup: "apiextensions.k8s.io",
|
||||
apiVersion: "v1beta1",
|
||||
apiVersionWithGroup: "apiextensions.k8s.io/v1beta1",
|
||||
namespace: undefined,
|
||||
resource: "customresourcedefinitions",
|
||||
name: "prometheuses.monitoring.coreos.com",
|
||||
}],
|
||||
["/api/v1/namespaces/kube-system/pods/coredns-6955765f44-v8p27", {
|
||||
apiBase: "/api/v1/pods",
|
||||
apiPrefix: "/api",
|
||||
apiGroup: "",
|
||||
apiVersion: "v1",
|
||||
apiVersionWithGroup: "v1",
|
||||
namespace: "kube-system",
|
||||
resource: "pods",
|
||||
name: "coredns-6955765f44-v8p27",
|
||||
}],
|
||||
["/apis/stable.example.com/foo1/crontabs", {
|
||||
apiBase: "/apis/stable.example.com/foo1/crontabs",
|
||||
apiPrefix: "/apis",
|
||||
apiGroup: "stable.example.com",
|
||||
apiVersion: "foo1",
|
||||
apiVersionWithGroup: "stable.example.com/foo1",
|
||||
resource: "crontabs",
|
||||
name: undefined,
|
||||
namespace: undefined,
|
||||
}],
|
||||
["/apis/cluster.k8s.io/v1alpha1/clusters", {
|
||||
apiBase: "/apis/cluster.k8s.io/v1alpha1/clusters",
|
||||
apiPrefix: "/apis",
|
||||
apiGroup: "cluster.k8s.io",
|
||||
apiVersion: "v1alpha1",
|
||||
apiVersionWithGroup: "cluster.k8s.io/v1alpha1",
|
||||
resource: "clusters",
|
||||
name: undefined,
|
||||
namespace: undefined,
|
||||
}],
|
||||
["/api/v1/namespaces", {
|
||||
apiBase: "/api/v1/namespaces",
|
||||
apiPrefix: "/api",
|
||||
apiGroup: "",
|
||||
apiVersion: "v1",
|
||||
apiVersionWithGroup: "v1",
|
||||
resource: "namespaces",
|
||||
name: undefined,
|
||||
namespace: undefined,
|
||||
}],
|
||||
["/api/v1/secrets", {
|
||||
apiBase: "/api/v1/secrets",
|
||||
apiPrefix: "/api",
|
||||
apiGroup: "",
|
||||
apiVersion: "v1",
|
||||
apiVersionWithGroup: "v1",
|
||||
resource: "secrets",
|
||||
name: undefined,
|
||||
namespace: undefined,
|
||||
}],
|
||||
["/api/v1/nodes/minikube", {
|
||||
apiBase: "/api/v1/nodes",
|
||||
apiPrefix: "/api",
|
||||
apiGroup: "",
|
||||
apiVersion: "v1",
|
||||
apiVersionWithGroup: "v1",
|
||||
resource: "nodes",
|
||||
name: "minikube",
|
||||
namespace: undefined,
|
||||
}],
|
||||
["/api/foo-bar/nodes/minikube", {
|
||||
apiBase: "/api/foo-bar/nodes",
|
||||
apiPrefix: "/api",
|
||||
apiGroup: "",
|
||||
apiVersion: "foo-bar",
|
||||
apiVersionWithGroup: "foo-bar",
|
||||
resource: "nodes",
|
||||
name: "minikube",
|
||||
namespace: undefined,
|
||||
}],
|
||||
["/api/v1/namespaces/kube-public", {
|
||||
apiBase: "/api/v1/namespaces",
|
||||
apiPrefix: "/api",
|
||||
apiGroup: "",
|
||||
apiVersion: "v1",
|
||||
apiVersionWithGroup: "v1",
|
||||
resource: "namespaces",
|
||||
name: "kube-public",
|
||||
namespace: undefined,
|
||||
}],
|
||||
];
|
||||
|
||||
const invalidTests = [
|
||||
undefined,
|
||||
"",
|
||||
"ajklsmh",
|
||||
];
|
||||
|
||||
describe("parseApi unit tests", () => {
|
||||
it.each(tests)("testing %j", (url, expected) => {
|
||||
expect(parseKubeApi(url)).toStrictEqual(expected);
|
||||
});
|
||||
|
||||
it.each(invalidTests)("testing %j should throw", (url) => {
|
||||
expect(parseKubeApi(url as never)).toBe(undefined);
|
||||
});
|
||||
});
|
||||
@ -3,8 +3,8 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import type { ApiManager } from "../api-manager";
|
||||
import type { IngressApi } from "@k8slens/kube-api";
|
||||
import { HorizontalPodAutoscalerApi } from "@k8slens/kube-api";
|
||||
import type { IngressApi } from "../endpoints";
|
||||
import { HorizontalPodAutoscalerApi } from "../endpoints";
|
||||
import { Ingress } from "@k8slens/kube-object";
|
||||
import { getDiForUnitTesting } from "../../../renderer/getDiForUnitTesting";
|
||||
import type { Fetch } from "../../fetch/fetch.injectable";
|
||||
@ -20,8 +20,9 @@ import hostedClusterInjectable from "../../../renderer/cluster-frame-context/hos
|
||||
import directoryForKubeConfigsInjectable from "../../app-paths/directory-for-kube-configs/directory-for-kube-configs.injectable";
|
||||
import apiManagerInjectable from "../api-manager/manager.injectable";
|
||||
import type { DiContainer } from "@ogre-tools/injectable";
|
||||
import { ingressApiInjectable, maybeKubeApiInjectable } from "@k8slens/kube-api-specifics";
|
||||
import { logErrorInjectionToken, logInfoInjectionToken, logWarningInjectionToken } from "@k8slens/logger";
|
||||
import ingressApiInjectable from "../endpoints/ingress.api.injectable";
|
||||
import { loggerInjectionToken } from "@k8slens/logger";
|
||||
import maybeKubeApiInjectable from "../maybe-kube-api.injectable";
|
||||
import { Cluster } from "../../cluster/cluster";
|
||||
|
||||
describe("KubeApi", () => {
|
||||
@ -709,9 +710,7 @@ describe("KubeApi", () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
horizontalPodAutoscalerApi = new HorizontalPodAutoscalerApi({
|
||||
logError: di.inject(logErrorInjectionToken),
|
||||
logInfo: di.inject(logInfoInjectionToken),
|
||||
logWarn: di.inject(logWarningInjectionToken),
|
||||
logger: di.inject(loggerInjectionToken),
|
||||
maybeKubeApi: di.inject(maybeKubeApiInjectable),
|
||||
}, {
|
||||
allowedUsableVersions: {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
import { noop } from "@k8slens/utilities";
|
||||
import type { KubeApi } from "@k8slens/kube-api";
|
||||
import type { KubeApi } from "../kube-api";
|
||||
import { KubeObject } from "@k8slens/kube-object";
|
||||
import type { KubeObjectStoreLoadingParams } from "../kube-object.store";
|
||||
import { KubeObjectStore } from "../kube-object.store";
|
||||
|
||||
@ -3,32 +3,33 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import { KubeJsonApi, StatefulSetApi } from "@k8slens/kube-api";
|
||||
import { flushPromises } from "@k8slens/test-utils";
|
||||
import asyncFn from "@async-fn/jest";
|
||||
import storesAndApisCanBeCreatedInjectable from "../../../renderer/stores-apis-can-be-created.injectable";
|
||||
import { getDiForUnitTesting } from "../../../renderer/getDiForUnitTesting";
|
||||
import apiKubeInjectable from "../../../renderer/k8s/api-kube.injectable";
|
||||
import type { StatefulSetApi } from "../endpoints";
|
||||
import statefulSetApiInjectable from "../endpoints/stateful-set.api.injectable";
|
||||
import type { KubeJsonApi } from "../kube-json-api";
|
||||
import type { AsyncFnMock } from "@async-fn/jest";
|
||||
import asyncFn from "@async-fn/jest";
|
||||
import { flushPromises } from "@k8slens/test-utils";
|
||||
|
||||
describe("StatefulSetApi", () => {
|
||||
let statefulSetApi: StatefulSetApi;
|
||||
let kubeJsonApi: KubeJsonApi;
|
||||
let kubeJsonApiPatchMock: AsyncFnMock<KubeJsonApi["patch"]>;
|
||||
let kubeJsonApiGetMock: AsyncFnMock<KubeJsonApi["get"]>;
|
||||
|
||||
beforeEach(() => {
|
||||
kubeJsonApiGetMock = asyncFn<KubeJsonApi["get"]>();
|
||||
kubeJsonApiPatchMock = asyncFn<KubeJsonApi["patch"]>();
|
||||
kubeJsonApi = {
|
||||
const di = getDiForUnitTesting();
|
||||
|
||||
di.override(storesAndApisCanBeCreatedInjectable, () => true);
|
||||
kubeJsonApiPatchMock = asyncFn();
|
||||
kubeJsonApiGetMock = asyncFn();
|
||||
di.override(apiKubeInjectable, () => ({
|
||||
get: kubeJsonApiGetMock,
|
||||
patch: kubeJsonApiPatchMock,
|
||||
} as Partial<KubeJsonApi> as KubeJsonApi;
|
||||
statefulSetApi = new StatefulSetApi({
|
||||
logger: {
|
||||
info: jest.fn(),
|
||||
debug: jest.fn(),
|
||||
error: jest.fn(),
|
||||
} as any,
|
||||
maybeKubeApi: kubeJsonApi,
|
||||
});
|
||||
} as Partial<KubeJsonApi> as KubeJsonApi));
|
||||
|
||||
statefulSetApi = di.inject(statefulSetApiInjectable);
|
||||
});
|
||||
|
||||
describe("scale", () => {
|
||||
@ -36,9 +37,7 @@ describe("StatefulSetApi", () => {
|
||||
const req = statefulSetApi.scale({ namespace: "default", name: "statefulset-1" }, 5);
|
||||
|
||||
await flushPromises();
|
||||
expect(kubeJsonApiPatchMock).toHaveBeenCalledWith(
|
||||
"/apis/apps/v1/namespaces/default/statefulsets/statefulset-1/scale",
|
||||
{
|
||||
expect(kubeJsonApiPatchMock).toHaveBeenCalledWith("/apis/apps/v1/namespaces/default/statefulsets/statefulset-1/scale", {
|
||||
data: {
|
||||
spec: {
|
||||
replicas: 5,
|
||||
@ -49,8 +48,7 @@ describe("StatefulSetApi", () => {
|
||||
headers: {
|
||||
"content-type": "application/merge-patch+json",
|
||||
},
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
await kubeJsonApiPatchMock.resolve({});
|
||||
await req;
|
||||
@ -60,7 +58,7 @@ describe("StatefulSetApi", () => {
|
||||
const req = statefulSetApi.getReplicas({ namespace: "default", name: "statefulset-1" });
|
||||
|
||||
await flushPromises();
|
||||
expect(kubeJsonApi.get).toHaveBeenCalledWith("/apis/apps/v1/namespaces/default/statefulsets/statefulset-1/scale");
|
||||
expect(kubeJsonApiGetMock).toHaveBeenCalledWith("/apis/apps/v1/namespaces/default/statefulsets/statefulset-1/scale");
|
||||
await kubeJsonApiGetMock.resolve({ status: { replicas: 10 }});
|
||||
|
||||
expect(await req).toBe(10);
|
||||
@ -7,9 +7,9 @@ import type { KubeObjectStore } from "../kube-object.store";
|
||||
|
||||
import type { IComputedValue } from "mobx";
|
||||
import { autorun, action, observable } from "mobx";
|
||||
import type { KubeApi } from "@k8slens/kube-api";
|
||||
import type { KubeApi } from "../kube-api";
|
||||
import type { KubeObject, ObjectReference } from "@k8slens/kube-object";
|
||||
import { parseKubeApi, createKubeApiURL } from "@k8slens/kube-api";
|
||||
import { parseKubeApi, createKubeApiURL } from "../kube-api-parse";
|
||||
import { getOrInsertWith, iter } from "@k8slens/utilities";
|
||||
import type { CreateCustomResourceStore } from "./create-custom-resource-store.injectable";
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import EventEmitter from "events";
|
||||
import type TypedEventEmitter from "typed-emitter";
|
||||
import type { KubeApi } from "@k8slens/kube-api";
|
||||
import type { KubeApi } from "../kube-api";
|
||||
|
||||
export interface LegacyAutoRegistration {
|
||||
kubeApi: (api: KubeApi<any, any>) => void;
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
import { getInjectionToken } from "@ogre-tools/injectable";
|
||||
import type { KubeApi } from "@k8slens/kube-api";
|
||||
import type { KubeApi } from "../kube-api";
|
||||
|
||||
export const customResourceDefinitionApiInjectionToken = getInjectionToken<KubeApi>({
|
||||
id: "custom-resource-definition-api-token",
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import clusterFrameContextForNamespacedResourcesInjectable from "../../../renderer/cluster-frame-context/for-namespaced-resources.injectable";
|
||||
import { loggerInjectionToken } from "@k8slens/logger";
|
||||
import type { KubeApi } from "@k8slens/kube-api";
|
||||
import type { KubeApi } from "../kube-api";
|
||||
import type { KubeObject } from "@k8slens/kube-object";
|
||||
import type { KubeObjectStoreDependencies } from "../kube-object.store";
|
||||
import { CustomResourceStore } from "./resource.store";
|
||||
|
||||
@ -3,10 +3,11 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { storesAndApisCanBeCreatedInjectionToken } from "../stores-apis-can-be-created.token";
|
||||
import { ApiManager } from "./api-manager";
|
||||
import { computedInjectManyInjectable } from "@ogre-tools/injectable-extension-for-mobx";
|
||||
import { kubeObjectStoreInjectionToken } from "./kube-object-store-token";
|
||||
import { kubeApiInjectionToken, storesAndApisCanBeCreatedInjectionToken } from "@k8slens/kube-api-specifics";
|
||||
import { kubeApiInjectionToken } from "../kube-api/kube-api-injection-token";
|
||||
import { computed } from "mobx";
|
||||
import { customResourceDefinitionApiInjectionToken } from "./crd-api-token";
|
||||
import createCustomResourceStoreInjectable from "./create-custom-resource-store.injectable";
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import type { KubeApi } from "@k8slens/kube-api";
|
||||
import type { KubeApi } from "../kube-api";
|
||||
import type { KubeObjectStoreDependencies } from "../kube-object.store";
|
||||
import { KubeObjectStore } from "../kube-object.store";
|
||||
import type { KubeObject } from "@k8slens/kube-object";
|
||||
|
||||
@ -3,13 +3,13 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { logErrorInjectionToken, logInfoInjectionToken, logWarningInjectionToken } from "@k8slens/logger";
|
||||
import { loggerInjectionToken } from "@k8slens/logger";
|
||||
import { apiKubePrefix } from "../vars";
|
||||
import isDevelopmentInjectable from "../vars/is-development.injectable";
|
||||
import apiBaseInjectable from "./api-base.injectable";
|
||||
import type { KubeApiConstructor } from "./create-kube-api-for-remote-cluster.injectable";
|
||||
import createKubeJsonApiInjectable from "./create-kube-json-api.injectable";
|
||||
import { KubeApi } from "@k8slens/kube-api";
|
||||
import { KubeApi } from "./kube-api";
|
||||
import type { KubeJsonApiDataFor, KubeObject, KubeObjectConstructor } from "@k8slens/kube-object";
|
||||
|
||||
export interface CreateKubeApiForLocalClusterConfig {
|
||||
@ -37,9 +37,7 @@ const createKubeApiForClusterInjectable = getInjectable({
|
||||
const apiBase = di.inject(apiBaseInjectable);
|
||||
const isDevelopment = di.inject(isDevelopmentInjectable);
|
||||
const createKubeJsonApi = di.inject(createKubeJsonApiInjectable);
|
||||
const logError = di.inject(logErrorInjectionToken);
|
||||
const logInfo = di.inject(logInfoInjectionToken);
|
||||
const logWarn = di.inject(logWarningInjectionToken);
|
||||
const logger = di.inject(loggerInjectionToken);
|
||||
|
||||
return (
|
||||
cluster: CreateKubeApiForLocalClusterConfig,
|
||||
@ -66,9 +64,7 @@ const createKubeApiForClusterInjectable = getInjectable({
|
||||
|
||||
return new KubeApi(
|
||||
{
|
||||
logError,
|
||||
logInfo,
|
||||
logWarn,
|
||||
logger,
|
||||
maybeKubeApi: undefined,
|
||||
},
|
||||
{
|
||||
|
||||
@ -6,11 +6,11 @@ import { getInjectable } from "@ogre-tools/injectable";
|
||||
import type { AgentOptions } from "https";
|
||||
import { Agent } from "https";
|
||||
import type { RequestInit } from "@k8slens/node-fetch";
|
||||
import { logErrorInjectionToken, logInfoInjectionToken, logWarningInjectionToken } from "@k8slens/logger";
|
||||
import { loggerInjectionToken } from "@k8slens/logger";
|
||||
import isDevelopmentInjectable from "../vars/is-development.injectable";
|
||||
import createKubeJsonApiInjectable from "./create-kube-json-api.injectable";
|
||||
import type { KubeApiOptions } from "@k8slens/kube-api";
|
||||
import { KubeApi } from "@k8slens/kube-api";
|
||||
import type { KubeApiOptions } from "./kube-api";
|
||||
import { KubeApi } from "./kube-api";
|
||||
import type { KubeJsonApiDataFor, KubeObject, KubeObjectConstructor } from "@k8slens/kube-object";
|
||||
|
||||
export interface CreateKubeApiForRemoteClusterConfig {
|
||||
@ -53,9 +53,7 @@ const createKubeApiForRemoteClusterInjectable = getInjectable({
|
||||
instantiate: (di): CreateKubeApiForRemoteCluster => {
|
||||
const isDevelopment = di.inject(isDevelopmentInjectable);
|
||||
const createKubeJsonApi = di.inject(createKubeJsonApiInjectable);
|
||||
const logError = di.inject(logErrorInjectionToken);
|
||||
const logInfo = di.inject(logInfoInjectionToken);
|
||||
const logWarn = di.inject(logWarningInjectionToken);
|
||||
const logger = di.inject(loggerInjectionToken);
|
||||
|
||||
return (
|
||||
config: CreateKubeApiForRemoteClusterConfig,
|
||||
@ -112,9 +110,7 @@ const createKubeApiForRemoteClusterInjectable = getInjectable({
|
||||
|
||||
return new KubeApi(
|
||||
{
|
||||
logError,
|
||||
logInfo,
|
||||
logWarn,
|
||||
logger,
|
||||
maybeKubeApi: undefined,
|
||||
},
|
||||
{
|
||||
|
||||
@ -3,9 +3,9 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { logErrorInjectionToken, logInfoInjectionToken, logWarningInjectionToken } from "@k8slens/logger";
|
||||
import type { DerivedKubeApiOptions, KubeApiDependencies } from "@k8slens/kube-api";
|
||||
import { maybeKubeApiInjectable } from "@k8slens/kube-api-specifics";
|
||||
import { loggerInjectionToken } from "@k8slens/logger";
|
||||
import type { DerivedKubeApiOptions, KubeApiDependencies } from "./kube-api";
|
||||
import maybeKubeApiInjectable from "./maybe-kube-api.injectable";
|
||||
|
||||
export interface CreateKubeApi {
|
||||
<Api>(ctor: new (deps: KubeApiDependencies, opts: DerivedKubeApiOptions) => Api, opts?: DerivedKubeApiOptions): Api;
|
||||
@ -15,9 +15,7 @@ const createKubeApiInjectable = getInjectable({
|
||||
id: "create-kube-api",
|
||||
instantiate: (di): CreateKubeApi => {
|
||||
const deps: KubeApiDependencies = {
|
||||
logError: di.inject(logErrorInjectionToken),
|
||||
logInfo: di.inject(logInfoInjectionToken),
|
||||
logWarn: di.inject(logWarningInjectionToken),
|
||||
logger: di.inject(loggerInjectionToken),
|
||||
maybeKubeApi: di.inject(maybeKubeApiInjectable),
|
||||
};
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ import { apiKubePrefix } from "../vars";
|
||||
import isDebuggingInjectable from "../vars/is-debugging.injectable";
|
||||
import { apiBaseHostHeaderInjectionToken, apiBaseServerAddressInjectionToken } from "./api-base-configs";
|
||||
import createKubeJsonApiInjectable from "./create-kube-json-api.injectable";
|
||||
import type { KubeJsonApi } from "@k8slens/kube-api";
|
||||
import type { KubeJsonApi } from "./kube-json-api";
|
||||
|
||||
export type CreateKubeJsonApiForCluster = (clusterId: string) => KubeJsonApi;
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ import lensProxyCertificateInjectable from "../certificate/lens-proxy-certificat
|
||||
import fetchInjectable from "../fetch/fetch.injectable";
|
||||
import { loggerInjectionToken } from "@k8slens/logger";
|
||||
import type { JsonApiConfig, JsonApiDependencies } from "@k8slens/json-api";
|
||||
import { KubeJsonApi } from "@k8slens/kube-api";
|
||||
import { KubeJsonApi } from "./kube-json-api";
|
||||
|
||||
export type CreateKubeJsonApi = (config: JsonApiConfig, reqInit?: RequestInit) => KubeJsonApi;
|
||||
|
||||
|
||||
@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import assert from "assert";
|
||||
import { storesAndApisCanBeCreatedInjectionToken } from "../stores-apis-can-be-created.token";
|
||||
import { ClusterRoleBindingApi } from "./cluster-role-binding.api";
|
||||
import { kubeApiInjectionToken } from "../kube-api/kube-api-injection-token";
|
||||
import { loggerInjectionToken } from "@k8slens/logger";
|
||||
import maybeKubeApiInjectable from "../maybe-kube-api.injectable";
|
||||
|
||||
const clusterRoleBindingApiInjectable = getInjectable({
|
||||
id: "cluster-role-binding-api",
|
||||
instantiate: (di) => {
|
||||
assert(di.inject(storesAndApisCanBeCreatedInjectionToken), "clusterRoleBindingApi is only accessible in certain environments");
|
||||
|
||||
return new ClusterRoleBindingApi({
|
||||
logger: di.inject(loggerInjectionToken),
|
||||
maybeKubeApi: di.inject(maybeKubeApiInjectable),
|
||||
});
|
||||
},
|
||||
|
||||
injectionToken: kubeApiInjectionToken,
|
||||
});
|
||||
|
||||
export default clusterRoleBindingApiInjectable;
|
||||
@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import assert from "assert";
|
||||
import { storesAndApisCanBeCreatedInjectionToken } from "../stores-apis-can-be-created.token";
|
||||
import { ClusterRoleApi } from "./cluster-role.api";
|
||||
import { kubeApiInjectionToken } from "../kube-api/kube-api-injection-token";
|
||||
import { loggerInjectionToken } from "@k8slens/logger";
|
||||
import maybeKubeApiInjectable from "../maybe-kube-api.injectable";
|
||||
|
||||
const clusterRoleApiInjectable = getInjectable({
|
||||
id: "cluster-role-api",
|
||||
instantiate: (di) => {
|
||||
assert(di.inject(storesAndApisCanBeCreatedInjectionToken), "clusterRoleApi is only available in certain environments");
|
||||
|
||||
return new ClusterRoleApi({
|
||||
logger: di.inject(loggerInjectionToken),
|
||||
maybeKubeApi: di.inject(maybeKubeApiInjectable),
|
||||
});
|
||||
},
|
||||
|
||||
injectionToken: kubeApiInjectionToken,
|
||||
});
|
||||
|
||||
export default clusterRoleApiInjectable;
|
||||
@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import assert from "assert";
|
||||
import { storesAndApisCanBeCreatedInjectionToken } from "../stores-apis-can-be-created.token";
|
||||
import { ClusterApi } from "./cluster.api";
|
||||
import { kubeApiInjectionToken } from "../kube-api/kube-api-injection-token";
|
||||
import { loggerInjectionToken } from "@k8slens/logger";
|
||||
import maybeKubeApiInjectable from "../maybe-kube-api.injectable";
|
||||
|
||||
const clusterApiInjectable = getInjectable({
|
||||
id: "cluster-api",
|
||||
instantiate: (di) => {
|
||||
assert(di.inject(storesAndApisCanBeCreatedInjectionToken), "clusterApi is only available in certain environments");
|
||||
|
||||
return new ClusterApi({
|
||||
logger: di.inject(loggerInjectionToken),
|
||||
maybeKubeApi: di.inject(maybeKubeApiInjectable),
|
||||
});
|
||||
},
|
||||
|
||||
injectionToken: kubeApiInjectionToken,
|
||||
});
|
||||
|
||||
export default clusterApiInjectable;
|
||||
@ -20,7 +20,7 @@ export class ClusterApi extends KubeApi<Cluster> {
|
||||
|
||||
constructor(deps: KubeApiDependencies, opts?: DerivedKubeApiOptions) {
|
||||
super(deps, {
|
||||
...(opts ?? {}),
|
||||
...opts ?? {},
|
||||
objectConstructor: Cluster,
|
||||
});
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import assert from "assert";
|
||||
import { storesAndApisCanBeCreatedInjectionToken } from "../stores-apis-can-be-created.token";
|
||||
import { ComponentStatusApi } from "./component-status.api";
|
||||
import { kubeApiInjectionToken } from "../kube-api/kube-api-injection-token";
|
||||
import maybeKubeApiInjectable from "../maybe-kube-api.injectable";
|
||||
import { loggerInjectionToken } from "@k8slens/logger";
|
||||
|
||||
const componentStatusApiInjectable = getInjectable({
|
||||
id: "component-status-api",
|
||||
instantiate: (di) => {
|
||||
assert(di.inject(storesAndApisCanBeCreatedInjectionToken), "componentStatusApi is only available in certain environments");
|
||||
|
||||
return new ComponentStatusApi({
|
||||
logger: di.inject(loggerInjectionToken),
|
||||
maybeKubeApi: di.inject(maybeKubeApiInjectable),
|
||||
});
|
||||
},
|
||||
|
||||
injectionToken: kubeApiInjectionToken,
|
||||
});
|
||||
|
||||
export default componentStatusApiInjectable;
|
||||
@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import assert from "assert";
|
||||
import { storesAndApisCanBeCreatedInjectionToken } from "../stores-apis-can-be-created.token";
|
||||
import { ConfigMapApi } from "./config-map.api";
|
||||
import { kubeApiInjectionToken } from "../kube-api/kube-api-injection-token";
|
||||
import { loggerInjectionToken } from "@k8slens/logger";
|
||||
import maybeKubeApiInjectable from "../maybe-kube-api.injectable";
|
||||
|
||||
const configMapApiInjectable = getInjectable({
|
||||
id: "config-map-api",
|
||||
instantiate: (di) => {
|
||||
assert(di.inject(storesAndApisCanBeCreatedInjectionToken), "configMapApi is only available in certain environments");
|
||||
|
||||
return new ConfigMapApi({
|
||||
logger: di.inject(loggerInjectionToken),
|
||||
maybeKubeApi: di.inject(maybeKubeApiInjectable),
|
||||
});
|
||||
},
|
||||
|
||||
injectionToken: kubeApiInjectionToken,
|
||||
});
|
||||
|
||||
export default configMapApiInjectable;
|
||||
@ -12,7 +12,7 @@ export class ConfigMapApi extends KubeApi<ConfigMap, ConfigMapData> {
|
||||
constructor(deps: KubeApiDependencies, opts?: DerivedKubeApiOptions) {
|
||||
super(deps, {
|
||||
objectConstructor: ConfigMap,
|
||||
...(opts ?? {}),
|
||||
...opts ?? {},
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import assert from "assert";
|
||||
import { storesAndApisCanBeCreatedInjectionToken } from "../stores-apis-can-be-created.token";
|
||||
import { CronJobApi } from "./cron-job.api";
|
||||
import { kubeApiInjectionToken } from "../kube-api/kube-api-injection-token";
|
||||
import { loggerInjectionToken } from "@k8slens/logger";
|
||||
import maybeKubeApiInjectable from "../maybe-kube-api.injectable";
|
||||
|
||||
const cronJobApiInjectable = getInjectable({
|
||||
id: "cron-job-api",
|
||||
instantiate: (di) => {
|
||||
assert(di.inject(storesAndApisCanBeCreatedInjectionToken), "cronJobApi is only available in certain environments");
|
||||
|
||||
return new CronJobApi({
|
||||
logger: di.inject(loggerInjectionToken),
|
||||
maybeKubeApi: di.inject(maybeKubeApiInjectable),
|
||||
}, {
|
||||
checkPreferredVersion: true,
|
||||
});
|
||||
},
|
||||
|
||||
injectionToken: kubeApiInjectionToken,
|
||||
});
|
||||
|
||||
export default cronJobApiInjectable;
|
||||
@ -16,15 +16,11 @@ export class CronJobApi extends KubeApi<CronJob> {
|
||||
}
|
||||
|
||||
private requestSetSuspend(params: NamespacedResourceDescriptor, suspend: boolean) {
|
||||
return this.patch(
|
||||
params,
|
||||
{
|
||||
return this.patch(params, {
|
||||
spec: {
|
||||
suspend,
|
||||
},
|
||||
},
|
||||
"strategic",
|
||||
);
|
||||
}, "strategic");
|
||||
}
|
||||
|
||||
suspend(params: NamespacedResourceDescriptor) {
|
||||
@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import assert from "assert";
|
||||
import { storesAndApisCanBeCreatedInjectionToken } from "../stores-apis-can-be-created.token";
|
||||
import { CustomResourceDefinitionApi } from "./custom-resource-definition.api";
|
||||
import { kubeApiInjectionToken } from "../kube-api/kube-api-injection-token";
|
||||
import maybeKubeApiInjectable from "../maybe-kube-api.injectable";
|
||||
import { loggerInjectionToken } from "@k8slens/logger";
|
||||
|
||||
const customResourceDefinitionApiInjectable = getInjectable({
|
||||
id: "custom-resource-definition-api",
|
||||
instantiate: (di) => {
|
||||
assert(di.inject(storesAndApisCanBeCreatedInjectionToken), "customResourceDefinitionApi is only available in certain environments");
|
||||
|
||||
return new CustomResourceDefinitionApi({
|
||||
logger: di.inject(loggerInjectionToken),
|
||||
maybeKubeApi: di.inject(maybeKubeApiInjectable),
|
||||
});
|
||||
},
|
||||
|
||||
injectionToken: kubeApiInjectionToken,
|
||||
});
|
||||
|
||||
export default customResourceDefinitionApiInjectable;
|
||||
@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import assert from "assert";
|
||||
import { storesAndApisCanBeCreatedInjectionToken } from "../stores-apis-can-be-created.token";
|
||||
import { DaemonSetApi } from "./daemon-set.api";
|
||||
import { kubeApiInjectionToken } from "../kube-api/kube-api-injection-token";
|
||||
import { loggerInjectionToken } from "@k8slens/logger";
|
||||
import maybeKubeApiInjectable from "../maybe-kube-api.injectable";
|
||||
|
||||
const daemonSetApiInjectable = getInjectable({
|
||||
id: "daemon-set-api",
|
||||
instantiate: (di) => {
|
||||
assert(di.inject(storesAndApisCanBeCreatedInjectionToken), "daemonSetApi is only available in certain environments");
|
||||
|
||||
return new DaemonSetApi({
|
||||
logger: di.inject(loggerInjectionToken),
|
||||
maybeKubeApi: di.inject(maybeKubeApiInjectable),
|
||||
});
|
||||
},
|
||||
|
||||
injectionToken: kubeApiInjectionToken,
|
||||
});
|
||||
|
||||
export default daemonSetApiInjectable;
|
||||
@ -11,15 +11,13 @@ import { DaemonSet } from "@k8slens/kube-object";
|
||||
export class DaemonSetApi extends KubeApi<DaemonSet> {
|
||||
constructor(deps: KubeApiDependencies, opts?: DerivedKubeApiOptions) {
|
||||
super(deps, {
|
||||
...(opts ?? {}),
|
||||
...opts ?? {},
|
||||
objectConstructor: DaemonSet,
|
||||
});
|
||||
}
|
||||
|
||||
restart(params: NamespacedResourceDescriptor) {
|
||||
return this.patch(
|
||||
params,
|
||||
{
|
||||
return this.patch(params, {
|
||||
spec: {
|
||||
template: {
|
||||
metadata: {
|
||||
@ -27,8 +25,6 @@ export class DaemonSetApi extends KubeApi<DaemonSet> {
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"strategic",
|
||||
);
|
||||
}, "strategic");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import assert from "assert";
|
||||
import { storesAndApisCanBeCreatedInjectionToken } from "../stores-apis-can-be-created.token";
|
||||
import { DeploymentApi } from "./deployment.api";
|
||||
import { kubeApiInjectionToken } from "../kube-api/kube-api-injection-token";
|
||||
import { loggerInjectionToken } from "@k8slens/logger";
|
||||
import maybeKubeApiInjectable from "../maybe-kube-api.injectable";
|
||||
|
||||
const deploymentApiInjectable = getInjectable({
|
||||
id: "deployment-api",
|
||||
instantiate: (di) => {
|
||||
assert(di.inject(storesAndApisCanBeCreatedInjectionToken), "deploymentApi is only available in certain environments");
|
||||
|
||||
return new DeploymentApi({
|
||||
logger: di.inject(loggerInjectionToken),
|
||||
maybeKubeApi: di.inject(maybeKubeApiInjectable),
|
||||
});
|
||||
},
|
||||
|
||||
injectionToken: kubeApiInjectionToken,
|
||||
});
|
||||
|
||||
export default deploymentApiInjectable;
|
||||
@ -12,7 +12,7 @@ import { Deployment } from "@k8slens/kube-object";
|
||||
export class DeploymentApi extends KubeApi<Deployment> {
|
||||
constructor(deps: KubeApiDependencies, opts?: DerivedKubeApiOptions) {
|
||||
super(deps, {
|
||||
...(opts ?? {}),
|
||||
...opts ?? {},
|
||||
objectConstructor: Deployment,
|
||||
});
|
||||
}
|
||||
@ -28,9 +28,7 @@ export class DeploymentApi extends KubeApi<Deployment> {
|
||||
}
|
||||
|
||||
restart(params: NamespacedResourceDescriptor) {
|
||||
return this.patch(
|
||||
params,
|
||||
{
|
||||
return this.patch(params, {
|
||||
spec: {
|
||||
template: {
|
||||
metadata: {
|
||||
@ -38,8 +36,6 @@ export class DeploymentApi extends KubeApi<Deployment> {
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"strategic",
|
||||
);
|
||||
}, "strategic");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import assert from "assert";
|
||||
import { storesAndApisCanBeCreatedInjectionToken } from "../stores-apis-can-be-created.token";
|
||||
import { EndpointsApi } from "./endpoint.api";
|
||||
import { kubeApiInjectionToken } from "../kube-api/kube-api-injection-token";
|
||||
import { loggerInjectionToken } from "@k8slens/logger";
|
||||
import maybeKubeApiInjectable from "../maybe-kube-api.injectable";
|
||||
|
||||
const endpointsApiInjectable = getInjectable({
|
||||
id: "endpoints-api",
|
||||
instantiate: (di) => {
|
||||
assert(di.inject(storesAndApisCanBeCreatedInjectionToken), "endpointsApi is only available in certain environments");
|
||||
|
||||
return new EndpointsApi({
|
||||
logger: di.inject(loggerInjectionToken),
|
||||
maybeKubeApi: di.inject(maybeKubeApiInjectable),
|
||||
});
|
||||
},
|
||||
|
||||
injectionToken: kubeApiInjectionToken,
|
||||
});
|
||||
|
||||
export default endpointsApiInjectable;
|
||||
@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import assert from "assert";
|
||||
import { storesAndApisCanBeCreatedInjectionToken } from "../stores-apis-can-be-created.token";
|
||||
import { KubeEventApi } from "./events.api";
|
||||
import { kubeApiInjectionToken } from "../kube-api/kube-api-injection-token";
|
||||
import { loggerInjectionToken } from "@k8slens/logger";
|
||||
import maybeKubeApiInjectable from "../maybe-kube-api.injectable";
|
||||
|
||||
const kubeEventApiInjectable = getInjectable({
|
||||
id: "kube-event-api",
|
||||
instantiate: (di) => {
|
||||
assert(di.inject(storesAndApisCanBeCreatedInjectionToken), "kubeEventApi is only available in certain environments");
|
||||
|
||||
return new KubeEventApi({
|
||||
logger: di.inject(loggerInjectionToken),
|
||||
maybeKubeApi: di.inject(maybeKubeApiInjectable),
|
||||
});
|
||||
},
|
||||
|
||||
injectionToken: kubeApiInjectionToken,
|
||||
});
|
||||
|
||||
export default kubeEventApiInjectable;
|
||||
@ -4,14 +4,14 @@
|
||||
*/
|
||||
|
||||
import type { ItemObject } from "@k8slens/list-layout";
|
||||
import type { HelmReleaseData } from "../../../features/helm-releases/common/channels";
|
||||
import type { HelmReleaseDetails } from "./helm-releases.api/request-details.injectable";
|
||||
|
||||
export interface HelmReleaseUpdateDetails {
|
||||
log: string;
|
||||
release: HelmReleaseData;
|
||||
release: HelmReleaseDetails;
|
||||
}
|
||||
|
||||
export interface HelmRelease extends ItemObject {
|
||||
export interface HelmReleaseDto {
|
||||
appVersion: string;
|
||||
name: string;
|
||||
namespace: string;
|
||||
@ -19,10 +19,14 @@ export interface HelmRelease extends ItemObject {
|
||||
status: string;
|
||||
updated: string;
|
||||
revision: string;
|
||||
}
|
||||
|
||||
export interface HelmRelease extends HelmReleaseDto, ItemObject {
|
||||
getNs: () => string;
|
||||
getChart: (withVersion?: boolean) => string;
|
||||
getRevision: () => number;
|
||||
getStatus: () => string;
|
||||
getVersion: () => string;
|
||||
getUpdated: (humanize?: boolean, compact?: boolean) => string | number;
|
||||
getRepo: () => Promise<string>;
|
||||
}
|
||||
|
||||
@ -0,0 +1,41 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import type { KubeJsonApiData } from "@k8slens/kube-object";
|
||||
import { urlBuilderFor } from "@k8slens/utilities";
|
||||
import apiBaseInjectable from "../../api-base.injectable";
|
||||
|
||||
export interface HelmReleaseDetails {
|
||||
resources: KubeJsonApiData[];
|
||||
name: string;
|
||||
namespace: string;
|
||||
version: string;
|
||||
config: string; // release values
|
||||
manifest: string;
|
||||
info: {
|
||||
deleted: string;
|
||||
description: string;
|
||||
first_deployed: string;
|
||||
last_deployed: string;
|
||||
notes: string;
|
||||
status: string;
|
||||
};
|
||||
}
|
||||
|
||||
export type CallForHelmReleaseDetails = (name: string, namespace: string) => Promise<HelmReleaseDetails>;
|
||||
|
||||
const requestDetailsEndpoint = urlBuilderFor("/v2/releases/:namespace/:name");
|
||||
|
||||
const requestHelmReleaseDetailsInjectable = getInjectable({
|
||||
id: "call-for-helm-release-details",
|
||||
|
||||
instantiate: (di): CallForHelmReleaseDetails => {
|
||||
const apiBase = di.inject(apiBaseInjectable);
|
||||
|
||||
return (name, namespace) => apiBase.get(requestDetailsEndpoint.compile({ name, namespace }));
|
||||
},
|
||||
});
|
||||
|
||||
export default requestHelmReleaseDetailsInjectable;
|
||||
@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { urlBuilderFor } from "@k8slens/utilities";
|
||||
import apiBaseInjectable from "../../api-base.injectable";
|
||||
import type { HelmReleaseDto } from "../helm-releases.api";
|
||||
|
||||
export type RequestHelmReleases = (namespace?: string) => Promise<HelmReleaseDto[]>;
|
||||
|
||||
const requestHelmReleasesEndpoint = urlBuilderFor("/v2/releases/:namespace?");
|
||||
|
||||
const requestHelmReleasesInjectable = getInjectable({
|
||||
id: "request-helm-releases",
|
||||
|
||||
instantiate: (di): RequestHelmReleases => {
|
||||
const apiBase = di.inject(apiBaseInjectable);
|
||||
|
||||
return (namespace) => apiBase.get(requestHelmReleasesEndpoint.compile({ namespace }));
|
||||
},
|
||||
});
|
||||
|
||||
export default requestHelmReleasesInjectable;
|
||||
@ -8,7 +8,7 @@ import apiBaseInjectable from "../../api-base.injectable";
|
||||
|
||||
export type RequestHelmReleaseRollback = (name: string, namespace: string, revision: number) => Promise<void>;
|
||||
|
||||
const requestRollbackEndpoint = urlBuilderFor("/v2/releases/:namespace/:name/rollback");
|
||||
const requestRollbackEndpoint = urlBuilderFor("/v2/releases/:namespace/:name");
|
||||
|
||||
const requestHelmReleaseRollbackInjectable = getInjectable({
|
||||
id: "request-helm-release-rollback",
|
||||
|
||||
@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import assert from "assert";
|
||||
import { storesAndApisCanBeCreatedInjectionToken } from "../stores-apis-can-be-created.token";
|
||||
import { HorizontalPodAutoscalerApi } from "./horizontal-pod-autoscaler.api";
|
||||
import { kubeApiInjectionToken } from "../kube-api/kube-api-injection-token";
|
||||
import { loggerInjectionToken } from "@k8slens/logger";
|
||||
import maybeKubeApiInjectable from "../maybe-kube-api.injectable";
|
||||
|
||||
const horizontalPodAutoscalerApiInjectable = getInjectable({
|
||||
id: "horizontal-pod-autoscaler-api",
|
||||
instantiate: (di) => {
|
||||
assert(di.inject(storesAndApisCanBeCreatedInjectionToken), "horizontalPodAutoscalerApi is only available in certain environments");
|
||||
|
||||
return new HorizontalPodAutoscalerApi({
|
||||
logger: di.inject(loggerInjectionToken),
|
||||
maybeKubeApi: di.inject(maybeKubeApiInjectable),
|
||||
});
|
||||
},
|
||||
|
||||
injectionToken: kubeApiInjectionToken,
|
||||
});
|
||||
|
||||
export default horizontalPodAutoscalerApiInjectable;
|
||||
@ -11,9 +11,14 @@ export class HorizontalPodAutoscalerApi extends KubeApi<HorizontalPodAutoscaler>
|
||||
constructor(deps: KubeApiDependencies, opts?: DerivedKubeApiOptions) {
|
||||
super(deps, {
|
||||
allowedUsableVersions: {
|
||||
autoscaling: ["v2", "v2beta2", "v2beta1", "v1"],
|
||||
autoscaling: [
|
||||
"v2",
|
||||
"v2beta2",
|
||||
"v2beta1",
|
||||
"v1",
|
||||
],
|
||||
},
|
||||
...(opts ?? {}),
|
||||
...opts ?? {},
|
||||
objectConstructor: HorizontalPodAutoscaler,
|
||||
checkPreferredVersion: true,
|
||||
});
|
||||
@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
// Kubernetes apis
|
||||
// Docs: https://kubernetes.io/docs/reference/kubernetes-api/
|
||||
// Docs: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.10/
|
||||
|
||||
export * from "./cluster.api";
|
||||
export * from "./cluster-role.api";
|
||||
@ -12,7 +12,6 @@ export * from "./cluster-role-binding.api";
|
||||
export * from "./config-map.api";
|
||||
export * from "./custom-resource-definition.api";
|
||||
export * from "./cron-job.api";
|
||||
export * from "./component-status.api";
|
||||
export * from "./daemon-set.api";
|
||||
export * from "./deployment.api";
|
||||
export * from "./endpoint.api";
|
||||
@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { IngressClassApi } from "./ingress-class.api";
|
||||
import { kubeApiInjectionToken } from "../kube-api/kube-api-injection-token";
|
||||
import { loggerInjectionToken } from "@k8slens/logger";
|
||||
import maybeKubeApiInjectable from "../maybe-kube-api.injectable";
|
||||
|
||||
const ingressClassApiInjectable = getInjectable({
|
||||
id: "ingress-class-api",
|
||||
instantiate: (di) => new IngressClassApi({
|
||||
logger: di.inject(loggerInjectionToken),
|
||||
maybeKubeApi: di.inject(maybeKubeApiInjectable),
|
||||
}),
|
||||
|
||||
injectionToken: kubeApiInjectionToken,
|
||||
});
|
||||
|
||||
export default ingressClassApiInjectable;
|
||||
@ -17,16 +17,12 @@ export class IngressClassApi extends KubeApi<IngressClass> {
|
||||
}
|
||||
|
||||
setAsDefault({ name }: ResourceDescriptor, isDefault = true) {
|
||||
return this.patch(
|
||||
{ name },
|
||||
{
|
||||
return this.patch({ name }, {
|
||||
metadata: {
|
||||
annotations: {
|
||||
[IngressClass.ANNOTATION_IS_DEFAULT]: String(isDefault),
|
||||
},
|
||||
},
|
||||
},
|
||||
"strategic",
|
||||
);
|
||||
}, "strategic");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import assert from "assert";
|
||||
import { storesAndApisCanBeCreatedInjectionToken } from "../stores-apis-can-be-created.token";
|
||||
import { IngressApi } from "./ingress.api";
|
||||
import { kubeApiInjectionToken } from "../kube-api/kube-api-injection-token";
|
||||
import { loggerInjectionToken } from "@k8slens/logger";
|
||||
import maybeKubeApiInjectable from "../maybe-kube-api.injectable";
|
||||
|
||||
const ingressApiInjectable = getInjectable({
|
||||
id: "ingress-api",
|
||||
instantiate: (di) => {
|
||||
assert(di.inject(storesAndApisCanBeCreatedInjectionToken), "ingressApi is only available in certain environments");
|
||||
|
||||
return new IngressApi({
|
||||
logger: di.inject(loggerInjectionToken),
|
||||
maybeKubeApi: di.inject(maybeKubeApiInjectable),
|
||||
});
|
||||
},
|
||||
|
||||
injectionToken: kubeApiInjectionToken,
|
||||
});
|
||||
|
||||
export default ingressApiInjectable;
|
||||
@ -10,7 +10,7 @@ import { KubeApi } from "../kube-api";
|
||||
export class IngressApi extends KubeApi<Ingress> {
|
||||
constructor(deps: KubeApiDependencies, opts?: DerivedKubeApiOptions) {
|
||||
super(deps, {
|
||||
...(opts ?? {}),
|
||||
...opts ?? {},
|
||||
objectConstructor: Ingress,
|
||||
// Add fallback for Kubernetes <1.19
|
||||
checkPreferredVersion: true,
|
||||
@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import assert from "assert";
|
||||
import { storesAndApisCanBeCreatedInjectionToken } from "../stores-apis-can-be-created.token";
|
||||
import { JobApi } from "./job.api";
|
||||
import { kubeApiInjectionToken } from "../kube-api/kube-api-injection-token";
|
||||
import { loggerInjectionToken } from "@k8slens/logger";
|
||||
import maybeKubeApiInjectable from "../maybe-kube-api.injectable";
|
||||
|
||||
const jobApiInjectable = getInjectable({
|
||||
id: "job-api",
|
||||
instantiate: (di) => {
|
||||
assert(di.inject(storesAndApisCanBeCreatedInjectionToken), "jobApi is only available in certain environments");
|
||||
|
||||
return new JobApi({
|
||||
logger: di.inject(loggerInjectionToken),
|
||||
maybeKubeApi: di.inject(maybeKubeApiInjectable),
|
||||
}, {
|
||||
checkPreferredVersion: true,
|
||||
});
|
||||
},
|
||||
|
||||
injectionToken: kubeApiInjectionToken,
|
||||
});
|
||||
|
||||
export default jobApiInjectable;
|
||||
@ -10,7 +10,7 @@ import { Job } from "@k8slens/kube-object";
|
||||
export class JobApi extends KubeApi<Job> {
|
||||
constructor(deps: KubeApiDependencies, opts?: DerivedKubeApiOptions) {
|
||||
super(deps, {
|
||||
...(opts ?? {}),
|
||||
...opts ?? {},
|
||||
objectConstructor: Job,
|
||||
});
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user