1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
Commit Graph

493 Commits

Author SHA1 Message Date
Roman
73ebf0a457 catalog-pusher clean up, replaced .observe_() to external observe() helper from "mobx"
Signed-off-by: Roman <ixrock@gmail.com>
2021-05-16 15:36:02 +03:00
Roman
3405c49613 fix: app-crash when navigating to catalog from active cluster-view, refactoring catalog-entity-store
Signed-off-by: Roman <ixrock@gmail.com>
2021-05-15 13:49:13 +03:00
Roman
97ad405f9f clean up / responding to comments
Signed-off-by: Roman <ixrock@gmail.com>
2021-05-14 22:36:50 +03:00
Roman
456490cca0 update KubeObject class type definition
Signed-off-by: Roman <ixrock@gmail.com>
2021-05-14 16:18:37 +03:00
Roman
6addce21fb - Merging interfaces & classses to avoid overwriting fields from parent's super(data)-call with Object.assign(this, data). Otherwise use "declare" keyword at class field definition.
- Revamping {useDefineForClassFields: true} to avoid issues with non-observable class fields in some cases (from previous commit):

```
@observer
export class CommandContainer extends React.Component<CommandContainerProps> {
  // without some defined initial value "commandComponent" is non-observable for some reasons
  // when tsconfig.ts has {useDefineForClassFields:false}
  @observable.ref commandComponent: React.ReactNode = null;

  constructor(props: CommandContainerProps) {
    super(props);
    makeObservable(this);
  }
```

Signed-off-by: Roman <ixrock@gmail.com>
2021-05-14 16:04:30 +03:00
Roman
291595d476 fix: CommandPalette doesn't appear from global menu by click/hotkey
Signed-off-by: Roman <ixrock@gmail.com>
2021-05-14 14:29:24 +03:00
Roman
b1ae284b3b fix: Catalog -> Browse all tab
Signed-off-by: Roman <ixrock@gmail.com>
2021-05-13 16:46:54 +03:00
Roman
4cfe3b1521 catalog.tsx / catalog-entities.store.ts refactoring & fixes
Signed-off-by: Roman <ixrock@gmail.com>
2021-05-13 16:38:24 +03:00
Roman
68a6ed52c0 Merge remote-tracking branch 'origin/master' into mobx6-migration
# Conflicts:
#	src/renderer/components/hotbar/hotbar-icon.tsx
2021-05-13 13:16:28 +03:00
Alex Andreev
a930d5f14f
Hotbar disabled items (#2710)
* Saving more entity data to HotbarItem

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Adding generic MaterialTooltip component

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Move HotbarCell to separate component

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Abstract out HotbarEntityIcon from HotbarIcon

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Styling disabled hotbar items

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Migration for adding extra data to hotbar items

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Testing migration

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Some cleaning up

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Bump migration version

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Bump app version in package.json

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
2021-05-13 10:24:58 +03:00
Roman
ca49305014 master-merge lint-fixes
Signed-off-by: Roman <ixrock@gmail.com>
2021-05-12 19:01:12 +03:00
Roman
88c9fe3210 Merge remote-tracking branch 'origin/master' into mobx6-migration
# Conflicts:
#	src/common/catalog/catalog-category-registry.ts
#	src/common/catalog/catalog-entity-registry.ts
#	src/common/hotbar-store.ts
#	src/common/search-store.ts
#	src/common/utils/autobind.ts
#	src/common/utils/extended-map.ts
#	src/common/utils/toggle-set.ts
#	src/extensions/extension-api.ts
#	src/extensions/renderer-api/navigation.ts
#	src/main/catalog-pusher.ts
#	src/main/catalog-sources/kubeconfig-sync.ts
#	src/renderer/api/catalog-entity-registry.ts
#	src/renderer/api/endpoints/cluster-role.api.ts
#	src/renderer/api/endpoints/endpoint.api.ts
#	src/renderer/api/endpoints/poddisruptionbudget.api.ts
#	src/renderer/api/endpoints/podsecuritypolicy.api.ts
#	src/renderer/api/endpoints/role-binding.api.ts
#	src/renderer/api/endpoints/service-accounts.api.ts
#	src/renderer/api/endpoints/service.api.ts
#	src/renderer/api/endpoints/storage-class.api.ts
#	src/renderer/api/websocket-api.ts
#	src/renderer/components/+catalog/catalog-entity.store.ts
#	src/renderer/components/+cluster/cluster-overview.store.ts
#	src/renderer/components/+config-autoscalers/hpa.store.ts
#	src/renderer/components/+config-limit-ranges/limit-ranges.store.ts
#	src/renderer/components/+custom-resources/crd-resource.store.ts
#	src/renderer/components/+custom-resources/crd.store.ts
#	src/renderer/components/+namespaces/namespace.store.ts
#	src/renderer/components/+network-ingresses/ingress.store.ts
#	src/renderer/components/+storage-volume-claims/volume-claim.store.ts
#	src/renderer/components/+user-management-service-accounts/service-accounts.store.ts
#	src/renderer/components/+workloads-daemonsets/daemonsets.store.ts
#	src/renderer/components/+workloads-deployments/deployments.store.ts
#	src/renderer/components/+workloads-replicasets/replicasets.store.ts
#	src/renderer/components/+workloads-statefulsets/statefulset.store.ts
#	src/renderer/components/command-palette/command-dialog.tsx
#	src/renderer/components/dock/dock-tab.store.ts
#	src/renderer/components/dock/edit-resource.store.ts
#	src/renderer/components/dock/install-chart.store.ts
#	src/renderer/components/dock/log.store.ts
#	src/renderer/components/dock/upgrade-chart.store.ts
#	src/renderer/components/item-object-list/page-filters.store.ts
#	src/renderer/navigation/page-param.ts
#	src/renderer/theme.store.ts
2021-05-12 18:57:52 +03:00
Jari Kolehmainen
2d0609ed24
Check source files for license header (#2763)
* check source files for license header

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* tweak

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* add license header to all relevant source files

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
2021-05-12 18:33:26 +03:00
Roman
16d4fb1818 Merge remote-tracking branch 'origin/master' into mobx6-migration
# Conflicts:
#	src/renderer/components/+user-management/user-management.tsx
#	src/renderer/components/layout/sidebar.tsx
#	yarn.lock
2021-05-12 17:19:26 +03:00
Roman
df686a64b9 Reverted "use {useDefineForClassFields: true} in tsconfig.json" (various app-crash fixes)
This flag seems to be not possible to use with class-inheritance in some cases.

Example / demo:
`KubeObject` class has initial type definitions for the fields like: "metadata", "kind", etc.
and constructor() has Object.assign(this, data);
Meanwhile child class, e.g. KubeEvent inherited from KubeObject and has it's own extra type definitions for underlying resource, e.g. "involvedObject", "source", etc.

So calling super(data) doesn't work as expected for child class as it's own type definitions overwrites data from parent's constructor with `undefined` at later point.

Signed-off-by: Roman <ixrock@gmail.com>
2021-05-12 17:13:13 +03:00
Sebastian Malton
0771fd5be5
Cherry-Pick from v4.2.4 (#2701)
Co-authored-by: Jim Ehrismann <40840436+jim-docker@users.noreply.github.com>
2021-05-12 08:04:01 -04:00
Sebastian Malton
47e5cb1732
Only show the UserManagement tab in the sidebar if the sub menus are allowed for that cluster (#2258)
- Optimize Cluster.isAllowedResource

Signed-off-by: Sebastian Malton <sebastian@malton.name>
2021-05-12 08:03:23 -04:00
Roman
0c83513e51 fix: various app-crashes related to kube-events (events page, some details page, overview, etc.)
Signed-off-by: Roman <ixrock@gmail.com>
2021-05-12 14:44:51 +03:00
Roman
b15713cc42 refactoring: extensions-api exports clarification for "@k8slens/extensions"
Signed-off-by: Roman <ixrock@gmail.com>
2021-05-12 14:04:42 +03:00
Jim Ehrismann
c0dddc0f40
relax kube api data type validation (to allow metrics-server resources) (#2744)
* relax kube api data type validation (to allow metrics-server resources)

Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com>

* removed a few now incorrect tests

Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com>

* correct PodMetrics kind

Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com>
2021-05-12 06:56:31 +03:00
Alex
619b66c5d5
Allow dynamic menu titles in 'WelcomeMenuRegistration' (#2752)
Signed-off-by: Alex Culliere <alozhkin@mirantis.com>

Co-authored-by: Alex Culliere <alozhkin@mirantis.com>
2021-05-11 18:41:45 +03:00
Roman
b9354584cf fix: crd definitions -> groups selector couldn't deselect last selected option
Signed-off-by: Roman <ixrock@gmail.com>
2021-05-11 14:39:26 +03:00
Roman
a3a9be4a4f fix: crd definition details -> crashing with <AceEditor mode="json"> (added missing mode-file in ace-editor.tsx)
Signed-off-by: Roman <ixrock@gmail.com>
2021-05-11 13:27:57 +03:00
Roman
cf664de29b - fix: persist table-sort params and cluster-view's sidebar state to lens-local-storage
- new-feature: auto-open main-window's devtools in development-mode (yes/no/ugly?)

Signed-off-by: Roman <ixrock@gmail.com>
2021-05-10 23:22:36 +03:00
Roman
749eb4a42b fix: restore "all namespaces" on page reload
Signed-off-by: Roman <ixrock@gmail.com>
2021-05-10 21:22:00 +03:00
Roman
5c67bb7ae2 fix: app-crash on editing k8s resource
Signed-off-by: Roman <ixrock@gmail.com>
2021-05-10 20:26:13 +03:00
Roman
ed1f88b5d8 fix: don't cache mobx.when(() => this.someObservable) cause might not work as expected due later call of makeObservable(this) in constructor
Signed-off-by: Roman <ixrock@gmail.com>
2021-05-10 17:35:20 +03:00
Roman
3357269c5d fix: namespace-store refactoring / saving selected-namespaces to external json-file
Signed-off-by: Roman <ixrock@gmail.com>
2021-05-10 15:55:07 +03:00
Roman
f96b789280 fix: various app-crashes related to KubeObject.spec.* access from "undefined"
fix: config-map-details crash

Signed-off-by: Roman <ixrock@gmail.com>
2021-05-09 23:57:08 +03:00
Roman
e5c0fe5d65 fix: refreshing cluster-view on ready
Signed-off-by: Roman <ixrock@gmail.com>
2021-05-09 23:22:01 +03:00
Roman
995e032be4 debugging cluster-view error -- part 1
Signed-off-by: Roman <ixrock@gmail.com>
2021-05-09 18:39:51 +03:00
Roman
6ee2385d3c refactoring, more possible branch fixes + lint
Signed-off-by: Roman <ixrock@gmail.com>
2021-05-08 15:06:27 +03:00
Roman
0c8ff6a1d6 normalize usages of #observable-value.toJSON() / attempt to catch the wind
Signed-off-by: Roman <ixrock@gmail.com>
2021-05-08 13:52:12 +03:00
Roman
d4d03532d7 storage-helper refactoring
Signed-off-by: Roman <ixrock@gmail.com>
2021-05-07 14:16:11 +03:00
Roman
81a6b3ce17 Merge remote-tracking branch 'origin/master' into mobx6-migration
# Conflicts:
#	src/renderer/kube-object.store.ts
2021-05-07 12:29:55 +03:00
Roman
d60f1a775a fix: removed makeObservable(this) from "terminal-tab.tsx"
Signed-off-by: Roman <ixrock@gmail.com>
2021-05-07 12:26:51 +03:00
Roman
8e6770114b use {useDefineForClassFields: true} in tsconfig.json
Signed-off-by: Roman <ixrock@gmail.com>
2021-05-06 19:52:50 +03:00
Roman
e1af76754a removed @observable static
Signed-off-by: Roman <ixrock@gmail.com>
2021-05-06 19:41:15 +03:00
Roman
5d09d7a126 mobx-6: use toJS()-wrapper since monkey-patching require(mobx).toJS doesn't work
Signed-off-by: Roman <ixrock@gmail.com>
2021-05-06 18:55:14 +03:00
Roman
4a9178e8ea mobx-6: replacing @autobind() as method-decorator to @boundMethod
Signed-off-by: Roman <ixrock@gmail.com>
2021-05-06 17:24:11 +03:00
Roman
884f8ae523 mobx-6 migration -- remove @autobind as class-decorator
Signed-off-by: Roman <ixrock@gmail.com>
2021-05-06 17:07:57 +03:00
Roman
02aa3217c3 mobx-6 migration -- part 3 (more fixes)
Signed-off-by: Roman <ixrock@gmail.com>
2021-05-06 15:59:48 +03:00
Roman
ae1b840df7 mobx-6 migration -- part 2 (npx mobx-undecorate --keepDecorators)
Signed-off-by: Roman <ixrock@gmail.com>
2021-05-06 15:49:22 +03:00
Roman
a0fb8b5933 mobx-6 migration -- part 1
Signed-off-by: Roman <ixrock@gmail.com>
2021-05-06 15:09:24 +03:00
Sebastian Malton
7b1b8e6321
Fix ClusterScoped kube APIs not subscribing (#2706)
* Fix ClusterScoped kube APIs not subscribing

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* remove debug

Signed-off-by: Sebastian Malton <sebastian@malton.name>
2021-05-06 09:10:52 +03:00
Alex Andreev
768e1d14ca
Fixing hotbar drag-n-drop animation issues (#2704) 2021-05-05 17:37:06 -04:00
Jari Kolehmainen
1044c544ad
Fix cluster disconnect not going switching to catalog (#2703)
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
2021-05-05 15:01:21 +03:00
Jari Kolehmainen
8fff064e0c
Fix kubeconfig-sync issues (#2692)
- Removed `getFreePort` as its use is always a race condition. Change
  all uses of it to retrive the port after listening

- Added `getPortFrom` as a helper function to read a port from a stream

- Remove `Cluster.ownerRef` as it is outdated and no longer needed for 5.0

- Remove `Cluster.enabled`, no longer needed because of above

- Removed `Cluster.init`, moved its contents into `Cluster.constructor`
  as nothing in that function is asyncronous. Currently only being run
  on `main` as a stop gap until `renderer` gets its own version of
  `Cluster`

- Refactored `LensProxy` so as to prevent `pty.node` (a NodeJS
  extension) being included in `webpack.extension.ts`'s run

- Removed the passing around of the proxy port as that can now be
  accessed from an instance of `LensProxy`

- purge ContextHandler's cache on disconnect

Co-authored-by: Sebastian Malton <sebastian@malton.name>
2021-05-04 15:21:15 -04:00
Alex Andreev
1af12fe59e
Hotbar inner drag-n-drop (#2691)
* Configure ts to use react-jsx rule

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Moving HotbarSelector to separate component

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Initial drag-n-drop implementation

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Revert tsconfig and linter changes

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Reverting back active cell effect

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Adding drag-n-drop behavior

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Fix drag-n-drop logic

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* White border on dragging over

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Adding test coverage

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Fixing cell hover effect

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Increase PageLayout z-index

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Styling hotbar selector tooltip

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
2021-05-04 07:49:14 +03:00
Sebastian Malton
d1272515b8
Add browse all tab to catalog page (#2629) 2021-05-03 08:39:04 -04:00