Remove ExtenedMap, ToggleSet, and observable versions (#3310)

- Switch to helper functions instead. They don't impact the prototype
  tree and it means that we don't need to introduce versions that are
  both observable and "normal"

- Tidy <ItemListLayout> and hiddenTableColumns to not need
  pre-initialization

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton authored and GitHub committed 2022-02-16 18:20:22 -05:00
1 parent ed91ef2d03
commit 8088d3b5c2
10 files changed
+58 -105

No files matched your search

@@ -27,7 +27,7 @@ interface Props extends KubeObjectDetailsProps<Secret> {
export class SecretDetails extends React.Component<Props> {
@observable isSaving = false;
@observable data: { [name: string]: string } = {};
revealSecret = new Set<string>();
@observable revealSecret = observable.set<string>();
constructor(props: Props) {
super(props);
@@ -11,7 +11,7 @@ import { Notice } from "../+extensions/notice";
import { KubeconfigSyncEntry, KubeconfigSyncValue, UserStore } from "../../../common/user-store";
import { isWindows } from "../../../common/vars";
import logger from "../../../main/logger";
import { iter, multiSet } from "../../utils";
import { iter } from "../../utils";
import { SubTitle } from "../layout/sub-title";
import { PathPicker } from "../path-picker/path-picker";
import { Spinner } from "../spinner";
@@ -93,7 +93,9 @@ export class KubeconfigSyncs extends React.Component {
return Array.from(this.syncs.entries(), ([filePath, value]) => ({ filePath, ...value }));
}
onPick = async (filePaths: string[]) => multiSet(this.syncs, await getAllEntries(filePaths));
onPick = async (filePaths: string[]) => {
this.syncs.merge(await getAllEntries(filePaths));
};
getIconName(entry: Entry) {
switch (entry.info.type) {
@@ -6,21 +6,15 @@
import React from "react";
import { kubernetesClusterCategory } from "../../common/catalog-entities";
import { addClusterURL, kubernetesURL } from "../../common/routes";
import { multiSet } from "../utils";
import { UserStore } from "../../common/user-store";
import { getAllEntries } from "../components/+preferences/kubeconfig-syncs";
import { runInAction } from "mobx";
import { isLinux, isWindows } from "../../common/vars";
import { PathPicker } from "../components/path-picker";
import { Notifications } from "../components/notifications";
import { Link } from "react-router-dom";
async function addSyncEntries(filePaths: string[]) {
const entries = await getAllEntries(filePaths);
runInAction(() => {
multiSet(UserStore.getInstance().syncKubeconfigEntries, entries);
});
UserStore.getInstance().syncKubeconfigEntries.merge(await getAllEntries(filePaths));
Notifications.ok(
<div>