Giter Site home page Giter Site logo

admin-interface / admin-interface Goto Github PK

View Code? Open in Web Editor NEW
37.0 9.0 9.0 16.28 MB

Library for provide Admin UI

Home Page: https://www.npmjs.com/package/@admin-interface/express

License: MIT License

JavaScript 50.18% HTML 4.81% CSS 45.02%
admin-panel express sequelize nodejs node-module javascript admin node panel

admin-interface's Introduction

Warning

At the moment, the project is suspended. As soon as I have more time, I will continue to develop this project.

Admin Interface

Admin Interface it is library for provide Admin UI on base Sequelize and Express.

Also check out our demo project

Installation

$ npm install --save @admin-interface/core @admin-interface/express

Connect to Your project

const app            = require('express')();
const AdminInterface = require('@admin-interface/express');

const adminInterface = new AdminInterface();
adminInterface.setConfigFile(__dirname, 'admin-interface.yaml');

// Your API ...

// Mount Admin Interface
app.use('/admin', adminInterface.middleware());

app.listen(3000, () => console.log('run server on 3000 port'));

Screenshots

a a a

As a basis UI is taken AdminBSB - Material Design

Looking for docs?

License

Admin Interface is an open source project that is licensed under the MIT license.

admin-interface's People

Contributors

fredure avatar kuzmenko1256 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

admin-interface's Issues

Hang up on config loading

Hi! I'm experiencing an issue when the following line is falling into continuous loop.

adminInterface.setConfigFile(__dirname, 'admin-interface.yaml');

While tracing down the call stack I've found that this happens somewhere inside this part while trying to load node_modules/@admin-interface/express/config/admin-interface.yaml. BTW, I don't yet understand why it's even used cause we've already set up one (__dirname, 'admin-interface.yaml'). And there's some folder scan at this point node_modules/**/**/@admin-interface/core. I'm not sure but is this really required? May be this could be overridden somehow?

Why filtering out PK values from creation attributes when creating an item?

Issue:

The ApiModelController of the @admin-interface/express package deliberately removes the values of PK columns when creating an item:

const attributes = lodash.pickBy(body, (value: any, key: string) => key !== primaryKey);

As much as I understand this behavior might be convenient for some primary key scenarios such as an autoincremental id (EG: column id of table users of the demo package schema), it makes the entire admin-interface not support use cases like, for example, many-to-many relationships (as it is not possible to insert data in the junction table).

Proposed course of action:

If we do not want users' values for an autoincremental id column to hit the db, instead of removing them from the creation attributes (as currently), I would suggest not exposing them to the user to begin with. And since fields are configurable (yay!), this is something that can already be achieved in the current state of admin-interface.

So I would suggest dropping this line in charge of removing primary key values from creation attributes.

I could submit a PR with this change:
ureesoriano@18d2d1d

Cannot use with a webpack environment

Hello, I've been looking to integrate your application and find it quite fascinating but am having trouble integrating it with node via webpack. I get this error

Error: ENOENT: no such file or directory, open '../node_modules/@admin-interface/express/config/admin-interface.yaml'
    at Object.fs.openSync (fs.js:652:18)
    at Object.fs.readFileSync (fs.js:553:33)
    at yamlParse (/repository/my-app/my-app-node/compiled/webpack:/~/@admin-interface/core/dist/Utils/Yaml/Parser.js:133:1)
    at yamlConfigParse (/repository/my-app/my-app-node/compiled/webpack:/~/@admin-interface/core/dist/Utils/Yaml/Parser.js:149:1)
    at getLocalConfig (/repository/my-app/my-app-node/compiled/webpack:/~/@admin-interface/express/dist/Utils/Config/Config.js:26:1)
    at Function.setConfigEvent (/repository/my-app/my-app-node/compiled/webpack:/~/@admin-interface/express/dist/Event/Events/set-config.js:61:1)
    at getSubscribersByEvent.map.handler (/repository/my-app/my-app-node/compiled/webpack:/~/@admin-interface/core/dist/EventEmitter/EventEmitter.js:47:1)
    at Array.map (native)
    at EventEmitter.emit (/repository/my-app/my-app-node/compiled/webpack:/~/@admin-interface/core/dist/EventEmitter/EventEmitter.js:47:1)
    at AdminInterface.setConfigFile (/repository/my-app/my-app-node/compiled/webpack:/~/@admin-interface/express/dist/AdminInterface/AdminInterface.js:24:1)
    at Object.<anonymous> (/repository/my-app/my-app-node/compiled/webpack:/server/index.js:16:16)
    at Object.module.exports.Object.defineProperty.value (/repository/my-app/my-app-node/compiled/server.dev.js:22502:30)
    at __webpack_require__ (/repository/my-app/my-app-node/compiled/webpack:/webpack/bootstrap 8034041fb7028d7ea63b:19:1)
    at module.exports.validateFormat (/repository/my-app/my-app-node/compiled/webpack:/webpack/bootstrap 8034041fb7028d7ea63b:65:1)
    at Object.<anonymous> (/repository/my-app/my-app-node/compiled/server.dev.js:71:10)
    at Module._compile (module.js:569:30)

I've tracked it down to this since __dirname is a bit different in a webpack environment.

function getLocalConfig() {
  const root = _path2.default.join(__dirname, '../../../config');
  return (0, _core.yamlConfigParse)(root, 'admin-interface.yaml');
}

Would you have any insight on how to address this or would you recommend with going a pure node approach?

EDIT:
Another thing is my main server file is nested in [project_dir]/server/index.js

Do not limit admin-interface to be required at the root level of the project

Issue:

The configParser method of core's package Util/Yaml/Parser populates a cache by searching modules inside the project's node_modules/ directory:

cache[ moduleName ] = globby.sync(`${ Registry.getRepository('App').get('cwd') }/node_modules/**/**/${ moduleName }/`, {

The problem here is that it achieves this purpose by searching in ${ Registry.getRepository('App').get('cwd') }/node_modules/.
Since Registry.getRepository('App').get('cwd') seems to evaluate to the point in the project tree in which admin-interface was required, this introduces quite a heavy limitation: admin-interface must be required at the root level of the project (or more precisely: at the same level than node_modules/); otherwise, node_modules/ directory won't be found.

Proposed course of action:

Since the functionality achieved by Registry.getRepository('App').get('cwd') is already provided by node's process.cwd(), I would suggest relying on process.cwd() instead of Registry.getRepository('App').get('cwd').

I submitted a PR with this change: #33

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.