From b700931a8baadb200ff5d48127bd9c62e6aa2cb3 Mon Sep 17 00:00:00 2001 From: Ramon Wenger Date: Tue, 17 Oct 2023 13:27:11 +0200 Subject: [PATCH 1/2] Fix bug on snapshot overview page --- client/src/__generated__/gql.ts | 13 +++++++++---- client/src/__generated__/graphql.ts | 11 +++++++---- .../src/components/modules/SnapshotListItem.vue | 17 ++++++++++++++--- client/src/pages/snapshot/snapshots.vue | 2 +- 4 files changed, 31 insertions(+), 12 deletions(-) diff --git a/client/src/__generated__/gql.ts b/client/src/__generated__/gql.ts index 31da88e6..fbf5b8e1 100644 --- a/client/src/__generated__/gql.ts +++ b/client/src/__generated__/gql.ts @@ -21,12 +21,13 @@ const documents = { "\n mutation UpdateLastModuleLevelMutation($input: UpdateLastModuleLevelInput!) {\n updateLastModuleLevel(input: $input) {\n clientMutationId\n user {\n username\n id\n lastModuleLevel {\n ...ModuleLevelFragment\n }\n }\n }\n }\n ": types.UpdateLastModuleLevelMutationDocument, "\n query ModuleTitleQuery($slug: String) {\n module(slug: $slug) {\n title\n }\n }\n ": types.ModuleTitleQueryDocument, "\n fragment SnapshotListItem on SnapshotNode {\n shared\n }\n": types.SnapshotListItemFragmentDoc, - "\n fragment SnapshotTitle on SnapshotNode {\n title\n }\n": types.SnapshotTitleFragmentDoc, + "\n fragment SnapshotTitleFragment on SnapshotNode {\n title\n }\n": types.SnapshotTitleFragmentFragmentDoc, + "\n fragment SnapshotDetailsFragment on SnapshotNode {\n id\n title\n shared\n created\n creator\n mine\n }\n": types.SnapshotDetailsFragmentFragmentDoc, "\n query ModuleEditModeQuery($slug: String) {\n module(slug: $slug) {\n inEditMode @client\n slug\n }\n }\n": types.ModuleEditModeQueryDocument, "\n query ChapterQuery($id: ID!) {\n chapter(id: $id) {\n path\n }\n }\n ": types.ChapterQueryDocument, "\n query ContentBlockQuery($id: ID!) {\n contentBlock(id: $id) {\n path\n }\n }\n ": types.ContentBlockQueryDocument, "\n query MeLanguage {\n me {\n language @client\n }\n }\n ": types.MeLanguageDocument, - "\n query ModuleSnapshotsQuery($slug: String!) {\n module(slug: $slug) {\n id\n title\n metaTitle\n slug\n topic {\n title\n }\n snapshots {\n ...SnapshotListItem\n }\n }\n }\n ": types.ModuleSnapshotsQueryDocument, + "\n query ModuleSnapshotsQuery($slug: String!) {\n module(slug: $slug) {\n id\n title\n metaTitle\n slug\n topic {\n title\n }\n snapshots {\n ...SnapshotDetailsFragment\n }\n }\n }\n ": types.ModuleSnapshotsQueryDocument, "\n query ModuleSolutions($slug: String) {\n module(slug: $slug) {\n solutionsEnabled\n slug\n }\n }\n": types.ModuleSolutionsDocument, }; @@ -79,7 +80,11 @@ export function graphql(source: "\n fragment SnapshotListItem on SnapshotNode { /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function graphql(source: "\n fragment SnapshotTitle on SnapshotNode {\n title\n }\n"): (typeof documents)["\n fragment SnapshotTitle on SnapshotNode {\n title\n }\n"]; +export function graphql(source: "\n fragment SnapshotTitleFragment on SnapshotNode {\n title\n }\n"): (typeof documents)["\n fragment SnapshotTitleFragment on SnapshotNode {\n title\n }\n"]; +/** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function graphql(source: "\n fragment SnapshotDetailsFragment on SnapshotNode {\n id\n title\n shared\n created\n creator\n mine\n }\n"): (typeof documents)["\n fragment SnapshotDetailsFragment on SnapshotNode {\n id\n title\n shared\n created\n creator\n mine\n }\n"]; /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ @@ -99,7 +104,7 @@ export function graphql(source: "\n query MeLanguage {\n me {\n /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function graphql(source: "\n query ModuleSnapshotsQuery($slug: String!) {\n module(slug: $slug) {\n id\n title\n metaTitle\n slug\n topic {\n title\n }\n snapshots {\n ...SnapshotListItem\n }\n }\n }\n "): (typeof documents)["\n query ModuleSnapshotsQuery($slug: String!) {\n module(slug: $slug) {\n id\n title\n metaTitle\n slug\n topic {\n title\n }\n snapshots {\n ...SnapshotListItem\n }\n }\n }\n "]; +export function graphql(source: "\n query ModuleSnapshotsQuery($slug: String!) {\n module(slug: $slug) {\n id\n title\n metaTitle\n slug\n topic {\n title\n }\n snapshots {\n ...SnapshotDetailsFragment\n }\n }\n }\n "): (typeof documents)["\n query ModuleSnapshotsQuery($slug: String!) {\n module(slug: $slug) {\n id\n title\n metaTitle\n slug\n topic {\n title\n }\n snapshots {\n ...SnapshotDetailsFragment\n }\n }\n }\n "]; /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ diff --git a/client/src/__generated__/graphql.ts b/client/src/__generated__/graphql.ts index 511db48c..581eba13 100644 --- a/client/src/__generated__/graphql.ts +++ b/client/src/__generated__/graphql.ts @@ -2414,7 +2414,9 @@ export type ModuleTitleQueryQuery = { __typename?: 'Query', module?: { __typenam export type SnapshotListItemFragment = { __typename?: 'SnapshotNode', shared: boolean } & { ' $fragmentName'?: 'SnapshotListItemFragment' }; -export type SnapshotTitleFragment = { __typename?: 'SnapshotNode', title?: string | null } & { ' $fragmentName'?: 'SnapshotTitleFragment' }; +export type SnapshotTitleFragmentFragment = { __typename?: 'SnapshotNode', title?: string | null } & { ' $fragmentName'?: 'SnapshotTitleFragmentFragment' }; + +export type SnapshotDetailsFragmentFragment = { __typename?: 'SnapshotNode', id: string, title?: string | null, shared: boolean, created: any, creator: string, mine?: boolean | null } & { ' $fragmentName'?: 'SnapshotDetailsFragmentFragment' }; export type ModuleEditModeQueryQueryVariables = Exact<{ slug?: InputMaybe; @@ -2449,7 +2451,7 @@ export type ModuleSnapshotsQueryQueryVariables = Exact<{ export type ModuleSnapshotsQueryQuery = { __typename?: 'Query', module?: { __typename?: 'ModuleNode', id: string, title: string, metaTitle: string, slug: string, topic?: { __typename?: 'TopicNode', title: string } | null, snapshots?: Array<( { __typename?: 'SnapshotNode' } - & { ' $fragmentRefs'?: { 'SnapshotListItemFragment': SnapshotListItemFragment } } + & { ' $fragmentRefs'?: { 'SnapshotDetailsFragmentFragment': SnapshotDetailsFragmentFragment } } ) | null> | null } | null }; export type ModuleSolutionsQueryVariables = Exact<{ @@ -2461,7 +2463,8 @@ export type ModuleSolutionsQuery = { __typename?: 'Query', module?: { __typename export const ModuleLevelFragmentFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ModuleLevelFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ModuleLevelNode"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"filterAttributeType"}}]}}]} as unknown as DocumentNode; export const SnapshotListItemFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SnapshotListItem"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"SnapshotNode"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"shared"}}]}}]} as unknown as DocumentNode; -export const SnapshotTitleFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SnapshotTitle"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"SnapshotNode"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"title"}}]}}]} as unknown as DocumentNode; +export const SnapshotTitleFragmentFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SnapshotTitleFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"SnapshotNode"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"title"}}]}}]} as unknown as DocumentNode; +export const SnapshotDetailsFragmentFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SnapshotDetailsFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"SnapshotNode"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"shared"}},{"kind":"Field","name":{"kind":"Name","value":"created"}},{"kind":"Field","name":{"kind":"Name","value":"creator"}},{"kind":"Field","name":{"kind":"Name","value":"mine"}}]}}]} as unknown as DocumentNode; export const LanguageQueryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"LanguageQuery"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"me"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"language"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"client"}}]}]}}]}}]} as unknown as DocumentNode; export const SetLanguageDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SetLanguage"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"language"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"setLanguage"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"language"},"value":{"kind":"Variable","name":{"kind":"Name","value":"language"}}}],"directives":[{"kind":"Directive","name":{"kind":"Name","value":"client"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"language"}}]}}]}}]} as unknown as DocumentNode; export const ReadOnlyQueryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"ReadOnlyQuery"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"me"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"readOnly"}},{"kind":"Field","name":{"kind":"Name","value":"selectedClass"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"readOnly"}}]}}]}}]}}]} as unknown as DocumentNode; @@ -2472,5 +2475,5 @@ export const ModuleEditModeQueryDocument = {"kind":"Document","definitions":[{"k export const ChapterQueryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"ChapterQuery"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"chapter"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"path"}}]}}]}}]} as unknown as DocumentNode; export const ContentBlockQueryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"ContentBlockQuery"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"contentBlock"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"path"}}]}}]}}]} as unknown as DocumentNode; export const MeLanguageDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"MeLanguage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"me"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"language"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"client"}}]}]}}]}}]} as unknown as DocumentNode; -export const ModuleSnapshotsQueryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"ModuleSnapshotsQuery"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"slug"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"module"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"slug"},"value":{"kind":"Variable","name":{"kind":"Name","value":"slug"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"metaTitle"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"topic"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"title"}}]}},{"kind":"Field","name":{"kind":"Name","value":"snapshots"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SnapshotListItem"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SnapshotListItem"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"SnapshotNode"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"shared"}}]}}]} as unknown as DocumentNode; +export const ModuleSnapshotsQueryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"ModuleSnapshotsQuery"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"slug"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"module"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"slug"},"value":{"kind":"Variable","name":{"kind":"Name","value":"slug"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"metaTitle"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"topic"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"title"}}]}},{"kind":"Field","name":{"kind":"Name","value":"snapshots"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SnapshotDetailsFragment"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SnapshotDetailsFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"SnapshotNode"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"shared"}},{"kind":"Field","name":{"kind":"Name","value":"created"}},{"kind":"Field","name":{"kind":"Name","value":"creator"}},{"kind":"Field","name":{"kind":"Name","value":"mine"}}]}}]} as unknown as DocumentNode; export const ModuleSolutionsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"ModuleSolutions"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"slug"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"module"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"slug"},"value":{"kind":"Variable","name":{"kind":"Name","value":"slug"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"solutionsEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}}]}}]}}]} as unknown as DocumentNode; \ No newline at end of file diff --git a/client/src/components/modules/SnapshotListItem.vue b/client/src/components/modules/SnapshotListItem.vue index 55e25db2..4d29e755 100644 --- a/client/src/components/modules/SnapshotListItem.vue +++ b/client/src/components/modules/SnapshotListItem.vue @@ -63,12 +63,23 @@ export const SnapshotListItemFragment = graphql(` } `); -export const SnapshotTitleListItem = graphql(` - fragment SnapshotTitle on SnapshotNode { +export const SnapshotTitleFragment = graphql(` + fragment SnapshotTitleFragment on SnapshotNode { title } `); +export const SnapshotDetailsFragment = graphql(` + fragment SnapshotDetailsFragment on SnapshotNode { + id + title + shared + created + creator + mine + } +`); + export default { props: { snapshot: { @@ -125,7 +136,7 @@ export default { const { id, title } = snapshot; store.writeFragment({ id, - fragment: SnapshotTitleListItem, + fragment: SnapshotTitleFragment, data: { title, __typename: 'SnapshotNode', diff --git a/client/src/pages/snapshot/snapshots.vue b/client/src/pages/snapshot/snapshots.vue index 75366e83..32da1d29 100644 --- a/client/src/pages/snapshot/snapshots.vue +++ b/client/src/pages/snapshot/snapshots.vue @@ -49,7 +49,7 @@ const { result } = useQuery( title } snapshots { - ...SnapshotListItem + ...SnapshotDetailsFragment } } } From 3cb566c5993c1a540559e8982be34ca0f08b874c Mon Sep 17 00:00:00 2001 From: Ramon Wenger Date: Tue, 17 Oct 2023 13:32:40 +0200 Subject: [PATCH 2/2] Fix bug on snapshot detail page --- client/src/components/objective-groups/ObjectiveGroup.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/components/objective-groups/ObjectiveGroup.vue b/client/src/components/objective-groups/ObjectiveGroup.vue index 05c81019..8d1b4e19 100644 --- a/client/src/components/objective-groups/ObjectiveGroup.vue +++ b/client/src/components/objective-groups/ObjectiveGroup.vue @@ -16,7 +16,7 @@ @@ -63,7 +63,7 @@ export default { computed: { editMode() { - return this.group.module.inEditMode; + return this.group.module?.inEditMode || false; }, hidden() { return hidden({