diff --git a/src/fireedge/src/client/apps/sunstone/routesOne.js b/src/fireedge/src/client/apps/sunstone/routesOne.js index eacce5d774..f4ebd75cd6 100644 --- a/src/fireedge/src/client/apps/sunstone/routesOne.js +++ b/src/fireedge/src/client/apps/sunstone/routesOne.js @@ -104,8 +104,17 @@ const ServiceTemplates = loadable( () => import('client/containers/ServiceTemplates'), { ssr: false } ) -// const DeployServiceTemplates = loadable(() => import('client/containers/ServiceTemplates/Instantiate'), { ssr: false }) -// const CreateServiceTemplates = loadable(() => import('client/containers/ServiceTemplates/Create'), { ssr: false }) + +const InstantiateServiceTemplate = loadable( + () => import('client/containers/ServiceTemplates/Instantiate'), + { ssr: false } +) + +const CreateServiceTemplates = loadable( + () => import('client/containers/ServiceTemplates/Create'), + { ssr: false } +) + const ServiceTemplateDetail = loadable( () => import('client/containers/ServiceTemplates/Detail'), { ssr: false } @@ -314,7 +323,7 @@ export const PATH = { SERVICES: { LIST: `/${RESOURCE_NAMES.SERVICE_TEMPLATE}`, DETAIL: `/${RESOURCE_NAMES.SERVICE_TEMPLATE}/:id`, - DEPLOY: `/${RESOURCE_NAMES.SERVICE_TEMPLATE}/deploy/`, + INSTANTIATE: `/${RESOURCE_NAMES.SERVICE_TEMPLATE}/instantiate/`, CREATE: `/${RESOURCE_NAMES.SERVICE_TEMPLATE}/create`, }, }, @@ -485,6 +494,13 @@ const ENDPOINTS = [ path: PATH.TEMPLATE.VMS.DETAIL, Component: VMTemplateDetail, }, + { + title: T.InstantiateServiceTemplate, + description: (_, state) => + state?.ID !== undefined && `#${state.ID} ${state.NAME}`, + path: PATH.TEMPLATE.SERVICES.INSTANTIATE, + Component: InstantiateServiceTemplate, + }, { title: T.ServiceTemplates, path: PATH.TEMPLATE.SERVICES.LIST, @@ -492,13 +508,6 @@ const ENDPOINTS = [ icon: ServiceTemplateIcon, Component: ServiceTemplates, }, - /* { - title: T.DeployServiceTemplate, - description: (_, state) => - state?.ID !== undefined && `#${state.ID} ${state.NAME}`, - path: PATH.TEMPLATE.SERVICES.DEPLOY, - Component: DeployServiceTemplates, - }, { title: (_, state) => state?.ID !== undefined @@ -508,7 +517,7 @@ const ENDPOINTS = [ state?.ID !== undefined && `#${state.ID} ${state.NAME}`, path: PATH.TEMPLATE.SERVICES.CREATE, Component: CreateServiceTemplates, - }, */ + }, { title: T.ServiceTemplate, description: (params) => `#${params?.id}`, diff --git a/src/fireedge/src/client/components/Cards/ServiceCard.js b/src/fireedge/src/client/components/Cards/ServiceCard.js index 34dc64f68b..799c801cb5 100644 --- a/src/fireedge/src/client/components/Cards/ServiceCard.js +++ b/src/fireedge/src/client/components/Cards/ServiceCard.js @@ -15,59 +15,35 @@ * ------------------------------------------------------------------------- */ import { ReactElement, memo, useMemo } from 'react' import PropTypes from 'prop-types' - -import { WarningCircledOutline as WarningIcon } from 'iconoir-react' import { Typography } from '@mui/material' - -import { useViews } from 'client/features/Auth' -import MultipleTags from 'client/components/MultipleTags' import Timer from 'client/components/Timer' import { StatusCircle } from 'client/components/Status' import { rowStyles } from 'client/components/Tables/styles' -import { - timeFromMilliseconds, - getUniqueLabels, - getColorFromString, -} from 'client/models/Helper' +import { timeFromMilliseconds } from 'client/models/Helper' import { getState } from 'client/models/Service' -import { T, Service, ACTIONS, RESOURCE_NAMES } from 'client/constants' +import { T, Service } from 'client/constants' const ServiceCard = memo( /** * @param {object} props - Props * @param {Service} props.service - Service resource * @param {object} props.rootProps - Props to root component - * @param {function(string):Promise} [props.onDeleteLabel] - Callback to delete label * @param {ReactElement} [props.actions] - Actions * @returns {ReactElement} - Card */ - ({ service, rootProps, actions, onDeleteLabel }) => { + ({ service, rootProps, actions }) => { const classes = rowStyles() - const { [RESOURCE_NAMES.SERVICE]: serviceView } = useViews() - - const enableEditLabels = - serviceView?.actions?.[ACTIONS.EDIT_LABELS] === true && !!onDeleteLabel const { ID, NAME, - TEMPLATE: { BODY: { description, labels, start_time: startTime } = {} }, + TEMPLATE: { BODY: { description, start_time: startTime } = {} }, } = service const { color: stateColor, name: stateName } = getState(service) const time = useMemo(() => timeFromMilliseconds(+startTime), [startTime]) - const uniqueLabels = useMemo( - () => - getUniqueLabels(labels).map((label) => ({ - text: label, - stateColor: getColorFromString(label), - onDelete: enableEditLabels && onDeleteLabel, - })), - [labels, enableEditLabels, onDeleteLabel] - ) - return (