-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add web spotlight entity #61
Conversation
3c405a0
to
69cf9d7
Compare
src/modules/importExport/importExportEntities/entities/webSpotlight.ts
Outdated
Show resolved
Hide resolved
@@ -43,14 +43,17 @@ export const sync = async (client: ManagementClient, diff: DiffModel, logOptions | |||
logInfo(logOptions, "standard", "Updating content types and adding their references"); | |||
await updateContentTypesAndAddReferences(client, diff.contentTypes); | |||
|
|||
logInfo(logOptions, "standard", "Updating web spotlight"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add here comment, that the web_spotlight will use already existing type and never use the option to create one, that was added earlier :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure what you mean
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean explaining the order of these operations. As we first create all the types, when enabling Web Spotlight we don't have to worry that the type we are referencing won't exist. Due to this we always use the option when we provide the root_type
parameter. We never use null
when enabling Web Spotlight. Ideally, we would also update the diagram in the images :D
bc7027a
to
e71dcbf
Compare
@@ -21,6 +22,18 @@ export const spacesEntity: EntityDefinition<ReadonlyArray<SpaceContracts.ISpaceC | |||
.withData({ | |||
name: importSpace.name, | |||
codename: importSpace.codename, | |||
collections: importSpace.collections?.map(c => ({ | |||
id: getRequired(context.collectionIdsByOldIds, c.id ?? "missing-collection-id", "collection"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a comment on line 16 that should be removed
src/modules/sync/printDiff.ts
Outdated
|
||
if (diffModel.webSpotlight.change !== "none") { | ||
logInfo(logOptions, "standard", chalk.blue.bold("\nWEB SPOTLIGHT:")); | ||
switch (diffModel.webSpotlight.change) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const messsage = match(diffModel.webSpotlight)
.with({change: 'activate'} , ({rootTypeCodename}) => `Web Spotlight is to be activated with root type: ${chalk.green(rootTypeCodename)}`)
.with({change: "changeRootType"}, ({rootTypeCodename}) => `Web Spotlight root type is changed to: ${chalk.green(rootTypeCodename)}`)
.with({change: "deactivate"}, () => "Web Spotlight is to be deactivated")
.exhaustive();
logInfo(logOptions, "standard", messsage);
src/modules/sync/sync.ts
Outdated
@@ -300,6 +303,21 @@ const transformTaxonomyOperations = ( | |||
} as unknown as TaxonomyModels.IModifyTaxonomyData; | |||
}; | |||
|
|||
const updateWebSpotlight = (client: ManagementClient, diffModel: WebSpotlightDiffModel): Promise<unknown> => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const updateWebSpotlight = (client: ManagementClient, diffModel: WebSpotlightDiffModel): Promise<unknown> =>
match(diffModel)
.with({ change: "none" }, () => Promise.resolve())
.with({ change: "deactivate" }, () => client.deactivateWebSpotlight().toPromise())
.with(
{ change: P.union("activate", "changeRootType") },
({ rootTypeCodename }) =>
client.activateWebSpotlight().withData({ root_type: { codename: rootTypeCodename } }).toPromise(),
)
.exhaustive();
b2ff989
to
1d6618c
Compare
1d6618c
to
af67c7e
Compare
Motivation
Which issue does this fix? Fixes #
issue number
If no issue exists, what is the fix or new feature? Were there any reasons to fix/implement things that are not obvious?
Checklist
How to test
If manual testing is required, what are the steps?