mirror of
https://github.com/strapi/strapi.git
synced 2025-09-01 04:42:58 +00:00
Remove useless pull function for dashboard
This commit is contained in:
parent
d34274abe6
commit
eda9b9039f
@ -332,67 +332,6 @@ module.exports = function (strapi) {
|
|||||||
cb(null, obj);
|
cb(null, obj);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* Pull global strapi variable from local server
|
|
||||||
* in order to provide them to the dashboard
|
|
||||||
*
|
|
||||||
* @param {Object} data
|
|
||||||
*
|
|
||||||
* @return {Function} cb
|
|
||||||
*/
|
|
||||||
|
|
||||||
pullServerForDashboard: function (data, cb) {
|
|
||||||
try {
|
|
||||||
|
|
||||||
// Init ouptput object
|
|
||||||
const obj = {};
|
|
||||||
|
|
||||||
// Set the config.
|
|
||||||
obj.settings = {
|
|
||||||
url: strapi.config.url,
|
|
||||||
i18n: strapi.config.i18n
|
|
||||||
};
|
|
||||||
|
|
||||||
// Set the models.
|
|
||||||
obj.models = strapi.models;
|
|
||||||
|
|
||||||
// Format `config.api` for multi templates models.
|
|
||||||
_.forEach(strapi.api, function (api, key) {
|
|
||||||
if (api.templates) {
|
|
||||||
obj.models[key].templates = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Assign the template attributes with the model attributes.
|
|
||||||
_.forEach(api.templates, function (template, templateName) {
|
|
||||||
obj.models[key].templates[templateName] = {};
|
|
||||||
obj.models[key].templates[templateName].attributes = {};
|
|
||||||
_.forEach(template.attributes, function (value, attributeKey) {
|
|
||||||
obj.models[key].templates[templateName].attributes[attributeKey] = _.cloneDeep(obj.models[key].attributes[attributeKey]);
|
|
||||||
});
|
|
||||||
obj.models[key].templates[templateName].displayedAttribute = template.displayedAttribute;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// User count.
|
|
||||||
const promises = [];
|
|
||||||
promises.push(strapi.orm.collections.user.count());
|
|
||||||
|
|
||||||
Promise.all(promises)
|
|
||||||
.then(function (response) {
|
|
||||||
// Define if the app is considered as new.
|
|
||||||
const userCount = response[0];
|
|
||||||
obj.settings.isNewApp = !userCount;
|
|
||||||
|
|
||||||
// Finally send the result in the callback.
|
|
||||||
cb(null, obj);
|
|
||||||
}, function (err) {
|
|
||||||
cb(err);
|
|
||||||
});
|
|
||||||
} catch (err) {
|
|
||||||
cb(err);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rebuild dictionary
|
* Rebuild dictionary
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user