diff --git a/app-catalog/src/components/charts/AppCatalogTitle.stories.tsx b/app-catalog/src/components/charts/AppCatalogTitle.stories.tsx
index e1378fa..889bd92 100644
--- a/app-catalog/src/components/charts/AppCatalogTitle.stories.tsx
+++ b/app-catalog/src/components/charts/AppCatalogTitle.stories.tsx
@@ -1,15 +1,21 @@
-import { Meta, Story } from '@storybook/react';
-import React from 'react';
-import { BrowserRouter as Router } from 'react-router-dom';
-import { AppCatalogTitle } from './AppCatalogTitle';
-
-export default {
- title: 'Components/AppCatalogTitle',
- component: AppCatalogTitle,
- decorators: [(Story) => ],
-} as Meta;
-
-const Template: Story = (args) => ;
-
-export const Title = Template.bind({});
-Title.args = {};
\ No newline at end of file
+import { Meta, Story } from '@storybook/react';
+import React from 'react';
+import { BrowserRouter as Router } from 'react-router-dom';
+import { AppCatalogTitle } from './AppCatalogTitle';
+
+export default {
+ title: 'Components/AppCatalogTitle',
+ component: AppCatalogTitle,
+ decorators: [
+ Story => (
+
+
+
+ ),
+ ],
+} as Meta;
+
+const Template: Story = args => ;
+
+export const Title = Template.bind({});
+Title.args = {};
diff --git a/app-catalog/src/components/charts/AppCatalogTitle.tsx b/app-catalog/src/components/charts/AppCatalogTitle.tsx
index 88b6f15..7109825 100644
--- a/app-catalog/src/components/charts/AppCatalogTitle.tsx
+++ b/app-catalog/src/components/charts/AppCatalogTitle.tsx
@@ -1,22 +1,17 @@
-import {
- Box,
- Typography,
-} from '@mui/material';
-import { SettingsLink } from './SettingsLink';
-
-
-
-export function AppCatalogTitle() {
- return (
-
-
- Applications
-
-
-
- );
-}
\ No newline at end of file
+import { Box, Typography } from '@mui/material';
+import { SettingsLink } from './SettingsLink';
+
+export function AppCatalogTitle() {
+ return (
+
+
+ Applications
+
+
+
+ );
+}
diff --git a/app-catalog/src/components/charts/ChartsList.stories.tsx b/app-catalog/src/components/charts/ChartsList.stories.tsx
index 706e68a..fd46863 100644
--- a/app-catalog/src/components/charts/ChartsList.stories.tsx
+++ b/app-catalog/src/components/charts/ChartsList.stories.tsx
@@ -40,6 +40,7 @@ const mockCharts = [
repository: {
name: 'MockRepoy',
url: 'https://exampley.com',
+ verified_publisher: true,
},
},
{
@@ -51,29 +52,42 @@ const mockCharts = [
repository: {
name: 'MockRepo2y',
url: 'https://example2y.com',
+ verified_publisher: true,
},
},
];
-const initialState = {
+const initialStateTrue = {
config: {
+ showOnlyVerified: true,
settings: {
tableRowsPerPageOptions: [15, 25, 50],
},
},
};
-const mockStore = configureStore({
- reducer: (state = initialState) => state,
-});
+const initialStateFalse = {
+ config: {
+ showOnlyVerified: false,
+ settings: {
+ tableRowsPerPageOptions: [15, 25, 50],
+ },
+ },
+};
-const Template: Story = args => (
-
-
-
-
-
-);
+const Template: Story = ({ initialState, ...args }) => {
+ const mockStore = configureStore({
+ reducer: (state = initialState) => state,
+ });
+
+ return (
+
+
+
+
+
+ );
+};
export const EmptyCharts = Template.bind({});
EmptyCharts.args = {
@@ -102,3 +116,33 @@ SomeCharts.args = {
],
}),
};
+
+export const WithShowOnlyVerifiedTrue = Template.bind({});
+WithShowOnlyVerifiedTrue.args = {
+ initialState: initialStateTrue,
+ fetchCharts: () =>
+ Promise.resolve({
+ packages: mockCharts,
+ facets: [
+ {
+ title: 'Category',
+ options: [{ name: 'All', total: 0 }],
+ },
+ ],
+ }),
+};
+
+export const WithShowOnlyVerifiedFalse = Template.bind({});
+WithShowOnlyVerifiedFalse.args = {
+ initialState: initialStateFalse,
+ fetchCharts: () =>
+ Promise.resolve({
+ packages: mockCharts,
+ facets: [
+ {
+ title: 'Category',
+ options: [{ name: 'All', total: 0 }],
+ },
+ ],
+ }),
+};
diff --git a/app-catalog/src/components/charts/List.tsx b/app-catalog/src/components/charts/List.tsx
index 633ce5a..b9cf36c 100644
--- a/app-catalog/src/components/charts/List.tsx
+++ b/app-catalog/src/components/charts/List.tsx
@@ -75,6 +75,10 @@ export function ChartsList({ fetchCharts = fetchChartsFromArtifact }) {
store.set({ showOnlyVerified: showOnlyVerified });
+ if (props.showOnlyVerified!!) {
+ store.set({ showOnlyVerified: props.showOnlyVerified });
+ }
+
async function fetchData() {
try {
const response: any = await fetchCharts(search, showOnlyVerified, chartCategory, page);
@@ -165,8 +169,9 @@ export function ChartsList({ fetchCharts = fetchChartsFromArtifact }) {
) : charts.length === 0 ? (
- {`No charts found for ${search ? `search term: ${search}` : `category: ${chartCategory.title}`
- }`}
+ {`No charts found for ${
+ search ? `search term: ${search}` : `category: ${chartCategory.title}`
+ }`}
) : (
diff --git a/app-catalog/src/components/charts/SettingsLink.stories.tsx b/app-catalog/src/components/charts/SettingsLink.stories.tsx
index 5f65f1a..7bf82de 100644
--- a/app-catalog/src/components/charts/SettingsLink.stories.tsx
+++ b/app-catalog/src/components/charts/SettingsLink.stories.tsx
@@ -1,16 +1,21 @@
-import { Meta, Story } from '@storybook/react';
-import React from 'react';
-import { BrowserRouter as Router } from 'react-router-dom';
-import { SettingsLink } from './SettingsLink';
-
-
-export default {
- title: 'Components/SettingsLink',
- component: SettingsLink,
- decorators: [(Story) => ],
-} as Meta;
-
-const Template: Story = (args) => ;
-
-export const Title = Template.bind({});
-Title.args = {};
\ No newline at end of file
+import { Meta, Story } from '@storybook/react';
+import React from 'react';
+import { BrowserRouter as Router } from 'react-router-dom';
+import { SettingsLink } from './SettingsLink';
+
+export default {
+ title: 'Components/SettingsLink',
+ component: SettingsLink,
+ decorators: [
+ Story => (
+
+
+
+ ),
+ ],
+} as Meta;
+
+const Template: Story = args => ;
+
+export const Title = Template.bind({});
+Title.args = {};
diff --git a/app-catalog/src/components/charts/SettingsLink.tsx b/app-catalog/src/components/charts/SettingsLink.tsx
index 1c58a7d..a871f7f 100644
--- a/app-catalog/src/components/charts/SettingsLink.tsx
+++ b/app-catalog/src/components/charts/SettingsLink.tsx
@@ -1,25 +1,20 @@
-import { Link as RouterLink } from '@kinvolk/headlamp-plugin/lib/CommonComponents';
-import {
- Typography,
- useTheme,
-} from '@mui/material';
-
-
-
-export function SettingsLink() {
- const theme = useTheme();
-
- return (
-
-
- Settings
-
-
- );
-}
\ No newline at end of file
+import { Link as RouterLink } from '@kinvolk/headlamp-plugin/lib/CommonComponents';
+import { Typography, useTheme } from '@mui/material';
+
+export function SettingsLink() {
+ const theme = useTheme();
+
+ return (
+
+
+ Settings
+
+
+ );
+}
diff --git a/app-catalog/src/components/settings/AppCatalogSettings.stories.tsx b/app-catalog/src/components/settings/AppCatalogSettings.stories.tsx
index e3a7631..f8683ee 100644
--- a/app-catalog/src/components/settings/AppCatalogSettings.stories.tsx
+++ b/app-catalog/src/components/settings/AppCatalogSettings.stories.tsx
@@ -1,30 +1,30 @@
-import { createTheme, ThemeProvider } from '@mui/material/styles';
-import { Meta, Story } from '@storybook/react';
-import React from 'react';
-import { AppCatalogSettings, AppCatalogSettingsProps } from './AppCatalogSettings';
-
-export default {
- title: 'Components/AppCatalogSettings',
- component: AppCatalogSettings,
-} as Meta
-
-const theme = createTheme();
-
-const Template: Story = (args) => (
-
-
-
-);
-
-export const Default = Template.bind({});
-Default.args = {};
-
-export const ShowOnlyVerifiedTrue = Template.bind({});
-ShowOnlyVerifiedTrue.args = {
- initialConfig: { showOnlyVerified: true },
-};
-
-export const ShowOnlyVerifiedFalse = Template.bind({});
-ShowOnlyVerifiedFalse.args = {
- initialConfig: { showOnlyVerified: false },
-};
\ No newline at end of file
+import { createTheme, ThemeProvider } from '@mui/material/styles';
+import { Meta, Story } from '@storybook/react';
+import React from 'react';
+import { AppCatalogSettings, AppCatalogSettingsProps } from './AppCatalogSettings';
+
+export default {
+ title: 'Components/AppCatalogSettings',
+ component: AppCatalogSettings,
+} as Meta;
+
+const theme = createTheme();
+
+const Template: Story = args => (
+
+
+
+);
+
+export const Default = Template.bind({});
+Default.args = {};
+
+export const ShowOnlyVerifiedTrue = Template.bind({});
+ShowOnlyVerifiedTrue.args = {
+ initialConfig: { showOnlyVerified: true },
+};
+
+export const ShowOnlyVerifiedFalse = Template.bind({});
+ShowOnlyVerifiedFalse.args = {
+ initialConfig: { showOnlyVerified: false },
+};
diff --git a/app-catalog/src/components/settings/AppCatalogSettings.tsx b/app-catalog/src/components/settings/AppCatalogSettings.tsx
index dd0e4ca..c292b39 100644
--- a/app-catalog/src/components/settings/AppCatalogSettings.tsx
+++ b/app-catalog/src/components/settings/AppCatalogSettings.tsx
@@ -1,52 +1,55 @@
-import { HoverInfoLabel, NameValueTable } from '@kinvolk/headlamp-plugin/lib/components/common';
-import { Box, Typography } from '@mui/material';
-import { useState } from 'react';
-import { store } from '../charts/List';
-import { EnableSwitch } from './EnableSwitch';
-
-export interface AppCatalogSettingsProps {
- initialConfig?: { showOnlyVerified: boolean };
-}
-
-export function AppCatalogSettings({ initialConfig }: AppCatalogSettingsProps) {
- const config = initialConfig || store.get();
-
- const [currentConfig, setCurrentConfig] = useState(config);
-
- function handleSave(value) {
- const updatedConfig = { showOnlyVerified: value };
- store.set(updatedConfig);
- setCurrentConfig(store.get());
- return;
- }
-
- function toggleShowOnlyVerified() {
- const newShowOnlyVerified = currentConfig?.showOnlyVerified;
- handleSave(!newShowOnlyVerified);
- }
-
- return (
-
- App Catalog Settings
-
- ),
- value: (
-
- ),
- },
- ]}
- />
-
- );
-}
\ No newline at end of file
+import { HoverInfoLabel, NameValueTable } from '@kinvolk/headlamp-plugin/lib/components/common';
+import { Box, Typography } from '@mui/material';
+import { useState } from 'react';
+import { store } from '../charts/List';
+import { EnableSwitch } from './EnableSwitch';
+
+export interface AppCatalogSettingsProps {
+ initialConfig?: { showOnlyVerified: boolean };
+}
+
+export function AppCatalogSettings({ initialConfig }: AppCatalogSettingsProps) {
+ const config = initialConfig || store.get();
+
+ const [currentConfig, setCurrentConfig] = useState(config);
+
+ function handleSave(value) {
+ const updatedConfig = { showOnlyVerified: value };
+ store.set(updatedConfig);
+ setCurrentConfig(store.get());
+ return;
+ }
+
+ function toggleShowOnlyVerified() {
+ const newShowOnlyVerified = currentConfig?.showOnlyVerified;
+ handleSave(!newShowOnlyVerified);
+ }
+
+ return (
+
+ App Catalog Settings
+
+ ),
+ value: (
+
+ ),
+ },
+ ]}
+ />
+
+ );
+}
diff --git a/app-catalog/src/components/settings/EnableSwitch.Stories.tsx b/app-catalog/src/components/settings/EnableSwitch.Stories.tsx
index 8a4ec8d..4a63a65 100644
--- a/app-catalog/src/components/settings/EnableSwitch.Stories.tsx
+++ b/app-catalog/src/components/settings/EnableSwitch.Stories.tsx
@@ -1,20 +1,20 @@
-import { Meta, Story } from '@storybook/react';
-import React from 'react';
-import { EnableSwitch } from './EnableSwitch';
-
-export default {
- title: 'Components/EnableSwitch',
- component: EnableSwitch,
-} as Meta;
-
-const Template: Story = (args) => ;
-
-export const CheckedTrue = Template.bind({});
-CheckedTrue.args = {
- checked: true,
-};
-
-export const CheckedFalse = Template.bind({});
-CheckedFalse.args = {
- checked: false,
-};
\ No newline at end of file
+import { Meta, Story } from '@storybook/react';
+import React from 'react';
+import { EnableSwitch } from './EnableSwitch';
+
+export default {
+ title: 'Components/EnableSwitch',
+ component: EnableSwitch,
+} as Meta;
+
+const Template: Story = args => ;
+
+export const CheckedTrue = Template.bind({});
+CheckedTrue.args = {
+ checked: true,
+};
+
+export const CheckedFalse = Template.bind({});
+CheckedFalse.args = {
+ checked: false,
+};
diff --git a/app-catalog/src/components/settings/EnableSwitch.tsx b/app-catalog/src/components/settings/EnableSwitch.tsx
index 3608079..2f30fcf 100644
--- a/app-catalog/src/components/settings/EnableSwitch.tsx
+++ b/app-catalog/src/components/settings/EnableSwitch.tsx
@@ -1,60 +1,60 @@
-import { Switch, SwitchProps, useTheme } from '@mui/material';
-
-export function EnableSwitch(props: SwitchProps) {
- const theme = useTheme();
-
- return (
-
- );
-};
\ No newline at end of file
+import { Switch, SwitchProps, useTheme } from '@mui/material';
+
+export function EnableSwitch(props: SwitchProps) {
+ const theme = useTheme();
+
+ return (
+
+ );
+}