Skip to content

Commit

Permalink
4205 // Update all menus
Browse files Browse the repository at this point in the history
  • Loading branch information
Dinika committed Oct 3, 2023
1 parent 85a3ccd commit 499b01b
Show file tree
Hide file tree
Showing 10 changed files with 223 additions and 156 deletions.
42 changes: 23 additions & 19 deletions src/shared/components/JIRA/JIRA.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -317,17 +317,20 @@ const JIRAPluginUI = ({
>
<Dropdown
dropdownRender={() => (
<Menu>
<Menu.Item
key="create"
onClick={() => setCreateIssueVisible(true)}
>
Create issue
</Menu.Item>
<Menu.Item key="link" onClick={() => setLinkIssueVisible(true)}>
Link issue
</Menu.Item>
</Menu>
<Menu
items={[
{
key: 'create',
onClick: () => setCreateIssueVisible(true),
label: 'Create issue',
},
{
key: 'link',
onClick: () => setLinkIssueVisible(true),
label: 'Link issue',
},
]}
/>
)}
>
<Button type="primary" style={{ marginLeft: 'auto' }}>
Expand Down Expand Up @@ -423,14 +426,15 @@ const JIRAPluginUI = ({
<Dropdown.Button
size="small"
dropdownRender={() => (
<Menu>
<Menu.Item
key="unlink"
onClick={() => confirmUnlinkIssue(issue.key)}
>
Unlink
</Menu.Item>
</Menu>
<Menu
items={[
{
key: 'unlink',
label: 'Unlink',
onClick: () => confirmUnlinkIssue(issue.key),
},
]}
/>
)}
>
Options
Expand Down
10 changes: 5 additions & 5 deletions src/shared/components/Login/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ const Login: React.FunctionComponent<LoginProps> = ({
onRealmSelected(realm);
}
}}
>
{realms.map(realm => (
<Menu.Item key={realm}>{realm}</Menu.Item>
))}
</Menu>
items={realms.map(realm => ({
key: realm,
label: realm,
}))}
/>
);

return (
Expand Down
18 changes: 14 additions & 4 deletions src/shared/components/ResourceList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,20 @@ const ResourceListComponent: React.FunctionComponent<{
};

const sortOptions = (
<Menu onClick={onChangeSort} selectedKeys={[sortOption]}>
<Menu.Item key="-_createdAt">Newest</Menu.Item>
<Menu.Item key="_createdAt">Oldest</Menu.Item>
</Menu>
<Menu
onClick={onChangeSort}
selectedKeys={[sortOption]}
items={[
{
key: '-_createdAt',
label: 'Newest',
},
{
key: '_createdAt',
label: 'Oldest',
},
]}
></Menu>
);

const hiddenListForCalculatingDimensionsForPageSize = (
Expand Down
20 changes: 15 additions & 5 deletions src/shared/containers/DataCartContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,21 @@ const DataCartContainer = () => {
? downLoadFiles()
: downLoadMetaData();
}}
>
<Menu.Item key="meta-data">Metadata</Menu.Item>
<Menu.Item key="files">Files</Menu.Item>
<Menu.Item key="both">Both</Menu.Item>
</Menu>
items={[
{
key: 'meta-data',
label: 'Metadata',
},
{
key: 'files',
label: 'Files',
},
{
key: 'both',
label: 'Both',
},
]}
/>
);

const downloadButton = (disabled: boolean) => {
Expand Down
16 changes: 9 additions & 7 deletions src/shared/containers/RemoveTagButtonContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,15 @@ const RemoveTagButton: React.FunctionComponent<{
onClick={e => {
setConfirm({ visible: true, tagName: e.key.toString(), busy: false });
}}
>
{tags?.map(t => (
<Menu.Item key={t.tag}>
{t.tag} (<em>revision {t.rev} </em>)
</Menu.Item>
))}
</Menu>
items={tags?.map(t => ({
key: t.tag,
label: (
<>
{t.tag} (<em>revision {t.rev} </em>)
</>
),
}))}
/>
);

return (
Expand Down
160 changes: 83 additions & 77 deletions src/shared/containers/ResourceViewActionsContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,23 +171,23 @@ const ResourceViewActionsContainer: React.FC<{

const revisionMenuItems = React.useMemo(
() => (
<Menu>
{[...Array(latestResource?._rev).keys()]
<Menu
items={[...Array(latestResource?._rev).keys()]
.map(k => k + 1)
.sort((a, b) => b - a)
.map(rev => (
<Menu.Item
key={rev}
onClick={() => {
goToResource(orgLabel, projectLabel, encodedResourceId, rev);
}}
>
Revision {rev}
{revisionLabels(rev).length > 0 &&
` (${revisionLabels(rev).join(', ')})`}
</Menu.Item>
))}
</Menu>
.map(rev => ({
key: rev,
onClick: () =>
goToResource(orgLabel, projectLabel, encodedResourceId, rev),
label: (
<>
Revision {rev}
{revisionLabels(rev).length > 0 &&
` (${revisionLabels(rev).join(', ')})`}
</>
),
}))}
/>
),
[resource, latestResource, tags]
);
Expand Down Expand Up @@ -244,70 +244,76 @@ const ResourceViewActionsContainer: React.FC<{
}
}}
dropdownRender={() => (
<Menu>
<Menu.Item
onClick={() => {
const pathToResource = `${basePath}${generatePath(
'/:orgLabel/:projectLabel/resources/:resourceId',
{
orgLabel,
projectLabel,
resourceId: encodedResourceId,
}
)}`;
<Menu
items={[
{
key: 'url',
label: 'URL',
onClick: () => {
const pathToResource = `${basePath}${generatePath(
'/:orgLabel/:projectLabel/resources/:resourceId',
{
orgLabel,
projectLabel,
resourceId: encodedResourceId,
}
)}`;

triggerCopy(
`${window.location.origin.toString()}${pathToResource}`
);
}}
>
URL
</Menu.Item>
<Menu.Item
onClick={() => {
const pathToResource = `${basePath}${generatePath(
'/:orgLabel/:projectLabel/resources/:resourceId',
{
orgLabel,
projectLabel,
resourceId: encodedResourceId,
}
)}`;
triggerCopy(
`${window.location.origin.toString()}${pathToResource}`
);
},
},
{
key: 'url_with_revision',
label: 'URL (with revision)',
onClick: () => {
const pathToResource = `${basePath}${generatePath(
'/:orgLabel/:projectLabel/resources/:resourceId',
{
orgLabel,
projectLabel,
resourceId: encodedResourceId,
}
)}`;

triggerCopy(
`${window.location.origin.toString()}${pathToResource}?rev=${
resource._rev
}`
);
}}
>
URL (with revision)
</Menu.Item>
<Menu.Item onClick={() => triggerCopy(resource['@id'])}>
ID
</Menu.Item>
<Menu.Item
onClick={() =>
triggerCopy(`${resource['@id']}?rev=${resource._rev}`)
}
>
ID (with revision)
</Menu.Item>
<Menu.Item onClick={() => triggerCopy(self ? self : '')}>
Nexus address
</Menu.Item>
<Menu.Item
onClick={() =>
triggerCopy(
self
? `${self}?rev=${resource ? resource._rev : ''}`
: ''
)
}
>
Nexus address (with revision)
</Menu.Item>
</Menu>
triggerCopy(
`${window.location.origin.toString()}${pathToResource}?rev=${
resource._rev
}`
);
},
},
{
key: 'id',
label: 'ID',
onClick: () => triggerCopy(resource['@id']),
},
{
key: 'id_with_revision',
label: 'ID (with revision)',
onClick: () =>
triggerCopy(
`${resource['@id']}?rev=${resource._rev}`
),
},
{
key: 'nexus_address',
label: 'Nexus address',
onClick: () => triggerCopy(self ? self : ''),
},
{
key: 'nexus_address_with_revision',
label: 'Nexus address (with revision)',
onClick: () =>
triggerCopy(
self
? `${self}?rev=${resource ? resource._rev : ''}`
: ''
),
},
]}
/>
)}
>
{copySuccess ? 'Copied!' : 'Copy'}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,17 @@ const DateFieldSelector = ({
defaultSelectedKeys={['']}
selectedKeys={dateField ? [dateField] : undefined}
className="my-data-date-type-popover"
>
<Menu.Item key="createdAt">{dateFieldName.createdAt}</Menu.Item>
<Menu.Item key="updatedAt">{dateFieldName.updatedAt}</Menu.Item>
</Menu>
items={[
{
key: 'createdAt',
label: dateFieldName.createdAt,
},
{
key: 'updatedAt',
label: dateFieldName.updatedAt,
},
]}
/>
);
return (
<Dropdown
Expand Down
5 changes: 2 additions & 3 deletions src/subapps/admin/components/Settings/ResolversSubView.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import React, { useState } from 'react';
import { isObject, orderBy } from 'lodash';
import { Table, Button, Row, Input, Col, notification, Alert } from 'antd';
import { orderBy } from 'lodash';
import { Table, Button, Input, Alert } from 'antd';
import { ColumnsType } from 'antd/es/table';
import { useMutation, useQuery } from 'react-query';
import { useNexusContext } from '@bbp/react-nexus';
import { useHistory, useLocation, useRouteMatch } from 'react-router';
import { NexusClient } from '@bbp/nexus-sdk/es';
import { PromisePool } from '@supercharge/promise-pool';
import ReactJson from 'react-json-view';
import { easyValidURL } from '../../../../utils/validUrl';
import './styles.scss';

Expand Down
Loading

0 comments on commit 499b01b

Please sign in to comment.