mirror of https://github.com/portainer/portainer
feat(microk8s): BE teasers in wizard [EE-4772] (#8449)
* feat(microk8s): separate existing/new envs EE-4772 update icons fix be teaser box selector style * match environment wizard box selectors * revert title back * updated kaas description in wizard --------- Co-authored-by: testa113 <testa113> Co-authored-by: Prabhat Khera <prabhat.khera@portainer.io>pull/8591/head
parent
d032119ebc
commit
769c8372fb
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 8.7 KiB |
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 8.2 KiB |
|
@ -14,6 +14,7 @@ const BoxSelectorReact = react2angular(BoxSelector, [
|
||||||
'options',
|
'options',
|
||||||
'radioName',
|
'radioName',
|
||||||
'slim',
|
'slim',
|
||||||
|
'hiddenSpacingCount',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export const boxSelectorModule = angular
|
export const boxSelectorModule = angular
|
||||||
|
|
|
@ -20,12 +20,14 @@ export type Props<T extends Value> = Union<T> & {
|
||||||
radioName: string;
|
radioName: string;
|
||||||
options: ReadonlyArray<BoxSelectorOption<T>> | Array<BoxSelectorOption<T>>;
|
options: ReadonlyArray<BoxSelectorOption<T>> | Array<BoxSelectorOption<T>>;
|
||||||
slim?: boolean;
|
slim?: boolean;
|
||||||
|
hiddenSpacingCount?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function BoxSelector<T extends Value>({
|
export function BoxSelector<T extends Value>({
|
||||||
radioName,
|
radioName,
|
||||||
options,
|
options,
|
||||||
slim = false,
|
slim = false,
|
||||||
|
hiddenSpacingCount,
|
||||||
...props
|
...props
|
||||||
}: Props<T>) {
|
}: Props<T>) {
|
||||||
return (
|
return (
|
||||||
|
@ -47,6 +49,10 @@ export function BoxSelector<T extends Value>({
|
||||||
slim={slim}
|
slim={slim}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
|
{hiddenSpacingCount &&
|
||||||
|
Array.from(Array(hiddenSpacingCount)).map((_, index) => (
|
||||||
|
<div key={index} className="flex-1" />
|
||||||
|
))}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -8,19 +8,21 @@ import { useAnalytics } from '@/angulartics.matomo/analytics-services';
|
||||||
import { Button } from '@@/buttons';
|
import { Button } from '@@/buttons';
|
||||||
import { PageHeader } from '@@/PageHeader';
|
import { PageHeader } from '@@/PageHeader';
|
||||||
import { Widget, WidgetBody, WidgetTitle } from '@@/Widget';
|
import { Widget, WidgetBody, WidgetTitle } from '@@/Widget';
|
||||||
|
import { FormSection } from '@@/form-components/FormSection';
|
||||||
|
|
||||||
import { useCreateEdgeDeviceParam } from '../hooks/useCreateEdgeDeviceParam';
|
import { useCreateEdgeDeviceParam } from '../hooks/useCreateEdgeDeviceParam';
|
||||||
|
|
||||||
|
import { EnvironmentSelector } from './EnvironmentSelector';
|
||||||
import {
|
import {
|
||||||
EnvironmentSelector,
|
EnvironmentOptionValue,
|
||||||
EnvironmentSelectorValue,
|
existingEnvironmentTypes,
|
||||||
} from './EnvironmentSelector';
|
newEnvironmentTypes,
|
||||||
import { environmentTypes } from './environment-types';
|
} from './environment-types';
|
||||||
|
|
||||||
export function EnvironmentTypeSelectView() {
|
export function EnvironmentTypeSelectView() {
|
||||||
const createEdgeDevice = useCreateEdgeDeviceParam();
|
const createEdgeDevice = useCreateEdgeDeviceParam();
|
||||||
|
|
||||||
const [types, setTypes] = useState<EnvironmentSelectorValue[]>([]);
|
const [types, setTypes] = useState<EnvironmentOptionValue[]>([]);
|
||||||
const { trackEvent } = useAnalytics();
|
const { trackEvent } = useAnalytics();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
|
@ -36,11 +38,34 @@ export function EnvironmentTypeSelectView() {
|
||||||
<Widget>
|
<Widget>
|
||||||
<WidgetTitle icon={Wand2} title="Environment Wizard" />
|
<WidgetTitle icon={Wand2} title="Environment Wizard" />
|
||||||
<WidgetBody>
|
<WidgetBody>
|
||||||
<EnvironmentSelector
|
<div className="form-horizontal">
|
||||||
value={types}
|
<FormSection title="Select your environment(s)">
|
||||||
onChange={setTypes}
|
<p className="text-muted small">
|
||||||
createEdgeDevice={createEdgeDevice}
|
You can onboard different types of environments, select all
|
||||||
/>
|
that apply.
|
||||||
|
</p>
|
||||||
|
<p className="control-label !mb-2">
|
||||||
|
Connect to existing environments
|
||||||
|
</p>
|
||||||
|
<EnvironmentSelector
|
||||||
|
value={types}
|
||||||
|
onChange={setTypes}
|
||||||
|
createEdgeDevice={createEdgeDevice}
|
||||||
|
options={existingEnvironmentTypes}
|
||||||
|
/>
|
||||||
|
<p className="control-label !mb-2">Set up new environments</p>
|
||||||
|
<EnvironmentSelector
|
||||||
|
value={types}
|
||||||
|
onChange={setTypes}
|
||||||
|
createEdgeDevice={createEdgeDevice}
|
||||||
|
options={newEnvironmentTypes}
|
||||||
|
hiddenSpacingCount={
|
||||||
|
existingEnvironmentTypes.length -
|
||||||
|
newEnvironmentTypes.length
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</FormSection>
|
||||||
|
</div>
|
||||||
<Button
|
<Button
|
||||||
disabled={types.length === 0}
|
disabled={types.length === 0}
|
||||||
onClick={() => startWizard()}
|
onClick={() => startWizard()}
|
||||||
|
@ -59,6 +84,11 @@ export function EnvironmentTypeSelectView() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const environmentTypes = [
|
||||||
|
...existingEnvironmentTypes,
|
||||||
|
...newEnvironmentTypes,
|
||||||
|
];
|
||||||
|
|
||||||
const steps = _.compact(
|
const steps = _.compact(
|
||||||
types.map((id) => environmentTypes.find((eType) => eType.id === id))
|
types.map((id) => environmentTypes.find((eType) => eType.id === id))
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,17 +1,16 @@
|
||||||
import { BoxSelector } from '@@/BoxSelector';
|
import { BoxSelector } from '@@/BoxSelector';
|
||||||
import { FormSection } from '@@/form-components/FormSection';
|
|
||||||
|
|
||||||
import { environmentTypes } from './environment-types';
|
import { EnvironmentOption, EnvironmentOptionValue } from './environment-types';
|
||||||
|
|
||||||
export type EnvironmentSelectorValue = typeof environmentTypes[number]['id'];
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
value: EnvironmentSelectorValue[];
|
value: EnvironmentOptionValue[];
|
||||||
onChange(value: EnvironmentSelectorValue[]): void;
|
onChange(value: EnvironmentOptionValue[]): void;
|
||||||
|
options: EnvironmentOption[];
|
||||||
createEdgeDevice?: boolean;
|
createEdgeDevice?: boolean;
|
||||||
|
hiddenSpacingCount?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
const hasEdge: EnvironmentSelectorValue[] = [
|
const hasEdge: EnvironmentOptionValue[] = [
|
||||||
'dockerStandalone',
|
'dockerStandalone',
|
||||||
'dockerSwarm',
|
'dockerSwarm',
|
||||||
'kubernetes',
|
'kubernetes',
|
||||||
|
@ -21,31 +20,25 @@ export function EnvironmentSelector({
|
||||||
value,
|
value,
|
||||||
onChange,
|
onChange,
|
||||||
createEdgeDevice,
|
createEdgeDevice,
|
||||||
|
options,
|
||||||
|
hiddenSpacingCount,
|
||||||
}: Props) {
|
}: Props) {
|
||||||
const options = filterEdgeDevicesIfNeed(environmentTypes, createEdgeDevice);
|
const filteredOptions = filterEdgeDevicesIfNeed(options, createEdgeDevice);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="form-horizontal">
|
<BoxSelector
|
||||||
<FormSection title="Select your environment(s)">
|
options={filteredOptions}
|
||||||
<p className="text-muted small">
|
isMulti
|
||||||
You can onboard different types of environments, select all that
|
value={value}
|
||||||
apply.
|
onChange={onChange}
|
||||||
</p>
|
radioName="type-selector"
|
||||||
|
hiddenSpacingCount={hiddenSpacingCount}
|
||||||
<BoxSelector
|
/>
|
||||||
options={options}
|
|
||||||
isMulti
|
|
||||||
value={value}
|
|
||||||
onChange={onChange}
|
|
||||||
radioName="type-selector"
|
|
||||||
/>
|
|
||||||
</FormSection>
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function filterEdgeDevicesIfNeed(
|
function filterEdgeDevicesIfNeed(
|
||||||
types: typeof environmentTypes,
|
types: EnvironmentOption[],
|
||||||
createEdgeDevice?: boolean
|
createEdgeDevice?: boolean
|
||||||
) {
|
) {
|
||||||
if (!createEdgeDevice) {
|
if (!createEdgeDevice) {
|
||||||
|
|
|
@ -3,10 +3,27 @@ import Docker from '@/assets/ico/vendor/docker.svg?c';
|
||||||
import Kubernetes from '@/assets/ico/vendor/kubernetes.svg?c';
|
import Kubernetes from '@/assets/ico/vendor/kubernetes.svg?c';
|
||||||
import Azure from '@/assets/ico/vendor/azure.svg?c';
|
import Azure from '@/assets/ico/vendor/azure.svg?c';
|
||||||
import Nomad from '@/assets/ico/vendor/nomad.svg?c';
|
import Nomad from '@/assets/ico/vendor/nomad.svg?c';
|
||||||
|
import KaaS from '@/assets/ico/vendor/kaas-icon.svg?c';
|
||||||
|
import InstallK8s from '@/assets/ico/vendor/install-kubernetes.svg?c';
|
||||||
|
|
||||||
import KaaSIcon from './kaas-icon.svg?c';
|
import { BoxSelectorOption } from '@@/BoxSelector';
|
||||||
|
|
||||||
export const environmentTypes = [
|
export type EnvironmentOptionValue =
|
||||||
|
| 'dockerStandalone'
|
||||||
|
| 'dockerSwarm'
|
||||||
|
| 'kubernetes'
|
||||||
|
| 'aci'
|
||||||
|
| 'nomad'
|
||||||
|
| 'kaas'
|
||||||
|
| 'k8sInstall';
|
||||||
|
|
||||||
|
export interface EnvironmentOption
|
||||||
|
extends BoxSelectorOption<EnvironmentOptionValue> {
|
||||||
|
id: EnvironmentOptionValue;
|
||||||
|
value: EnvironmentOptionValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const existingEnvironmentTypes: EnvironmentOption[] = [
|
||||||
{
|
{
|
||||||
id: 'dockerStandalone',
|
id: 'dockerStandalone',
|
||||||
value: 'dockerStandalone',
|
value: 'dockerStandalone',
|
||||||
|
@ -49,23 +66,43 @@ export const environmentTypes = [
|
||||||
feature: FeatureId.NOMAD,
|
feature: FeatureId.NOMAD,
|
||||||
disabledWhenLimited: true,
|
disabledWhenLimited: true,
|
||||||
},
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export const newEnvironmentTypes: EnvironmentOption[] = [
|
||||||
{
|
{
|
||||||
id: 'kaas',
|
id: 'kaas',
|
||||||
value: 'kaas',
|
value: 'kaas',
|
||||||
label: 'KaaS',
|
label: 'Provision KaaS Cluster',
|
||||||
description: 'Provision a Kubernetes environment with a cloud provider',
|
description:
|
||||||
icon: KaaSIcon,
|
"Provision a Kubernetes cluster via a cloud provider's Kubernetes as a Service",
|
||||||
|
icon: KaaS,
|
||||||
iconType: 'logo',
|
iconType: 'logo',
|
||||||
feature: FeatureId.KAAS_PROVISIONING,
|
feature: FeatureId.KAAS_PROVISIONING,
|
||||||
disabledWhenLimited: true,
|
disabledWhenLimited: true,
|
||||||
},
|
},
|
||||||
] as const;
|
{
|
||||||
|
id: 'k8sInstall',
|
||||||
|
value: 'k8sInstall',
|
||||||
|
label: 'Create Kubernetes cluster',
|
||||||
|
description: 'Create a Kubernetes cluster on existing infrastructure',
|
||||||
|
icon: InstallK8s,
|
||||||
|
iconType: 'logo',
|
||||||
|
feature: FeatureId.K8SINSTALL,
|
||||||
|
disabledWhenLimited: true,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
export const formTitles = {
|
export const environmentTypes = [
|
||||||
|
...existingEnvironmentTypes,
|
||||||
|
...newEnvironmentTypes,
|
||||||
|
];
|
||||||
|
|
||||||
|
export const formTitles: Record<EnvironmentOptionValue, string> = {
|
||||||
dockerStandalone: 'Connect to your Docker Standalone environment',
|
dockerStandalone: 'Connect to your Docker Standalone environment',
|
||||||
dockerSwarm: 'Connect to your Docker Swarm environment',
|
dockerSwarm: 'Connect to your Docker Swarm environment',
|
||||||
kubernetes: 'Connect to your Kubernetes environment',
|
kubernetes: 'Connect to your Kubernetes environment',
|
||||||
aci: 'Connect to your ACI environment',
|
aci: 'Connect to your ACI environment',
|
||||||
nomad: 'Connect to your Nomad environment',
|
nomad: 'Connect to your Nomad environment',
|
||||||
kaas: 'Provision a KaaS environment',
|
kaas: 'Provision a KaaS environment',
|
||||||
|
k8sInstall: 'Create a Kubernetes cluster',
|
||||||
};
|
};
|
||||||
|
|
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 8.2 KiB |
|
@ -19,10 +19,10 @@ import { FormSection } from '@@/form-components/FormSection';
|
||||||
import { Icon } from '@@/Icon';
|
import { Icon } from '@@/Icon';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
EnvironmentOptionValue,
|
||||||
environmentTypes,
|
environmentTypes,
|
||||||
formTitles,
|
formTitles,
|
||||||
} from '../EnvironmentTypeSelectView/environment-types';
|
} from '../EnvironmentTypeSelectView/environment-types';
|
||||||
import { EnvironmentSelectorValue } from '../EnvironmentTypeSelectView/EnvironmentSelector';
|
|
||||||
|
|
||||||
import { WizardDocker } from './WizardDocker';
|
import { WizardDocker } from './WizardDocker';
|
||||||
import { WizardAzure } from './WizardAzure';
|
import { WizardAzure } from './WizardAzure';
|
||||||
|
@ -138,7 +138,7 @@ export function EnvironmentCreationView() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function useParamEnvironmentTypes(): EnvironmentSelectorValue[] {
|
function useParamEnvironmentTypes(): EnvironmentOptionValue[] {
|
||||||
const {
|
const {
|
||||||
params: { envType },
|
params: { envType },
|
||||||
} = useCurrentStateAndParams();
|
} = useCurrentStateAndParams();
|
||||||
|
@ -185,7 +185,7 @@ function useStepper(
|
||||||
setCurrentStepIndex(currentStepIndex - 1);
|
setCurrentStepIndex(currentStepIndex - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getComponent(id: EnvironmentSelectorValue) {
|
function getComponent(id: EnvironmentOptionValue) {
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case 'dockerStandalone':
|
case 'dockerStandalone':
|
||||||
case 'dockerSwarm':
|
case 'dockerSwarm':
|
||||||
|
|
|
@ -38,5 +38,6 @@ export enum FeatureId {
|
||||||
ENFORCE_DEPLOYMENT_OPTIONS = 'k8s-enforce-deployment-options',
|
ENFORCE_DEPLOYMENT_OPTIONS = 'k8s-enforce-deployment-options',
|
||||||
K8S_ADM_ONLY_USR_INGRESS_DEPLY = 'k8s-admin-only-ingress-deploy',
|
K8S_ADM_ONLY_USR_INGRESS_DEPLY = 'k8s-admin-only-ingress-deploy',
|
||||||
K8S_ROLLING_RESTART = 'k8s-rolling-restart',
|
K8S_ROLLING_RESTART = 'k8s-rolling-restart',
|
||||||
|
K8SINSTALL = 'k8s-install',
|
||||||
K8S_ANNOTATIONS = 'k8s-annotations',
|
K8S_ANNOTATIONS = 'k8s-annotations',
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ export async function init(edition: Edition) {
|
||||||
[FeatureId.K8S_RESOURCE_POOL_STORAGE_QUOTA]: Edition.BE,
|
[FeatureId.K8S_RESOURCE_POOL_STORAGE_QUOTA]: Edition.BE,
|
||||||
[FeatureId.K8S_CREATE_FROM_KUBECONFIG]: Edition.BE,
|
[FeatureId.K8S_CREATE_FROM_KUBECONFIG]: Edition.BE,
|
||||||
[FeatureId.KAAS_PROVISIONING]: Edition.BE,
|
[FeatureId.KAAS_PROVISIONING]: Edition.BE,
|
||||||
|
[FeatureId.K8SINSTALL]: Edition.BE,
|
||||||
[FeatureId.NOMAD]: Edition.BE,
|
[FeatureId.NOMAD]: Edition.BE,
|
||||||
[FeatureId.ACTIVITY_AUDIT]: Edition.BE,
|
[FeatureId.ACTIVITY_AUDIT]: Edition.BE,
|
||||||
[FeatureId.EXTERNAL_AUTH_LDAP]: Edition.BE,
|
[FeatureId.EXTERNAL_AUTH_LDAP]: Edition.BE,
|
||||||
|
|
Loading…
Reference in New Issue