Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
Signed-off-by: Max Cao <[email protected]>
  • Loading branch information
maxcao13 committed Mar 31, 2023
1 parent bb44cd0 commit 407aa17
Show file tree
Hide file tree
Showing 18 changed files with 41 additions and 31 deletions.
4 changes: 2 additions & 2 deletions src/app/Archives/AllArchivedRecordingsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import { ServiceContext } from '@app/Shared/Services/Services';
import { Target } from '@app/Shared/Services/Target.service';
import { useSort } from '@app/utils/useSort';
import { useSubscriptions } from '@app/utils/useSubscriptions';
import { sortResouces } from '@app/utils/utils';
import { sortResources } from '@app/utils/utils';
import {
Toolbar,
ToolbarContent,
Expand Down Expand Up @@ -153,7 +153,7 @@ export const AllArchivedRecordingsTable: React.FC<AllArchivedRecordingsTableProp
d.connectUrl.toLowerCase().includes(formattedSearchText)
);
}
return sortResouces(sortBy, updatedSearchedDirectories, mapper, getTransform);
return sortResources(sortBy, updatedSearchedDirectories, mapper, getTransform);
}, [directories, searchText, sortBy]);

React.useEffect(() => {
Expand Down
4 changes: 2 additions & 2 deletions src/app/Archives/AllTargetsArchivedRecordingsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import { includesTarget, indexOfTarget, isEqualTarget, Target } from '@app/Share
import { TargetDiscoveryEvent } from '@app/Shared/Services/Targets.service';
import { useSort } from '@app/utils/useSort';
import { useSubscriptions } from '@app/utils/useSubscriptions';
import { hashCode, sortResouces } from '@app/utils/utils';
import { hashCode, sortResources } from '@app/utils/utils';
import {
Toolbar,
ToolbarContent,
Expand Down Expand Up @@ -278,7 +278,7 @@ export const AllTargetsArchivedRecordingsTable: React.FC<AllTargetsArchivedRecor
t.connectUrl.toLowerCase().includes(formattedSearchText)
);
}
return sortResouces(
return sortResources(
sortBy,
updated.filter((v) => !hideEmptyTargets || v.archiveCount > 0),
mapper,
Expand Down
4 changes: 2 additions & 2 deletions src/app/Events/EventTypes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import { ServiceContext } from '@app/Shared/Services/Services';
import { NO_TARGET } from '@app/Shared/Services/Target.service';
import { useSort } from '@app/utils/useSort';
import { useSubscriptions } from '@app/utils/useSubscriptions';
import { hashCode, sortResouces } from '@app/utils/utils';
import { hashCode, sortResources } from '@app/utils/utils';
import {
Toolbar,
ToolbarContent,
Expand Down Expand Up @@ -190,7 +190,7 @@ export const EventTypes: React.FC<EventTypesProps> = (_) => {
includesSubstr(t.typeId, filterText) ||
includesSubstr(t.description, filterText) ||
includesSubstr(getCategoryString(t), filterText);
return sortResouces(sortBy, types.filter(withFilters), mapper, getTransform);
return sortResources(sortBy, types.filter(withFilters), mapper, getTransform);
}, [types, filterText, sortBy]);

const displayedTypeRowData = React.useMemo(() => {
Expand Down
7 changes: 4 additions & 3 deletions src/app/Joyride/CryostatJoyride.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
* SOFTWARE.
*/
import cryostatLogo from '@app/assets/cryostat_logo_vert_rgb_default.svg';
import build from '@app/build.json';
import { useJoyride } from '@app/Joyride/JoyrideProvider';
import JoyrideTooltip from '@app/Joyride/JoyrideTooltip';
import React from 'react';
Expand Down Expand Up @@ -197,12 +198,12 @@ const CryostatJoyride: React.FC<CryostatJoyrideProps> = (props) => {
content: (
<p>
Stay up-to-date with everything Cryostat on our{' '}
<a target="_blank" href="https://cryostat.io/blog/" rel="noreferrer">
<a target="_blank" href={`${build.homePageUrl}/blog/`} rel="noreferrer">
blog
</a>{' '}
or continue to learn more in our{' '}
<a target="_blank" href="https://cryostat.io/guides/" rel="noreferrer">
documentation
<a target="_blank" href={`${build.homePageUrl}/guides/`} rel="noreferrer">
documentation guides
</a>
.
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,15 @@
*/
import cryostatLogoIcon from '@app/assets/cryostat_icon_rgb_default.svg';
import cryostatLogo from '@app/assets/cryostat_logo_vert_rgb_default.svg';
import build from '@app/build.json';
import { FeatureLevel } from '@app/Shared/Services/Settings.service';
import { QuickStart } from '@patternfly/quickstarts';

// TODO: Add quickstarts based on the following example:
const AutomatedRulesQuickStart: QuickStart = {
apiVersion: 'v2.3.0',
metadata: {
name: 'automated-rule-quickstart',
name: 'automated-rules-quickstart',
featureLevel: FeatureLevel.PRODUCTION,
},
spec: {
Expand Down Expand Up @@ -113,7 +114,7 @@ The Automated Rule creation form has several fields that you can fill out to cre
**The rest of the fields are optional and not required for this quick start: \`[Description, Maximum Size, Maximum Age, Maximum Age, Archival Period, Initial Delay, and Preserved Archives]\`.**
[Learn more about these other Automated Rule attributes in the upstream [Cryostat documentation](https://cryostat.io/guides/#create-an-automated-rule).]{{admonition tip}}
[Learn more about these other Automated Rule attributes in the [Cryostat documentation](https://cryostat.io/guides/#create-an-automated-rule).]{{admonition tip}}
When you are finished, click the [Create]{{highlight rule-create-btn}} button.
Expand Down Expand Up @@ -151,7 +152,7 @@ This recording was created by the rule that we just created and should have a na
<div style="max-width: 350px">
<img style="margin-top: 2em; margin-bottom: 2em" src="${cryostatLogo}" alt="Cryostat Logo" width="100%" height="100%" />
</div>
<p>For more information about the <strong>Automated Rules</strong> feature, read our guide on the upstream <a href="https://cryostat.io/guides/#create-an-automated-rule" target="_blank">Cryostat documentation</a>.</p>
<p>For more information about the <strong>Automated Rules</strong> feature, read our guide on the <a href="${build.homePageUrl}/guides/#create-an-automated-rule" target="_blank">Cryostat documentation</a>.</p>
</div>`,
type: {
text: 'Featured',
Expand Down
3 changes: 2 additions & 1 deletion src/app/QuickStarts/quickstarts/cryostat-link-quickstart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
* SOFTWARE.
*/
import cryostatLogo from '@app/assets/cryostat_icon_rgb_default.svg';
import build from '@app/build.json';
import { QuickStart } from '@patternfly/quickstarts';

// TODO: Put link quickstarts in a separate QuickStartCatalogSection
Expand All @@ -54,7 +55,7 @@ const CryostatLinkQuickStart: QuickStart = {
prerequisites: [''],
introduction: '### This is a generic quickstart.',
link: {
href: 'https://cryostat.io',
href: build.homePageUrl,
text: 'cryostat.io',
},
type: {
Expand Down
5 changes: 3 additions & 2 deletions src/app/QuickStarts/quickstarts/dashboard-quickstart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
*/
import cryostatLogoIcon from '@app/assets/cryostat_icon_rgb_default.svg';
import cryostatLogo from '@app/assets/cryostat_logo_vert_rgb_default.svg';
import build from '@app/build.json';
import { FeatureLevel } from '@app/Shared/Services/Settings.service';
import { QuickStart } from '@patternfly/quickstarts';

Expand Down Expand Up @@ -77,7 +78,7 @@ Each card displays a different set of information about the currently selected t
- How to move and resize Dashboard Cards
- How to rename, upload, download, and delete Dashboard Layouts
[Learn more about each Dashboard Card in the upstream [Cryostat documentation](https://cryostat.io/docs/user-guide/dashboard/).]{{admonition tip}}
[Learn more about each Dashboard Card in the [Cryostat documentation](${build.homePageUrl}/guides/#dashboard/).]{{admonition tip}}
`,
tasks: [
{
Expand Down Expand Up @@ -165,7 +166,7 @@ You can rename, upload, download, and delete **Dashboard Layouts**. You may also
<div style="max-width: 350px">
<img style="margin-top: 2em; margin-bottom: 2em" src="${cryostatLogo}" alt="Cryostat Logo" width="100%" height="100%" />
</div>
<p>For more information about the new <strong>Dashboard</strong> and <strong>Dashboard Cards</strong> in [APP] 2.3, read our guide on the upstream <a href="https://cryostat.io/guides/#create-an-automated-rule" target="_blank">Cryostat documentation</a>.</p>
<p>For more information about the new <strong>Dashboard</strong> and <strong>Dashboard Cards</strong> in [APP] 2.3, read our guide on the <a href="${build.homePageUrl}/guides/#dashboard" target="_blank">Cryostat documentation</a>.</p>
</div>`,
type: {
text: 'Featured',
Expand Down
3 changes: 2 additions & 1 deletion src/app/QuickStarts/quickstarts/generic-quickstart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
* SOFTWARE.
*/
import cryostatLogo from '@app/assets/cryostat_icon_rgb_default.svg';
import build from '@app/build.json';
import { FeatureLevel } from '@app/Shared/Services/Settings.service';
import { QuickStart } from '@patternfly/quickstarts';

Expand Down Expand Up @@ -161,7 +162,7 @@ world
<div style="max-width: 350px">
<img style="margin-top: 2em; margin-bottom: 2em" src="${cryostatLogo}" alt="Cryostat Logo" width="100%" height="100%" />
</div>
<p>To learn more about [APP]'s extensive features and capabilities, read our upstream guides at <a href="https://cryostat.io/guides/" target="_blank">cryostat.io</a>.</p>
<p>To learn more about [APP]'s extensive features and capabilities, read our guides at <a href="${build.homePageUrl}/guides/" target="_blank">cryostat.io</a>.</p>
</div>`,
nextQuickStart: ['start-a-recording-quickstart'],
},
Expand Down
2 changes: 1 addition & 1 deletion src/app/QuickStarts/quickstarts/settings-quickstart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ Credentials are used to authenticate with the target JVMs that Cryostat communic
<div style="max-width: 350px">
<img style="margin-top: 2em; margin-bottom: 2em" src="${cryostatLogo}" alt="Cryostat Logo" width="100%" height="100%" />
</div>
<p>For more information about the <strong>Automated Rules</strong> feature, read our guide on the upstream <a href="https://cryostat.io/guides/#create-an-automated-rule" target="_blank">Cryostat documentation</a>.</p>
<p>For more information about configuring <strong>Settings</strong> in Cryostat, read our guides on the <a href="${build.homePageUrl}" target="_blank">Cryostat website</a>.</p>
</div>`,
type: {
text: 'Featured',
Expand Down
4 changes: 3 additions & 1 deletion src/app/QuickStarts/quickstarts/start-a-recording.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
*/
import cryostatLogoIcon from '@app/assets/cryostat_icon_rgb_default.svg';
import cryostatLogo from '@app/assets/cryostat_logo_vert_rgb_default.svg';
import build from '@app/build.json';
import { FeatureLevel } from '@app/Shared/Services/Settings.service';

import { QuickStart } from '@patternfly/quickstarts';
Expand Down Expand Up @@ -187,12 +188,13 @@ Archiving a recording will save the recording to [APP]'s archival storage, and w
<div style="max-width: 350px">
<img style="margin-top: 2em; margin-bottom: 2em" src="${cryostatLogo}" alt="Cryostat Logo" width="100%" height="100%" />
</div>
<p>To learn more about [APP]'s extensive features and capabilities, read our upstream guides at <a href="https://cryostat.io/guides/" target="_blank">cryostat.io</a>.</p>
<p>To learn more about [APP]'s extensive features and capabilities, read our guides at <a href="${build.homePageUrl}/guides/" target="_blank">cryostat.io</a>.</p>
</div>`,
type: {
text: 'Featured',
color: 'blue',
},
nextQuickStart: ['automated-rules-quickstart'],
},
};

Expand Down
4 changes: 2 additions & 2 deletions src/app/Recordings/ActiveRecordingsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ import { NO_TARGET } from '@app/Shared/Services/Target.service';
import { useDayjs } from '@app/utils/useDayjs';
import { useSort } from '@app/utils/useSort';
import { useSubscriptions } from '@app/utils/useSubscriptions';
import { sortResouces } from '@app/utils/utils';
import { sortResources } from '@app/utils/utils';
import {
Button,
Checkbox,
Expand Down Expand Up @@ -346,7 +346,7 @@ export const ActiveRecordingsTable: React.FunctionComponent<ActiveRecordingsTabl

React.useEffect(() => {
setFilteredRecordings(
sortResouces(sortBy, filterRecordings(recordings, targetRecordingFilters), mapper, getTransform)
sortResources(sortBy, filterRecordings(recordings, targetRecordingFilters), mapper, getTransform)
);
}, [sortBy, recordings, targetRecordingFilters, setFilteredRecordings]);

Expand Down
4 changes: 2 additions & 2 deletions src/app/Recordings/ArchivedRecordingsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ import { ServiceContext } from '@app/Shared/Services/Services';
import { NO_TARGET, Target } from '@app/Shared/Services/Target.service';
import { useSort } from '@app/utils/useSort';
import { useSubscriptions } from '@app/utils/useSubscriptions';
import { formatBytes, hashCode, sortResouces } from '@app/utils/utils';
import { formatBytes, hashCode, sortResources } from '@app/utils/utils';
import {
Button,
Checkbox,
Expand Down Expand Up @@ -367,7 +367,7 @@ export const ArchivedRecordingsTable: React.FC<ArchivedRecordingsTableProps> = (

React.useEffect(() => {
setFilteredRecordings(
sortResouces(sortBy, filterRecordings(recordings, targetRecordingFilters), mapper, getTransform)
sortResources(sortBy, filterRecordings(recordings, targetRecordingFilters), mapper, getTransform)
);
}, [sortBy, recordings, targetRecordingFilters, setFilteredRecordings]);

Expand Down
4 changes: 2 additions & 2 deletions src/app/SecurityPanel/Credentials/CredentialTestTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import { Target } from '@app/Shared/Services/Target.service';
import { useSearchExpression } from '@app/Topology/Shared/utils';
import { useSort } from '@app/utils/useSort';
import { useSubscriptions } from '@app/utils/useSubscriptions';
import { evaluateTargetWithExpr, portalRoot, sortResouces } from '@app/utils/utils';
import { evaluateTargetWithExpr, portalRoot, sortResources } from '@app/utils/utils';
import {
Bullseye,
Button,
Expand Down Expand Up @@ -140,7 +140,7 @@ export const CredentialTestTable: React.FC<CredentialTestTableProps> = ({ ...pro

const rows = React.useMemo(
() =>
sortResouces(sortBy, matchedTargets, mapper, getTransform).map((t) => (
sortResources(sortBy, matchedTargets, mapper, getTransform).map((t) => (
<CredentialTestRow target={t} key={t.connectUrl} filters={filters} searchText={searchText} />
)),
[matchedTargets, filters, searchText, sortBy]
Expand Down
4 changes: 2 additions & 2 deletions src/app/SecurityPanel/Credentials/MatchedTargetsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import { Target } from '@app/Shared/Services/Target.service';
import { TargetDiscoveryEvent } from '@app/Shared/Services/Targets.service';
import { useSort } from '@app/utils/useSort';
import { useSubscriptions } from '@app/utils/useSubscriptions';
import { sortResouces } from '@app/utils/utils';
import { sortResources } from '@app/utils/utils';
import { EmptyState, EmptyStateIcon, Title } from '@patternfly/react-core';
import { SearchIcon } from '@patternfly/react-icons';
import { InnerScrollContainer, TableComposable, Tbody, Td, Th, Thead, Tr } from '@patternfly/react-table';
Expand Down Expand Up @@ -121,7 +121,7 @@ export const MatchedTargetsTable: React.FunctionComponent<MatchedTargetsTablePro
}, [addSubscription, context, context.notificationChannel, setTargets, matchExpression]);

const targetRows = React.useMemo(() => {
return sortResouces(sortBy, targets, mapper, getTransform).map((target, idx) => {
return sortResources(sortBy, targets, mapper, getTransform).map((target, idx) => {
return (
<Tr key={`target-${idx}`}>
<Td key={`target-table-row-${idx}_0`}>
Expand Down
4 changes: 2 additions & 2 deletions src/app/SecurityPanel/Credentials/StoreCredentials.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import { ServiceContext } from '@app/Shared/Services/Services';
import { TargetDiscoveryEvent } from '@app/Shared/Services/Targets.service';
import { useSort } from '@app/utils/useSort';
import { useSubscriptions } from '@app/utils/useSubscriptions';
import { evaluateTargetWithExpr, sortResouces } from '@app/utils/utils';
import { evaluateTargetWithExpr, sortResources } from '@app/utils/utils';
import {
Badge,
Button,
Expand Down Expand Up @@ -378,7 +378,7 @@ export const StoreCredentials = () => {
};

const matchExpressionRows = React.useMemo(() => {
return sortResouces(sortBy, state.credentials, mapper, getTransform).map((credential, idx) => {
return sortResources(sortBy, state.credentials, mapper, getTransform).map((credential, idx) => {
const isExpanded: boolean = state.expandedCredentials.includes(credential);
const isChecked: boolean = state.checkedCredentials.includes(credential);

Expand Down
4 changes: 2 additions & 2 deletions src/app/Topology/Shared/Entity/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ export const getTargetOwnedResources = (
true,
true
);
/* eslint-disable @typescript-eslint/no-explicit-any */
case 'archivedRecordings':
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
return apiService
.graphql<any>(
`
Expand All @@ -161,7 +161,6 @@ export const getTargetOwnedResources = (
)
.pipe(map((v) => v.data.archivedRecordings.data as ArchivedRecording[]));
case 'archivedUploadRecordings':
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
return apiService
.graphql<any>(
`query UploadedRecordings($filter: ArchivedRecordingFilterInput){
Expand All @@ -182,6 +181,7 @@ export const getTargetOwnedResources = (
true
)
.pipe(map((v) => v.data.archivedRecordings.data as ArchivedRecording[]));
/* eslint-enable @typescript-eslint/no-explicit-any */
case 'eventTemplates':
return apiService.doGet<EventTemplate[]>(
`targets/${encodeURIComponent(target.connectUrl)}/templates`,
Expand Down
1 change: 1 addition & 0 deletions src/app/Topology/typings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export enum NodeType {
}

export interface NodeLabels {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
readonly [key: string]: any;
}

Expand Down
4 changes: 3 additions & 1 deletion src/app/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,12 @@ export class StreamOf<T> {
}
}

/* eslint-disable @typescript-eslint/no-explicit-any */
export const getValue = (object: any, keyPath: string[]) => {
return keyPath.reduce((acc, key) => acc[key], object);
};

export const sortResouces = <R>(
export const sortResources = <R>(
{ index, direction }: ISortBy,
resources: R[],
mapper: (index?: number) => string[] | undefined,
Expand All @@ -220,3 +221,4 @@ export const sortResouces = <R>(
});
return [...(direction === SortByDirection.asc ? sorted : sorted.reverse())];
};
/* eslint-enable @typescript-eslint/no-explicit-any */

0 comments on commit 407aa17

Please sign in to comment.