mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
mobx-6 migration -- part 3 (more fixes)
Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
parent
ae1b840df7
commit
02aa3217c3
@ -2,9 +2,7 @@
|
||||
// API: https://github.com/andreypopp/autobind-decorator
|
||||
import bindMethodOrClass from "autobind-decorator"
|
||||
|
||||
// TODO: unwrap, replace usages of @autobind() to @autobind
|
||||
// TODO: unwrap, replace calls @autobind() to @autobind
|
||||
export function autobind<T extends object>() {
|
||||
return function (target: { new(...args: any[]): T } | object, prop?: string, descriptor?: PropertyDescriptor) {
|
||||
return bindMethodOrClass(target, prop, descriptor) as any;
|
||||
};
|
||||
return bindMethodOrClass;
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// Extensions API -> Commands
|
||||
|
||||
import { BaseRegistry } from "./base-registry";
|
||||
import { action, observable, makeObservable } from "mobx";
|
||||
import { makeObservable, observable } from "mobx";
|
||||
import { LensExtension } from "../lens-extension";
|
||||
import { CatalogEntity } from "../../common/catalog";
|
||||
|
||||
@ -26,7 +26,6 @@ export class CommandRegistry extends BaseRegistry<CommandRegistration> {
|
||||
makeObservable(this);
|
||||
}
|
||||
|
||||
@action
|
||||
add(items: CommandRegistration | CommandRegistration[], extension?: LensExtension) {
|
||||
const itemArray = [items].flat();
|
||||
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
import type { IconProps } from "../../renderer/components/icon";
|
||||
import type React from "react";
|
||||
import type { PageTarget, RegisteredPage } from "./page-registry";
|
||||
import { action, makeObservable } from "mobx";
|
||||
import { BaseRegistry } from "./base-registry";
|
||||
import { LensExtension } from "../lens-extension";
|
||||
|
||||
@ -22,13 +21,6 @@ export interface PageMenuComponents {
|
||||
}
|
||||
|
||||
export class PageMenuRegistry<T extends PageMenuRegistration> extends BaseRegistry<T> {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
makeObservable(this);
|
||||
}
|
||||
|
||||
@action
|
||||
add(items: T[], ext: LensExtension) {
|
||||
const normalizedItems = items.map(menuItem => {
|
||||
menuItem.target = {
|
||||
|
||||
@ -12,11 +12,6 @@ interface Props {
|
||||
|
||||
@observer
|
||||
export class RemoveClusterButton extends React.Component<Props> {
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
makeObservable(this);
|
||||
}
|
||||
|
||||
@autobind()
|
||||
confirmRemoveCluster() {
|
||||
const { cluster } = this.props;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// Manage observable param from document's location.search
|
||||
import type { ObservableHistory } from "mobx-observable-history";
|
||||
import { action, computed, makeObservable } from "mobx";
|
||||
import { action, makeObservable } from "mobx";
|
||||
|
||||
export interface PageParamInit<V = any> {
|
||||
name: string;
|
||||
@ -81,7 +81,7 @@ export class PageParam<V = any> {
|
||||
/**
|
||||
* Get stringified raw value(s) from `document.location.search`
|
||||
*/
|
||||
@computed getRaw(): string | string[] {
|
||||
getRaw(): string | string[] {
|
||||
const values: string[] = this.history.searchParams.getAll(this.name);
|
||||
|
||||
return this.isMulti ? values : values[0];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user