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

Feature/cdctoolbox 462 #107

Open
wants to merge 69 commits into
base: dev
Choose a base branch
from
Open

Feature/cdctoolbox 462 #107

wants to merge 69 commits into from

Conversation

Helsinky
Copy link
Contributor

@Helsinky Helsinky commented Jan 8, 2025

No description provided.

statusReason: 'OK',
time: '2025-01-09T15:17:08.545Z',
id: 'a25eed98877d42faaee2a8c0c4ab7d78',
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't you have already a success response defined for previous tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved, I've reused a success message that was using on another test.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This object is not used in the code/tests

reducers: {
getServerConfiguration(state, action) {
const option = getConfigurationByKey(state.serverConfigurations, action.payload.selectedOption)
console.log('option', option)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This console.log was forgotten?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

* License: Apache-2.0
*/

export const isInputFilled = (configurations) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even not having branches the previous code won't work?

@@ -0,0 +1,33 @@
export const scheduleResponse = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't you have a successfull gygia response in previous code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved, I've reused a previous success gigya response.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This object is not being used, can be removed

*/

import { initialState, initialStateWithServerConfigurations } from './dataTest'
import { clearConfigurations, getServerConfiguration, setAccountType } from './serverImportSlice'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove setAccountType because it is not used

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the setAccountType

}

const hasMandatoryFieldInSugestion = (structure, parentId, parentNode, value) => {
if ((parentId.length = 3)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition is correct? The comparison operator is ==.

parentNode = parentId.slice(0, -1).join('.')
} else if (parentId.length < 3) {
parentNode = parentId.slice(0, -1).join('.')
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The if and else do the same, can be changed to
if ((parentId.length <= 3)) {
parentNode = parentId.slice(0, -1).join('.')
}

What does it means parentId.length = 3 or <3?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the parentId.length will be the length of the parentNode id, for example if it's subscriptions.newsletter.commercial.lastUpdatedSubscriptionState, the parentId.length will be 3.

} else if (parentId.length < 3) {
parentNode = parentId.slice(0, -1).join('.')
}
if (parentNode.endsWith('optIn')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this special case of ending with optIn?

statusReason: 'OK',
time: '2025-01-09T15:17:08.545Z',
id: 'a25eed98877d42faaee2a8c0c4ab7d78',
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This object is not used in the code/tests

export const hasMandatoryFieldInSugestion = (structure, parentId, parentNode, value) => {
if (parentId.length <= 3) {
parentNode = parentId.slice(0, -1).join('.')
} else if (parentId.length > 3) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
} else if (parentId.length > 3) {
} else {

@@ -0,0 +1,33 @@
export const scheduleResponse = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This object is not being used, can be removed

async #replaceAndSetDataflow(dataflow, dataflowBody, dataflowConfig) {
dataflowBody.id = dataflow.id
const replacedBody = this.replaceVariables(dataflowBody, dataflowConfig)
await this.#dataFlow.set(this.#site, this.#dataCenter, replacedBody)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to check the response to see if it was successful

const dataflowBody = accountOption === ServerImport.#ACCOUNT_TYPE_LITE ? importLiteAccountAzure : importFullAccountAzure
const createDataflow = await this.#dataFlow.create(this.#site, this.#dataCenter, dataflowBody)
if (createDataflow.errorCode === 0) {
await this.#searchDataflowOnApiKey(this.#site, createDataflow.id, dataflowBody, dataflowConfig)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to return the response after setting everything on dataflow. The user needs to know if there was en error or not.


static #ACCOUNT_TYPE_LITE = 'Lite'

constructor(credentials, site, dataCenter) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to not see any code regarding Azure on this class.
Create an interface (abstract class) StorageProvider, with some methods like getFullAccountTemplate and getLiteAccountTemplate and receive it as an argument in the constructor. Then implement this interface in a class AzureStorageProvider where is the specific code for azure.
This ServerImport class should not be necessary to change when we implement other StorageProviders.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants