Skip to content

Commit

Permalink
Merge pull request #1502 from BlueBrain/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Dinika authored Feb 21, 2024
2 parents 92ce7a0 + f0bd16c commit bd2ff7c
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/pages/StudiosPage/StudiosPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ const StudioItem = ({
)}
</h3>
</Link>
<p>{description}</p>
<p className="description">{description}</p>
</div>
<div className="statistics studios-list-item">
<div className="statistics_item">
Expand Down
3 changes: 2 additions & 1 deletion src/shared/containers/DataTableContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import {
DataPanelEvent,
} from '../organisms/DataPanel/DataPanel';
import { TResourceTableData } from '../molecules/MyDataTable/MyDataTable';
import { resourceWithoutMetadata } from '../../subapps/studioLegacy/containers/StudioContainer';

export type TableColumn = {
'@type': string;
Expand Down Expand Up @@ -290,7 +291,7 @@ const DataTableContainer: React.FC<DataTableProps> = ({
projectLabel,
encodeURIComponent(data['@id']),
latest._rev,
{ ...latest, ...data }
{ ...resourceWithoutMetadata(latest), ...resourceWithoutMetadata(data) }
);
}
const resource = await nexus.Resource.create(orgLabel, projectLabel, data);
Expand Down
10 changes: 10 additions & 0 deletions src/shared/styles/route-layout.less
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
text-align: center;
vertical-align: middle;
}

.depreacted-tag {
font-family: 'Titillium Web';
font-style: normal;
Expand All @@ -143,6 +144,7 @@
margin: 0 3px;
vertical-align: middle;
}

.deletion-tag {
font-family: 'Titillium Web';
font-style: normal;
Expand All @@ -168,6 +170,14 @@
}
}

.description {
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
line-clamp: 2;
}

.statistics {
display: grid;
grid-template-columns: 1fr 1fr;
Expand Down
12 changes: 10 additions & 2 deletions src/subapps/studioLegacy/containers/StudioContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import * as React from 'react';
import { Resource } from '@bbp/nexus-sdk';
import { useNexusContext, AccessControl } from '@bbp/react-nexus';
import { Empty, message } from 'antd';
import { omitBy } from 'lodash';
import { useHistory } from 'react-router';

import EditStudio from '../components/EditStudio';
import StudioHeader from '../components/StudioHeader';
import StudioReactContext from '../contexts/StudioContext';
Expand All @@ -14,6 +16,10 @@ import useNotification, {
parseNexusError,
} from '../../../shared/hooks/useNotification';

export const resourceWithoutMetadata = (
studioResource: StudioResource | Resource
) => omitBy(studioResource, (_, key) => key.trim().startsWith('_'));

const resourcesWritePermissionsWrapper = (
child: React.ReactNode,
permissionPath: string
Expand Down Expand Up @@ -114,7 +120,9 @@ const StudioContainer: React.FunctionComponent = () => {
studioId,
studioResource._rev,
{
...studioResource,
// remove the metadata from the payload, delta do full update
// and not accept the metadata fields to be in the payload
...resourceWithoutMetadata(studioResource),
label,
description,
plugins,
Expand Down Expand Up @@ -145,7 +153,7 @@ const StudioContainer: React.FunctionComponent = () => {
onSave={updateStudio}
onSaveImage={saveImage(nexus, orgLabel, projectLabel)}
markdownViewer={MarkdownViewerContainer}
></EditStudio>
/>
);
return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
} from 'antd';
import TextArea from 'antd/lib/input/TextArea';
import useNotification from '../../../shared/hooks/useNotification';
import { resourceWithoutMetadata } from './StudioContainer';

type NexusSparqlError = {
reason: string;
Expand Down Expand Up @@ -123,7 +124,7 @@ const WorkspaceForm: React.FunctionComponent<WorkspaceFormProps> = ({
projectLabel,
encodeURIComponent(workspace['@id']),
workspace['_rev'],
newWorkspace
resourceWithoutMetadata(newWorkspace)
)
.then(result => {
if (onSuccess) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
import PromisePool from '@supercharge/promise-pool';
import { ItemType } from 'antd/lib/menu/hooks/useItems';
import { useQuery } from 'react-query';
import { find, orderBy } from 'lodash';
import { find, omitBy, orderBy } from 'lodash';
import useNotification from '../../../shared/hooks/useNotification';
import EditTableForm from '../../../shared/components/EditTableForm';
import DashboardEditorContainer from './DashBoardEditor/DashboardEditorContainer';
Expand All @@ -30,6 +30,7 @@ import STUDIO_CONTEXT from '../components/StudioContext';
import { createTableContext } from '../../../subapps/projects/utils/workFlowMetadataUtils';
import { ErrorComponent } from '../../../shared/components/ErrorComponent';
import '../studio.less';
import { resourceWithoutMetadata } from './StudioContainer';

const DASHBOARD_TYPE = 'StudioDashboard';

Expand Down Expand Up @@ -484,18 +485,18 @@ const WorkspaceMenu: React.FC<WorkspaceMenuProps> = ({
data: TableResource | UnsavedTableResource
) => {
if (selectedDashboard) {
const resource = await nexus.Resource.get(
const resource = (await nexus.Resource.get(
orgLabel,
projectLabel,
encodeURIComponent(selectedDashboard['@id'])
);
)) as StudioResource;
await nexus.Resource.update(
orgLabel,
projectLabel,
encodeURIComponent(selectedDashboard['@id']),
selectedDashboard._rev,
{
...resource,
...resourceWithoutMetadata(resource),
description: data.description,
label: data['name'],
}
Expand Down

0 comments on commit bd2ff7c

Please sign in to comment.