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

Global field #26

Merged
merged 13 commits into from
Apr 17, 2020
Merged

Global field #26

merged 13 commits into from
Apr 17, 2020

Conversation

rohitmishra209
Copy link
Contributor

No description provided.

config/default.js Outdated Show resolved Hide resolved
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'
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you verify this?

Copy link
Contributor

@ninadhatkar ninadhatkar left a 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.

var self = this;
return new Promise(function(resolve, reject) {
return Promise.map(_globalField_pending, function (globalfield) {
var lenglobalfield = (self.globalfields).length;
Copy link
Contributor

@ninadhatkar ninadhatkar Apr 1, 2020

Choose a reason for hiding this comment

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

lenglobalfield >> lenGlobaField

// 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));
Copy link
Contributor

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

@@ -18,8 +18,12 @@ var supress = require('../util/extensionsUidReplace');
var config = util.getConfig();

var contentTypeConfig = config.modules.content_types;
var globalfieldsConfig = config.modules.globalfields;
Copy link
Contributor

@ninadhatkar ninadhatkar Apr 1, 2020

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

}
};
return request(requestGlobalfieldOptions).then(function (response) {
// console.log("globalfieldsuid", response.body.global_field.uid);
Copy link
Contributor

Choose a reason for hiding this comment

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

remove unwanted console logs

}
}
}, {
concurrency: 3
Copy link
Contributor

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

@@ -190,6 +190,9 @@ importEntries.prototype = {
return resolve();
}
for (var eUid in entries) {
// console.log("self contentstypess>>>", self.ctSchemas[ctUid])
Copy link
Contributor

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

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));
Copy link
Contributor

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)

Copy link
Contributor Author

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.

@@ -26,6 +26,7 @@ module.exports = function (data, mappedAssetUids, mappedAssetUrls, assetUidMappe
var matchedUrls = [];

var find = function (schema, entry) {
// console.log("findingggg", schema);
Copy link
Contributor

Choose a reason for hiding this comment

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

remove unused comments

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

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));
Copy link
Contributor

Choose a reason for hiding this comment

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

failed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

return;
});
}
}
}, {
concurrency: 3
concurrency: concurrencyNo
Copy link
Contributor

Choose a reason for hiding this comment

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

Only concurrency works

@@ -17,9 +17,10 @@ var log = require('../util/log');
var supress = require('../util/extensionsUidReplace');
var config = util.getConfig();

var concurrencyNo = config.concurrency;
Copy link
Contributor

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

Copy link
Contributor Author

@rohitmishra209 rohitmishra209 Apr 16, 2020

Choose a reason for hiding this comment

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

change to reqConcurrency

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));
Copy link
Contributor

Choose a reason for hiding this comment

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

imported >> import

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

if(error.errors.title[0]) {
log.error('Globalfield already exists ');
} else {
log.error('Globalfield fail to import '+ JSON.stringify(error.errors));
Copy link
Contributor

Choose a reason for hiding this comment

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

fail >> failed

// 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 ');
Copy link
Contributor

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

// 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',
Copy link
Contributor

Choose a reason for hiding this comment

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

Verify this

@rohitmishra209 rohitmishra209 merged commit 8be30c0 into master Apr 17, 2020
@rohitmishra209
Copy link
Contributor Author

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

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.

2 participants