Add the ability to sync kube config files (#2567)

* Add the ability to sync kube config files

- Will update when the files changes

- add KUBECONFIG_SYNC label

- fix rebase and change to addObservableSource

- move UI to user settings

- support shallow folder watching

- add some unit tests for the diff-er

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

* responding to review comments

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

* fix tests and add try/catch

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

* always sync c&p folder, remove bad rebase

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

* fix preferences

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

* Fix settings saving and catalog view

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

* fix unit tests

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

* fix synced clusters not connectable

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

* change to non-complete shallow watching

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

* fix sizing

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

* Catch readStream errors

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

* don't clear UserStore on non-existant preference field, fix unlinking not removing items from source

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

* change label to file

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton authored and GitHub committed 2021-04-30 16:48:20 +03:00
1 parent f06d330835
commit 998f7aa934
32 files changed
+1215 -236

No files matched your search

@@ -1,10 +1,15 @@
import { action, computed, observable, IObservableArray } from "mobx";
import { action, computed, observable, IComputedValue, IObservableArray } from "mobx";
import { CatalogEntity } from "./catalog-entity";
import { iter } from "../utils";
export class CatalogEntityRegistry {
protected sources = observable.map<string, IObservableArray<CatalogEntity>>([], { deep: true });
protected sources = observable.map<string, IComputedValue<CatalogEntity[]>>([], { deep: true });
@action addSource(id: string, source: IObservableArray<CatalogEntity>) {
@action addObservableSource(id: string, source: IObservableArray<CatalogEntity>) {
this.sources.set(id, computed(() => source));
}
@action addComputedSource(id: string, source: IComputedValue<CatalogEntity[]>) {
this.sources.set(id, source);
}
@@ -13,7 +18,7 @@ export class CatalogEntityRegistry {
}
@computed get items(): CatalogEntity[] {
return Array.from(this.sources.values()).flat();
return Array.from(iter.flatMap(this.sources.values(), source => source.get()));
}
getItemsForApiKind<T extends CatalogEntity>(apiVersion: string, kind: string): T[] {
+1 -1
View File
@@ -65,7 +65,7 @@ export interface CatalogEntityContextMenu {
icon: string;
title: string;
onlyVisibleForSource?: string; // show only if empty or if matches with entity source
onClick: () => Promise<void>;
onClick: () => void | Promise<void>;
confirm?: {
message: string;
}