mirror of
https://github.com/harness/drone.git
synced 2025-05-03 21:11:08 +08:00

* fix: lint check * fix: page overflow * resolve comments * resolve comments * fix: space label addition * resolve comments : added enum * update: settings -> manage repository * update: resolved comments * update: bugbash comments * fix: ref exact scope for individual label values call * fix lint * add hook to handle current scope in HC and fix scope filter * update space delete * prettier check * update labelAPIs to use getConfig in base * support for harness-code labels * fix no result card * resolved comments for types * resolved comments * added sorting in labels and handled edge cases * fix: replacement of any value label * fix: spacing in value filter search input * add: update modal on click for spaces * added search for values in filter * fix: UI issues and some enhancements * handle empty labels list in space and remove tooltip for PR labels * added getConifg and any values for label filter * change label value color to enum * make value-id a pionter * update ordering * expose value id * handle long values * update search in label selector * handle edge cases * fix lint * added FF : CODE_PULLREQ_LABELS and standalone flag to labels * fix popover on scrolling and added strings * fix checks * fix checks * swagger update * labels support in Gitness
87 lines
2.4 KiB
TypeScript
87 lines
2.4 KiB
TypeScript
/*
|
|
* Copyright 2023 Harness, Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
import React from 'react'
|
|
import { Button, Container, ButtonVariation, NoDataCard } from '@harnessio/uicore'
|
|
import type { IconName } from '@harnessio/icons'
|
|
import { noop } from 'lodash-es'
|
|
import { CodeIcon } from 'utils/GitUtils'
|
|
import { useStrings } from 'framework/strings'
|
|
import { Images } from 'images'
|
|
import css from './NoResultCard.module.scss'
|
|
|
|
interface NoResultCardProps {
|
|
showWhen?: () => boolean
|
|
forSearch: boolean
|
|
title?: string
|
|
message?: string
|
|
emptySearchMessage?: string
|
|
buttonText?: string
|
|
buttonIcon?: IconName
|
|
onButtonClick?: () => void
|
|
permissionProp?: { disabled: boolean; tooltip: JSX.Element | string } | undefined
|
|
standalone?: boolean
|
|
forFilter?: boolean
|
|
emptyFilterMessage?: string
|
|
}
|
|
|
|
export const NoResultCard: React.FC<NoResultCardProps> = ({
|
|
showWhen = () => true,
|
|
forSearch,
|
|
forFilter = false,
|
|
title,
|
|
message,
|
|
emptySearchMessage,
|
|
emptyFilterMessage,
|
|
buttonText = '',
|
|
buttonIcon = CodeIcon.Add,
|
|
onButtonClick = noop,
|
|
permissionProp
|
|
}) => {
|
|
const { getString } = useStrings()
|
|
|
|
if (!showWhen()) {
|
|
return null
|
|
}
|
|
|
|
return (
|
|
<Container className={css.main}>
|
|
<NoDataCard
|
|
image={Images.EmptyState}
|
|
messageTitle={forSearch || forFilter ? title || getString('noResultTitle') : undefined}
|
|
message={
|
|
forSearch
|
|
? emptySearchMessage || getString('noResultMessage')
|
|
: forFilter
|
|
? emptyFilterMessage || getString('noFilterResultMessage')
|
|
: message || getString('noResultMessage')
|
|
}
|
|
button={
|
|
forSearch || forFilter ? undefined : (
|
|
<Button
|
|
variation={ButtonVariation.PRIMARY}
|
|
text={buttonText}
|
|
icon={buttonIcon as IconName}
|
|
onClick={onButtonClick}
|
|
{...permissionProp}
|
|
/>
|
|
)
|
|
}
|
|
/>
|
|
</Container>
|
|
)
|
|
}
|