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 os from "os";
|
||||||
import { fileNameMigration } from "../migrations/user-store";
|
import { fileNameMigration } from "../migrations/user-store";
|
||||||
import { ObservableToggleSet } from "../renderer/utils";
|
import { ObservableToggleSet } from "../renderer/utils";
|
||||||
import { ClusterStore } from "./cluster-store";
|
|
||||||
|
|
||||||
export interface UserStoreModel {
|
export interface UserStoreModel {
|
||||||
kubeConfigPath: string;
|
kubeConfigPath: string;
|
||||||
@ -23,10 +22,12 @@ export interface UserStoreModel {
|
|||||||
preferences: UserPreferencesModel;
|
preferences: UserPreferencesModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface KubeconfigSyncEntry {
|
export interface KubeconfigSyncEntry extends KubeconfigSyncValue {
|
||||||
filePath: string;
|
filePath: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface KubeconfigSyncValue {}
|
||||||
|
|
||||||
export interface UserPreferencesModel {
|
export interface UserPreferencesModel {
|
||||||
httpsProxy?: string;
|
httpsProxy?: string;
|
||||||
shell?: string;
|
shell?: string;
|
||||||
@ -86,9 +87,8 @@ export class UserStore extends BaseStore<UserStoreModel> {
|
|||||||
/**
|
/**
|
||||||
* The set of file/folder paths to be synced
|
* The set of file/folder paths to be synced
|
||||||
*/
|
*/
|
||||||
syncKubeconfigEntries = observable.set([
|
syncKubeconfigEntries = observable.map<string, KubeconfigSyncValue>([
|
||||||
path.join(os.homedir(), ".kube"),
|
[path.join(os.homedir(), ".kube"), {}]
|
||||||
ClusterStore.storedKubeConfigFolder,
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
async load(): Promise<void> {
|
async load(): Promise<void> {
|
||||||
@ -240,12 +240,19 @@ export class UserStore extends BaseStore<UserStoreModel> {
|
|||||||
|
|
||||||
this.hiddenTableColumns.clear();
|
this.hiddenTableColumns.clear();
|
||||||
|
|
||||||
for (const [tableId, columnIds] of preferences.hiddenTableColumns ?? []) {
|
if (preferences.hiddenTableColumns) {
|
||||||
this.hiddenTableColumns.set(tableId, new ObservableToggleSet(columnIds));
|
this.hiddenTableColumns.replace(
|
||||||
|
preferences.hiddenTableColumns
|
||||||
|
.map(([tableId, columnIds]) => [tableId, new ObservableToggleSet(columnIds)])
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
this.hiddenTableColumns.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preferences.syncKubeconfigEntries) {
|
if (preferences.syncKubeconfigEntries) {
|
||||||
this.syncKubeconfigEntries.replace(preferences.syncKubeconfigEntries.map(({ filePath }) => filePath));
|
this.syncKubeconfigEntries.replace(
|
||||||
|
preferences.syncKubeconfigEntries.map(({ filePath, ...rest }) => [filePath, rest])
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
this.syncKubeconfigEntries.clear();
|
this.syncKubeconfigEntries.clear();
|
||||||
}
|
}
|
||||||
@ -259,8 +266,8 @@ export class UserStore extends BaseStore<UserStoreModel> {
|
|||||||
hiddenTableColumns.push([key, Array.from(values)]);
|
hiddenTableColumns.push([key, Array.from(values)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const filePath of this.syncKubeconfigEntries) {
|
for (const [filePath, rest] of this.syncKubeconfigEntries) {
|
||||||
syncKubeconfigEntries.push({ filePath });
|
syncKubeconfigEntries.push({ filePath, ...rest });
|
||||||
}
|
}
|
||||||
|
|
||||||
const model: UserStoreModel = {
|
const model: UserStoreModel = {
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import { loadConfigFromString, splitConfig, validateKubeConfig } from "../../com
|
|||||||
import { Cluster } from "../cluster";
|
import { Cluster } from "../cluster";
|
||||||
import { catalogEntityFromCluster } from "../cluster-manager";
|
import { catalogEntityFromCluster } from "../cluster-manager";
|
||||||
import { UserStore } from "../../common/user-store";
|
import { UserStore } from "../../common/user-store";
|
||||||
import { UpdateClusterModel } from "../../common/cluster-store";
|
import { ClusterStore, UpdateClusterModel } from "../../common/cluster-store";
|
||||||
|
|
||||||
const logPrefix = "[KUBECONFIG-SYNC]:";
|
const logPrefix = "[KUBECONFIG-SYNC]:";
|
||||||
|
|
||||||
@ -32,21 +32,24 @@ export class KubeconfigSyncManager extends Singleton {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.syncing = true;
|
||||||
|
|
||||||
logger.info(`${logPrefix} starting requested syncs`);
|
logger.info(`${logPrefix} starting requested syncs`);
|
||||||
|
|
||||||
for (const syncEntry of UserStore.getInstance().syncKubeconfigEntries) {
|
// This must be done so that c&p-ed clusters are visible
|
||||||
this.startNewSync(syncEntry, port);
|
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 => {
|
this.syncListDisposer = UserStore.getInstance().syncKubeconfigEntries.observe(change => {
|
||||||
switch (change.type) {
|
switch (change.type) {
|
||||||
case "add":
|
case "add":
|
||||||
this.startNewSync(change.newValue, port);
|
this.startNewSync(change.name, port);
|
||||||
break;
|
break;
|
||||||
case "delete":
|
case "delete":
|
||||||
this.stopOldSync(change.oldValue);
|
this.stopOldSync(change.name);
|
||||||
break;
|
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 {
|
html {
|
||||||
font-size: var(--font-size);
|
font-size: 62.5%; // 1 rem == 10px
|
||||||
color: $textColorPrimary;
|
color: $textColorPrimary;
|
||||||
background-color: $mainBackground;
|
background-color: $mainBackground;
|
||||||
--flex-gap: #{$padding};
|
--flex-gap: #{$padding};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user