mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Improve bootstrap logging for help with iframe debugging (#4020)
This commit is contained in:
1 parent
e779c7c317
commit
885af07d0b
12 files changed
+113
-76
No files matched your search
@@ -43,6 +43,8 @@ export abstract class BaseStore<T> extends Singleton {
|
||||
protected storeConfig?: Config<T>;
|
||||
protected syncDisposers: Disposer[] = [];
|
||||
|
||||
readonly displayName: string = this.constructor.name;
|
||||
|
||||
protected constructor(protected params: BaseStoreParams<T>) {
|
||||
super();
|
||||
makeObservable(this);
|
||||
@@ -56,6 +58,10 @@ export abstract class BaseStore<T> extends Singleton {
|
||||
* This must be called after the last child's constructor is finished (or just before it finishes)
|
||||
*/
|
||||
load() {
|
||||
if (!isTestEnv) {
|
||||
logger.info(`[${kebabCase(this.displayName).toUpperCase()}]: LOADING from ${this.path} ...`);
|
||||
}
|
||||
|
||||
this.storeConfig = new Config({
|
||||
...this.params,
|
||||
projectName: "lens",
|
||||
@@ -66,13 +72,13 @@ export abstract class BaseStore<T> extends Singleton {
|
||||
const res: any = this.fromStore(this.storeConfig.store);
|
||||
|
||||
if (res instanceof Promise || (typeof res === "object" && res && typeof res.then === "function")) {
|
||||
console.error(`${this.constructor.name} extends BaseStore<T>'s fromStore method returns a Promise or promise-like object. This is an error and must be fixed.`);
|
||||
console.error(`${this.displayName} extends BaseStore<T>'s fromStore method returns a Promise or promise-like object. This is an error and must be fixed.`);
|
||||
}
|
||||
|
||||
this.enableSync();
|
||||
|
||||
if (!isTestEnv) {
|
||||
logger.info(`[${kebabCase(this.constructor.name).toUpperCase()}]: LOADED from ${this.path}`);
|
||||
logger.info(`[${kebabCase(this.displayName).toUpperCase()}]: LOADED from ${this.path}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ export interface ClusterStoreModel {
|
||||
const initialStates = "cluster:states";
|
||||
|
||||
export class ClusterStore extends BaseStore<ClusterStoreModel> {
|
||||
readonly displayName = "ClusterStore";
|
||||
clusters = observable.map<ClusterId, Cluster>();
|
||||
|
||||
protected disposer = disposer();
|
||||
|
||||
@@ -35,6 +35,7 @@ export interface HotbarStoreModel {
|
||||
}
|
||||
|
||||
export class HotbarStore extends BaseStore<HotbarStoreModel> {
|
||||
readonly displayName = "HotbarStore";
|
||||
@observable hotbars: Hotbar[] = [];
|
||||
@observable private _activeHotbarId: string;
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ export interface UserStoreModel {
|
||||
}
|
||||
|
||||
export class UserStore extends BaseStore<UserStoreModel> /* implements UserStoreFlatModel (when strict null is enabled) */ {
|
||||
readonly displayName = "UserStore";
|
||||
constructor() {
|
||||
super({
|
||||
configName: "lens-user-store",
|
||||
|
||||
@@ -43,6 +43,7 @@ export interface WeblinkStoreModel {
|
||||
}
|
||||
|
||||
export class WeblinkStore extends BaseStore<WeblinkStoreModel> {
|
||||
readonly displayName = "WeblinkStore";
|
||||
@observable weblinks: WeblinkData[] = [];
|
||||
|
||||
constructor() {
|
||||
|
||||
Reference in new issue
Block a user