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 (
|
return (
|
||||||
<>
|
<>
|
||||||
{
|
<MenuItem onClick={this.settings}>
|
||||||
<MenuItem onClick={this.settings}>
|
<Icon material="settings" interactive={toolbar} title="Settings"/>
|
||||||
<Icon material="settings" interactive={toolbar} title={`Settings`}/>
|
<span className="title">Settings</span>
|
||||||
<span className="title">Settings</span>
|
</MenuItem>
|
||||||
</MenuItem>
|
|
||||||
}
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,8 +5,8 @@ import { ItemObject, ItemStore } from "../../item.store";
|
|||||||
import { autobind } from "../../utils";
|
import { autobind } from "../../utils";
|
||||||
|
|
||||||
export class ClusterItem implements ItemObject {
|
export class ClusterItem implements ItemObject {
|
||||||
cluster: Cluster;
|
constructor(public cluster: Cluster) {}
|
||||||
|
|
||||||
getName() {
|
getName() {
|
||||||
return this.cluster.name;
|
return this.cluster.name;
|
||||||
}
|
}
|
||||||
@ -28,13 +28,13 @@ export class WorkspaceClusterStore extends ItemStore<ClusterItem> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
loadAll() {
|
loadAll() {
|
||||||
return this.loadItems(() => clusterStore.getByWorkspaceId(this.workspaceId).map(cluster => {
|
return this.loadItems(
|
||||||
const clusterItem = new ClusterItem();
|
() => (
|
||||||
|
clusterStore
|
||||||
clusterItem.cluster = cluster;
|
.getByWorkspaceId(this.workspaceId)
|
||||||
|
.map(cluster => new ClusterItem(cluster))
|
||||||
return clusterItem;
|
)
|
||||||
}));
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async remove(clusterItem: ClusterItem) {
|
async remove(clusterItem: ClusterItem) {
|
||||||
@ -46,19 +46,10 @@ export class WorkspaceClusterStore extends ItemStore<ClusterItem> {
|
|||||||
|
|
||||||
const clusterId = cluster.id;
|
const clusterId = cluster.id;
|
||||||
|
|
||||||
return super.removeItem(clusterItem, async () => {
|
return super.removeItem(clusterItem, async () => clusterStore.removeById(clusterId));
|
||||||
if (clusterStore.activeClusterId === clusterId) {
|
|
||||||
clusterStore.setActive(null);
|
|
||||||
}
|
|
||||||
clusterStore.removeById(clusterId);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async removeSelectedItems() {
|
async removeSelectedItems() {
|
||||||
if (!this.selectedItems.length) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Promise.all(this.selectedItems.map(this.remove));
|
return Promise.all(this.selectedItems.map(this.remove));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -60,9 +60,9 @@ export class WorkspaceOverview extends Component<Props> {
|
|||||||
item.cluster.online ? "online" : "offline"
|
item.cluster.online ? "online" : "offline"
|
||||||
]}
|
]}
|
||||||
onDetails={this.showCluster}
|
onDetails={this.showCluster}
|
||||||
renderItemMenu={(clusterItem: ClusterItem) => {
|
renderItemMenu={(clusterItem: ClusterItem) => (
|
||||||
return <WorkspaceClusterMenu clusterItem={clusterItem} workspace={workspace} workspaceClusterStore={workspaceClusterStore}/>;
|
<WorkspaceClusterMenu clusterItem={clusterItem} workspace={workspace} workspaceClusterStore={workspaceClusterStore}/>
|
||||||
}}
|
)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user