Skip to content

Commit

Permalink
Merge branch 'main' and resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
moontrip committed Jun 28, 2024
2 parents c15d9f7 + 8493062 commit 3300405
Show file tree
Hide file tree
Showing 31 changed files with 598 additions and 350 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState, useRef } from 'react';
import { default as ReactSelect, components, InputAction } from 'react-select';
import { default as ReactSelect, components } from 'react-select';

export interface Option {
value: number | string | undefined;
Expand Down Expand Up @@ -67,10 +67,7 @@ const MultiSelect = (props: any) => {
(value !== '*' && label?.toLowerCase().includes(input.toLowerCase())) ||
(value === '*' && filteredOptions?.length > 0);

const onInputChange = (
inputValue: string,
event: { action: InputAction }
) => {
const onInputChange = (inputValue: string, event: { action: any }) => {
if (event.action === 'input-change') setSelectInput(inputValue);
else if (event.action === 'menu-close' && selectInput !== '')
setSelectInput('');
Expand Down
8 changes: 6 additions & 2 deletions packages/libs/eda/src/lib/core/api/DataClient/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
keyof,
boolean,
literal,
any,
} from 'io-ts';
import { Filter } from '../../types/filter';
import {
Expand Down Expand Up @@ -396,6 +395,11 @@ export const NodeIdList = type({
// The network types are all built from nodes and links. Currently we've defined specific
// flavors of networks, called "correlation" networks, that have extra information
// about them based on their context.

// NOTE tech debt below! The `sourece` and `target` of the NetworkData links should be
// NodeData, but the backend is sending us strings. At this point it is unlikely the backend
// will change for a while to fix this issue. If it does, we can simplify the below and let
// BipartiteNetworkData extend NetworkData.
const NodeData = intersection([
type({
id: string,
Expand Down Expand Up @@ -425,7 +429,7 @@ export const NetworkData = type({
});

const NetworkConfig = partial({
variables: any,
variables: unknown,
correlationCoefThreshold: number,
significanceThreshold: number,
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useMemo } from 'react';
import { useFindEntityAndVariableCollection } from '../../..';
import { ComputationConfigProps, ComputationPlugin } from '../Types';
import { partial } from 'lodash';
Expand Down Expand Up @@ -127,11 +126,10 @@ export function SelfCorrelationConfiguration(props: ComputationConfigProps) {
visualizationId,
} = props;

const configuration = computation.descriptor
.configuration as SelfCorrelationConfig;

assertComputationWithConfig(computation, SelfCorrelationConfig);

const { configuration } = computation.descriptor;

const changeConfigHandler = useConfigChangeHandler(
analysisState,
computation,
Expand Down Expand Up @@ -212,17 +210,11 @@ export function SelfCorrelationConfiguration(props: ComputationConfigProps) {
</div>
);

const correlationMethodSelectorText = useMemo(() => {
if (configuration.correlationMethod) {
return (
CORRELATION_METHODS.find(
(method) => method.value === configuration.correlationMethod
)?.displayName ?? 'Select a method'
);
} else {
return 'Select a method';
}
}, [configuration.correlationMethod]);
const correlationMethodSelectorText = configuration.correlationMethod
? CORRELATION_METHODS.find(
(method) => method.value === configuration.correlationMethod
)?.displayName ?? 'Select a method'
: 'Select a method';

return (
<ComputationStepContainer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ import { FacetedPlotLayout } from '../../layouts/FacetedPlotLayout';
import { H6 } from '@veupathdb/coreui';
import { CorrelationConfig } from '../../../types/apps';
import { LabelPosition } from '@veupathdb/components/lib/plots/Node';

import MultiSelect, {
Option as NodeLabelProp,
} from '@veupathdb/components/lib/components/plotControls/MultiSelect';
Expand Down
23 changes: 12 additions & 11 deletions packages/libs/user-datasets/src/lib/Actions/UserDatasetsActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
EmptyAction,
emptyAction,
} from '@veupathdb/wdk-client/lib/Core/WdkMiddleware';
import { ServiceError } from '@veupathdb/wdk-client/lib/Service/ServiceError';

import { validateVdiCompatibleThunk } from '../Service';

Expand All @@ -25,6 +24,7 @@ import {
UserQuotaMetadata,
UserDatasetFileListing,
} from '../Utils/types';
import { FetchClientError } from '@veupathdb/http-utils';

export type Action =
| DetailErrorAction
Expand Down Expand Up @@ -91,12 +91,12 @@ export const LIST_ERROR_RECEIVED = 'user-dataset/list-error';
export type ListErrorReceivedAction = {
type: typeof LIST_ERROR_RECEIVED;
payload: {
error: ServiceError;
error: FetchClientError;
};
};

export function listErrorReceived(
error: ServiceError
error: FetchClientError
): ListErrorReceivedAction {
return {
type: LIST_ERROR_RECEIVED,
Expand Down Expand Up @@ -161,11 +161,11 @@ export const DETAIL_ERROR = 'user-datasets/detail-error';
export type DetailErrorAction = {
type: typeof DETAIL_ERROR;
payload: {
error: ServiceError;
error: FetchClientError;
};
};

export function detailError(error: ServiceError): DetailErrorAction {
export function detailError(error: FetchClientError): DetailErrorAction {
return {
type: DETAIL_ERROR,
payload: {
Expand Down Expand Up @@ -217,12 +217,12 @@ export const DETAIL_UPDATE_ERROR = 'user-datasets/detail-update-error';
export type DetailUpdateErrorAction = {
type: typeof DETAIL_UPDATE_ERROR;
payload: {
error: ServiceError;
error: FetchClientError;
};
};

export function detailUpdateError(
error: ServiceError
error: FetchClientError
): DetailUpdateErrorAction {
return {
type: DETAIL_UPDATE_ERROR,
Expand Down Expand Up @@ -275,12 +275,12 @@ export const DETAIL_REMOVE_ERROR = 'user-datasets/detail-remove-error';
export type DetailRemoveErrorAction = {
type: typeof DETAIL_REMOVE_ERROR;
payload: {
error: ServiceError;
error: FetchClientError;
};
};

export function detailRemoveError(
error: ServiceError
error: FetchClientError
): DetailRemoveErrorAction {
return {
type: DETAIL_REMOVE_ERROR,
Expand Down Expand Up @@ -485,8 +485,7 @@ export function loadUserDatasetDetailWithoutLoadingIndicator(id: string) {
};
return detailReceived(id, transformedResponse, fileListing);
},
(error: ServiceError) =>
error.status === 404 ? detailReceived(id) : detailError(error)
(error: FetchClientError) => detailError(error)
)
);
}
Expand Down Expand Up @@ -632,6 +631,7 @@ function transformVdiResponseToLegacyResponseHelper(
created,
status,
importMessages,
visibility,
} = ud;
const { quota } = userQuotaMetadata;
return {
Expand All @@ -647,6 +647,7 @@ function transformVdiResponseToLegacyResponseHelper(
name,
description: description ?? '',
summary: summary ?? '',
visibility,
},
ownerUserId: owner.userId,
age: Date.now() - Date.parse(created),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import { Public } from '@material-ui/icons';

import Icon from '@veupathdb/wdk-client/lib/Components/Icon/IconAlt';
import SaveableTextEditor from '@veupathdb/wdk-client/lib/Components/InputControls/SaveableTextEditor';
Expand Down Expand Up @@ -149,8 +150,8 @@ class UserDatasetDetail extends React.Component {

return [
{
className: classify('Name'),
attribute: this.props.detailsPageTitle,
className: classify('Name'),
value: (
<SaveableTextEditor
value={meta.name}
Expand All @@ -161,7 +162,6 @@ class UserDatasetDetail extends React.Component {
},
{
attribute: 'Status',
className: classify('Status'),
value: (
<UserDatasetStatus
linkToDataset={false}
Expand All @@ -173,6 +173,36 @@ class UserDatasetDetail extends React.Component {
/>
),
},
{
attribute: 'Visibility',
value:
meta.visibility === 'public' ? (
<>
{' '}
<Public className="Community-visible" /> This{' '}
{dataNoun.singular.toLowerCase()} is visible to the community.
</>
) : (
<>
This {dataNoun.singular.toLowerCase()} is only visble to the owner
and those they have shared it with.
</>
),
},
!isOwner || !sharedWith || !sharedWith.length
? null
: {
attribute: 'Shared with',
value: (
<ul>
{sharedWith.map((share, index) => (
<li key={`${share.userDisplayName}-${index}`}>
{share.userDisplayName}
</li>
))}
</ul>
),
},
{
attribute: 'Owner',
value: isOwner ? 'Me' : owner,
Expand Down Expand Up @@ -223,20 +253,6 @@ class UserDatasetDetail extends React.Component {
quotaSize
)}`,
},
!isOwner || !sharedWith || !sharedWith.length
? null
: {
attribute: 'Shared with',
value: (
<ul>
{sharedWith.map((share, index) => (
<li key={`${share.userDisplayName}-${index}`}>
{share.userDisplayName}
</li>
))}
</ul>
),
},
!questions || !questions.length || !isInstalled
? null
: {
Expand Down Expand Up @@ -298,7 +314,9 @@ class UserDatasetDetail extends React.Component {
{attributes.map(({ attribute, value, className }, index) => (
<div
className={
classify('AttributeRow') + (className ? ' ' + className : '')
classify('AttributeRow') +
' ' +
(className ?? classify(attribute))
}
key={index}
>
Expand Down Expand Up @@ -326,7 +344,9 @@ class UserDatasetDetail extends React.Component {
onPress={this.openSharingModal}
/>
)}
<ThemedDeleteButton buttonText="Delete" onPress={this.handleDelete} />
{isOwner ? (
<ThemedDeleteButton buttonText="Delete" onPress={this.handleDelete} />
) : null}
</div>
);
}
Expand Down Expand Up @@ -617,6 +637,8 @@ class UserDatasetDetail extends React.Component {
sharingDatasetPending,
shareSuccessful,
shareError,
updateUserDatasetDetail,
enablePublicUserDatasets,
} = this.props;
const AllDatasetsLink = this.renderAllDatasetsLink;
if (!userDataset)
Expand Down Expand Up @@ -644,6 +666,8 @@ class UserDatasetDetail extends React.Component {
sharingDatasetPending={sharingDatasetPending}
shareSuccessful={shareSuccessful}
shareError={shareError}
updateUserDatasetDetail={updateUserDatasetDetail}
enablePublicUserDatasets={enablePublicUserDatasets}
/>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@
flex: 1 1 auto;
}
}
.UserDatasetDetail-Status {
margin-bottom: 1em;
.UserDatasetDetail-Owner {
margin-top: 1em;
}
}
}
Loading

0 comments on commit 3300405

Please sign in to comment.