Skip to content

Commit 51322ad

Browse files
authored
Merge branch 'master' into user-serach-fiel
2 parents a4bcd1d + 742c66f commit 51322ad

File tree

13 files changed

+220
-130
lines changed

13 files changed

+220
-130
lines changed

.github/workflows/bump-meshery-version.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
token: ${{ secrets.RELEASEDRAFTER_PAT }}
3030
commit-message: Bump sistent ${{ github.event.release.tag_name }} dependencies
3131
committer: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
32-
author: "l5io"
32+
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
3333
signoff: true
3434
branch: bump-sistent-bot
3535
delete-branch: true
@@ -67,7 +67,7 @@ jobs:
6767
token: ${{ secrets.RELEASEDRAFTER_PAT }}
6868
commit-message: Bump sistent ${{ github.event.release.tag_name }} dependencies
6969
committer: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
70-
author: "l5io"
70+
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
7171
signoff: true
7272
branch: bump-sistent-bot
7373
delete-branch: true
@@ -105,7 +105,7 @@ jobs:
105105
token: ${{ secrets.RELEASEDRAFTER_PAT }}
106106
commit-message: Bump sistent ${{ github.event.release.tag_name }} dependencies
107107
committer: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
108-
author: "l5io"
108+
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
109109
signoff: true
110110
branch: bump-sistent-bot
111111
delete-branch: true
@@ -118,4 +118,4 @@ jobs:
118118
119119
_This pull request has been auto-generated by [l5io](http://github.com/l5io)_
120120
assignees: l5io
121-
draft: false
121+
draft: false

.github/workflows/storybook-deploy.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

src/custom/CatalogDetail/ActionButton.tsx

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import _ from 'lodash';
22
import React from 'react';
33
import { CircularProgress } from '../../base';
4-
import { CopyIcon, KanvasIcon } from '../../icons';
4+
import { CopyIcon, KanvasIcon, PublishIcon } from '../../icons';
55
import Download from '../../icons/Download/Download';
66
import { charcoal } from '../../theme';
77
import { Pattern } from '../CustomCatalog/CustomCard';
88
import { downloadFilter, downloadYaml, slugify } from './helper';
9-
import { ActionButton, LinkUrl, StyledActionWrapper } from './style';
9+
import { ActionButton, LinkUrl, StyledActionWrapper, UnpublishAction } from './style';
1010
import { RESOURCE_TYPES } from './types';
1111

1212
interface ActionButtonsProps {
@@ -17,8 +17,10 @@ interface ActionButtonsProps {
1717
isCloneLoading: boolean;
1818
handleClone: (name: string, id: string) => void;
1919
mode: string;
20+
handleUnpublish: () => void;
2021
isCloneDisabled: boolean;
2122
showOpenPlaygroundButton: boolean;
23+
showUnpublishAction: boolean;
2224
}
2325

2426
const ActionButtons: React.FC<ActionButtonsProps> = ({
@@ -30,7 +32,9 @@ const ActionButtons: React.FC<ActionButtonsProps> = ({
3032
handleClone,
3133
mode,
3234
isCloneDisabled,
33-
showOpenPlaygroundButton
35+
showOpenPlaygroundButton,
36+
showUnpublishAction,
37+
handleUnpublish
3438
}) => {
3539
const cleanedType = type.replace('my-', '').replace(/s$/, '');
3640
const resourcePlaygroundType = Object.values({
@@ -112,6 +116,19 @@ const ActionButtons: React.FC<ActionButtonsProps> = ({
112116
</ActionButton>
113117
</LinkUrl>
114118
)}
119+
{showUnpublishAction && (
120+
<UnpublishAction
121+
sx={{
122+
borderRadius: '0.2rem',
123+
gap: '10px',
124+
width: '100%'
125+
}}
126+
onClick={handleUnpublish}
127+
>
128+
<PublishIcon width={24} height={24} fill={charcoal[10]} />
129+
Unpublish
130+
</UnpublishAction>
131+
)}
115132
</StyledActionWrapper>
116133
);
117134
};

src/custom/CatalogDetail/LeftPanel.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ interface LeftPanelProps {
2222
technologySVGSubpath: string;
2323
fontFamily?: string;
2424
showOpenPlaygroundButton?: boolean;
25+
handleUnpublish: () => void;
26+
showUnpublishAction?: boolean;
2527
}
2628

2729
const LeftPanel: React.FC<LeftPanelProps> = ({
@@ -31,13 +33,15 @@ const LeftPanel: React.FC<LeftPanelProps> = ({
3133
actionItems = true,
3234
isCloneLoading,
3335
handleClone,
36+
handleUnpublish,
3437
showTechnologies = true,
3538
mode,
3639
filteredAcademyData,
3740
isCloneDisabled,
3841
technologySVGPath,
3942
technologySVGSubpath,
4043
fontFamily,
44+
showUnpublishAction = false,
4145
showOpenPlaygroundButton = true
4246
}) => {
4347
const theme = useTheme();
@@ -77,6 +81,8 @@ const LeftPanel: React.FC<LeftPanelProps> = ({
7781
cardId={cardId}
7882
isCloneLoading={isCloneLoading}
7983
handleClone={handleClone}
84+
showUnpublishAction={showUnpublishAction}
85+
handleUnpublish={handleUnpublish}
8086
mode={mode}
8187
isCloneDisabled={isCloneDisabled}
8288
showOpenPlaygroundButton={showOpenPlaygroundButton}

src/custom/CatalogDetail/style.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,22 @@ export const ActionButton = styled('div')<ActionButtonProps>(({ disabled = false
3939
flex: '1'
4040
}));
4141

42+
export const UnpublishAction = styled('div')<ActionButtonProps>(({ disabled = false, theme }) => ({
43+
cursor: disabled ? 'not-allowed' : 'pointer',
44+
opacity: disabled ? '0.5' : '1',
45+
textAlign: 'center',
46+
display: 'flex',
47+
justifyContent: 'center',
48+
alignItems: 'center',
49+
borderRadius: '0.5rem',
50+
backgroundColor: 'transparent',
51+
border: `1px solid ${theme.palette.border.normal}`,
52+
padding: '0.5rem',
53+
color: theme.palette.text.default,
54+
gap: '0.625rem',
55+
flex: '1'
56+
}));
57+
4258
export const ContentDetailsText = styled(Typography)(({ theme }) => ({
4359
fontFamily: 'inherit',
4460
fontSize: '1rem',

src/custom/CatalogFilterSection/CatalogFilterSidebar.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,24 @@ export interface FilterOption {
2929
export interface FilterList {
3030
filterKey: string;
3131
sectionDisplayName?: string;
32-
options: FilterOption[];
3332
defaultOpen?: boolean;
3433
isMultiSelect?: boolean;
34+
options?: FilterOption[];
35+
customComponent?: React.ComponentType;
3536
}
3637

38+
type FilterListWithOptions = FilterList & { options: FilterOption[]; customComponent?: never };
39+
40+
type FilterListWithCustomComponent = FilterList & {
41+
customComponent: React.ComponentType;
42+
options?: never;
43+
};
44+
45+
export type FilterListType = FilterListWithOptions | FilterListWithCustomComponent;
46+
3747
export interface CatalogFilterSidebarProps {
3848
setData: (callback: (prevFilters: FilterValues) => FilterValues) => void;
39-
lists: FilterList[];
49+
lists: FilterListType[];
4050
value?: FilterValues;
4151
styleProps?: StyleProps;
4252
}

src/custom/CatalogFilterSection/CatalogFilterSidebarState.tsx

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useCallback, useState } from 'react';
22
import {
33
CatalogFilterSidebarProps,
4-
FilterList,
4+
FilterListType,
55
FilterValues,
66
StyleProps
77
} from './CatalogFilterSidebar';
@@ -16,7 +16,7 @@ import FilterSection from './FilterSection';
1616
* @param {Object} styleProps - The style properties for the component.
1717
*/
1818
const CatalogFilterSidebarState: React.FC<{
19-
lists: FilterList[];
19+
lists: FilterListType[];
2020
onApplyFilters: CatalogFilterSidebarProps['setData'];
2121
value: FilterValues;
2222
styleProps: StyleProps;
@@ -78,19 +78,36 @@ const CatalogFilterSidebarState: React.FC<{
7878

7979
return (
8080
<>
81-
{lists.map((list) => (
82-
<FilterSection
83-
key={list.filterKey}
84-
filterKey={list.filterKey}
85-
sectionDisplayName={list.sectionDisplayName}
86-
options={list.options}
87-
filters={value}
88-
openSections={openSections}
89-
onCheckboxChange={handleCheckboxChange}
90-
onSectionToggle={handleSectionToggle}
91-
styleProps={styleProps}
92-
/>
93-
))}
81+
{lists.map((list) => {
82+
if (list.customComponent) {
83+
return (
84+
<FilterSection
85+
key={list.filterKey}
86+
filterKey={list.filterKey}
87+
filters={value}
88+
sectionDisplayName={list.sectionDisplayName}
89+
onSectionToggle={handleSectionToggle}
90+
styleProps={styleProps}
91+
openSections={openSections}
92+
customComponent={list.customComponent}
93+
/>
94+
);
95+
}
96+
97+
return (
98+
<FilterSection
99+
key={list.filterKey}
100+
filterKey={list.filterKey}
101+
sectionDisplayName={list.sectionDisplayName}
102+
options={list.options}
103+
filters={value}
104+
openSections={openSections}
105+
onCheckboxChange={handleCheckboxChange}
106+
onSectionToggle={handleSectionToggle}
107+
styleProps={styleProps}
108+
/>
109+
);
110+
})}
94111
</>
95112
);
96113
};

0 commit comments

Comments
 (0)