diff --git a/src/components/Assets/AssetTypeList/AssetTypeList.stories.tsx b/src/components/Assets/AssetTypeList/AssetTypeList.stories.tsx
index a73cf43c5..b1041fa6f 100644
--- a/src/components/Assets/AssetTypeList/AssetTypeList.stories.tsx
+++ b/src/components/Assets/AssetTypeList/AssetTypeList.stories.tsx
@@ -51,3 +51,13 @@ export const Default: Story = {
}
}
};
+
+export const Empty: Story = {
+ args: {
+ searchQuery: "",
+ services: [],
+ data: {
+ assetCategories: []
+ }
+ }
+};
diff --git a/src/components/Assets/AssetTypeList/index.tsx b/src/components/Assets/AssetTypeList/index.tsx
index f6521d837..167db54b4 100644
--- a/src/components/Assets/AssetTypeList/index.tsx
+++ b/src/components/Assets/AssetTypeList/index.tsx
@@ -1,18 +1,13 @@
import { useContext, useEffect, useMemo, useRef, useState } from "react";
-import { actions as globalActions } from "../../../actions";
import { dispatcher } from "../../../dispatcher";
import { getFeatureFlagValue } from "../../../featureFlags";
import { usePrevious } from "../../../hooks/usePrevious";
-import { trackingEvents as globalTrackingEvents } from "../../../trackingEvents";
import { isNumber } from "../../../typeGuards/isNumber";
import { isString } from "../../../typeGuards/isString";
import { FeatureFlag } from "../../../types";
-import { sendTrackingEvent } from "../../../utils/sendTrackingEvent";
import { ConfigContext } from "../../common/App/ConfigContext";
-import { EmptyState } from "../../common/EmptyState";
-import { NewCircleLoader } from "../../common/NewCircleLoader";
-import { CardsIcon } from "../../common/icons/CardsIcon";
import { AssetFilterQuery } from "../AssetsFilter/types";
+import { NoDataMessage } from "../NoDataMessage";
import { actions } from "../actions";
import { checkIfAnyFiltersApplied, getAssetTypeInfo } from "../utils";
import { AssetTypeListItem } from "./AssetTypeListItem";
@@ -176,53 +171,16 @@ export const AssetTypeList = (props: AssetTypeListProps) => {
props.onAssetTypeSelect(assetTypeId);
};
- const handleTroubleshootingLinkClick = () => {
- sendTrackingEvent(globalTrackingEvents.TROUBLESHOOTING_LINK_CLICKED, {
- origin: "assets"
- });
-
- window.sendMessageToDigma({
- action: globalActions.OPEN_TROUBLESHOOTING_GUIDE
- });
- };
-
if (isInitialLoading) {
- return (
-
- } />
-
- );
+ return ;
}
if (data?.assetCategories.every((x) => x.count === 0)) {
- let title = "No data yet";
- let content = (
- <>
-
- Trigger actions that call this application to learn more about its
- runtime behavior
-
-
- Not seeing your application data?
-
- >
- );
-
if (areAnyFiltersApplied) {
- title = "No results";
- content = (
-
- It seems there are no assets matching your selected filters at the
- moment
-
- );
+ return ;
}
- return (
-
-
-
- );
+ return ;
}
return (
diff --git a/src/components/Assets/AssetTypeList/styles.ts b/src/components/Assets/AssetTypeList/styles.ts
index 7602d6504..fd035dddd 100644
--- a/src/components/Assets/AssetTypeList/styles.ts
+++ b/src/components/Assets/AssetTypeList/styles.ts
@@ -1,5 +1,4 @@
import styled from "styled-components";
-import { Link } from "../../common/Link";
export const List = styled.ul`
display: flex;
@@ -17,38 +16,3 @@ export const List = styled.ul`
}
}};
`;
-
-export const NoDataContainer = styled.div`
- flex-grow: 1;
- display: flex;
- flex-direction: column;
- align-items: center;
-`;
-
-export const EmptyStateDescription = styled.span`
- font-size: 14px;
- font-weight: 500;
- margin-bottom: 4px;
- text-align: center;
- color: ${({ theme }) => {
- switch (theme.mode) {
- case "light":
- return "#788ca9";
- case "dark":
- case "dark-jetbrains":
- return "#7c7c94";
- }
- }};
-`;
-
-export const TroubleshootingLink = styled(Link)`
- color: ${({ theme }) => {
- switch (theme.mode) {
- case "light":
- return "#7891d0";
- case "dark":
- case "dark-jetbrains":
- return "#92affa";
- }
- }};
-`;
diff --git a/src/components/Assets/NoDataMessage/NoDataMessage.stories.tsx b/src/components/Assets/NoDataMessage/NoDataMessage.stories.tsx
new file mode 100644
index 000000000..83f320d40
--- /dev/null
+++ b/src/components/Assets/NoDataMessage/NoDataMessage.stories.tsx
@@ -0,0 +1,36 @@
+import { Meta, StoryObj } from "@storybook/react";
+
+import { NoDataMessage } from ".";
+
+// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction
+const meta: Meta = {
+ title: "Assets/NoDataMessage",
+ component: NoDataMessage,
+ parameters: {
+ // More on how to position stories at: https://storybook.js.org/docs/react/configure/story-layout
+ layout: "fullscreen"
+ }
+};
+
+export default meta;
+
+type Story = StoryObj;
+
+// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
+export const Loading: Story = {
+ args: {
+ type: "loading"
+ }
+};
+
+export const NoDataYet: Story = {
+ args: {
+ type: "noDataYet"
+ }
+};
+
+export const NoSearchResults: Story = {
+ args: {
+ type: "noSearchResults"
+ }
+};
diff --git a/src/components/Assets/NoDataMessage/index.tsx b/src/components/Assets/NoDataMessage/index.tsx
new file mode 100644
index 000000000..8653ad722
--- /dev/null
+++ b/src/components/Assets/NoDataMessage/index.tsx
@@ -0,0 +1,62 @@
+import { actions as globalActions } from "../../../actions";
+import { trackingEvents as globalTrackingEvents } from "../../../trackingEvents";
+import { sendTrackingEvent } from "../../../utils/sendTrackingEvent";
+import { EmptyState } from "../../common/EmptyState";
+import { NewCircleLoader } from "../../common/NewCircleLoader";
+import { CardsIcon } from "../../common/icons/CardsIcon";
+import * as s from "./styles";
+import { NoDataMessageProps } from "./types";
+
+export const NoDataMessage = (props: NoDataMessageProps) => {
+ const handleTroubleshootingLinkClick = () => {
+ sendTrackingEvent(globalTrackingEvents.TROUBLESHOOTING_LINK_CLICKED, {
+ origin: "assets"
+ });
+
+ window.sendMessageToDigma({
+ action: globalActions.OPEN_TROUBLESHOOTING_GUIDE
+ });
+ };
+
+ let content: JSX.Element | null = null;
+
+ switch (props.type) {
+ case "loading":
+ content = ;
+ break;
+ case "noDataYet":
+ content = (
+
+
+ Trigger actions that call this application to learn more about
+ its runtime behavior
+
+
+ Not seeing your application data?
+
+ >
+ }
+ />
+ );
+ break;
+ case "noSearchResults":
+ content = (
+
+ It seems there are no assets matching your selected filters at the
+ moment
+
+ }
+ />
+ );
+ }
+
+ return {content};
+};
diff --git a/src/components/Assets/NoDataMessage/styles.ts b/src/components/Assets/NoDataMessage/styles.ts
new file mode 100644
index 000000000..f4542a328
--- /dev/null
+++ b/src/components/Assets/NoDataMessage/styles.ts
@@ -0,0 +1,37 @@
+import styled from "styled-components";
+import { Link } from "../../common/Link";
+
+export const NoDataContainer = styled.div`
+ flex-grow: 1;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+`;
+
+export const EmptyStateDescription = styled.span`
+ font-size: 14px;
+ font-weight: 500;
+ margin-bottom: 4px;
+ text-align: center;
+ color: ${({ theme }) => {
+ switch (theme.mode) {
+ case "light":
+ return "#788ca9";
+ case "dark":
+ case "dark-jetbrains":
+ return "#7c7c94";
+ }
+ }};
+`;
+
+export const TroubleshootingLink = styled(Link)`
+ color: ${({ theme }) => {
+ switch (theme.mode) {
+ case "light":
+ return "#7891d0";
+ case "dark":
+ case "dark-jetbrains":
+ return "#92affa";
+ }
+ }};
+`;
diff --git a/src/components/Assets/NoDataMessage/types.ts b/src/components/Assets/NoDataMessage/types.ts
new file mode 100644
index 000000000..8332c3096
--- /dev/null
+++ b/src/components/Assets/NoDataMessage/types.ts
@@ -0,0 +1,3 @@
+export interface NoDataMessageProps {
+ type: "loading" | "noDataYet" | "noSearchResults";
+}
diff --git a/src/components/Assets/index.tsx b/src/components/Assets/index.tsx
index b15c817b7..89f1d76c8 100644
--- a/src/components/Assets/index.tsx
+++ b/src/components/Assets/index.tsx
@@ -14,12 +14,12 @@ import { useDebounce } from "../../hooks/useDebounce";
import { FeatureFlag } from "../../types";
import { ConfigContext } from "../common/App/ConfigContext";
import { EmptyState } from "../common/EmptyState";
-import { NewCircleLoader } from "../common/NewCircleLoader";
import { MagnifierIcon } from "../common/icons/MagnifierIcon";
import { AssetList } from "./AssetList";
import { AssetTypeList } from "./AssetTypeList";
import { AssetsFilter } from "./AssetsFilter";
import { AssetFilterQuery } from "./AssetsFilter/types";
+import { NoDataMessage } from "./NoDataMessage";
import { ServicesFilter } from "./ServicesFilter";
import { actions } from "./actions";
import * as s from "./styles";
@@ -103,7 +103,7 @@ export const Assets = () => {
}
if (!selectedFilters && !selectedServices) {
- return } />;
+ return ;
}
if (!selectedAssetTypeId) {