Skip to content

Fix/add note analysis framework #2814

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 10, 2024
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
5 changes: 5 additions & 0 deletions app/views/ProjectEdit/Framework/FrameworkDetail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,11 @@ function FrameworkDetail(props: Props) {
contentClassName={styles.content}
>
<div className={styles.metadataContainer}>
{frameworkDetailsResponse?.projects?.totalCount === 0 && (
<div className={styles.warning}>
This framework has not been used in any project in DEEP.
</div>
)}
{frameworkDetails?.description}
<TextOutput
className={styles.block}
Expand Down
9 changes: 8 additions & 1 deletion app/views/ProjectEdit/Framework/FrameworkDetail/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
.heading-container {
padding-bottom: var(--dui-spacing-small);
}

.header-actions {
display: flex;
align-items: center;
Expand Down Expand Up @@ -54,6 +53,14 @@
gap: var(--dui-spacing-medium);
overflow-y: auto;

.warning {
display: flex;
align-items: center;
color: var(--dui-color-text-description);
font-size: var(--dui-font-size-small);
gap: var(--dui-spacing-small);
}

.value{
&:hover {
text-decoration: underline;
Expand Down
41 changes: 35 additions & 6 deletions app/views/ProjectEdit/Framework/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
SelectInput,
TextInput,
TextOutput,
Tooltip,
} from '@the-deep/deep-ui';
import {
ObjectSchema,
Expand Down Expand Up @@ -71,6 +72,10 @@ export const PROJECT_FRAMEWORKS = gql`
title
id
createdAt
usedInProjectCount {
projectCount
testProjectCount
}
}
page
totalCount
Expand All @@ -84,6 +89,8 @@ interface ItemProps {
createdAt: string;
onClick: (key: string) => void;
isSelected: boolean;
projectCount: number;
testProjectCount: number;
}

function Item(props: ItemProps) {
Expand All @@ -93,8 +100,12 @@ function Item(props: ItemProps) {
createdAt,
onClick,
isSelected,
projectCount,
testProjectCount,
} = props;

const totalProjectCount = projectCount + testProjectCount;

return (
<RawButton
name={itemKey}
Expand All @@ -107,12 +118,28 @@ function Item(props: ItemProps) {
<div className={styles.title}>
{title}
</div>
<TextOutput
className={styles.createdOn}
label={_ts('projectEdit', 'createdOnLabel')}
value={createdAt}
valueType="date"
/>
<div className={styles.inline}>
<TextOutput
className={styles.createdOn}
label={_ts('projectEdit', 'createdOnLabel')}
value={createdAt}
valueType="date"
/>
<TextOutput
className={styles.warning}
label="Used in"
value={`${totalProjectCount} projects`}
/>
<Tooltip>
{totalProjectCount !== 0
? `This framework is used in
${projectCount === 0 ? 'no' : projectCount}
${projectCount === 1 ? 'project' : 'projects'} and
${testProjectCount === 0 ? 'no' : testProjectCount} test
${testProjectCount === 1 ? 'project' : 'projects'}`
: 'This framework is not used in any projects.'}
</Tooltip>
</div>
</RawButton>
);
}
Expand Down Expand Up @@ -271,6 +298,8 @@ function ProjectFramework(props: Props) {
createdAt: data.createdAt,
onClick: setSelectedFramework,
isSelected: String(key) === selectedFramework,
projectCount: data.usedInProjectCount?.projectCount ?? 0,
testProjectCount: data.usedInProjectCount?.testProjectCount ?? 0,
}), [selectedFramework]);

const handleNewFrameworkAddSuccess = useCallback((newFrameworkId: string) => {
Expand Down
11 changes: 11 additions & 0 deletions app/views/ProjectEdit/Framework/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@
font-weight: var(--dui-font-weight-bold);
}

.inline {
display: flex;
justify-content: space-between;
width: 100%;

.warning {
color: var(--dui-color-text-description);
font-size: var(--dui-font-size-small);
}
}

.created-on {
color: var(--dui-color-text-description);
font-size: var(--dui-font-size-small);
Expand Down