-
Notifications
You must be signed in to change notification settings - Fork 7
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
Global field #26
Global field #26
Conversation
config/index.js
Outdated
@@ -9,5 +9,5 @@ module.exports = { | |||
password: '', | |||
target_stack: '', | |||
// Folder in which exported contents are stored | |||
data: './contents' | |||
data: './New-data' |
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.
Can you verify this?
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.
Missing dependencies
- chalk: ./lib/util/login.js
Resolve linting issues.
lib/import/content_types.js
Outdated
var self = this; | ||
return new Promise(function(resolve, reject) { | ||
return Promise.map(_globalField_pending, function (globalfield) { | ||
var lenglobalfield = (self.globalfields).length; |
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.
lenglobalfield >> lenGlobaField
lib/import/content_types.js
Outdated
// console.log("dattatatat", _globalField_pending); | ||
if(error.error_code === 115) { | ||
// eslint-disable-next-line no-console | ||
log.error('globalfield fail to import '+ JSON.stringify(error.errors)); |
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.
Re-check what error message we can add here
lib/import/content_types.js
Outdated
@@ -18,8 +18,12 @@ var supress = require('../util/extensionsUidReplace'); | |||
var config = util.getConfig(); | |||
|
|||
var contentTypeConfig = config.modules.content_types; | |||
var globalfieldsConfig = config.modules.globalfields; |
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.
Follow naming conventions for global fields as we follow for content types
e.g.
globalFieldsConfig >> globalFiledConfig (Revmoed 's' and used capital for F) Follow this pattern for all the variables for global filed
updateGlobalFiled
lib/import/content_types.js
Outdated
} | ||
}; | ||
return request(requestGlobalfieldOptions).then(function (response) { | ||
// console.log("globalfieldsuid", response.body.global_field.uid); |
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.
remove unwanted console logs
lib/import/content_types.js
Outdated
} | ||
} | ||
}, { | ||
concurrency: 3 |
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.
Make this concurrency configurable from config
lib/import/entries.js
Outdated
@@ -190,6 +190,9 @@ importEntries.prototype = { | |||
return resolve(); | |||
} | |||
for (var eUid in entries) { | |||
// console.log("self contentstypess>>>", self.ctSchemas[ctUid]) |
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.
Remove comments if not required
lib/import/global_fields.js
Outdated
if(error.error_code === 115) { | ||
// eslint-disable-next-line no-console | ||
log.error('Globalfield fail to import '+ JSON.stringify(error.errors)); | ||
log.error('globalfield fail to import '+ JSON.stringify(error.errors)); |
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.
Suggestion for log 'Global Field: Failed to import due to: ' + JSON.stringify(error.errors)
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.
Have done because all other messages are in small cases the error log.
lib/util/lookupReplaceAssets.js
Outdated
@@ -26,6 +26,7 @@ module.exports = function (data, mappedAssetUids, mappedAssetUrls, assetUidMappe | |||
var matchedUrls = []; | |||
|
|||
var find = function (schema, entry) { | |||
// console.log("findingggg", schema); |
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.
remove unused comments
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.
done
lib/import/content_types.js
Outdated
log.error('globalfield fail to import '+ JSON.stringify(error.errors)); | ||
} | ||
// eslint-disable-next-line no-console | ||
log.error('Globalfield fail to import '+ JSON.stringify(error.errors)); |
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.
failed
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.
done
lib/import/content_types.js
Outdated
return; | ||
}); | ||
} | ||
} | ||
}, { | ||
concurrency: 3 | ||
concurrency: concurrencyNo |
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.
Only concurrency works
lib/import/content_types.js
Outdated
@@ -17,9 +17,10 @@ var log = require('../util/log'); | |||
var supress = require('../util/extensionsUidReplace'); | |||
var config = util.getConfig(); | |||
|
|||
var concurrencyNo = config.concurrency; |
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.
change var name to concurrency
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.
change to reqConcurrency
lib/import/environments.js
Outdated
if(error.errors.name[0]) { | ||
log.success('Environment: \'' + env.name + '\' already exists'); | ||
} else { | ||
log.error('Environment: \'' + env.name + '\' failed to be imported\n ' + JSON.stringify(error.errors)); |
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.
imported >> import
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.
done
lib/import/global_fields.js
Outdated
if(error.errors.title[0]) { | ||
log.error('Globalfield already exists '); | ||
} else { | ||
log.error('Globalfield fail to import '+ JSON.stringify(error.errors)); |
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.
fail >> failed
lib/import/global_fields.js
Outdated
// eslint-disable-next-line no-console | ||
log.error('globalfield fail to import '+ JSON.stringify(error.errors)); | ||
if(error.errors.title[0]) { | ||
log.error('Globalfield already exists '); |
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.
Add global field details in error logs
config/default.js
Outdated
// pass locale, only to migrate entries from that locale | ||
// not passing `locale` will migrate all the locales present | ||
// locales: ['fr-fr'], | ||
host: 'https://api.contentstack.io/v3', | ||
host: 'https://api.contentstack.com/v3', |
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.
Verify this
Now you can use Global fields as blocks of a Modular Blocks field and add them within the Group field. You can also add Modular Blocks, Group, and Reference fields to the Global field schema |
No description provided.