X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/58db72fee358d5987139a1b8526c0ca873e07dbf..9da78c51275666c685545d29cd92ffa0d32f7b2f:/src/views-components/data-explorer/renderers.tsx?ds=sidebyside
diff --git a/src/views-components/data-explorer/renderers.tsx b/src/views-components/data-explorer/renderers.tsx
index 901704d9..7cdd9b83 100644
--- a/src/views-components/data-explorer/renderers.tsx
+++ b/src/views-components/data-explorer/renderers.tsx
@@ -35,6 +35,7 @@ import { formatPermissionLevel } from 'views-components/sharing-dialog/permissio
import { PermissionLevel } from 'models/permission';
import { openPermissionEditContextMenu } from 'store/context-menu/context-menu-actions';
import { getUserUuid } from 'common/getuser';
+import { VirtualMachinesResource } from 'models/virtual-machines';
const renderName = (dispatch: Dispatch, item: GroupContentsResource) => {
@@ -194,7 +195,10 @@ const renderIsActive = (props: { uuid: string, kind: ResourceKind, isActive: boo
color="primary"
checked={props.isActive}
disabled={!!props.disabled}
- onClick={() => props.toggleIsActive(props.uuid)} />;
+ onClick={(e) => {
+ e.stopPropagation();
+ props.toggleIsActive(props.uuid)
+ }} />;
} else {
return ;
}
@@ -221,7 +225,7 @@ const renderIsHidden = (props: {
permissionLinkUuid: string,
visible: boolean,
canManage: boolean,
- setMemberIsHidden: (memberLinkUuid: string, permissionLinkUuid: string, hide: boolean) => void
+ setMemberIsHidden: (memberLinkUuid: string, permissionLinkUuid: string, hide: boolean) => void
}) => {
if (props.memberLinkUuid) {
return props.setMemberIsHidden(props.memberLinkUuid, props.permissionLinkUuid, !props.visible)} />;
+ onClick={(e) => {
+ e.stopPropagation();
+ props.setMemberIsHidden(props.memberLinkUuid, props.permissionLinkUuid, !props.visible);
+ }} />;
} else {
return ;
}
@@ -262,7 +269,10 @@ const renderIsAdmin = (props: { uuid: string, isAdmin: boolean, toggleIsAdmin: (
props.toggleIsAdmin(props.uuid)} />;
+ onClick={(e) => {
+ e.stopPropagation();
+ props.toggleIsAdmin(props.uuid);
+ }} />;
export const ResourceIsAdmin = connect(
(state: RootState, props: { uuid: string }) => {
@@ -271,15 +281,37 @@ export const ResourceIsAdmin = connect(
}, { toggleIsAdmin }
)(renderIsAdmin);
-const renderUsername = (item: { username: string }) =>
- {item.username};
+const renderUsername = (item: { username: string, uuid: string }) =>
+ {item.username || item.uuid};
export const ResourceUsername = connect(
(state: RootState, props: { uuid: string }) => {
const resource = getResource(props.uuid)(state.resources);
- return resource || { username: '' };
+ return resource || { username: '', uuid: props.uuid };
})(renderUsername);
+// Virtual machine resource
+
+const renderHostname = (item: { hostname: string }) =>
+ {item.hostname};
+
+export const VirtualMachineHostname = connect(
+ (state: RootState, props: { uuid: string }) => {
+ const resource = getResource(props.uuid)(state.resources);
+ return resource || { hostname: '' };
+ })(renderHostname);
+
+const renderVirtualMachineLogin = (login: {user: string}) =>
+ {login.user}
+
+export const VirtualMachineLogin = connect(
+ (state: RootState, props: { linkUuid: string }) => {
+ const permission = getResource(props.linkUuid)(state.resources);
+ const user = getResource(permission?.tailUuid || '')(state.resources);
+
+ return {user: user?.username || permission?.tailUuid || ''};
+ })(renderVirtualMachineLogin);
+
// Common methods
const renderCommonData = (data: string) =>
{data};
@@ -319,7 +351,7 @@ const clusterColors = [
export const ResourceCluster = (props: { uuid: string }) => {
const CLUSTER_ID_LENGTH = 5;
const pos = props.uuid.length > CLUSTER_ID_LENGTH ? props.uuid.indexOf('-') : 5;
- const clusterId = pos >= CLUSTER_ID_LENGTH ? props.uuid.substr(0, pos) : '';
+ const clusterId = pos >= CLUSTER_ID_LENGTH ? props.uuid.substring(0, pos) : '';
const ci = pos >= CLUSTER_ID_LENGTH ? (((((
(props.uuid.charCodeAt(0) * props.uuid.charCodeAt(1))
+ props.uuid.charCodeAt(2))