Skip to content

Commit

Permalink
Use console quick start drawer
Browse files Browse the repository at this point in the history
  • Loading branch information
batzionb committed Aug 16, 2023
1 parent 5ad79eb commit ac683ab
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 120 deletions.
14 changes: 9 additions & 5 deletions locales/en/plugin__clustertemplates-plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@
"Apply labels to the ManagedClusters created from this template.": "Apply labels to the ManagedClusters created from this template.",
"Required": "Required",
"Create": "Create",
"Download YAML": "Download YAML",
"Failed to download YAML": "Failed to download YAML",
"Failed to load template {{templateName}}": "Failed to load template {{templateName}}",
"Failed to parse template status {{templateName}}": "Failed to parse template status {{templateName}}",
"Some of the Helm parameters are none primitives and cannot be set in the UI": "Some of the Helm parameters are none primitives and cannot be set in the UI",
Expand Down Expand Up @@ -163,15 +165,15 @@
"Templates": "Templates",
"Consumption in use": "Consumption in use",
"Edit": "Edit",
"This certificate authority is utilized by all repositories with the host {{hostname}}": "This certificate authority is utilized by all repositories with the host {{hostname}}",
"This certificate authority is utilized by all repositories with the host {{hostname}}_plural": "This certificate authority is utilized by all repositories with the host {{hostname}}",
"This certificate authority is utilized by all repositories with the host {{hostname}}.": "This certificate authority is utilized by all repositories with the host {{hostname}}.",
"This certificate authority is utilized by all repositories with the host {{hostname}}._plural": "This certificate authority is utilized by all repositories with the host {{hostname}}.",
"Any modifications made to the certificate authority will impact the following repository:": "Any modifications made to the certificate authority will impact the following repository:",
"Any modifications made to the certificate authority will impact the following repository:_plural": "Any modifications made to the certificate authority will impact the following repositories:",
"Failed to get the available Certificate Authorities": "Failed to get the available Certificate Authorities",
"Failed to load repositories": "Failed to load repositories",
"Allow self-signed certificates": "Allow self-signed certificates",
"Certificate authority": "Certificate authority",
"Certificate authority field loading": "Certificate authority field loading",
"Skip certificate verification": "Skip certificate verification",
"Custom certificate authority": "Custom certificate authority",
"Custom certificate authority field loading": "Custom certificate authority field loading",
"Edit {{repoName}} repository": "Edit {{repoName}} repository",
"Type": "Type",
"Repository name and URL": "Repository name and URL",
Expand Down Expand Up @@ -236,6 +238,8 @@
"markdown": "markdown",
"preview": "preview",
"Template processing failed": "Template processing failed",
"Download instance YAML": "Download instance YAML",
"Failed to download instance YAML": "Failed to download instance YAML",
"Community templates cannot be modified": "Community templates cannot be modified",
"Community templates cannot be deleted": "Community templates cannot be deleted",
"To fix this, edit the template and reselect the repository": "To fix this, edit the template and reselect the repository",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import { getResourceVendor } from '../../utils/clusterTemplateDataUtils';
import useClusterTemplateActions from '../../hooks/useClusterTemplateActions';
import useClusterTemplateDeserializer from '../../hooks/useClusterTemplateDeserializer';
import Alerts from '../../alerts/Alerts';
import WithClusterTemplateQuickStarts from '../ClusterTemplatesGettingStarted/WithClusterTemplateQuickStarts';

const useActiveNavItem = (clusterTemplate: DeserializedClusterTemplate | undefined) => {
const history = useHistory();
Expand Down Expand Up @@ -153,37 +152,33 @@ const ClusterTemplateDetailsPage = ({ match }: { match: { params: { name: string
<ErrorBoundary>
<AlertsContextProvider>
<PageLoader loaded={loaded} error={error}>
<WithClusterTemplateQuickStarts>
{deserializedTemplate && (
<Page>
<PageHeader clusterTemplate={deserializedTemplate} />
{deserializedTemplate && (
<Page>
<PageHeader clusterTemplate={deserializedTemplate} />

{activeNavItem !== 'yaml' && (
<PageSection>
<Stack hasGutter>
<StackItem>
<Alerts />
</StackItem>
<StackItem>
{activeNavItem === 'overview' && (
<OverviewTab clusterTemplate={deserializedTemplate} />
)}
{activeNavItem === 'quotas' && (
<DetailsQuotasTab clusterTemplate={clusterTemplate} />
)}
{activeNavItem === 'instances' && (
<InstancesTab clusterTemplate={clusterTemplate} />
)}
</StackItem>
</Stack>
</PageSection>
)}
{activeNavItem === 'yaml' && (
<ResourceYAMLEditor initialResource={clusterTemplate} />
)}
</Page>
)}
</WithClusterTemplateQuickStarts>
{activeNavItem !== 'yaml' && (
<PageSection>
<Stack hasGutter>
<StackItem>
<Alerts />
</StackItem>
<StackItem>
{activeNavItem === 'overview' && (
<OverviewTab clusterTemplate={deserializedTemplate} />
)}
{activeNavItem === 'quotas' && (
<DetailsQuotasTab clusterTemplate={clusterTemplate} />
)}
{activeNavItem === 'instances' && (
<InstancesTab clusterTemplate={clusterTemplate} />
)}
</StackItem>
</Stack>
</PageSection>
)}
{activeNavItem === 'yaml' && <ResourceYAMLEditor initialResource={clusterTemplate} />}
</Page>
)}
</PageLoader>
</AlertsContextProvider>
</ErrorBoundary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const CreateTemplateCard = ({ description }: { description: string }) =>
const { t } = useTranslation();
if (!qsCtx || !qsCtx.setActiveQuickStart) {
return (
<ErrorState error={'QuickStartContext should be used without QuickStartContextProvider'} />
<ErrorState error={'QuickStartContext should be used within QuickStartContextProvider'} />
);
}

Expand Down

This file was deleted.

33 changes: 15 additions & 18 deletions src/components/ClusterTemplatesPage/ClusterTemplatesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import ClusterTemplatesTab from './ClusterTemplatesTab';
import QuotasTab from './QuotasTab';
import RepositoriesTable from './RepositoriesTab';
import './hack.css';
import WithClusterTemplateQuickStarts from '../ClusterTemplatesGettingStarted/WithClusterTemplateQuickStarts';
import { AlertsContextProvider } from '../../alerts/AlertsContext';
import Alerts from '../../alerts/Alerts';
import ErrorBoundary from '../../helpers/ErrorBoundary';
Expand Down Expand Up @@ -90,23 +89,21 @@ const ClusterTemplatesPage = () => {
return (
<ErrorBoundary>
<AlertsContextProvider>
<WithClusterTemplateQuickStarts>
<Page>
<PageHeader />
<PageSection>
<Stack hasGutter>
<StackItem>
<Alerts />
</StackItem>
<StackItem>
{activeTab === 'templates' && <ClusterTemplatesTab />}
{activeTab === 'repositories' && <RepositoriesTable />}
{activeTab === 'quotas' && <QuotasTab />}
</StackItem>
</Stack>
</PageSection>
</Page>
</WithClusterTemplateQuickStarts>
<Page>
<PageHeader />
<PageSection>
<Stack hasGutter>
<StackItem>
<Alerts />
</StackItem>
<StackItem>
{activeTab === 'templates' && <ClusterTemplatesTab />}
{activeTab === 'repositories' && <RepositoriesTable />}
{activeTab === 'quotas' && <QuotasTab />}
</StackItem>
</Stack>
</PageSection>
</Page>
</AlertsContextProvider>
</ErrorBoundary>
);
Expand Down
19 changes: 8 additions & 11 deletions src/components/Quotas/QuotaEditor/QuotaFormPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { getClusterTemplatesPageUrl } from '../../../hooks/useNavigation';
import { useTranslation } from '../../../hooks/useTranslation';
import { AlertsContextProvider } from '../../../alerts/AlertsContext';
import Alerts from '../../../alerts/Alerts';
import WithClusterTemplateQuickStarts from '../../ClusterTemplatesGettingStarted/WithClusterTemplateQuickStarts';

const PageHeader = ({ quota }: { quota?: Quota }) => {
const { t } = useTranslation();
Expand Down Expand Up @@ -37,16 +36,14 @@ const QuotaFormPage = ({ quota }: { quota?: Quota }) => {
return (
<ErrorBoundary>
<AlertsContextProvider>
<WithClusterTemplateQuickStarts>
<Page>
<PageHeader quota={quota} />
<Divider />
<Alerts />
<PageSection variant={PageSectionVariants.light}>
<QuotaForm quota={quota} />
</PageSection>
</Page>
</WithClusterTemplateQuickStarts>
<Page>
<PageHeader quota={quota} />
<Divider />
<Alerts />
<PageSection variant={PageSectionVariants.light}>
<QuotaForm quota={quota} />
</PageSection>
</Page>
</AlertsContextProvider>
</ErrorBoundary>
);
Expand Down

0 comments on commit ac683ab

Please sign in to comment.