Skip to content
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

WIP: Knowledge base BoK instead of Subspace in Written Knowledge creation #7381

Draft
wants to merge 20 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
19f2c3e
added new tabs to user + org admin pages; refactored how admin pages …
techsmyth Dec 21, 2024
108a4e0
updated generation to match api tidy ups related to set of preference…
techsmyth Dec 22, 2024
0569961
fix compile errors related to dropping of separate UserPreferenceType…
techsmyth Dec 22, 2024
f1b711c
Merge branch 'develop' into server-4742
bobbykolev Dec 23, 2024
c9dfdc7
Synchronize icons, remove comments, make sure there are no redundant …
bobbykolev Dec 23, 2024
e06e393
Merge branch 'server-4742' of https://github.com/alkem-io/client-web …
bobbykolev Dec 23, 2024
84a223f
Links & Docs to BoK on VC creation (#7365)
bobbykolev Dec 30, 2024
2e5abde
Links and Docs - forgotten commit with Validation (#7377)
bobbykolev Dec 30, 2024
af3d9d7
CalloutsSet entity (#7376)
techsmyth Dec 30, 2024
36c8015
Merge remote-tracking branch 'origin/develop' into develop
bobbykolev Dec 31, 2024
e5559d1
Merge remote-tracking branch 'origin/develop' into develop
bobbykolev Dec 31, 2024
940ac64
VC knowledge base instead of subspace init
bobbykolev Dec 31, 2024
d425af5
Space creation after VC creation, loading, code opt & reorganization
bobbykolev Jan 2, 2025
c5038eb
Fix docs uploading, code organization and documentation;
bobbykolev Jan 2, 2025
1ba4313
fix uploading of docs in case there's no space under the acc; remove …
bobbykolev Jan 2, 2025
8e552d7
Merge branch 'develop' into client-7379-vc-bok-v2
bobbykolev Jan 2, 2025
4f6a17d
useLoadingState instead of a new React State
ccanos Jan 2, 2025
e3df846
Fix - set properly the persona type depending on the 3 steps;
bobbykolev Jan 3, 2025
0c6875b
Ability to select SpaceLevel2 on create VC (#7386)
ccanos Jan 3, 2025
d07052c
Merge branch 'develop' into client-7379-vc-bok-v2
bobbykolev Jan 3, 2025
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
16 changes: 16 additions & 0 deletions src/core/apollo/generated/apollo-hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17762,6 +17762,22 @@ export const CreateVirtualContributorOnAccountDocument = gql`
id
url
}
knowledgeBase {
id
calloutsSet {
id
callouts {
id
framing {
id
profile {
id
displayName
}
}
}
}
}
}
}
`;
Expand Down
19 changes: 19 additions & 0 deletions src/core/apollo/generated/graphql-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23307,6 +23307,25 @@ export type CreateVirtualContributorOnAccountMutation = {
id: string;
nameID: string;
profile: { __typename?: 'Profile'; id: string; url: string };
knowledgeBase?:
| {
__typename?: 'KnowledgeBase';
id: string;
calloutsSet: {
__typename?: 'CalloutsSet';
id: string;
callouts: Array<{
__typename?: 'Callout';
id: string;
framing: {
__typename?: 'CalloutFraming';
id: string;
profile: { __typename?: 'Profile'; id: string; displayName: string };
};
}>;
};
}
| undefined;
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,22 @@ mutation CreateVirtualContributorOnAccount($virtualContributorData: CreateVirtua
id
url
}
knowledgeBase {
id
calloutsSet {
id
callouts {
id
framing {
id
profile {
id
displayName
}
}
}
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const AddContent = ({ onClose, onCreateVC, spaceId }: AddContentProps) => {
};

return (
<StorageConfigContextProvider locationType="journey" spaceId={spaceId}>
<StorageConfigContextProvider locationType={spaceId ? 'journey' : 'platform'} spaceId={spaceId}>
<DialogHeader onClose={onCancel}>{t('createVirtualContributorWizard.addContent.title')}</DialogHeader>
<DialogContent>
<Gutters disablePadding paddingBottom={gutters(2)}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { PostItem } from './PostItem';
import { Caption } from '@/core/ui/typography';
import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
import { DocumentItem } from '@/main/topLevelPages/myDashboard/newVirtualContributorWizard/AddContent/DocumentItem';
import useLoadingState from '@/domain/shared/utils/useLoadingState';

const MAX_POSTS = 25;

Expand All @@ -33,10 +34,12 @@ export const AddContentForm = ({
onCancel,
}: {
onCancel: () => void;
onSubmit: (values: BoKCalloutsFormValues) => void;
onSubmit: (values: BoKCalloutsFormValues) => Promise<void>;
}) => {
const { t } = useTranslation();

const [handleSubmit, isSubmitting] = useLoadingState(onSubmit);

const validationSchema = yup.object().shape({
posts: yup
.array()
Expand Down Expand Up @@ -82,8 +85,8 @@ export const AddContentForm = ({
};

return (
<Formik initialValues={initialValues} validationSchema={validationSchema} onSubmit={onSubmit} validateOnMount>
{({ values: { posts, documents }, isValid, setFieldValue }) => {
<Formik initialValues={initialValues} validationSchema={validationSchema} onSubmit={handleSubmit} validateOnMount>
{({ values: { posts, documents }, isValid, setFieldValue, submitForm }) => {
const moreThanOnePost = posts.length > 1;
const maxPostsReached = posts.length >= MAX_POSTS;

Expand Down Expand Up @@ -192,8 +195,9 @@ export const AddContentForm = ({
<span>
<LoadingButton
variant="contained"
loading={isSubmitting}
disabled={!isValid}
onClick={() => onSubmit({ posts, documents })}
onClick={() => submitForm()}
>
{t('buttons.continue')}
</LoadingButton>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { CalloutState, CalloutType, CalloutVisibility } from '@/core/apollo/generated/graphql-schema';

export type PostValues = {
title: string;
description: string;
Expand All @@ -18,3 +20,35 @@ export type AddContentProps = {
onCreateVC: (values: BoKCalloutsFormValues) => Promise<void>;
spaceId: string;
};

export const getPostCalloutRequestData = (title: string, description: string) => ({
framing: {
profile: {
description: description,
displayName: title,
referencesData: [],
},
},
type: CalloutType.Post,
contributionPolicy: {
state: CalloutState.Closed,
},
visibility: CalloutVisibility.Published,
sendNotification: false,
});

export const getDocumentCalloutRequestData = (name: string) => ({
framing: {
profile: {
displayName: name,
description: '',
referencesData: [],
},
},
type: CalloutType.LinkCollection,
contributionPolicy: {
state: CalloutState.Open,
},
visibility: CalloutVisibility.Published,
sendNotification: false,
});
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ import { MessageWithPayload } from '@/domain/shared/i18n/ValidationMessageTransl
import { AiPersonaBodyOfKnowledgeType, AiPersonaEngine } from '@/core/apollo/generated/graphql-schema';

type CreateNewVirtualContributorProps = {
canCreateSubspace?: boolean;
canUseExisting?: boolean;
onClose: () => void;
onCreateSpace: (values: VirtualContributorFromProps) => void;
onCreateKnowledge: (values: VirtualContributorFromProps) => void;
onUseExistingKnowledge: (values: VirtualContributorFromProps) => void;
onUseExternal: (values: VirtualContributorFromProps) => void;
loading?: boolean;
Expand Down Expand Up @@ -82,7 +80,7 @@ const BigButton = ({

const CreateNewVirtualContributor = ({
onClose,
onCreateSpace,
onCreateKnowledge,
onUseExistingKnowledge,
onUseExternal,
loading,
Expand Down Expand Up @@ -117,7 +115,7 @@ const CreateNewVirtualContributor = ({
const newValues = { ...values, name };
switch (source) {
case VCSourceOptions.WRITTEN_KNOWLEDGE:
onCreateSpace(newValues);
onCreateKnowledge(newValues);
break;
case VCSourceOptions.EXISTING_SPACE:
onUseExistingKnowledge(newValues);
Expand Down
Loading