mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
always sync c&p folder, remove bad rebase
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
8acf77a42c
commit
71c6f25d9d
@ -14,7 +14,6 @@ import path from "path";
|
||||
import os from "os";
|
||||
import { fileNameMigration } from "../migrations/user-store";
|
||||
import { ObservableToggleSet } from "../renderer/utils";
|
||||
import { ClusterStore } from "./cluster-store";
|
||||
|
||||
export interface UserStoreModel {
|
||||
kubeConfigPath: string;
|
||||
@ -23,10 +22,12 @@ export interface UserStoreModel {
|
||||
preferences: UserPreferencesModel;
|
||||
}
|
||||
|
||||
export interface KubeconfigSyncEntry {
|
||||
export interface KubeconfigSyncEntry extends KubeconfigSyncValue {
|
||||
filePath: string;
|
||||
}
|
||||
|
||||
export interface KubeconfigSyncValue {}
|
||||
|
||||
export interface UserPreferencesModel {
|
||||
httpsProxy?: string;
|
||||
shell?: string;
|
||||
@ -86,9 +87,8 @@ export class UserStore extends BaseStore<UserStoreModel> {
|
||||
/**
|
||||
* The set of file/folder paths to be synced
|
||||
*/
|
||||
syncKubeconfigEntries = observable.set([
|
||||
path.join(os.homedir(), ".kube"),
|
||||
ClusterStore.storedKubeConfigFolder,
|
||||
syncKubeconfigEntries = observable.map<string, KubeconfigSyncValue>([
|
||||
[path.join(os.homedir(), ".kube"), {}]
|
||||
]);
|
||||
|
||||
async load(): Promise<void> {
|
||||
@ -240,12 +240,19 @@ export class UserStore extends BaseStore<UserStoreModel> {
|
||||
|
||||
this.hiddenTableColumns.clear();
|
||||
|
||||
for (const [tableId, columnIds] of preferences.hiddenTableColumns ?? []) {
|
||||
this.hiddenTableColumns.set(tableId, new ObservableToggleSet(columnIds));
|
||||
if (preferences.hiddenTableColumns) {
|
||||
this.hiddenTableColumns.replace(
|
||||
preferences.hiddenTableColumns
|
||||
.map(([tableId, columnIds]) => [tableId, new ObservableToggleSet(columnIds)])
|
||||
);
|
||||
} else {
|
||||
this.hiddenTableColumns.clear();
|
||||
}
|
||||
|
||||
if (preferences.syncKubeconfigEntries) {
|
||||
this.syncKubeconfigEntries.replace(preferences.syncKubeconfigEntries.map(({ filePath }) => filePath));
|
||||
this.syncKubeconfigEntries.replace(
|
||||
preferences.syncKubeconfigEntries.map(({ filePath, ...rest }) => [filePath, rest])
|
||||
);
|
||||
} else {
|
||||
this.syncKubeconfigEntries.clear();
|
||||
}
|
||||
@ -259,8 +266,8 @@ export class UserStore extends BaseStore<UserStoreModel> {
|
||||
hiddenTableColumns.push([key, Array.from(values)]);
|
||||
}
|
||||
|
||||
for (const filePath of this.syncKubeconfigEntries) {
|
||||
syncKubeconfigEntries.push({ filePath });
|
||||
for (const [filePath, rest] of this.syncKubeconfigEntries) {
|
||||
syncKubeconfigEntries.push({ filePath, ...rest });
|
||||
}
|
||||
|
||||
const model: UserStoreModel = {
|
||||
|
||||
@ -11,7 +11,7 @@ import { loadConfigFromString, splitConfig, validateKubeConfig } from "../../com
|
||||
import { Cluster } from "../cluster";
|
||||
import { catalogEntityFromCluster } from "../cluster-manager";
|
||||
import { UserStore } from "../../common/user-store";
|
||||
import { UpdateClusterModel } from "../../common/cluster-store";
|
||||
import { ClusterStore, UpdateClusterModel } from "../../common/cluster-store";
|
||||
|
||||
const logPrefix = "[KUBECONFIG-SYNC]:";
|
||||
|
||||
@ -32,21 +32,24 @@ export class KubeconfigSyncManager extends Singleton {
|
||||
return;
|
||||
}
|
||||
|
||||
this.syncing = true;
|
||||
|
||||
logger.info(`${logPrefix} starting requested syncs`);
|
||||
|
||||
for (const syncEntry of UserStore.getInstance().syncKubeconfigEntries) {
|
||||
this.startNewSync(syncEntry, port);
|
||||
}
|
||||
// This must be done so that c&p-ed clusters are visible
|
||||
this.startNewSync(ClusterStore.storedKubeConfigFolder, port);
|
||||
|
||||
this.syncing = true;
|
||||
for (const [filePath] of UserStore.getInstance().syncKubeconfigEntries) {
|
||||
this.startNewSync(filePath, port);
|
||||
}
|
||||
|
||||
this.syncListDisposer = UserStore.getInstance().syncKubeconfigEntries.observe(change => {
|
||||
switch (change.type) {
|
||||
case "add":
|
||||
this.startNewSync(change.newValue, port);
|
||||
this.startNewSync(change.name, port);
|
||||
break;
|
||||
case "delete":
|
||||
this.stopOldSync(change.oldValue);
|
||||
this.stopOldSync(change.name);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
@ -1,18 +0,0 @@
|
||||
// Switch representation of hiddenTableColumns in store
|
||||
import { migration } from "../migration-wrapper";
|
||||
|
||||
export default migration({
|
||||
version: "5.0.0-alpha.2",
|
||||
run(store) {
|
||||
const preferences = store.get("preferences");
|
||||
const oldHiddenTableColumns: Record<string, string[]> = preferences?.hiddenTableColumns;
|
||||
|
||||
if (!oldHiddenTableColumns) {
|
||||
return;
|
||||
}
|
||||
|
||||
preferences.hiddenTableColumns = Object.entries(oldHiddenTableColumns);
|
||||
|
||||
store.get("preferences", preferences);
|
||||
}
|
||||
});
|
||||
@ -55,7 +55,7 @@
|
||||
}
|
||||
|
||||
html {
|
||||
font-size: var(--font-size);
|
||||
font-size: 62.5%; // 1 rem == 10px
|
||||
color: $textColorPrimary;
|
||||
background-color: $mainBackground;
|
||||
--flex-gap: #{$padding};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user