@superset-ui/core
Version:
88 lines (66 loc) • 4.12 kB
JavaScript
(function () {var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;enterModule && enterModule(module);})();var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {return a;}; /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 { css, styled } from '../../style';
import { t } from '../../translation';import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
const MESSAGE_STYLES = { maxWidth: 800 };
const MIN_WIDTH_FOR_BODY = 250;
const Container = styled.div
`
${({ theme, width, height }) => css`
align-items: center;
display: flex;
flex-direction: column;
justify-content: center;
text-align: center;
height: ${height}px;
width: ${width}px;
padding: ${theme.gridUnit * 4}px;
& .no-results-title {
font-size: ${theme.typography.sizes.l}px;
font-weight: ${theme.typography.weights.bold};
padding-bottom: ${theme.gridUnit * 2};
}
& .no-results-body {
font-size: ${theme.typography.sizes.m}px;
}
`}
`;
const NoResultsComponent = ({ className, height, id, width }) => {
// render the body if the width is auto/100% or greater than 250 pixels
const shouldRenderBody =
typeof width === 'string' || width > MIN_WIDTH_FOR_BODY;
const BODY_STRING = t(
'No results were returned for this query. If you expected results to be returned, ensure any filters are configured properly and the datasource contains data for the selected time range.'
);
return (
_jsx(Container, {
height: height,
width: width,
className: className,
id: id,
title: shouldRenderBody ? undefined : BODY_STRING, children:
_jsxs("div", { style: MESSAGE_STYLES, children: [
_jsx("div", { className: "no-results-title", children: t('No Results') }),
shouldRenderBody &&
_jsx("div", { className: "no-results-body", children: BODY_STRING })] }
) }
));
};const _default =
NoResultsComponent;export default _default;;(function () {var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;if (!reactHotLoader) {return;}reactHotLoader.register(MESSAGE_STYLES, "MESSAGE_STYLES", "/Users/evan_1/GitHub/superset/superset-frontend/packages/superset-ui-core/src/chart/components/NoResultsComponent.tsx");reactHotLoader.register(MIN_WIDTH_FOR_BODY, "MIN_WIDTH_FOR_BODY", "/Users/evan_1/GitHub/superset/superset-frontend/packages/superset-ui-core/src/chart/components/NoResultsComponent.tsx");reactHotLoader.register(Container, "Container", "/Users/evan_1/GitHub/superset/superset-frontend/packages/superset-ui-core/src/chart/components/NoResultsComponent.tsx");reactHotLoader.register(NoResultsComponent, "NoResultsComponent", "/Users/evan_1/GitHub/superset/superset-frontend/packages/superset-ui-core/src/chart/components/NoResultsComponent.tsx");reactHotLoader.register(_default, "default", "/Users/evan_1/GitHub/superset/superset-frontend/packages/superset-ui-core/src/chart/components/NoResultsComponent.tsx");})();;(function () {var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;leaveModule && leaveModule(module);})();
//# sourceMappingURL=NoResultsComponent.js.map