in modules/frontend/app/modules/agent/AgentManager.service.js [594:686]
metadata() {
return this._executeOnCluster('node:rest', {cmd: 'metadata'})
.then((caches) => {
let types = [];
const _compact = (className) => {
return className.replace('java.lang.', '').replace('java.util.', '').replace('java.sql.', '');
};
const _typeMapper = (meta, typeName) => {
const maskedName = _.isEmpty(meta.cacheName) ? '<default>' : meta.cacheName;
let fields = meta.fields[typeName];
let columns = [];
for (const fieldName in fields) {
if (fields.hasOwnProperty(fieldName)) {
const fieldClass = _compact(fields[fieldName]);
columns.push({
type: 'field',
name: fieldName,
clazz: fieldClass,
system: fieldName === '_KEY' || fieldName === '_VAL',
cacheName: meta.cacheName,
typeName,
maskedName
});
}
}
const indexes = [];
for (const index of meta.indexes[typeName]) {
fields = [];
for (const field of index.fields) {
fields.push({
type: 'index-field',
name: field,
order: index.descendings.indexOf(field) < 0,
unique: index.unique,
cacheName: meta.cacheName,
typeName,
maskedName
});
}
if (fields.length > 0) {
indexes.push({
type: 'index',
name: index.name,
children: fields,
cacheName: meta.cacheName,
typeName,
maskedName
});
}
}
columns = _.sortBy(columns, 'name');
if (nonEmpty(indexes)) {
columns = columns.concat({
type: 'indexes',
name: 'Indexes',
cacheName: meta.cacheName,
typeName,
maskedName,
children: indexes
});
}
return {
type: 'type',
cacheName: meta.cacheName || '',
typeName,
maskedName,
children: columns
};
};
for (const meta of caches) {
const cacheTypes = meta.types.map(_typeMapper.bind(null, meta));
if (!_.isEmpty(cacheTypes))
types = types.concat(cacheTypes);
}
return types;
});
}