Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | 30x 30x 30x 30x 30x 30x 30x 30x 30x 30x 30x 3x 3x 3x | /* * Copyright 2022 Harness Inc. All rights reserved. * Use of this source code is governed by the PolyForm Shield 1.0.0 license * that can be found in the licenses directory at the root of this repository, also available at * https://polyformproject.org/wp-content/uploads/2020/06/PolyForm-Shield-1.0.0.txt. */ import React from 'react' import { ButtonVariation, ButtonSize, ButtonProps } from '@wings-software/uicore' import { Color } from '@harness/design-system' import RbacButton from '@rbac/components/Button/Button' import { PermissionIdentifier } from '@rbac/interfaces/PermissionIdentifier' import { ResourceType } from '@rbac/interfaces/ResourceType' import { useStrings } from 'framework/strings' import type { PipelineInfoConfig, StageElementConfig } from 'services/cd-ng' import type { StepOrStepGroupOrTemplateStepData } from '@pipeline/components/PipelineStudio/StepCommands/StepCommandTypes' import { FeatureIdentifier } from 'framework/featureStore/FeatureIdentifier' import { useSaveAsTemplate } from '@pipeline/components/PipelineStudio/SaveTemplateButton/useSaveAsTemplate' import css from './SaveTemplateButton.module.scss' type TemplateData = StepOrStepGroupOrTemplateStepData | StageElementConfig | PipelineInfoConfig export interface SaveTemplateButtonProps { data: TemplateData | (() => Promise<TemplateData>) type: 'Step' | 'Stage' | 'Pipeline' buttonProps?: ButtonProps } export function SaveTemplateButton({ data, buttonProps, type }: SaveTemplateButtonProps): JSX.Element { const { getString } = useStrings() const { save } = useSaveAsTemplate({ data, type }) return ( <RbacButton withoutCurrentColor text={buttonProps?.variation === ButtonVariation.ICON ? undefined : getString('common.saveAsTemplate')} className={buttonProps?.variation === ButtonVariation.ICON ? css.iconButton : ''} variation={ButtonVariation.SECONDARY} size={ButtonSize.SMALL} icon="upload-box" iconProps={{ color: Color.PRIMARY_7 }} onClick={save} permission={{ permission: PermissionIdentifier.EDIT_TEMPLATE, resource: { resourceType: ResourceType.TEMPLATE } }} featuresProps={{ featuresRequest: { featureNames: [FeatureIdentifier.TEMPLATE_SERVICE] } }} {...buttonProps} /> ) } |