added hotReload saveFile
This commit is contained in:
84
utils.js
84
utils.js
@@ -4,25 +4,8 @@ const { dirname } = require('path');
|
||||
const { File: HotReload } = require(`@services/hotReload.js`);
|
||||
const { service } = require(`@root/server.js`);
|
||||
const { localPath, cache, runtimeFile } = require('@root/globalize.js');
|
||||
// let integratedStartmenuItems = require('@models/integratedStartmenuItems');
|
||||
|
||||
|
||||
// global.path = {
|
||||
// root: dirname(require.main.filename),
|
||||
// source:`${dirname(require.main.filename)}/src`,
|
||||
// public: `${dirname(require.main.filename)}/public`,
|
||||
// plugins: `${dirname(require.main.filename)}/plugins`
|
||||
// };
|
||||
|
||||
|
||||
// global.json = {
|
||||
// releaseNotes: new HotReload(path.join(global.path.source, 'models', 'releasenotes.json')),
|
||||
// configuration: new HotReload(path.join(global.path.source, 'models', 'configuration.json')),
|
||||
// stylesheet: new HotReload(path.join(global.path.source, 'models', 'stylesheet.json')),
|
||||
// indexRoutes: new HotReload(path.join(global.path.source, 'routes', 'indexRoutes.js'), { historyLimit: 50, fileType: 'js' }),
|
||||
// startMenuItems: new HotReload(path.join(global.path.source, 'models', 'integratedStartMenuItems.json'))
|
||||
// }
|
||||
|
||||
module.exports = startMenuItems = async function (app, objectGuid) {
|
||||
const debug = runtimeFile.configuration.live.debug.startMenuItems;
|
||||
let logContent = [];
|
||||
@@ -39,9 +22,6 @@ module.exports = startMenuItems = async function (app, objectGuid) {
|
||||
// Load menu sources
|
||||
// =========================
|
||||
const integratedStartmenuItems = runtimeFile.startMenuItems.live;
|
||||
// const integratedStartmenuItems =
|
||||
// service.get('fileSystemManager')
|
||||
// .loadJSON(global.json.startMenuItems.filePath) || [];
|
||||
|
||||
const plugins = service
|
||||
.get('pluginManager')
|
||||
@@ -156,70 +136,6 @@ module.exports = startMenuItems = async function (app, objectGuid) {
|
||||
return allPlugins;
|
||||
};
|
||||
|
||||
// module.exports = startMenuItems = async function (app, sAMAccountName) {
|
||||
|
||||
// function safeClone(obj) {
|
||||
// return JSON.parse(JSON.stringify(obj));
|
||||
// }
|
||||
|
||||
// const integratedStartmenuItems = safeClone(service.get('fileSystemManager').loadJSON(global.json.startMenuItems.filePath));
|
||||
|
||||
// const plugins = service
|
||||
// .get('pluginManager')
|
||||
// .getStatus()
|
||||
// .map(({ config, ...plugin }) => ({
|
||||
// ...safeClone(plugin),
|
||||
// section: 'Plugin'
|
||||
// }));
|
||||
|
||||
// let getAllPlugins = [...plugins, ...integratedStartmenuItems];
|
||||
|
||||
// for (const plugin of getAllPlugins) {
|
||||
|
||||
// plugin.menu.items = await Promise.all(
|
||||
// (plugin.menu.items || []).map(async item => {
|
||||
|
||||
// const authorized =
|
||||
// item.label === 'hr' ||
|
||||
// item.permissions.includes('Administration')
|
||||
// ? global.json.configuration.live.administration.some(
|
||||
// name => name.toLowerCase() === sAMAccountName.toLowerCase()
|
||||
// )
|
||||
// : item.permissions.includes('*') ||
|
||||
// (
|
||||
// await Promise.all(
|
||||
// item.permissions.map(async permission =>
|
||||
// (await service.get('activeDirectoryManager').getGroup(permission)) &&
|
||||
// (await service.get('activeDirectoryManager').isUserMemberOfRecursive(
|
||||
// sAMAccountName,
|
||||
// permission
|
||||
// ))
|
||||
// )
|
||||
// )
|
||||
// ).some(Boolean);
|
||||
|
||||
// return {
|
||||
// ...safeClone(item),
|
||||
// authorized
|
||||
// };
|
||||
// })
|
||||
// );
|
||||
|
||||
// plugin.onlyAdministration =
|
||||
// plugin.menu.items.every(item => !item.authorized) &&
|
||||
// !global.json.configuration.live.administration.includes(sAMAccountName);
|
||||
// }
|
||||
|
||||
// getAllPlugins = getAllPlugins
|
||||
// .filter(plugin => !plugin.onlyAdministration)
|
||||
// .filter(plugin => plugin.active);
|
||||
|
||||
// app.locals.startMenuItems = getAllPlugins;
|
||||
|
||||
// return [...getAllPlugins];
|
||||
// };
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Convert date into custom dateformat
|
||||
|
||||
Reference in New Issue
Block a user