Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function init_overview(client, jobs) {
var read_series, write_series;
$('#vgroups').toggle(client.features.lvm2);
$('#iscsi-sessions').toggle(client.features.iscsi);
var mdraids_tmpl = $("#mdraids-tmpl").html();
mustache.parse(mdraids_tmpl);
function render_mdraids() {
function cmp_mdraid(path_a, path_b) {
// TODO - ignore host part
return client.mdraids[path_a].Name.localeCompare(client.mdraids[path_b].Name);
}
function make_mdraid(path) {
var mdraid = client.mdraids[path];
return {
path: path,
UUID: mdraid.UUID,
Size: utils.fmt_size(mdraid.Size),
Name: utils.mdraid_name(mdraid)
};
.reduce((accum, dep) => {
const contents = loadDependency(dep);
const tokens = mustache.parse(contents)
.filter((x) => x[0] !== 'text')
.map((x) => ({ id: x[1] }))
.filter((x) => x.id !== 'author' && x.id !== 'id'); // Provided by cyto
return [
...accum.filter((x) => !tokens.includes(x)),
...uniqBy(tokens, 'id'),
];
}, []);
}
function parseMustache(expr, identifier = false) {
if (!expr) {
return ''
}
const tokens = parse(expr)
const isIdentifier = tokens.length === 1
return tokens.map(token => {
if (token[0] === 'text') {
if (identifier) {
return token[1]
}
return `'${token[1]}'`
} else if (token[0] === '!') { // {{ !loading }}
return `(!${token[1]})`
} else if (token[0] === 'name') {
if (isIdentifier) {
return token[1]
}
return `(${token[1]})`
}
}).join('+')
save() {
let exporter = getExporterByType("custom");
let content = ReactDOM.findDOMNode(this.refs.content).value;
let allowTrim = ReactDOM.findDOMNode(this.refs.allowTrim).checked;
let allowRotation = ReactDOM.findDOMNode(this.refs.allowRotation).checked;
let fileExt = ReactDOM.findDOMNode(this.refs.fileExt).value;
try {
mustache.parse(content);
exporter.content = content;
exporter.allowTrim = allowTrim;
exporter.allowRotation = allowRotation;
exporter.fileExt = fileExt;
Storage.save(STORAGE_CUSTOM_EXPORTER_KEY, exporter);
Observer.emit(GLOBAL_EVENT.HIDE_EDIT_CUSTOM_EXPORTER);
}
catch(e) {
Observer.emit(GLOBAL_EVENT.SHOW_MESSAGE, I18.f("EXPORTER_ERROR", e.message));
}
}
};
}
var m = Object.keys(client.mdraids).sort(cmp_mdraid).map(make_mdraid);
$('#mdraids').amend(mustache.render(mdraids_tmpl,
{ MDRaids: m,
HasMDRaids: m.length > 0
}));
permissions.update();
jobs.update('#mdraids');
}
$(client).on('changed', render_mdraids);
var vgroups_tmpl = $("#vgroups-tmpl").html();
mustache.parse(vgroups_tmpl);
function render_vgroups() {
function cmp_vgroup(path_a, path_b) {
return client.vgroups[path_a].Name.localeCompare(client.vgroups[path_b].Name);
}
function make_vgroup(path) {
var vgroup = client.vgroups[path];
return {
path: path,
Size: utils.fmt_size(vgroup.Size),
Name: vgroup.Name
};
}
compile: function (template) {
Mustache.parse(template);
return function (context) {
return Mustache.render(template, context, partials);
};
},
"use strict";
const mustache = require('mustache');
const template = '<h1>Hello <i>{{name}}</i></h1>';
mustache.parse(template);
module.exports.sayHello = toWhom => {
return mustache.render(template, {name: toWhom});
};
render(actionResult, template) {
mustache.parse(template);
var o = actionResult.toJSON();
this._injectHelperFunctions(o);
return mustache.render(template, o.result);
}
init: function(_runtimeAPI) {
runtimeAPI = _runtimeAPI;
editorTemplate = fs.readFileSync(path.join(templateDir,"index.mst"),"utf8");
Mustache.parse(editorTemplate);
},
fs.readdirSync(this.compiler.srcPath('templates')).forEach((filename) => {
const name = path.basename(filename, '.mustache');
this.templates[name] = fs.readFileSync(this.compiler.srcPath('templates', filename), 'utf8');
Mustache.parse(this.templates[name]);
});
}