1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-04 21:35:23 +02:00

feat(edge/templates): introduce edge app templates [EE-6209] (#10480)

This commit is contained in:
Chaim Lev-Ari 2023-11-14 14:54:44 +02:00 committed by GitHub
parent 95d96e1164
commit e1e90c9c1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
58 changed files with 1142 additions and 365 deletions

View file

@ -23,7 +23,7 @@ export function BlocklistItem<T extends ElementType>({
type="button"
className={clsx(
className,
'blocklist-item flex items-stretch overflow-hidden bg-transparent w-full !ml-0',
'blocklist-item flex items-stretch overflow-hidden bg-transparent w-full !ml-0 text-left',
{
'blocklist-item--selected': isSelected,
}

View file

@ -1,23 +1,14 @@
import { useEffect, useState } from 'react';
import { BadgeIcon, BadgeSize } from './BadgeIcon/BadgeIcon';
import { ReactNode, useEffect, useState } from 'react';
interface Props {
// props for the image to load
src?: string; // a link to an external image
fallbackIcon: string;
fallbackIcon: ReactNode;
alt?: string;
size?: BadgeSize;
className?: string;
}
export function FallbackImage({
src,
fallbackIcon,
alt,
size,
className,
}: Props) {
export function FallbackImage({ src, fallbackIcon, alt, className }: Props) {
const [error, setError] = useState(false);
useEffect(() => {
@ -36,5 +27,5 @@ export function FallbackImage({
}
// fallback icon if there is an error loading the image
return <BadgeIcon icon={fallbackIcon} size={size} />;
return <>{fallbackIcon}</>;
}

View file

@ -12,6 +12,7 @@ import { Select as ReactSelect } from '@@/form-components/ReactSelect';
export interface Option<TValue> {
value: TValue;
label: string;
disabled?: boolean;
}
type Options<TValue> = OptionsOrGroups<
@ -99,6 +100,7 @@ export function SingleSelect<TValue = string>({
options={options}
value={selectedValue}
onChange={(option) => onChange(option ? option.value : null)}
isOptionDisabled={(option) => !!option.disabled}
data-cy={dataCy}
inputId={inputId}
placeholder={placeholder}
@ -155,6 +157,7 @@ export function MultiSelect<TValue = string>({
isClearable={isClearable}
getOptionLabel={(option) => option.label}
getOptionValue={(option) => String(option.value)}
isOptionDisabled={(option) => !!option.disabled}
options={options}
value={selectedOptions}
closeMenuOnSelect={false}