mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
address review comments
Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com>
This commit is contained in:
parent
28da6330bb
commit
5e7379f187
@ -49,12 +49,10 @@ export class WorkspaceClusterMenu extends React.Component<Props> {
|
||||
|
||||
return (
|
||||
<>
|
||||
{
|
||||
<MenuItem onClick={this.settings}>
|
||||
<Icon material="settings" interactive={toolbar} title={`Settings`}/>
|
||||
<span className="title">Settings</span>
|
||||
</MenuItem>
|
||||
}
|
||||
<MenuItem onClick={this.settings}>
|
||||
<Icon material="settings" interactive={toolbar} title="Settings"/>
|
||||
<span className="title">Settings</span>
|
||||
</MenuItem>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@ -5,8 +5,8 @@ import { ItemObject, ItemStore } from "../../item.store";
|
||||
import { autobind } from "../../utils";
|
||||
|
||||
export class ClusterItem implements ItemObject {
|
||||
cluster: Cluster;
|
||||
|
||||
constructor(public cluster: Cluster) {}
|
||||
|
||||
getName() {
|
||||
return this.cluster.name;
|
||||
}
|
||||
@ -28,13 +28,13 @@ export class WorkspaceClusterStore extends ItemStore<ClusterItem> {
|
||||
}
|
||||
|
||||
loadAll() {
|
||||
return this.loadItems(() => clusterStore.getByWorkspaceId(this.workspaceId).map(cluster => {
|
||||
const clusterItem = new ClusterItem();
|
||||
|
||||
clusterItem.cluster = cluster;
|
||||
|
||||
return clusterItem;
|
||||
}));
|
||||
return this.loadItems(
|
||||
() => (
|
||||
clusterStore
|
||||
.getByWorkspaceId(this.workspaceId)
|
||||
.map(cluster => new ClusterItem(cluster))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
async remove(clusterItem: ClusterItem) {
|
||||
@ -46,19 +46,10 @@ export class WorkspaceClusterStore extends ItemStore<ClusterItem> {
|
||||
|
||||
const clusterId = cluster.id;
|
||||
|
||||
return super.removeItem(clusterItem, async () => {
|
||||
if (clusterStore.activeClusterId === clusterId) {
|
||||
clusterStore.setActive(null);
|
||||
}
|
||||
clusterStore.removeById(clusterId);
|
||||
});
|
||||
return super.removeItem(clusterItem, async () => clusterStore.removeById(clusterId));
|
||||
}
|
||||
|
||||
async removeSelectedItems() {
|
||||
if (!this.selectedItems.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
return Promise.all(this.selectedItems.map(this.remove));
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,9 +60,9 @@ export class WorkspaceOverview extends Component<Props> {
|
||||
item.cluster.online ? "online" : "offline"
|
||||
]}
|
||||
onDetails={this.showCluster}
|
||||
renderItemMenu={(clusterItem: ClusterItem) => {
|
||||
return <WorkspaceClusterMenu clusterItem={clusterItem} workspace={workspace} workspaceClusterStore={workspaceClusterStore}/>;
|
||||
}}
|
||||
renderItemMenu={(clusterItem: ClusterItem) => (
|
||||
<WorkspaceClusterMenu clusterItem={clusterItem} workspace={workspace} workspaceClusterStore={workspaceClusterStore}/>
|
||||
)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user