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

Add types to store table size configs in user preferences store

Signed-off-by: Alex Culliere <alozhkin@mirantis.com>
This commit is contained in:
Alex Culliere 2021-02-16 13:10:42 +02:00
parent f06fb7892b
commit 74785e2fbc
2 changed files with 14 additions and 1 deletions

View File

@ -0,0 +1,10 @@
import { ClusterId } from "./cluster-store";
export type TableId = string;
export type TableSizeRecord = Record<TableId, number[]>;
/**
* Stores a configuration of table column sizes, set by the user,
* for each table by `TableId`, for each cluster by `ClusterId`
*/
export type TableSizeConfig = Record<ClusterId, TableSizeRecord>;

View File

@ -9,6 +9,7 @@ import { getAppVersion } from "./utils/app-version";
import { kubeConfigDefaultPath, loadConfig } from "./kube-helpers"; import { kubeConfigDefaultPath, loadConfig } from "./kube-helpers";
import { appEventBus } from "./event-bus"; import { appEventBus } from "./event-bus";
import logger from "../main/logger"; import logger from "../main/logger";
import { TableSizeConfig } from "./table-size-config";
import path from "path"; import path from "path";
export interface UserStoreModel { export interface UserStoreModel {
@ -29,7 +30,8 @@ export interface UserPreferences {
downloadBinariesPath?: string; downloadBinariesPath?: string;
kubectlBinariesPath?: string; kubectlBinariesPath?: string;
openAtLogin?: boolean; openAtLogin?: boolean;
hiddenTableColumns?: Record<string, string[]>; tableSizeConfig?: TableSizeConfig;
hiddenTableColumns?: Record<string, string[]>
} }
export class UserStore extends BaseStore<UserStoreModel> { export class UserStore extends BaseStore<UserStoreModel> {
@ -57,6 +59,7 @@ export class UserStore extends BaseStore<UserStoreModel> {
downloadKubectlBinaries: true, // Download kubectl binaries matching cluster version downloadKubectlBinaries: true, // Download kubectl binaries matching cluster version
openAtLogin: false, openAtLogin: false,
hiddenTableColumns: {}, hiddenTableColumns: {},
tableSizeConfig: {},
}; };
protected async handleOnLoad() { protected async handleOnLoad() {