Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"source.organizeImports": "explicit"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"stylelint.validate": ["typescript"]
"stylelint.validate": ["typescript"],
"cSpell.words": ["uuidv"]
}
20 changes: 16 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"@types/react-syntax-highlighter": "^15.5.7",
"@types/react-transition-group": "^4.4.5",
"@types/semver": "^7.5.6",
"@types/uuid": "^9.0.8",
"@typescript-eslint/eslint-plugin": "^5.49.0",
"@typescript-eslint/parser": "^5.49.0",
"babel-loader": "^9.1.3",
Expand Down Expand Up @@ -120,6 +121,7 @@
"react-transition-group": "^4.4.5",
"recharts": "^2.6.2",
"semver": "^7.5.4",
"styled-components": "^6.1.0"
"styled-components": "^6.1.0",
"uuid": "^9.0.1"
}
}
2 changes: 1 addition & 1 deletion src/components/Assets/AssetList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ export const AssetList = (props: AssetListProps) => {
(Array.isArray(previousServices) &&
previousServices !== props.services) ||
(previousFilters && previousFilters !== props.filters) ||
(previousViewScope && previousViewScope !== props.scopeViewOptions)
previousViewScope !== props.scopeViewOptions
) {
getData(
props.assetTypeId,
Expand Down
2 changes: 1 addition & 1 deletion src/components/Assets/AssetList/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface AssetListProps {
services?: string[];
filters?: AssetFilterQuery;
searchQuery: string;
scopeViewOptions?: AssetScopeOption;
scopeViewOptions: AssetScopeOption | null;
}

export enum SORTING_CRITERION {
Expand Down
5 changes: 3 additions & 2 deletions src/components/Assets/AssetTypeList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export const AssetTypeList = (props: AssetTypeListProps) => {
(previousFilters && previousFilters !== props.filters) ||
(isString(previousSearchQuery) &&
previousSearchQuery !== props.searchQuery) ||
(previousViewScope && previousViewScope !== props.scopeViewOptions)
previousViewScope !== props.scopeViewOptions
) {
getData(
props.filters,
Expand All @@ -144,7 +144,8 @@ export const AssetTypeList = (props: AssetTypeListProps) => {
previousSearchQuery,
props.searchQuery,
isComplexFilterEnabled,
props.scopeViewOptions
props.scopeViewOptions,
previousViewScope
]);

useEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Assets/AssetTypeList/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export interface AssetTypeListProps {
services?: string[];
filters?: AssetFilterQuery;
searchQuery: string;
scopeViewOptions?: AssetScopeOption;
scopeViewOptions: AssetScopeOption | null;
}

export interface AssetCategoriesData {
Expand Down
6 changes: 2 additions & 4 deletions src/components/Assets/AssetsViewScopeConfiguration/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useContext, useEffect, useState } from "react";
import { ConfigContext } from "../../common/App/ConfigContext";
import { useEffect, useState } from "react";
import { ToggleSwitch } from "../../common/ToggleSwitch";
import * as s from "./styles";
import { AssetsViewConfigurationProps as AssetsViewScopeConfigurationProps } from "./types";
Expand All @@ -9,11 +8,10 @@ export const AssetsViewScopeConfiguration = (
) => {
const [isEntry, setIsEntry] = useState(false);
const [isDirect, setIsDirect] = useState(false);
const { scope } = useContext(ConfigContext);
const scope = props.currentScope;

useEffect(() => {
const isEntryPoint = !scope || scope.span?.role === "Entry";

props.onAssetViewChanged({
scopedSpanCodeObjectId: scope?.span?.spanCodeObjectId,
isDirect: !isEntryPoint
Expand Down
5 changes: 4 additions & 1 deletion src/components/Assets/AssetsViewScopeConfiguration/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { Scope } from "../../common/App/types";

export interface AssetsViewConfigurationProps {
onAssetViewChanged: (isDirect: AssetScopeOption) => void;
onAssetViewChanged: (assetViewScope: AssetScopeOption) => void;
currentScope: Scope;
}

export interface AssetScopeOption {
Expand Down
11 changes: 10 additions & 1 deletion src/components/Assets/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
ChangeEvent,
useContext,
useEffect,
useLayoutEffect,
useMemo,
useState
Expand Down Expand Up @@ -33,7 +34,8 @@ export const Assets = () => {
const [searchInputValue, setSearchInputValue] = useState("");
const debouncedSearchInputValue = useDebounce(searchInputValue, 1000);
const [selectedServices, setSelectedServices] = useState<string[]>();
const [assetScopeOption, setAssetScopeOption] = useState<AssetScopeOption>();
const [assetScopeOption, setAssetScopeOption] =
useState<AssetScopeOption | null>(null);
const [selectedFilters, setSelectedFilters] = useState<AssetFilterQuery>();
const config = useContext(ConfigContext);

Expand Down Expand Up @@ -68,6 +70,12 @@ export const Assets = () => {
});
}, []);

useEffect(() => {
if (!config.scope?.span) {
setAssetScopeOption(null);
}
}, [config.scope]);

const handleBackButtonClick = () => {
setSelectedAssetTypeId(null);
};
Expand Down Expand Up @@ -167,6 +175,7 @@ export const Assets = () => {
{config.scope && config.scope.span && (
<s.HeaderItem>
<AssetsViewScopeConfiguration
currentScope={config.scope}
onAssetViewChanged={(val) => {
setAssetScopeOption(val);
}}
Expand Down
39 changes: 20 additions & 19 deletions src/components/Insights/InsightsCatalog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { useEffect, useState } from "react";
import { usePrevious } from "../../../hooks/usePrevious";

import { isNumber } from "../../../typeGuards/isNumber";
import { isString } from "../../../typeGuards/isString";
import { Pagination } from "../../common/Pagination";
import { SearchInput } from "../../common/SearchInput";
import { SortingSelector } from "../../common/SortingSelector";
Expand Down Expand Up @@ -40,8 +39,7 @@ export const InsightsCatalog = (props: InsightsCatalogProps) => {
if (
(isNumber(previousPage) && previousPage !== page) ||
(previousSorting && previousSorting !== sorting) ||
(isString(previousSearchQuery) &&
previousSearchQuery !== searchInputValue)
previousSearchQuery !== searchInputValue
) {
props.onQueryChange({
page,
Expand Down Expand Up @@ -90,23 +88,26 @@ export const InsightsCatalog = (props: InsightsCatalogProps) => {
insights={insights}
isFilteringEnabled={searchInputValue !== null}
onJiraTicketCreate={onJiraTicketCreate}
onRefresh={props.onRefresh}
/>
<s.Footer>
<s.FooterItemsCount>
Showing{" "}
<s.FooterPageItemsCount>
{pageStartItemNumber} - {pageEndItemNumber}
</s.FooterPageItemsCount>{" "}
of {totalCount}
</s.FooterItemsCount>
<Pagination
itemsCount={totalCount}
page={page}
pageSize={PAGE_SIZE}
onPageChange={setPage}
extendedNavigation={true}
/>
</s.Footer>
{totalCount > 0 && (
<s.Footer>
<s.FooterItemsCount>
Showing{" "}
<s.FooterPageItemsCount>
{pageStartItemNumber} - {pageEndItemNumber}
</s.FooterPageItemsCount>{" "}
of {totalCount}
</s.FooterItemsCount>
<Pagination
itemsCount={totalCount}
page={page}
pageSize={PAGE_SIZE}
onPageChange={setPage}
extendedNavigation={true}
/>
</s.Footer>
)}
</>
);
};
1 change: 1 addition & 0 deletions src/components/Insights/InsightsCatalog/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface InsightsCatalogProps {
) => void;
onQueryChange: (query: InsightsQuery) => void;
defaultQuery: InsightsQuery;
onRefresh: () => void;
}

export enum SORTING_CRITERION {
Expand Down
Loading