npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

reservation-admin-engine-addon

v0.0.35

Published

The default blueprint for ember-cli addons.

Downloads

13

Readme

reservation-admin-engine-addon

This README outlines the details of collaborating on this Ember addon.

This addon must be worked on with the following ember addon found on npm: admin-engine-addon which is relied on for the styles and other addons that are already bundled inside admin-engine-addon.

This addon is to be also used with the sails.js generator found on npm as admin.rest.ember.generator. Please visit the npm page to install it and run it on your sails js server.

Before proceeding with this engine installation, please visit the ember-engine github page on this link: https://github.com/dgeb/ember-engines/tree/v0.3 and ember install [email protected]

Then set up the app.js file as follows:

import Ember from 'ember';
import Resolver from 'ember-engines/resolver';
import loadInitializers from 'ember-load-initializers';
import config from './config/environment';

let App;

Ember.MODEL_FACTORY_INJECTIONS = true;

App = Ember.Application.extend({
    modulePrefix: config.modulePrefix,
    podModulePrefix: config.podModulePrefix,
    Resolver,
    engines: {
        adminEngineAddon: {
            dependencies: {
                services: [
                    'session', 'store', 'current-user', 'app-config', 'permission-check', 'country-list'
                ]
            }
        },
        reservationAdminEngineAddon: {
            dependencies: {
                services: [
                    'session', 'store', 'current-user', 'app-config', 'permission-check', 'country-list'
                ],
                externalRoutes: {
                    login: 'security.' + config['ember-simple-auth'].authenticationRoute
                }
            }
        }

    }

});

loadInitializers(App, config.modulePrefix);

export default App;

Then go to the terminal and install reservation-admin-engine-addon like so:

ember install reservation-admin-engine-addon

Then go ahead and copy into the root the .env file, or create it and copy the following content:

ZURU_API_URL='http://localhost:1337/api/v1'
SERVER_TOKEN_ENDPOINT='http://localhost:1337/api/v1/auths/login?type=local'
SERVER_TOKEN_REFRESH_ENDPOINT='http://localhost:1337/api/v1/users/jwt'
ENABLE_AUTH_PROXY=true

Then set up the app config file with the following addition configurations add override the setting as necessary. Take note that a bundled addon 'admin-lte-app-shares' already has the same settings:

ENV['zuru'] = {
  apiUrl: process.env.ZURU_API_URL,
  enableAuthProxy: process.env.ENABLE_AUTH_PROXY
}

ENV['ember-simple-auth-token'] = {
  refreshAccessTokens: true,
  tokenExpireName: 'exp',
  timeFactor: 1,
  refreshLeeway: 300, //Refresh the token 5 minutes (300s) before it expires
  identificationField: 'email',
  tokenPropertyName: 'access_token',
  serverTokenEndpoint: process.env.SERVER_TOKEN_ENDPOINT,
  serverTokenRefreshEndpoint: process.env.SERVER_TOKEN_REFRESH_ENDPOINT
};
ENV['ember-simple-auth'] = {
  authenticationRoute: 'admin.access.login',
  routeAfterAuthentication: 'security.admin.tasks', //Note that it starts with security route as this is executed by parent app/engine at the application route
  routeIfAlreadyAuthenticated: 'admin.tasks'
};

And then go to the router.js file and set up the following mount:

import Ember from 'ember';
import config from './config/environment';

const Router = Ember.Router.extend({
    location: config.locationType,
    rootURL: config.rootURL
});

Router.map(function() {
    this.mount('admin-engine-addon', { as: 'security' });
    this.mount('reservation-admin-engine-addon', { as: 'internal' });
});

export default Router;

Notice that inside the mount the alias used by default for this is 'security'. If you change it, be sure to go back into the config and change the default access login paths with new alias.

Also, added the ember-can authorisation library. Please visit the ember-can github page on this link: https://github.com/minutebase/ember-can

To work with this in the engines, you would have to open their source files in an editor. To limit the view within the templates, use the following format:

{{#if (can 'view resource' (hash permission='canSee' resource='Resources' ))}}
{{/if}}

The first part '(can 'view resource') is for finding the ability class of 'resource' and calling the computed property 'can view' camel cased. The second part of '(hash permission='canSee' resource='Resources' )' is the model that will be passed on to the ability class. They are used to filter the permissions collection on the server by the resource model name and permission field on the permission object.

Installation

  • git clone <repository-url> this repository
  • cd admin.engine.addon
  • npm install
  • bower install

Running

Running Tests

  • npm test (Runs ember try:each to test your addon against multiple Ember versions)
  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit http://ember-cli.com/.