nav tabs on admin dashboard

This commit is contained in:
2019-03-07 00:20:34 -06:00
parent f73d6ae228
commit e4f473f376
11661 changed files with 216240 additions and 1544253 deletions

View File

@@ -2,14 +2,16 @@
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var forEachBail = require("./forEachBail");
"use strict";
function loadDescriptionFile(resolver, directory, filenames, callback) {
const forEachBail = require("./forEachBail");
function loadDescriptionFile(resolver, directory, filenames, resolveContext, callback) {
(function findDescriptionFile() {
forEachBail(filenames, function(filename, callback) {
var descriptionFilePath = resolver.join(directory, filename);
forEachBail(filenames, (filename, callback) => {
const descriptionFilePath = resolver.join(directory, filename);
if(resolver.fileSystem.readJson) {
resolver.fileSystem.readJson(descriptionFilePath, function(err, content) {
resolver.fileSystem.readJson(descriptionFilePath, (err, content) => {
if(err) {
if(typeof err.code !== "undefined") return callback();
return onJson(err);
@@ -17,10 +19,11 @@ function loadDescriptionFile(resolver, directory, filenames, callback) {
onJson(null, content);
});
} else {
resolver.fileSystem.readFile(descriptionFilePath, function(err, content) {
resolver.fileSystem.readFile(descriptionFilePath, (err, content) => {
if(err) return callback();
let json;
try {
var json = JSON.parse(content);
json = JSON.parse(content);
} catch(e) {
onJson(e);
}
@@ -30,8 +33,8 @@ function loadDescriptionFile(resolver, directory, filenames, callback) {
function onJson(err, content) {
if(err) {
if(callback.log)
callback.log(descriptionFilePath + " (directory description file): " + err);
if(resolveContext.log)
resolveContext.log(descriptionFilePath + " (directory description file): " + err);
else
err.message = descriptionFilePath + " (directory description file): " + err;
return callback(err);
@@ -42,7 +45,7 @@ function loadDescriptionFile(resolver, directory, filenames, callback) {
path: descriptionFilePath
});
}
}, function(err, result) {
}, (err, result) => {
if(err) return callback(err);
if(result) {
return callback(null, result);
@@ -61,8 +64,8 @@ function loadDescriptionFile(resolver, directory, filenames, callback) {
function getField(content, field) {
if(!content) return undefined;
if(Array.isArray(field)) {
var current = content;
for(var j = 0; j < field.length; j++) {
let current = content;
for(let j = 0; j < field.length; j++) {
if(current === null || typeof current !== "object") {
current = null;
break;
@@ -81,9 +84,9 @@ function getField(content, field) {
function cdUp(directory) {
if(directory === "/") return null;
var i = directory.lastIndexOf("/"),
const i = directory.lastIndexOf("/"),
j = directory.lastIndexOf("\\");
var p = i < 0 ? j : j < 0 ? i : i < j ? j : i;
const p = i < 0 ? j : j < 0 ? i : i < j ? j : i;
if(p < 0) return null;
return directory.substr(0, p || 1);
}