jeudi 31 mai 2018

Adding selector on ember-growl-notification flash message

I am using ember growl notification.On save below condition is checked and displays flash message.I need to add ember selector to this flash message.When i add attr using jquery it doesn't display selector on flash message inspect element.

On controller save click i call this function

    if(productDontAllow && (!!userManagement))
    {
      this.get('emberGrowlService').showNotification({
        message: messageDisplay,
        type: success
      });
      Ember.$('.ember-growl-notification-item').attr('data-test-flash-failure','')
      return;
    }




How to allow external URL use in ember.js

I have a web app project using ember.js, and use this code to access an external site.

var request = new XMLHttpRequest();
request.open("GET", "my_url/extras", true);
request.send(null);
request.onreadystatechange = function() {
    if (request.readyState == 4)
       alert(request.responseText);  }

This causes the error in browser console: "Mirage: Your Ember app tried to GET 'my_url/extras', but there was no route defined to handle this request. Define a route that matches this path in your mirage/config.js file. Did you forget to add your namespace?"

My jquery version is 3.2.1, and tried the following passthroughs in mirage/config.js but still get the same error.

this.passthrough('my_url/extras');
this.passthrough('my_url/**')




Recommended pattern to implement JSONAPI filter with query params in Ember?

I spent a chunk of time yesterday trying to include filter (reflecting the JSONAPI spec) in the query params of part of an Ember app. With Ember Data it is easy enough to pass a filter array to an endpoint, the problem I have is reflecting that filter array in the query params for a particular route. Note: other, non array, query params are working fine.

TL;DR I have tried various options without success and have a solution that really feels unsatisfactory and not at all DRY. I figure that many others must have tackled this problem and have surely found a better solution. Read on for details of what I have tried so far.

I started with something like this (I initially assumed it would work having read the Ember docs on query params):

Controller:

import Controller from '@ember/controller';

export default Controller.extend({
  queryParams: ['sort', 'page', 'filter'],
  sort: 'id',

  init() {
    this._super(...arguments);
    this.set('filter', []);
  },
});

Route:

import Route from '@ember/routing/route';

export default Route.extend({
  queryParams: {
    filter: {
      refreshModel: true
    },
    sort: {
      refreshModel: true
    }
  },

  model(params) {
    console.log(JSON.stringify(params)); // filter is always []
    return this.get('store').query('contact', params);
  }
});

Acceptance Test (this was just a proof of concept test before I started on the more complex stuff):

  test('visiting /contacts with query params', async function(assert) {
    assert.expect(1);
    let done = assert.async();

    server.createList('contact', 10);

    server.get('/contacts', (schema, request) => {
      let params = request.queryParams;

      assert.deepEqual(
        params,
        {
          sort: '-id',
          "filter[firstname]": 'wibble'
        },
        'Query parameters are passed in as expected'
      );
      done();
      return schema.contacts.all();
    });

    await visit('/contacts?filter[firstname]=wibble&sort=-id');
  });

No matter how I tweaked the above code, params.filter was always [] in the Route model function.

I have searched around for best-practice on what would seem to be a common use case, but have not found anything recent. sarus' solution here from Nov 2015 works, but means that every possible filter key has to be hardcoded in the controller and route, which seems far from ideal to me. Just imagine doing that for 20 possible filter keys! Using sarus' solution, here is code that works for the above acceptance test but as I say imagine having to hardcode 20+ potential filter keys:

Controller:

import Controller from '@ember/controller';

export default Controller.extend({
  queryParams: ['sort',
    { firstnameFilter: 'filter[firstname]' }
  ],
  sort: 'id',
  firstnameFilter: null,

  init() {
    this._super(...arguments);
  }
});

Route:

import Route from '@ember/routing/route';

export default Route.extend({
  queryParams: {
    firstnameFilter: {
      refreshModel: true
    },
    sort: {
      refreshModel: true
    }
  },

  model(params) {
    if (params.firstnameFilter) {
      params.filter = {};
      params.filter['firstname'] = params.firstnameFilter;
      delete params.firstnameFilter;
    }
    return this.get('store').query('contact', params);
  }
});

I hope there's a better way!




mercredi 30 mai 2018

Selected Attribute on Select Option Not Working (Ember.js + Handlebars)

I am implementing a dropdown using Ember, but I cannot set the selected property of an option element using a handlebars expression.

Here is an ember-twiddle example that shows the issue. Notice how in the DOM of the twiddle, the selected attribute does not appear for the top example.

<select
    aria-disabled=""
    aria-multiselectable=""
    disabled=
    onchange=
>
    <option selected disabled value=""></option>

    
        <option 
            value=
            selected=
            disabled=
        >
            
        </option>
    
</select>

"is-item-selected" is a custom helper that returns true if "item.state === 2", which is does when the item is selected in the dropdown.

No matter what I try in the handlebars, the selected attribute will not display (e.g. selected= does not work either). However, changing selected to data-selected works exactly as intended.

Is anyone aware of this issue? Or am I misunderstanding how the selected attribute is supposed to work?




ember-custom-actions addon urlForCustomAction not working

I am trying to use ember-customer-actions(v2.1.0) addon with my ember version = 3.1.4. It is really a cool addon and ease our life while implementing customer actions and urls.

It's configuration say to override this method 'urlForCustomAction' to complete override the url and even avoid model name.

I integrated it as doc says. I posted my issue here as well.

This is my adapter code:

import ApplicationAdapter from './application'; 

import { AdapterMixin } from 'ember-custom-actions';

export default ApplicationAdapter.extend(AdapterMixin,{

urlForCustomAction(modelName, id, snapshot, actionId, queryParams) {

return 'domain.com/resetPassword';

}

});

It seems like something is missing or may be there is a bug in addon or may be this addon is in beta phase.

I need quick help on this, if anyone has already used it then please share your experience thanks.




How to clone existing ember.js projects from Github repository and run into you local machine?

After installing Git, Node.js, Bower, Ember Cli and Phantoms Js into my local machine. I do the following steps.

  1. Git clone sample // in this case sample is a new repository in my local machine
  2. cd sample
  3. npm install
  4. bower install

So, after that, when i enter this command: ember server

It says that I am missing some dependencies. Do you know how to generally clone any public ember.js projects from Github account and run into your machine?




mardi 29 mai 2018

ember.js how can I insert new record?

I am currently learning Ember.js and get stuck about the database. I want to create a site for comments, the users are able to write a comment on and see the comment after them submitted.

I have learned basic knowledge about how to display content from the official tutorial, but the data in the tutorial were hard-coded. If I need to insert one record, how can I achieve it? with a database or something easier?

thank you




Jenkinsfile with Docker: resuse the same Docker container

I can't figure out nor find any Jenkins docs explaining how to achieve that. So I'm using Declarative PIpeline syntax to pull node:9and install the project dependencies:

#Jenkinsfile

#!/usr/bin/env groovy
pipeline {
  // Use always Docker agent for build
  agent {
      docker { image 'node:9' }
  }

stages {
    stage('Install') {
      steps {
        sh 'node --version'
        sh 'yarn --version'
        sh "yarn install --no-cache --frozen-lockfile;"
      }
    }

This works, - I have the right node and yarn versions installed.

Now when I try to add another stage to compile the assets:

#Jenkinsfile
...
stage('Build') {
      steps {
        script {
          docker.image("node:9").inside("-u 0") {
            //sh "${ember} deploy development"
            sh "${ember} deploy build --verbose"
          }
        }
      }
    }

it fails as if Jenkins can't find docker:

Running shell script
+ docker pull node:9
/opt/jenkins_data/workspace/decastore-front@tmp/durable-24c414d8/script.sh: 2: /opt/jenkins_data/workspace/decastore-front@tmp/durable-24c414d8/script.sh: docker: not found

What's wrong here ?




Keycloak integration in emberjs project?

Does any one know how to integrate keycloak in emberjs project. I tried different resources but cant find the solution




How to setup ember-intl service in Ember integration tests?

I have just begun adding ember-intl into an application for which I had working tests. My acceptance tests are still working, but my integration tests on components whose templates are using ember-intl for string translation are failing with:

"No locale defined. Unable to resolve translation:..."

In the ember-intl docs there is a section on Integration Testing, which seems to be out of date:

import hbs from 'htmlbars-inline-precompile';
import wait from 'ember-test-helpers/wait';
import { moduleForComponent, test } from 'ember-qunit';

let service;

moduleForComponent('x-product', 'XProductComponent', {
  integration: true,
  setup() {
    service = this.container.lookup('service:intl');
    service.setLocale('en-us');
  }
});

test('it renders', function(assert) {
  assert.expect(1);
  this.render(hbs``);
  this.set('price', 1000);
  this.set('deadline', new Date());
  let output = this.$().text();
  assert.ok(output);
});

test('it translates', function(assert) {
  assert.expect(1);

  /* waits for async behavior (loading translations on app boot) to settle */
  return wait().then(() => {
    assert.equal(service.t('some.key'), 'Hello world');
  });
});

I've looked in the Ember docs and I can see how to stub a service for testing, but not how to just load the service in a test and then work with it.




Ember cli mirage error: patch handler cannot read property update of null

I am using ember cli mirage with my amber app, i have data defined in fixtures and using the RestSerializer, i am trying to simulate updating the attributes of a record but getting an error: The patch handler for the url api/survey-groups/[id] threw an error: cannot read property update of null

mirage/config.js

 this.patch('/survey-groups/:id', function({ surveyGroups }, request) {
let id = request.params.id;
let attrs = this.normalizedRequestAttrs();

return surveyGroups.find(id).update(attrs);

});

mirage/serializers/application.js

import { RestSerializer } from 'ember-cli-mirage';
export default RestSerializer.extend({
primaryKey: 'keyId'});

app/serializers/application.js

import DS from 'ember-data';

export default DS.RESTSerializer.extend({
primaryKey: 'keyId', });

sample of fixture; mirage/fixtures/survey-groups.js

export default [
  {
    "code": "dfdj", 
    "description": "", 
    "keyId": 29116, 
  }, 
  {...... }]

I also noticed in the data returned by the server that an id attribute was added to each record, with a string value e.g. id: "1" When i attempt to find a record using this string value in place of the id, the record is returned.

What could be causing this error and behavior




Add local controller property to store models

I want to add a simple 'selected' property to store objects, just localised to the particular route/controller.

So in my controller I'm loading the 'groups' from the store. For each 'group' I want to add in a 'selected' property. Tried a few different approaches but just can't get it working.

Advice on "the ember way" would be much appreciated.




lundi 28 mai 2018

ember cookie vs server cookie

I am using Ember.

I am using ember simple auth. This question is clear my confusion related to cookies etc.

I have configure ember storage to cookie.

My server is sending a cookie to be saved at client side.

I have understanding that 1. browser automatically captures the cookie (mean it should be visible in dev tool) 2. browser automatically add this cookie in subsequent requests. 3. I don't need to do anything extra with Ember Simple Auth as server cookie is by default handled by browser.

Based on this understanding, in Chrome inspector I just see one cookie of ember-simple-auth and nothing else.

My questions are:

1- Should I see a separate cookie (the one sent from server) in dev tool along with Ember cookie (set by Ember simple Auth)? or my server cookie has to be embedded in Ember Cookie? 2- Is this right concept that ember cookie is storage for Ember but server cookie is the one that browser will capture and send in header in subsequent requests?




samedi 26 mai 2018

Ember use local JSON file instead of Mirage provided in tutorial

I am new to building websites and all I want to do at this stage is to use local JSON file to retrive data instead of mirage provided in ember tutorial. you have mirage/config.js like this:

export default function() {
  this.namespace = '/api';

  let rentals = [{
        //JSON
      }];


  this.get('/rentals', function(db, request) {
    if(request.queryParams.area !== undefined) {
      let filteredRentals = rentals.filter(function(i) {
        return i.attributes.area.toLowerCase().indexOf(request.queryParams.area.toLowerCase()) !== -1;
      });
      return { data: filteredRentals };
    } else {
      return { data: rentals };
    }
  });

  // Find and return the provided rental from our rental list above
  this.get('/rentals/:id', function (db, request) {
    return { data: rentals.find((rental) => request.params.id === rental.id) };
      });
}

This article shows part of the solution but I don't know where it's supposed to be written. Any help would be much appreciated.




vendredi 25 mai 2018

Ember user upload excel to csv - blank

With ember I am currently letting the user upload files through the ember-file-upload package and trying to parse excel files with the xlsx package but I can't seem to get them to work together. I have gotten other packages to convert the file to csv, json, etc. but can't seem to get the excel file upload to convert with xlsx and I can't seem to find any other packages that work.

I am currently trying to do it this way but it always appears empty.

     file.onloadstart = function (e) {
          alert("started reading");
      }

        file.onload = function (e) {
        // pre-process data
        var binary = "";
        var bytes = new Uint8Array(e.target.result);
        var length = bytes.byteLength;
        for (var i = 0; i < length; i++) {
            binary += String.fromCharCode(bytes[i]);
        }
        // call 'xlsx' to read the file
        var workbook = XLSX.read(binary, {type: 'binary', cellDates:true, cellStyles:true});
        //return oFile;
        alert(workbook.SheetNames.length);
        alert(workbook.SheetNames[0]);
        var worksheet = workbook.Sheets[workbook.SheetNames[0]];

        var desiredCell = worksheet['A1'];
        var desiredValue = (desiredCell ? desiredCell.v : undefined);
        alert(desiredValue);
    };



 file.readAsArrayBuffer().then(function(data) {
       alert(XLSX.utils.sheet_to_csv(data));
         csv2geojson.csv2geojson(data, function(err, jsondata) {
             // do something
         });
     });

Currently file.onloadstart never gets called and neither does file.onload but when I tested outside of those the workbook.SheetNames.length alerts the wrong length the workbook.SheetNames[0] gives a bad sheetname and the desiredValue alert is blank along with alerting XLSX.utils.sheet_to_csv(data) alert is blank and with length 0.




jeudi 24 mai 2018

How to upload and convert XLSX file to JSON using ember.js

I am trying to allow the user to upload an XLSX file to be converted to a JSON or CSV file to be parsed through on the back-end. I am using node.js, and tried several packages including the read-excel-file (https://github.com/catamphetamine/read-excel-file/blob/master/README.md)

readXlsxFile(file).then(function(data) {
let jsondata = JSON.parse(data);
-do something with jsondata-
});




Ember CLI + Watchman Not Detecting Addon Changes

I have an Ember.js addon which Watchman does not seem to operate correctly with. Any changes made to the addon-name/app files do not trigger a rebuild. However, changes to files within addon-name/tests do trigger a rebuild.

I have a .watchmanconfig file set up as follows...

{
  "ignore_dirs": [ "tmp", "dist", ".idea", "docs", ".git", "node_modules" ]
}

After running the dummy app with ember s, I checked watchman watch-list and do not see the addon listed in the "roots" category. I've added it manually, but that does not help either, as I'm guessing ember s has to tell watchman what to do when the files are changed.

Any ideas on what might be happening?

OS: Mac OSX High Sierra (10.13.4)
Ember: v3.1.0
Node: v8.11.1
NPM: 6.0.0
Yarn: 1.5.1




how to add record to array

I'm beginner in Emberjs, so i need to pass selected item in list to basket. I have route catalog

  <div class="flexbox">

<div class="main">
  
  <div class="catalog-container">
    <div class="container-inner">
        
        <ul class="responsive-table">
          <li class="table-header" >
            <div class="col col-1">Наименование</div>
            <div class="col col-2 radio-group">Год<i class="fas fa-angle-up angle angle-left radio" note="up" ></i><i class="fas fa-angle-down angle radio" data-value="down"></i></div>
            <div class="col col-3">Количество<i class="fas fa-angle-up angle angle-left radio"></i><i class="fas fa-angle-down angle"></i></div>
            <div class="col col-4">Цена<i class="fas fa-angle-up angle angle-left"></i><i class="fas fa-angle-down angle"></i></div>
            <div class="col col-5">Примечание</div>
          </li>
          
            
          
        </ul>
          
    </div>
  </div>
</div>

catalog.js controller

export default Controller.extend({
items: [],
actions: {
  filterByName(param) {
    if (param !== '') {
      return this.get('store').query('item', {name: param})
    }
  }
  getBasketItem(param){
    if (param !== '') {
      var item = this.get('store').query('item', {name: param});
      //how to add item in items to use in side-basket
    }
}
}
});

component item-list.hbs

<li class="table-row hvr-grow" >
  
  <div class="col col-1" data-label="Наименование"></div>
  <div class="col col-2" data-label="Год"></div>
  <div class="col col-3" data-label="Количество"></div>
  <div class="col col-4" data-label="Цена"></div>
  <div class="col col-5" data-label="Примечание"></div>
</li>

item-list.js

    export default Ember.Component.extend({
    selectedIndex : false,
    actions: {
     handleItem(param) {
     let handledItem = this.get('gotItem');
     handledItem(param);
   }
 }
});

and side-basket component with nested basket-list component

scheme

test

test with manual writing

how to realise this transfer?




mardi 22 mai 2018

How can I retrieve a route's model() when writing a test?

I have a route that has its own model, which does not come from the Ember store (let's say it can come from "anywhere" for the sake of this question).

  model() {
    return RSVP.hash({
      value: someCall()
    });
  }

this.owner.lookup('route:routeName').model() does not seem to work, neither does this.owner.lookup('controller:controllerName').get('model.X') or any of the other things I've tried.

Nor does it seem to be mentioned at https://guides.emberjs.com/v3.1.0/testing/testing-routes/

How would you retrieve a route's model in a test?




Ember: Mocking RecordArray

For acceptance tests of components that involve peekAll, I've stubbed the store service with the peekAll method that returns an array of Ember.Object, by which I'm able to retrieve the records and display.

But save, set and get methods aren't working, as peekAll in it's original form returns a RecordArray.

How do I return a RecordArray from the store stub?




TCPDF file download from js application

I've got SPA(ember js), and REST API service - php(laravel 5.2).

I'm trying to download pdf document generated on server

That's how i'm generating pdf

$tcpdf->Output({path}, 'I');

if i visit API resource directly in browser everything is fine and file downloads normally.

But when i try to catch response in SPA and initiate download i'm getting empty pdf as a result.

my js download function looks like

this.download(results, 'test.pdf','application/pdf')


download(data, filename, mime) {
    var blob = new Blob([data], {type: mime || 'application/octet-stream'});
    if (typeof window.navigator.msSaveBlob !== 'undefined') {
        // IE workaround for "HTML7007: One or more blob URLs were
        // revoked by closing the blob for which they were created.
        // These URLs will no longer resolve as the data backing
        // the URL has been freed."
        window.navigator.msSaveBlob(blob, filename);
    }
    else {
        var blobURL = window.URL.createObjectURL(blob);
        var tempLink = document.createElement('a');
        tempLink.style.display = 'none';
        tempLink.href = blobURL;
        tempLink.setAttribute('download', filename);

        // Safari thinks _blank anchor are pop ups. We only want to set _blank
        // target if the browser does not support the HTML5 download attribute.
        // This allows you to download files in desktop safari if pop up blocking
        // is enabled.
        if (typeof tempLink.download === 'undefined') {
            tempLink.setAttribute('target', '_blank');
        }

        document.body.appendChild(tempLink);
        tempLink.click();
        document.body.removeChild(tempLink);
        window.URL.revokeObjectURL(blobURL);
    }
},

results variable is a result file string returned from server.

Can someone point out what is wrong here and why my pdf is empty?




Unknown blueprint: resource in Ember JS

I am new to Ember JS. I am using ember-cli: 3.1.4. I want to create resource file. I have used "ember g resource data". But I cannot create it and the reply is like "Unknown blueprint: resource". Is resource is dropped in the latest version? or still is there? If it is dropped, is there any other methods to use the same feature? It would be better to me, if someone clarifies it as soon as possible. Thank you




Assertion failed error: in ember when api is called after transition to another page

We call an API from login page, and then transition to page called 2fa. On transition we call an api which send 2fa code after sucessfull login. and then redirect to 2fa page.

on login action

         is2FASave.save().then((response) => {
            if(response.data.is2fa){
                this.get('session').setLoginCredential(email,password);
                var sendCode = this.store.createRecord('sendCode', {
                    email: email,
                    password: password
                });
                sendCode.save().then((res) => {
                    this.get('store').unloadAll('sendCode');
                    this.transitionToRoute('twofa')
                },(error)=>{
                });
            }
         }

On twofa page we have resend button on its click where we call same api which is written on twofa controller

actions: {

    /**
     * Resend 2FA code.
     */
    twoFaResend: function() {
        var email = this.get('session').getEmail(),
            password = this.get('session').getPassword();
        var sendCode = this.store.createRecord('sendCode', {
            email: email,
            password: password
        });
        sendCode.save().then((res) => {
        },(error)=>{
        });
    },

while we call this api on twofa page it gives error

Assertion Failed: You can only unload a record which is not inFlight. <send-code:null>"

The error is shown as after the resend code button is clicked enter image description here

When we check ember data it has value of previous api call. enter image description here

Now we also tried calling the same api multiple times on same page which works absolutely fine. Dis issue occurs when it is transitioned to other page and api is called on another page.




Assign object property to value if x = null

I have an Ember computed property that creates an object from an ember model.

In one of the object properties I am trying to evaluate whether an ID exists and in cases where it does not make the property 0 rather than null.

The computed property is as follows (with an illustrative data set):

SpecSortData: computed('customerfr', function() {
  let newArray = [];
  this.get('customerfr').forEach(function(x) {

    function idCheck() {
      if (x.data.speciality_id !== null) {
        return x.data.specialty_id
      } else {
        return 0
      }
    };

    let newData = {
      specialtyID: x.data.specialty_id,
      specialty: x.data.specialty_name,
      customerID: x.data.customer_id,
      tspecID: idCheck()
    }
    newArray.push(newData)
  })
  return newArray
}),

I haven't been able to get the idCheck() function to evaluate properly. The specialty_id field is either a number or null. In cases where it is a number, I would like tspecID to be that number. In cases where it is null I would like tspecID to be 0.

The above function currently adds the speciality_id number to the tspecID property but it does not handle the null cases, they remain as null. If I invert the condition I get all tspecID properties set to 0.

I have tried a few variations of the condition and always end up with either:

  • specID = specialtyID with null cases remaining null
  • tspecID = always 0

I feel like I am making a basic error in the evaluation of function construction but I am stumped.




How I can reduce ember app build time on windows 10 but it works fine on ubuntu

I want to reduce build time of ember app. It is taking quite a lot time to build app specifically on windows 10 while it works great on Ubuntu. Your help would be highly appreciated.




lundi 21 mai 2018

UntrackedPropertyError - Glimmer.js

This is my first time using Glimmer. Its pretty cool and I'm just enjoying using it. That being said, I'm not really sure why but I keep getting an untracked error for the filtered property. I'd really appreciate any advice or help. :)

export default class DoggyAppGlimmer extends Component {
  @tracked dogHouse = [];
  @tracked filterValue = '';

  didInsertElement() {
    fetch('https://dog.ceo/api/breeds/list/all').then((response) => {
        return response.json();
    })
    .then((data) => {
        Object.keys(data.message).map((breed) => {
            fetch(`https://dog.ceo/api/breed/${breed}/images/random`).then((response) => {
                    return response.json();
            })
            .then((image) => {
                    this.dogHouse = [
                        ...this.dogHouse,
                        {
                            breed,
                            image: image.message,
                            filtered: false
                        }
                    ];
            });     
        });
    });
}

filterHandler(e) {
    this.filterValue = e.target.value;
    this.dogHouse = this.dogHouse.map(dog => {
        if (dog.breed.indexOf(this.filterValue) > -1) {
            return Object.assign(dog, {
                filtered: true,
            });
        } else {
            return Object.assign(dog, {
                filtered: false,
            });
        }
    });
    console.log(this.dogHouse);
 }




Ember.JS data model: Filtering a computed property

I have an Ember data model logger defined as below:

import DS from 'ember-data';
import EmberObject, { computed } from '@ember/object';
export default DS.Model.extend({

    someAttribute: DS.hasMany('attr'),
    test: computed('someAttribute.[]', function(){
        return this.get('someAttribute').filterBy('description', 'some value');        
    })
});

The above model gets passed as logger variable from the controller into my component template. In my template:

    
    <h1> Testing </h1>
    


It seems like the logger.test in the template is always false. In the same template if I add the following:


    


I can see all the values being enumerated. Not sure what I am missing? Any assistance would be greatly appreciated.




How to catch actions in rendering test?

I am adding tests to an existing Ember app which uses the old bubbling style actions. Eventually I want to change these to closure actions, and explicit passing of functions. Until then I need to know how to catch when an action is bubbled from a sub-component.

Previously I was able to use this.on() inside the test. However, with the new setupRenderingTest style, this.on does not exist anymore.

The components are using sendAction to fire an action identified by a string name. The parent context is catching the action in it's actions hash. I need to do the same in the test.




EmberJS - Clearing form fields on child component

I'm working on a project which has a component that's generating custom fields for forms, in which I need to reset their content once a button is pressed. This button also resets the rest of the hard coded fields.



This is how I'm passing the data to generate the fields to the child component, and the inputs are generated through a regular . Another component generates the fields themselves, like so:



How can I access these generated fields to reset them at the same time the rest of the form is reset?




getting value of action in ember route-action helper

Please refer to this issue: https://github.com/DockYard/ember-route-action-helper/issues/27

I am facing similar issue, posting it here again:

Is there any solution to this issue? I am trying to use route-action helper for checkbox as follows: Select All

It calls my action inside route, but it is passing some event object instead of checked value (I am expecting true/false) like it does for the usual action helper:

I am also facing the same issue while using select drodown: -- JDBC or HDFS load? -- JDBC HDFS Here I am expecting to get the values JDBC or HDFS when the actions is fired.

If it can be done by writing action to receive full event, please give some example how to extract required information from the event.

I am new to ember. Please help.




Getting action event parameter with ember-gestures and emblem

What I'm trying to do:

Get the event parameter on a panStart and panEnd action, like this:

panStart(event) {
  // do something with the event...
}

Deps:

ember-cli: 2.17.1
ember-cli-emblem: 0.9.0
ember-cli-htmlhandlebars: 2.0.3

various things i've tried

// does something, but as per ember docs this won't give you the event
.item{action 'panStart' on='panStart'}

// these don't work
.item panstart=""
.item onpanstart=""
.item onPanStart=""
.item panStart=""
.item panstart="{action 'panStart'}"
.item onpanstart="{action 'panStart'}"
.item onpanstart={action 'panStart'}
.item panstart="panStart"
.item onpanstart="panStart"

ember docs say to use this syntax for handlebars:

<button onclick=>Sign Up</button>

but there isn't anything in the emblem docs that describe how to translate that




vendredi 18 mai 2018

Right Click and left click options needs comes near to the clicking row

For the product, the mouse click options are wrote for action gear icon only. So if we left click on Task button(action icon), it will show options near to that icon.

While left click on the icon it showing options

and corresponding inspect(F12) html file is here:

<tr id="ember25477" class="ember-view content-row body-row-view container-view" tabindex="0" aria-label="">
<script id="metamorph-4508-start" type="text/x-placeholder">
</script>
<script id="metamorph-4531-start" type="text/x-placeholder">
</script>
<td id="ember25657" class="ember-view content-data item-number item-number-view container-view item-number-view-core_component_data-view-mixin container-view-core_component_data-view-mixin itemNumber">
<div id="ember25660" class="ember-view view">
<div>
<script id="metamorph-4593-start" type="text/x-placeholder">
</script>1<script id="metamorph-4593-end" type="text/x-placeholder">
</script>
</div>
</div>
</td>
<script id="metamorph-4531-end" type="text/x-placeholder">
</script>
<script id="metamorph-4508-end" type="text/x-placeholder">
</script>
<script id="metamorph-4509-start" type="text/x-placeholder">
</script>
<script id="metamorph-4532-start" type="text/x-placeholder">
</script>
<td id="ember25666" class="ember-view container-view">
<rs-icon id="ember25669" class="ember-view action-menu auto-actions-menu-button icon clickable-icon" style="width: 1em; height: 1em; font-size: 20px">
<icon glyph="action" class="action" style="font-size: 20px;">
</icon>
</rs-icon>
<span id="ember25672" class="ember-view view">
<script id="metamorph-4550-start" type="text/x-placeholder">
</script>CopyEditor<script id="metamorph-4550-end" type="text/x-placeholder">
</script>
</span>
</td>
<script id="metamorph-4532-end" type="text/x-placeholder">
</script>
<script id="metamorph-4533-start" type="text/x-placeholder">
</script>
<td id="ember25678" class="ember-view content-data view view-core_component_data-view-mixin description">
<div class="container">
<div class="content">
<div class="aria-hidden">Empty cell</div>
</div>
</div>
</td>
<script id="metamorph-4533-end" type="text/x-placeholder">
</script>
<script id="metamorph-4509-end" type="text/x-placeholder">
</script>
<script id="metamorph-4510-start" type="text/x-placeholder">
</script>
<script id="metamorph-4510-end" type="text/x-placeholder">
</script>
</tr>

But Now the new requirement is options have have to wherever click (both on right click and left click) on that corresponding row. So I have tried the below code:

click: function (event) {
            var eventResult = this.get('tableView').clickRow(event, this.get('object'));
            if (eventResult !== false) {
                this.get('element').focus();
                $('.content-row').bind('contextmenu', function(e) {
                    e.preventDefault();
                    var rowParentId = $(this).closest('tr').prop('id');
                    $('#'+rowParentId).find( ".action-menu" ).click();
                });
            }
            return eventResult;
        },

When I'm using the above code, right click option is working fine at the corresponding row. But the options are coming near to the gear icon only. I need the options needs to come near to wherever I click on that row.

Please provide me any other suggestion for this. Your help will be appreciate. Thanks in advance.




jeudi 17 mai 2018

How to save Sideloaded data from ajax call?

Just want to ask on how to create a JSONAPISerializer for an ajax call? From what I understand on the docs. I must first create a model before I can make a JSONAPISerializer. But I need to call a custom endpoint that is not listed as my model.

My goal is to pushPayload all the sideloaded data coming from my endpoint. but the problem is :

{  
 "data":[  
  {  
     "type":"promotions-verify",   <----- it's not an actual model 
     "attributes":{  
        "cart-items-discount-in-cents":21900
  }],
 "relationships":{...},    <---- sideloaded data that I want to push on ember-data
 "included": []              <---- sideloaded data that I want to push on ember-data
}




Redirect if already authenticated - ember simple auth

I have registration and login working for my Ember app but for some reason 'routeIfAlreadyAuthenticated' is not working currently. Here is my setup:

config/environment.js

'ember-simple-auth': {
  authenticationRoute: 'auth.login',
  routeIfAlreadyAuthenticated: 'rows',
  routeAfterAuthentication: 'rows'
}

But if I go to say /auth/login after I'm signed in it doesn't redirect me to the rows route. Does anybody know what I could be doing wrong?




How to parse string to JSON in Ember Handlebar

I am using Ember 2.16.0 and I can import string into Handlebar but when I try to access JSON property I am not getting expected result. Is there a helper that will convert a string into JSON inside Handlebar template?




While Right Click, options comes in the left side

I was worked on to make the right click as my customize menu to display using the mouse by using the below code:

click: function (event) {
    var eventResult = this.get('tableView').clickRow(event, this.get('object'));
    if (eventResult !== false) {
        this.get('element').focus();
        $('.content-row').bind('contextmenu', function(e) {
            e.preventDefault();
            var parentId = $(this).closest('tr').prop('id');
            $('#'+parentId).find( ".managed-object-action-menu" ).click();
        });
    }
    return eventResult;
},

But What happen means the options are coming in the left side for right click options. I need the options come by on right side for right click on mouse. I'm new to the ember. Your help will be appreciate. Thanks in advance.




Setting a new relation in EmberJS without original model

So I have a model created/loaded normally:

        let contact = self.get('store').createRecord('contact');

I then get the address, which is a BelongsTo relation on the model:

        let address = contact.get('address');

the returned address variable is a Proxy object, which the promise resolves as either the related model or null.

The question is how can I create a new address model and assign it to the original contact object, but with only the address proxy object?




mercredi 16 mai 2018

How to toggle class and get selected object on ember-models-table

I'm working on a project that is using ember-models-table, and cannot figure how to toggle a class and tell my controller that I've selected a specific row from the table. I've looked at the documentation but couldn't find anything that mentioned these two issues.

Many thanks in advance!




ember-electron: Different assets compiled for ember and electron apps

I'm trying to turn an existing ember app to electron app using ember-electron addon. When I run ember serve and ember electron, files in dist and electron-out/project/ember are getting generated newly.

But the assets in these folders are different.

I'm using fingerprinted assets.

The assets expected by index.html file in electron-out/project/ember aren't present in dist/assets folder.

In ember-electron/main.js, I have the lines -

protocolServe({
  cwd: join(__dirname || resolve(dirname('')), '..', 'ember'),
  app,
  protocol,
});

and

const emberAppLocation = 'serve://dist';

From my understanding, there are separate assets compiled for ember-electron app whose index.html refers to ember-electron assets but trying to fetch them from dist.

What is wrongly configured here? Please help!




Ember cannot pass parameter into action

It constantly gives me value undefined no matter what value I put in value or if I change it to onclick="". I've literally tried every combination I could think of. I've even used a tags to see if that will save the value. I'm not sure at all how I'm supposed to go about getting this image url.

This is in ember and I have used the combination in other parts of my code but this is the ONLY part that will not work.

Template file

<div class="gif-display">
              
                  <img width="150px"  src=>
              
</div>

Controller class

selectGIF: function (num) {
  console.log("num", num)
  let newPost = this.store.createRecord('post', {
    email: this.get("session.currentUser.email"),
    body: `${gifs[num].images.original.url}`,
    timestamp: new Date().getTime(),
    image: true
  });
  gifs = ''
  newPost.save()
}

And YES I have tested to see if it even runs the function and it does and the images do show up so that's not the problem either.

My question is, is it possible to pass a parameter into this function. If not is there a work around? Should I use a helper function?

Thank you!




Getting uncaught error in ember

When I'm doing the right click option for more than 5 (approx) times for certain task, it showing uncaught error as like below:

Uncaught TypeError: Cannot read property 'find' of undefined
    at Class.<anonymous> (core.js:21487)
    at fn (core.js:7779)
    at DeferredActionQueues.flush (core.js:7723)
    at Backburner.end (core.js:7738)
    at Backburner.run (core.js:7748)
    at executeTimers (core.js:7824)
    at core.js:7822

In that Place I'm having the below code:

Ember.run.later(view, function () {
    this.$().find('menu-item:eq(0)').focus();
}, 125);

Can anyone please suggest me why this error is coming and I need to avoid this error while right clicking the task for "n" number of time also. I'm new to the ember. Your help will be appreciate. Thanks in advance.




Using two different ember builds

I am having two different ember builds. Lets say one is one is parent build and one is child.

Can I have a setup where I can use components from one app inside another app?

Example: I have added the js,css and vendor js from both the projects in index.html.

<script src="../adap/emberapp-parent.js"></script>
<script src="../adap/emberapp-independent.js"></script>
...

My main usecase is, I have an parent ember app and I need to use components from another app, which is by itself an independent app.

Is this possible?




How to maintain Ember Data two-way binding when using DataTables?

I am working on a project using Ember and I have a table component. which is created in HTML/Handlebars and initialized as a DataTable using jquery.

When initialised as a Datatable, the table is no longer responsive to the refreshModel: true of the queryParams on the page and the two way binding of Ember Data is lost. This is important functionality for me so I wondered if there was a way to have the best of both worlds?

The jquery in the component.js is:

import Component from '@ember/component';

export default Component.extend({

  model: null,

  didInsertElement() {
    let table = $('#resultsTable').DataTable({
      dom: 'Bfrtip',
      paging: false,
      scrollY: 500
    });


  },

});

The table is correct on the initial render but changing one of my queryParams does not refresh the data. I tried to rerender as follows:

  didUpdateAttrs() {
    let table = $('#resultsTable').DataTable({
      destroy: true,
      dom: 'Bfrtip',
    });
  }

This works to some extent but produces some undesirable behavior such as the table updating but not updating the 'Showing x results' widgets or taking a long time to update. If do not destroy the table I receive an error like:

DataTables warning: table id={id} - Cannot reinitialise DataTable. 

Which is a limitation of the Datatables library described here

Thoughts welcome




mardi 15 mai 2018

Converting existing ember app to electron app

How do I convert a ember web app to cross platform desktop app using ember-electron?

I'm completely new to electron. I've simply installed the ember-electron addon(https://github.com/felixrieseberg/ember-electron) and started the app like this -

ember install ember-electron
ember electron

But I'm getting 'electron undefined' error in the main.js file itself on doing require('electron').

What is that I'm doing wrong here? Should I be rewriting the app or will doing small tweaks to the existing one work?




lundi 14 mai 2018

Ember call action in application route with return value

In Ember you can call an action in your current context as you would a normal function, using this.actions.actionName(). This means the action can return a value.

In my login route, I am trying to call an action from the application route in this way. However this.actions only contains the actions in my login route.

Login Route

actions: {
  test: function() {
    console.log(this.actions.sameRouteAction()); //5
    console.log(this.actions.applicationRouteAction()); // this.actions.applicationRouteAction() is not a function.
  },
  
  sameRouteAction: function() {
    return 5;
  }
}

Application Route

actions: {
  applicationRouteAction: function() {
    return 7;
  }
}

What would this.actions.applicationRouteAction() have to become in order for this to work?




minificated ember-concurrency timeout bug

there's an issue with timeout function in utils.js after production build with target set to last 1 chrome version only.

For demo open console and go to: https://cezaryh.github.io/ember-concurrency-utils-bug/

There's bug in ember-concurrency/utils module in timeout function. Code after minification looks like this:

e.timeout = function(e) {
  let t = new Ember.RSVP.Promise((t)=>{
    n = Ember.run.later(t, e)
  }), n;
  return t.__ec_cancel__ = ()=>{
    Ember.run.cancel(n)
  }
  ,t
}

The same code copied to other file (https://github.com/CezaryH/ember-concurrency-utils-bug/blob/master/app/utils.js) does not throw an error. And is minified differently

a.timeout = function(a) {
  let b, c = new Ember.RSVP.Promise((c)=>{
    b = Ember.run.later(c, a)
  });
  return c.__ec_cancel__ = ()=>{
    Ember.run.cancel(b)
  },c
}

In this case "b" is defined

that happens when build target is "last 1 Chrome versions"

config/targets.js

module.exports = {
  browsers: [
    'last 1 Chrome versions'
  ]
};

I can't figure out how to solve that, any ideas ?

that's also posted in ember-concurrency github https://github.com/machty/ember-concurrency/issues/232




dimanche 13 mai 2018

Need some guidance on Ember component functionality

I'm currently leveraging ember-cli-geolocate along with ember-google-maps to provide users with the closest point of interest to their current location. I've got the code working in a component but have now realized that I'm not able to sort. Been stuck on this a few days and could use some guidance, could also be helpful for those in the future that plan on doing something similar. Code below....

//routes/vineyard/index.js

import Ember from 'ember';
import { later } from '@ember/runloop';
import { inject as service } from '@ember/service';
import $ from 'jquery';

const { Route, set } = Ember;

export default Route.extend({
  model() {
    return this.store.findAll('vineyard');
  },
  setupController(controller, model) {
    set(controller, 'vineyards', model);
  },
  activate() {
    this.controllerFor('vineyard/index').send('distanceFrom');
  }
});

//controllers/vineyard/index.js

import Ember from 'ember';
import { inject as service } from '@ember/service';
import $ from 'jquery';

export default Ember.Controller.extend({
  userLocation: null,
  endLocation: null,
  milesAway: null,
  locationIsLoading: true,
  failState: false,
  googleMapsApi: service(),
  geolocation: service(),
  panelActions: Ember.inject.service(),
  userLocationChanged: function () {
    this.get('userLocation');
    this.toggleProperty('locationIsLoading');
  }.observes('userLocation'),
  actions: {
    distanceFrom: function() {
      this.get('geolocation').trackLocation().then((geoObject) => {
        let currentLocation = this.get('geolocation').get('currentLocation');
        this.set('userLocation', currentLocation);
      }, (reason) => {
        // this.toggleProperty('failState');
        // $('.error').css('height', '220px');
        // $('.error > p').css('height', 'auto');
        console.log('Geolocation failed because ' + reason);
      });
    },
    stopError: function() {
      this.toggleProperty('failState');
      $('.error').css('height', '0');
      $('.location-loader').animate({opacity: '0'}, 1000);
    }
  },
});

components/miles-away.js

import Component from '@ember/component';
import { inject as service } from '@ember/service';
import { later } from '@ember/runloop';
import $ from 'jquery';

export default Component.extend({
  googleMapsApi: service(),
  geolocation: service(),
  userLocation: null,
  endLocation: null,
  milesAway: null,
  distanceLoading: true,
  errorState: false,
  fadeClass: '',
  didInsertElement() {
    this.set('self', this);
    var address = this.get('address');
    var location = this.get('location');
    var distanceLoading = this.get('distanceLoading');
    var userLocationLat = location[0];
    var userLocationLon = location[1];
    let userLocation = '' + userLocationLat + ',' + userLocationLon
    this.set('userLocation', userLocation);
    this.set('endLocation', address);
    this.send('getDistance');
  },
  actions: {
    getDistance: function() {
      // let milesAway = this.get('milesAway');
      let userLocation = this.get('userLocation');
      let endLocation = this.get('endLocation');
      this._super(...arguments);
      this.get('googleMapsApi.google').then((google) => {
        var self = this;
        let distanceMatrixService = new google.maps.DistanceMatrixService();
        function calculateDistance() {
          distanceMatrixService.getDistanceMatrix({
            origins: [userLocation],
            destinations: [endLocation],
            travelMode: google.maps.TravelMode.DRIVING,
            unitSystem: google.maps.UnitSystem.IMPERIAL,
            avoidHighways: false,
            avoidTolls: false
          }, callback);
        }
        function callback(response, status) {
          if (status != google.maps.DistanceMatrixStatus.OK) {
            self.toggleProperty('errorState');
          } else {
            // var origin = response.originAddresses[0];
            // var destination = response.destinationAddresses[0];
            if (response.rows[0].elements[0].status === "ZERO_RESULTS") {
              self.toggleProperty('errorState');
            } else {
              var distance = response.rows[0].elements[0].distance;
              // var distance_value = distance.value;
              var distance_text = distance.text;
              // const miles = distance_text.substring(0, distance_text.length - 3);
              self.toggleProperty('distanceLoading');
              self.set('milesAway', distance_text);
              later((function() {
                $('.miles-away').addClass('fade-in');
              }), 45);
            }
          }
        }
        calculateDistance();
      });
    },
  }

});

components/miles-away.hbs


  <div class="miles-away-container">
    <p class="miles-away"></p>
  </div>



and finally, the template in which this is rendered..(just providing a snippet)

templates/vineyard/index.hbs

   <div class="distance">
          
            
          
          
            
            
            
          
        </div>

I'm open to implementing this in a completely different way, i know it's not even close to proper or perfect. Hoping to get some answers and insight...thanks.




How to set a TV banner in Cordova?

I don't know how to set the TV banner in Cordova, so the installed app uses it on the home screen.

I'm using cordova-plugin-android-tv which adds android:banner="@drawable/banner" to the <application> element as explain on the documentation:

https://developer.android.com/training/tv/start/start#banner

This is performed at cordova/plugins/cordova-plugin-android-tv/patch.js.

Installing the plugin worked at once and also the TV support. I was able to install the app in an Android TV and there is a launch banner on the home screen. But it's not the banner I've indicated.

The problem is that I don't know how to include the TV banner in Cordova.

I've tried putting it at cordova/res/drawable-xhdpi/banner.png and also at cordova/res/drawable/banner.png.

In config.xml I've included:

<platform name="android">
  <resource-file 
    src="res/drawable-xhdpi/banner.png" 
    target="app/src/main/res/drawable-xhdpi/banner.png" />
</platform>

And also have tried:

<platform name="android">
  <resource-file 
    src="res/drawable/banner.png" 
    target="app/src/main/res/drawable/banner.png" />
</platform>

But I don't see the banner in the Android TV home screen when it's installed.

How is it to be done?

I've checked Android and Cordova documentation, but I don't figure out how to achieve it:

https://developer.android.com/training/tv/start/start#banner

https://developer.android.com/guide/topics/resources/drawable-resource#BitmapFile

http://cordova.apache.org/docs/en/8.x/config_ref/index.html#resource-file

I'm developing the Cordova app with an Ember.js aplication using the Corber plugin. The version is Cordova 8.0.0.




samedi 12 mai 2018

How to create/install ember-cli test helpers with Ember 3?

Before v3.0, it used to be that to make a helper available to testing code, you'd import it into tests/helpers/start-app.js. Now that the testing reorg with 3.0 has removed that file, where should those imports go?

(FWIW the ember-cli docs still show the old, non-existent file: https://ember-cli.com/testing#single-helper-per-file )




Issues with Ember Functionality

I'm trying to measure distance from the user to an address in each model object. Thus far I've got the code working with hardcoded data but having a really tough time getting model data in my controller and updating my model. Files below...(also happy to hear of any alternative ways to do this i.e. a helper, etc etc)

/routes/homepage.js

import Ember from 'ember';
import { later } from '@ember/runloop';
import { inject as service } from '@ember/service';

const { Route, set } = Ember;

export default Route.extend({
  model() {
    return this.store.findAll('homepage');
  },
  setupController(controller, model) {
    set(controller, 'homepage', model);
  },
  activate() {
    this.controllerFor('homepage').send('distanceFrom');
  }
});

controllers/homepage.js

import Ember from 'ember';
import { inject as service } from '@ember/service';

export default Ember.Controller.extend({
  userLocation: null,
  endLocation: null,
  milesAway: null,
  locationIsLoading: true,
  googleMapsApi: service(),
  geolocation: service(),
  userLocationChanged: function () {
    this.get('homepage').forEach(model => {
      this.set('endLocation', model.get('address'));
    }),
    this.get('userLocation');
    this.toggleProperty('locationIsLoading');
    console.log("User's location recieved.")
    this.send('getDistance');
  }.observes('userLocation'),
  actions: {
    distanceFrom: function() {
      this.get('geolocation').trackLocation().then((geoObject) => {
        let currentLocation = this.get('geolocation').get('currentLocation');
        this.set('userLocation', currentLocation);
      }, (reason) => {
        console.log('Geolocation failed because ' + reason);
      });
    },
    getDistance: function(){
      console.log("Getting Distance");
      this._super(...arguments);
      this.get('googleMapsApi.google').then((google) => {
        let endLocation = this.get('endLocation');
        let userLocationLat = this.get('userLocation')[0];
        let userLocationLon = this.get('userLocation')[1];
        let userLocation = "" + userLocationLat + ',' + userLocationLon
        console.log(userLocation);
        let distanceMatrixService = new google.maps.DistanceMatrixService();
        $(function() {
          function calculateDistance(origin, destination) {
            distanceMatrixService.getDistanceMatrix({
              origins: [userLocation],
              destinations: [endLocation],
              travelMode: google.maps.TravelMode.DRIVING,
              unitSystem: google.maps.UnitSystem.IMPERIAL,
              avoidHighways: false,
              avoidTolls: false
            }, callback);
          }
          function callback(response, status) {
            if (status != google.maps.DistanceMatrixStatus.OK) {
              $('#result').html(err);
            } else {
              var origin = response.originAddresses[0];
              var destination = response.destinationAddresses[0];
              if (response.rows[0].elements[0].status === "ZERO_RESULTS") {
                console.log("No Results");
              } else {
                var distance = response.rows[0].elements[0].distance;
                var distance_value = distance.value;
                var distance_text = distance.text;
                var miles = distance_text.substring(0, distance_text.length - 3);
                console.log(miles);
              }
            }
          };
          calculateDistance();
        });
      });
    }
  }
});

models/homepage.js

import DS from 'ember-data';
import attr from 'ember-data/attr';
import { belongsTo } from 'ember-data/relationships';
import Contentful from 'ember-data-contentful/models/contentful';


export default Contentful.extend({
  logo: belongsTo('contentful-asset'),
  backgroundImage: belongsTo('contentful-asset'),
  rating: attr('number'),
  description: attr('string'),
  address: attr('string'),
  distanceFrom: attr(),
});

I know it's a lot but those are all the necessary files. I'd like to use the 'address' from each model object to update the distanceFrom with 'miles' for each model object. Thus having a list of points of interest with miles away showed. Make sense? Thanks!!




Ember auth with devise CORS or CSP? issue

I'm working on a headless Rails app with Ember on the frontend. I've been trying to get authentication working with devise. I followed this tutorial: http://romulomachado.github.io/2015/09/28/using-ember-simple-auth-with-devise.html but I'm getting the following in my logs:

Started POST "/users/sign_in" for 127.0.0.1 at 2018-05-12 01:36:58 -0700
Processing by SessionsController#create as JSON
Parameters: {"user"=>{"password"=>"[FILTERED]"}, "session"=>{"user"=>{"password"=>"[FILTERED]"}}}
HTTP Origin header (http://localhost:4200) didn't match request.base_url (http://localhost:3000)
Completed 422 Unprocessable Entity in 1ms (ActiveRecord: 0.0ms)
ActionController::InvalidAuthenticityToken
(ActionController::InvalidAuthenticityToken):

I'm running my rails app locally at the default port :3000, and also running the ember instance locally (out of a different directory) at the default port :4200.

I've installed ember-cli-cors and ember install ember-cli-content-security-policy, and tried everything I know of to get it working. Any help is greatly appreciated.

Here are my files:

//config/environment.js
module.exports = function(environment) {
  let ENV = {
    modulePrefix: 'dino-ui',
    environment,
    rootURL: '/',
    locationType: 'auto',
    contentSecurityPolicy: {
      'default-src': "'self' *",
      'script-src': "'self' *",
      'connect-src': "'self' *"
    },
    EmberENV: {
      FEATURES: {
      },
      EXTEND_PROTOTYPES: {
        Date: false
      }
    },

    APP: {
    }
  };

  ENV['ember-simple-auth'] = {
    routeAfterAuthentication: 'dashboard',
    routeIfAlreadyAuthenticated: 'dashboard'
  }
...
return ENV;
}
//components/login-form.js
import Ember from 'ember';

const { service } = Ember.inject;

export default Ember.Component.extend({
  session: service('session'),

  actions: {
    authenticate: function() {
      let { email, password } = this.getProperties('email', 'password');
      return this.get('session').authenticate('authenticator:devise', email, password).catch((reason) => {
        this.set('errorMessage', reason.error);
      });
    }
  }
});

//templates/login-form.hbs
<form >
  <label for="email">Login</label>
  

  <label for="password">Password</label>
  

  <button type="submit">Login</button>
</form>


  


//application.rb
class Application < Rails::Application
    # Initialize configuration defaults for originally generated Rails version.
    config.middleware.insert_before 0, Rack::Cors do
      allow do
        origins '*'
        resource '*', :headers => :any, :methods => [:get, :post, :put, :delete, :options, :patch, :head]
      end
    end
    config.middleware.use ActionDispatch::Flash
  ....

//controllers/application.rb
class ApplicationController < ActionController::Base
  protect_from_forgery with: :exception, prepend: true

  before_action :authenticate_user_from_token!
  before_action :authenticate_user!

  private

  def authenticate_user_from_token!
    authenticate_with_http_token do |token, options|
      user_email = options[:email].presence
      user = user_email && User.find_by_email(user_email)

      if user && Devise.secure_compare(user.authentication_token, token)
        sign_in user, store: false
      end
    end
  end
end

//controllers/sessions.rb
class SessionsController < Devise::SessionsController
  respond_to :html, :json

  def create
    super do |user|
      if request.format.json?
        data = {
          token: user.authentication_token,
          email: user.email
        }
        render json: data, status: 201 and return
      end
    end
  end
end




vendredi 11 mai 2018

Relationship with 2 API's getting error

Please help me, it's for a job interview!!

I have 2 API's:

  1. http://example.api.com/api.json (this file have aprox 5mb)
  2. http://api.com/:itemId

The 1st one have all data that i need, like this:

{
"realms": [
{"name":"Azralon","slug":"azralon"}],
"auctions": [
{"auc":828911977,"item":76139,"owner":"Bloodkina","bid":15294990,"buyout":16099990,"quantity":10,"timeLeft":"VERY_LONG"},
{"auc":828911979,"item":10000,"owner":"Bloodkina", "bid":15294990,"buyout":16099990,"quantity":100,"timeLeft":"VERY_LONG"},
{"auc":829305192,"item":98828,"owner":"Tempestivå","bid":15294990,"buyout":16099990,"quantity":5,"timeLeft":"VERY_LONG"},
{"auc":829305193,"item":98728,"owner":"Tempestivå", "bid":15294990,"buyout":16099990,"quantity":2,"timeLeft":"VERY_LONG"}
]}

The 2nd one have the name of the Items, but it only responds when i pass itemId as parameter. For example the item:76139, like http://api.com/76139

{
    "id": 76139,
    "description": "",
    "name": "Wild Jade",
    "icon": "inv_misc_gem_x4_rare_uncut_green",
}

I want to show the name of item and owner, but i getting an error like <DS.PromiseObject:ember71726> im my item field, the owner field is ok. How can i do this?? (it's the Blizzard API for auctions and items)

model/auction.js

import DS from 'ember-data';

export default DS.Model.extend({
  auc: DS.attr('number'),
  items: DS.belongsTo('item'),
  owner: DS.attr('string'),
});

model/item.js

import DS from 'ember-data';

export default DS.Model.extend({
  auctions: DS.hasMany('auction'),
  name: DS.attr('string')
});

routes/index.js

import Route from '@ember/routing/route';

export default Route.extend({
  model(){
    return this.store.findAll('auction');
  }
});

routes/item.js

import Route from '@ember/routing/route';

export default Route.extend({
  model(params){
    return this.store.findRecord('item', params.item_id)
  },
});

serializers/auction.js

import DS from 'ember-data';

export default DS.RESTSerializer.extend({
  normalizeResponse (store, primaryModelClass, payload, id, requestType) {
    return {
      realms: payload.realms,
      data: payload.auctions.map(ah=>{
        return {
        id: ah.auc,
        type:'auction',
        attributes: ah
        }
      })
    };
  }
});

serializers/item.js

import DS from 'ember-data';

export default DS.JSONSerializer.extend({
  normalizeResponse (store, primaryModelClass, payload, id, requestType) {
    payload = {
      data : payload,
      id: payload.id,
      name: payload.name
    };
    return this._super(store, primaryModelClass, payload, id, requestType)
  }
});

templates/index.hbs


<ul>
 <li></li>
 <li></li>
 <li></li>
 <li></li>
 <li></li>
 <li></li>
</ul>


Error




jeudi 10 mai 2018

Ember Push Range To Array

I have to variables in my template "from" and "to" that loops through array of data in a select tag

i want to push the "from", "to" and the values in between to another array

like if the array was like this

[1,2,3,4,5,6,7,8,9,0]

if the user chose "2" in the from field and "6" in the "to" field i want to push "2" and "6" and the data in between so the result would be

[2,3,4,5,6]

i tried to this

result : [],
time : Ember.computed('from', 'to', function() {
    this.get('formData.time').forEach(time => {
    // formData.time is a service from which i'm getting the array
        if (time == this.get('from')) this.get('result').push(time)
        this.get('result').push(time)
        if (time == this.get('to')) this.get('result').push(time)
    })
    return this.get('result')
})

but it pushes all the array, i know it's a wrong approach that i'm doing but i couldn't find the proper way to do it

Help Appreciated.




mercredi 9 mai 2018

Ember.js correct syntax for passing closure actions to nested components

When passing a closure action down through some nested components, is there a difference between passing the action down using the action helper (First image), and simply passing the action down as a property (Second image)?

Passing action down with the action helper

Passing action down as a property




Need to remove the Input field

I need to remove the Input field element, when the type is hidden, when I'm selecting hidden type for control type in another tab from autocomplete type, the value is getting hide in display. but in the console(F12) is showing like below with the value:

<div id="ember30156" class="ember-view hidden field" core-role="utility-field" aria-label="Non hidden">
<input id="ember30193" class="ember-view ember-text-field hidden text-field component" type="hidden" name="non-hidden" value="I am Hidden">
</div>

In the network field also showing like below with the value

------WebKitFormBoundaryMUmkbDAG6Iw0D4Xj
Content-Disposition: form-data; name="hidden"

I am Hidden
------WebKitFormBoundaryMUmkbDAG6Iw0D4Xj
Content-Disposition: form-data; name="rc"

1
------WebKitFormBoundaryMUmkbDAG6Iw0D4Xj--

But I need to hide the values from the both element and network tab of console. Here is my code

Core.view.Form.Field.extend()
    .named('Core.view.Form.Field.hidden')
    .reopen({
        template: Ember.Handlebars.compile(''),
        field: Ember.TextField.extend({
            type: "hidden",
            attributeBindings: ['name', 'value'],
            classNames: 'hidden',
            noLabel: true
        })
    });

Please provide me suggestion on this. I'm new to the ember. Thanks in advance. Your help is more appreciate. Thanks in advance.




Post request in Emberjs with Django rest

I am trying to do some crud applications My Backend is Django Rest Framework front end i'm using Emberjs

I am not able to perform post request i'm getting unsupported media error here is my code

//model js customer.js

import DS from 'ember-data';

export default DS.Model.extend({
  name: DS.attr('string'),
  company: DS.attr('string'),
  title: DS.attr('string')
});


//route customer.js

import Route from '@ember/routing/route';

export default Route.extend({
  model(params){
    return Ember.RSVP.hash({
      customers: this.store.findAll('customers'),
    })
  },
  actions:{
    saveCustomer(){
      let customer = this.store.CreateRecord('customers',{
        name: this.getProperties('name'),
        company: this.getProperties('company'),
        city: this.getProperties('cist'),
      })
      customer.save();
    }
  },
});


//template customers.hbs

<table>
  <tr>
    <th>Name</th>
    <th>Company</th>
    <th>City</th>
  </tr>
  
     <tr>
       <td></td>
       <td></td>
       <td></td>
     </tr>
   
</table>

  <div class="layout-row">
    <div class="layout-column flex-50">
      
      
      
    </div>
  </div>
  <div class="layout-row">
    Submit
  </div>



// adapter application.js

import DS from 'ember-data';

export default DS.RESTAdapter.extend({
  namespace: 'api/v1',
  host: 'http://localhost:8000'
});

any one who can help to get out of this ..I am using my backed django rest framework.I tried my backed code in post man it works well but when i'm using with ember i'm not able to post request form client side




customize menu on right click for entire row

presently I'm working to make the right click as my customize menu to display using the mouse. Here are my code

click: function (event) {
                var eventResult = this.get('tableView').clickRow(event, this.get('object'));
                if (eventResult !== false) {
                    this.get('element').focus();
                    $('.content-row').bind('contextmenu', function(e) {
                        e.preventDefault();
                        var parentId = $(this).closest('tr').prop('id');
                        alert(parentId);
                        $('.managed-object-action-menu').click();
                    });
                }
                return eventResult;
            },

If I'm using the .managed-object-action-menu, it will affect for entire rows in the table. But I need only to display customize menu for the active row.

I'm new to the ember and jquery. Please provide me suggestion on this. Your help will be appreciate. Thanks in advance.




mardi 8 mai 2018

Needs to call console outside the function

I had wrote the console log in the below function, The presentDialog() function is on given below

presentDialog: function () {
        return new Promise(function (resolve, reject) {
           RSuite.services({
               service:'content/inspect',
               json: true
           })
           .done(function (result) {    
                    resolve(result);
           }.bind(this));
        });
    }.on('init'),

Expected output needs to be like:

    var result1;
    this.presentDialog().then(function(result2) {

                  result1 = result2 
              });
 console.log(result1)

I'm new to the ember and javascript. The console log is calling inside the function, but I need to print outside the function. Please provide me suggestion on this. Your help will be appreciate. Thanks in advance.




lundi 7 mai 2018

Ember JS: How can I practice 'Data Down, Actions Up' with composable helpers?

New to ember and practicing 'Data Down, Actions Up' with composable helpers. Is this possible? This is what I'm attempting to do:

//parent template


//child component template
<div >

But I get a 'no action handler for: toggleToppings' error.

So then I tried making an action on the child, like so:

//child component template 
<div >

//child component JS
actions: {
   togglePizza() {
          this.get('toggleToppings')();
   }
}

But when I click on that, nothing happens at all. :( How can I call my parent action from within my component template?




EMBER - Each handler is generating ember-view div around my component

So, my container is a flexbox and I am trying to render components with the handlebars each helper. The problem is that flexbox only affects its immediate children and being that the each helper is surrounding each of the components it generates with a div with the class of ember-view, my flexbox is obviously affecting the divs the helpers generating instead of my components.

EXAMPLE:

    
        <p class="text text--watermark text--bold">NEW</p>
        
                            
        
    

OUTPUT: Example of dom problem

What would be the best of getting around while still using the each helper?




Ember: Uncaught Error: infinite rendering invalidation detected

I am getting below error while running one of my component:

Uncaught Error: infinite rendering invalidation detected

On doing some research, it says this is an issue with Ember but I am not sure, so any thoughts here are appreciated? I am calling a service to return a promise and then doing promise.then(response) and if there is an error resolving the promise I am throwing an error.




cannot call class as a function

I am currently facing an issue with computed properties, I have a model named crossconnection containing some computed properties like :

relevantPoints: computed(function () {

    if (this.get('IsCA') === true && this.get('IsCM') === true) {
        return "/assets/images/big/ca-cm.png";
    }
    else if (this.get('IsCA') === true && this.get('IsCM') === false) {
        return "/assets/images/big/ca.png";
    }
    else if (this.get('IsCA') === false && this.get('IsCM') === true) {
        return "/assets/images/big/cm.png";
    }
    else if (this.get('IsCA') === false && this.get('IsCM') === false) {
        return "/assets/images/big/nca-ncm.png";
    }

}),

when running the project I keep getting the following error :

Uncaught TypeError: Cannot call a class as a function

Can somebody please clarify ?


PS : I am using,

  • Ember : 3.0.0
  • Ember Data : 3.0.2
  • jQuery : 3.3.1
  • Ember Bootstrap : 1.2.2



Need to hide particular hidden metadata values

I need to hide the hidden type metadata information from the console and network tab (F12). I'm having the metadata information, in that lot of types are there, but for the hidden type selection, If I select the hidden type by using below the console

<option id="ember11079" class="ember-view select-option" value="hidden">
<script id="metamorph-1890-start" type="text/x-placeholder"></script>
hidden
<script id="metamorph-1890-end" type="text/x-placeholder"></script></option>

I'm getting the below information from the network tab(F12),

------WebKitFormBoundaryZHAeGq1ANBBRpGJM
Content-Disposition: form-data; name="name"

hidden
------WebKitFormBoundaryZHAeGq1ANBBRpGJM
Content-Disposition: form-data; name="label"

some
------WebKitFormBoundaryZHAeGq1ANBBRpGJM
Content-Disposition: form-data; name="description"


------WebKitFormBoundaryZHAeGq1ANBBRpGJM
Content-Disposition: form-data; name="icon"

$blank
------WebKitFormBoundaryZHAeGq1ANBBRpGJM
Content-Disposition: form-data; name="Type"

hidden

------WebKitFormBoundaryZHAeGq1ANBBRpGJM
Content-Disposition: form-data; name="rc"

1
------WebKitFormBoundaryZHAeGq1ANBBRpGJM--

Actually, If that type is hidden means the whole metadata filled information needs to disable or hide from the Inspect tab(F12) of network and console too.

javascript I'm using like below:

if (data instanceof Array) {
                $(data).each(function () {
                    $("<input type='hidden'>").attr({
                        name : this.name,
                        value : this.value
                    }).appendTo(form);
                });
            } else {
                $.each(data || {}, function (name, value) {
                    $("<input type='hidden'>").attr({
                        name : name,
                        value : value
                    }).appendTo(form);
                });
            }

Please provide me suggestion to disable the information from Inspect tab. Your help will be appreciated. Thanks in advance.




dimanche 6 mai 2018

Generating a Route and Template

I have a problem with this below code. Can anyone check if this is right? Thank you for your assistance in advance!

screen with codeenter image description here




Could Import bpmn-js,bpmn-js-properties-panel module using ember-browserify

I am having ember-cli 2.16.2. I am getting the following error when I am trying to import bpmn-js module in one of my route. Uncaught Error: Could not find module npm:bpmn-js imported from prject/routes/hello at missingModule (loader.js:247) at findModule (loader.js:258)




samedi 5 mai 2018

Bootstrap's event handler not working in Emberjs component

In my component's didInsertElement() method I register event handler for Bootstraps's tab component:

didInsertElement() {
    this._super(...arguments);

    console.log('didInsertElement....');
    console.log(this.$("a[data-toggle='tab']"));

    this.$('a[data-toggle="tab"]').on('shown.bs.tab', function(e) {
        console.log('TAB SHOWN....');
        console.log(e);
    });
}

However, my handler is not executed. I copied the same handler code on console in browser and it works. This only seems to be in case of Bootsrap tab. Appearance of my console messages confirm that didInsertElement() is working fine.




vendredi 4 mai 2018

Ember extend component computed property?

I have a parent component Parent and Child component that extends Parent. In Parent there is a computed property items that returns array. Is there a way to have items in Child component that will return both elements from parent array and additional elements e.g.

Parent:

Ember.Component.extend({
  items: computed(function() {
    return ['a', 'b'];
  })
})

Child:

Parent.extend({
  items: computed(function() {
    // I want to add some more elements to parent property
    // so this should return ['a', 'b', 'c', 'd']
    return this.get('items').concat(['c', 'd']);
  })
});

Currently I get Maximum call stack size exceeded.




How to access model instance from function in model?

I wrote a function inside one of my Ember models that's designed to set some properties on the model instance. Below is a gross over-simplification of what the function is trying to do.

// In widget.js

export default DS.Model.extend({
  ...
  turnOn() {
    this.set('enabled', true);
  }
});

I come from a Ruby background, so something like this feels very natural and appropriate, but I can't seem to access the model instance from within the turnOn() function. Am I doing something wrong? Is there a more appropriate way to accomplish what I'm trying to do?




"some of the associated records were not loaded" but they are

I use Ember.js in something of an untraditional way, where I prefer to load everything I could want in my routes, and then switch my relationships to async: false

However, I've recently run into a peculiar issue, where I am updating a relationship on a model, then pushing the updated record into the store. In most cases, it works, but in this case I'm getting the "some of the associated records were not loaded" error, which is particularly bizzare, since they are definitely loaded.

It seems like ember.js just isn't linking them up properly during the store.push? Does anyone have any insights?




Ember-models-table addon throws ember warn error while trying to use 'routeName' property

Am using ember-models-table to display table in my applicaiton. The table is great for sorting , pagination etc, but am trying to route from specific row to different page based on the id. it has mentioned in its example to use 'routeName' But when I use it throws the following error:

"Assertion Failed: When calling warn you must provide an options hash as the third parameter. options should include an id property."

My .js coding :

columns:[   
        {
          "propertyName": "firstName",
          "title":"First Name",
          "routeName":"/#/profile/_id"
},

and so on

Thanks for your help.




Ember g-recaptcha not rendering on refresh

I realize a strange behavior for the component when i'm refeshing a route or access it directly. The component doesn't show up and this is what I have in my console :

Uncaught TypeError: window.grecaptcha.render is not a function

When I look under Render Performance in the Ember Inspector, the component is not rendered. Then, i'm going on an other route by clicking on a and the component is working perfectly.




jeudi 3 mai 2018

filterWithSelect in ember model Tables, remove regex

Using Ember Models Table

If I have set a field in my database to include: male and female

and I have this in my columns, I'm using this:

    {
        "propertyName": "sex",
        "title": "Sex",
        "filterWithSelect": true,
        "sortFilterOptions": true
    },

This works great if I select 'female', but 'male' includes both sexes. Is there any way to restrict it to the entire string, instead of it doing a regex?




Ember: Error while processing route. Can't hit API

This code works (hardcoded):

import Ember from 'ember';
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';

export default Ember.Route.extend(AuthenticatedRouteMixin, {
    model() {
        let stars = [
            {
                key: "johnlennon",
                logoUrl: "https://www.images.com/johnl.png",
                name: "John Lennon",
                alive: false
            }
        }
    }
});

When I do this, it doesn't (from API):

import Ember from 'ember';
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
import config from '../../../../../config/environment';

export default Ember.Route.extend(AuthenticatedRouteMixin, {
    model() {
        const token = this.get('session.data.authenticated.token');
        return Ember.RSVP.hash({
            stars: Ember.$.getJSON(Ember.$.getJSON(`${config.APP.starsAPI}/api/stars?authorizationToken=${token}`))
        });
    }
});

The error I receive:

jquery.js:9175 GET http://localhost:4242/stars/948/connect/[object%20Object] 404 (Not Found)

ember.debug.js:30291 Error while processing route: stars.show.connect.stars.index

As you may have guessed, I need it to work from API. Why is that giving me the error?




how to call parent component method from child component in ember js

I know about action down and data up strategy in Ember but is there a way I can call parent component method (not action) from child component?




Ember component call an action in a route or controller

I have a component the main purpose of which is to display a row of items. Every row has a delete button to make it possible to delete a row. How is possible to pass an action from a template to the component which will trigger an action in a router ?

Here is the template using the component:

#templates/holiday-hours.hbs


  


Here is the component template:

# templates/components/holiday-hour.hbs
...
div class="col-sm-1">
    
    <button type="button" class="btn btn-danger btn-sm mt-1" >
      <span class="oi oi-trash"></span>
    </button>
    
</div>

I'm using the same component to display a row and to create a new item (holiday-hour).

I'm using ember 3.1.2

Thank you




Ember: Serialize arbitrary hash key names

In my model I have an arbitrary hash (DS.attr()) whose properties are returned dasherized. Example,

{
  'lorem-ipsum': 'Some value',
  'dolor-sit': 'Some value'
}

I want the key names to be camelCased. How can I achieve this?




mercredi 2 mai 2018

Validate hasMany relationship against another hasMany

I have 3 models: type, restriction and item.

A type is simple and just has an id:

app/models/type.js:

import Model from 'ember-data/model';
export default Model.extend({});

A restriction can have many type describing the allowable types for an item with this restriction:

app/models/restriction.js:

import Model from 'ember-data/model';
import { hasMany } from 'ember-data/relationships';

export default Model.extend({
  allowedTypes: hasMany( "type" )
});

An item can have many type but also can have many restriction and the type must only be a subset of the intersection of the allowed types for all the restrictions (and if there is at least one restriction then it must have at least one type).

I've implemented a validation for this using a computed property:

app/models/item.js:

import Model from 'ember-data/model';
import { computed } from '@ember/object';
import { hasMany } from 'ember-data/relationships';
import { isEmpty } from '@ember/utils';

const peekHasMany    = attr => ( item => item.hasMany( attr ).ids() );
const hasItems       = array => !isEmpty( array );
const includedIn     = array => ( item => array.indexOf( item ) >= 0 );
const intersectionOf = ( array1, array2, index ) => index >= 0 ? array1.filter( includedIn( array2 ) ) : array2;

export default Model.extend({
  types:        hasMany( "type" ),
  restrictions: hasMany( "restriction" ),
  isValidTypes: computed(
    "types.[]",
    "restrictions.@each.allowedTypes",
    function(){
      let restrictions = this.hasMany( "restrictions" ).value();

      if ( isEmpty( restrictions ) )
      {
        return true;
      }

      let allowed = restrictions
                      .map( peekHasMany( "allowedTypes" ) )
                      .filter( hasItems );

      if ( isEmpty( allowed ) )
      {
        return true;
      }

      let types = this.hasMany( "types" ).ids();
      if ( isEmpty( types ) )
      {
        return false;
      }

      let allowedTypes = allowed.reduce( intersectionOf );
      return types.every( includedIn( allowedTypes ) );
    }
  )
});

This uses the DS.Model.hasMany( attributeName ) to synchronously get the HasManyReference for the relationships which relies on the referenced models being loaded.

How can I change the computed property to use this.get() to asynchronously get both attributes (and the child attributes) rather than using this.hasMany() synchronously?




Ember test fails in VSO user agent machine but passes in dev box

Ember test passes in my dev box but it fails when I pushed the solution to VSO.
Local box version uses Node V8.10.0 NPM 5.7.1 
User agent machines uses node/v6.9.2 npm/4.4.1
I am not sure if this is related to node version difference but the test used to pass all the time. I have not changed the package.json or the tests.

I noticed a warning ember-cli-babel has been deprecated. Please upgrade to at least ember-cli-bable 6.6 version. Not sure I need to upgrade this.

Here is my package.json

{     
  "devDependencies": {
    "active-model-adapter": "2.1.1",
    "broccoli-asset-rev": "2.7.0",
    "ember-ajax": "0.7.1",
    "ember-cli": "2.4.2",
    "ember-cli-app-version": "1.0.1",
    "ember-cli-babel": "5.2.8",
    "ember-cli-blanket": "0.9.10",
    "ember-cli-content-security-policy": "0.4.0",
    "ember-cli-dependency-checker": "1.4.0",
    "ember-cli-htmlbars": "1.3.4",
    "ember-cli-htmlbars-inline-precompile": "0.3.13",
    "ember-cli-ic-ajax": "0.2.1",
    "ember-cli-inject-live-reload": "1.7.0",
    "ember-cli-qunit": "1.4.2",
    "ember-cli-release": "0.2.8",
    "ember-cli-sass": "5.5.1",
    "ember-cli-spinjs": "1.3.0",
    "ember-cli-sri": "2.1.1",
    "ember-cli-uglify": "1.2.0",
    "ember-data": "2.14.10",
    "ember-disable-proxy-controllers": "1.0.1",
    "ember-export-application-global": "1.1.1",
    "ember-getowner-polyfill": "1.2.5",
    "ember-ic-you": "0.1.5",
    "ember-in-viewport": "2.1.1",
    "ember-lazy-image": "0.0.15",
    "ember-load-initializers": "0.5.1",
    "ember-modal-dialog": "0.8.8",
    "ember-resolver": "2.1.1",
    "ember-simple-auth": "1.1.0-beta.3",
    "ember-truth-helpers": "1.2.0",
    "loader.js": "4.6.0",
    "modernizr": "3.0.0-alpha.4"
  }
}


Below is the error that I am getting in VSO

2018-05-01T02:08:18.0622840Z         actual: >
2018-05-01T02:08:18.0622935Z             null
2018-05-01T02:08:18.0623053Z         stack: >
2018-05-01T02:08:18.0623162Z             http://localhost:7357/assets/test-support.js:12742:21
2018-05-01T02:08:18.0623287Z             _setupContainer@http://localhost:7357/assets/test-support.js:13628:65
2018-05-01T02:08:18.0623431Z             _setupIntegratedContainer@http://localhost:7357/assets/test-support.js:13663:27
2018-05-01T02:08:18.0623586Z             setupContainer@http://localhost:7357/assets/test-support.js:13487:39
2018-05-01T02:08:18.0623910Z             http://localhost:7357/assets/test-support.js:12541:30
2018-05-01T02:08:18.0624038Z             initializePromise@http://localhost:7357/assets/vendor.js:63149:15
2018-05-01T02:08:18.0624187Z             Promise@http://localhost:7357/assets/vendor.js:64999:38
2018-05-01T02:08:18.0624310Z             nextStep@http://localhost:7357/assets/test-support.js:12540:52
2018-05-01T02:08:18.0624436Z             invokeSteps@http://localhost:7357/assets/test-support.js:12547:22
2018-05-01T02:08:18.0624580Z             setup@http://localhost:7357/assets/test-support.js:12497:30
2018-05-01T02:08:18.0624704Z             setup@http://localhost:7357/assets/test-support.js:12271:28
2018-05-01T02:08:18.0624827Z             callHook@http://localhost:7357/assets/test-support.js:2727:24
2018-05-01T02:08:18.0624982Z             runHook@http://localhost:7357/assets/test-support.js:2720:13
2018-05-01T02:08:18.0625114Z             process@http://localhost:7357/assets/test-support.js:2487:24
2018-05-01T02:08:18.0625392Z             begin@http://localhost:7357/assets/test-support.js:2469:9
2018-05-01T02:08:18.0625539Z             http://localhost:7357/assets/test-support.js:2529:9
2018-05-01T02:08:18.0625647Z         message: >
2018-05-01T02:08:18.0625795Z             Promise rejected before follow button renders for authenticated user and for the leaf level forum: undefined is not a constructor (evaluating 'setupContainer(registry || container)')
2018-05-01T02:08:18.0625953Z         Log: |
2018-05-01T02:08:18.0626043Z     ...


I tried installing ember-cli-sass@latest and installed dependencies  broccoli-sass-source-maps@latest and node-sass@latest. The test passes but website display nothing due to error related to this change. 

This test was passing with out any update, recently it start failing, I don't know what part needs update.

Can you help what I am missing or needs to update?




Disable or hide specific inspect panel tabs

I want to hide or disable 4 inspect tabs out of 6 tabs in the group of Inspector Body.

My 6 Inspect tab of html file was mentioned in the snippet

<div class="inspectors-view">
        <script id="metamorph-86-start" type="text/x-placeholder"></script>
            <div class="inspector-chooser">
                <script id="metamorph-92-start" type="text/x-placeholder"></script><script id="metamorph-223-start" type="text/x-placeholder"></script>
                    <rs-icon id="ember5714" class="ember-view icon clickable-icon active" title="Preview &amp; Information" style="width: 1em; height: 1em; font-size: 24px"><icon glyph="preview" class="preview" style="font-size: 24px;"></icon></rs-icon>
                <script id="metamorph-223-end" type="text/x-placeholder"></script><script id="metamorph-224-start" type="text/x-placeholder"></script>
                    <rs-icon id="ember5717" class="ember-view icon clickable-icon" style="width: 1em; height: 1em; font-size: 24px"><icon glyph="metadata_global" class="metadata_global" style="font-size: 24px;"></icon></rs-icon>
                <script id="metamorph-224-end" type="text/x-placeholder"></script><script id="metamorph-225-start" type="text/x-placeholder"></script>
                    <rs-icon id="ember5720" class="ember-view icon clickable-icon" style="width: 1em; height: 1em; font-size: 24px"><icon glyph="metadata_contextual" class="metadata_contextual" style="font-size: 24px;"></icon></rs-icon>
                <script id="metamorph-225-end" type="text/x-placeholder"></script><script id="metamorph-226-start" type="text/x-placeholder"></script>
                    <rs-icon id="ember5723" class="ember-view icon clickable-icon" title="Aliases" style="width: 1em; height: 1em; font-size: 24px"><icon glyph="alias" class="alias" style="font-size: 24px;"></icon></rs-icon>
                <script id="metamorph-226-end" type="text/x-placeholder"></script><script id="metamorph-227-start" type="text/x-placeholder"></script>
                    <rs-icon id="ember5726" class="ember-view icon clickable-icon" title="Added to..." style="width: 1em; height: 1em; font-size: 24px"><icon glyph="references" class="references" style="font-size: 24px;"></icon></rs-icon>
                <script id="metamorph-227-end" type="text/x-placeholder"></script><script id="metamorph-228-start" type="text/x-placeholder"></script>
                    <rs-icon id="ember5729" class="ember-view icon clickable-icon" title="Permissions" style="width: 1em; height: 1em; font-size: 24px"><icon glyph="permissions" class="permissions" style="font-size: 24px;"></icon></rs-icon>
                <script id="metamorph-228-end" type="text/x-placeholder"></script><script id="metamorph-92-end" type="text/x-placeholder"></script>
            </div>
        <script id="metamorph-86-end" type="text/x-placeholder"></script>
        <div class="inspector-view">
            <script id="metamorph-93-start" type="text/x-placeholder"></script><script id="metamorph-93-end" type="text/x-placeholder"></script>
            <script id="metamorph-94-start" type="text/x-placeholder"></script>
                <script id="metamorph-95-start" type="text/x-placeholder"></script><div id="ember4758" class="ember-view inspector-body preview-and-information-view"><summary-info>
        <ui-summary-section tabindex="0">
                <ui-presentation>
                        <h2 id="ember4767" class="ember-view inspect-heading message"><script id="metamorph-96-start" type="text/x-placeholder"></script>Content Details<script id="metamorph-96-end" type="text/x-placeholder"></script></h2>
                </ui-presentation>
                <ui-content>
                        <table id="ember4804" class="ember-view details-list"><tbody>
        <script id="metamorph-100-start" type="text/x-placeholder"></script><script id="metamorph-97-start" type="text/x-placeholder"></script>
                <tr>
                        <script id="metamorph-102-start" type="text/x-placeholder"></script><script id="metamorph-101-start" type="text/x-placeholder"></script>
                                <td core-role="icon"><rs-icon id="ember4864" class="ember-view icon id" title="ID" style=""><icon glyph="type_dita_topic" class="type_dita_topic" set="types"></icon></rs-icon></td>
                                <td core-role="label" class="id" data-bindattr-4="4"><script id="metamorph-103-start" type="text/x-placeholder"></script>ID<script id="metamorph-103-end" type="text/x-placeholder"></script>
                                </td><td core-role="value" class="id" colspan="4" data-bindattr-5="5">
                                        <script id="metamorph-104-start" type="text/x-placeholder"></script>
                                                <script id="metamorph-105-start" type="text/x-placeholder"></script>1008 -&gt; 1006<script id="metamorph-105-end" type="text/x-placeholder"></script>
                                        <script id="metamorph-104-end" type="text/x-placeholder"></script>
                                </td>
                        <script id="metamorph-101-end" type="text/x-placeholder"></script><script id="metamorph-102-end" type="text/x-placeholder"></script>
                </tr>
        <script id="metamorph-97-end" type="text/x-placeholder"></script><script id="metamorph-98-start" type="text/x-placeholder"></script>
                <tr>
                        <script id="metamorph-108-start" type="text/x-placeholder"></script><script id="metamorph-106-start" type="text/x-placeholder"></script>
                                <td core-role="icon"><rs-icon id="ember4883" class="ember-view icon dtCreated" title="Created" style=""><icon glyph="version" class="version"></icon></rs-icon></td>
                                <td core-role="label" class="dtCreated" data-bindattr-6="6"><script id="metamorph-109-start" type="text/x-placeholder"></script>Created<script id="metamorph-109-end" type="text/x-placeholder"></script>
                                </td><td core-role="value" class="dtCreated" data-bindattr-7="7">
                                        <script id="metamorph-110-start" type="text/x-placeholder"></script>
                                                <script id="metamorph-111-start" type="text/x-placeholder"></script>2018-Mar-9 15:22<script id="metamorph-111-end" type="text/x-placeholder"></script>
                                        <script id="metamorph-110-end" type="text/x-placeholder"></script>
                                </td>
                        <script id="metamorph-106-end" type="text/x-placeholder"></script><script id="metamorph-107-start" type="text/x-placeholder"></script>
                                <td core-role="icon"><rs-icon id="ember4889" class="ember-view icon creator" title="Created by" style=""><icon glyph="user" class="user"></icon></rs-icon></td>
                                <td core-role="label" class="creator" data-bindattr-8="8"><script id="metamorph-112-start" type="text/x-placeholder"></script>Created by<script id="metamorph-112-end" type="text/x-placeholder"></script>
                                </td><td core-role="value" class="creator" data-bindattr-9="9">
                                        <script id="metamorph-113-start" type="text/x-placeholder"></script>
                                                <script id="metamorph-114-start" type="text/x-placeholder"></script>system<script id="metamorph-114-end" type="text/x-placeholder"></script>
                                        <script id="metamorph-113-end" type="text/x-placeholder"></script>
                                </td>
                        <script id="metamorph-107-end" type="text/x-placeholder"></script><script id="metamorph-108-end" type="text/x-placeholder"></script>
                </tr>
        <script id="metamorph-98-end" type="text/x-placeholder"></script><script id="metamorph-99-start" type="text/x-placeholder"></script>
                <tr>
                        <script id="metamorph-117-start" type="text/x-placeholder"></script><script id="metamorph-115-start" type="text/x-placeholder"></script>
                                <td core-role="icon"><rs-icon id="ember4908" class="ember-view icon dtModified" title="Modified" style=""><icon glyph="versions" class="versions"></icon></rs-icon></td>
                                <td core-role="label" class="dtModified" data-bindattr-10="10"><script id="metamorph-118-start" type="text/x-placeholder"></script>Modified<script id="metamorph-118-end" type="text/x-placeholder"></script>
                                </td><td core-role="value" class="dtModified" data-bindattr-11="11">
                                        <script id="metamorph-119-start" type="text/x-placeholder"></script>
                                                <script id="metamorph-120-start" type="text/x-placeholder"></script>2018-Apr-13 18:07<script id="metamorph-120-end" type="text/x-placeholder"></script>
                                        <script id="metamorph-119-end" type="text/x-placeholder"></script>
                                </td>
                        <script id="metamorph-115-end" type="text/x-placeholder"></script><script id="metamorph-116-start" type="text/x-placeholder"></script>
                                <td core-role="icon"><rs-icon id="ember4914" class="ember-view icon userId" title="Modified by" style=""><icon glyph="user" class="user"></icon></rs-icon></td>
                                <td core-role="label" class="userId" data-bindattr-12="12"><script id="metamorph-121-start" type="text/x-placeholder"></script>Modified by<script id="metamorph-121-end" type="text/x-placeholder"></script>
                                </td><td core-role="value" class="userId" data-bindattr-13="13">
                                        <script id="metamorph-122-start" type="text/x-placeholder"></script>
                                                <script id="metamorph-123-start" type="text/x-placeholder"></script>admin<script id="metamorph-123-end" type="text/x-placeholder"></script>
                                        <script id="metamorph-122-end" type="text/x-placeholder"></script>
                                </td>
                        <script id="metamorph-116-end" type="text/x-placeholder"></script><script id="metamorph-117-end" type="text/x-placeholder"></script>
                </tr>
        <script id="metamorph-99-end" type="text/x-placeholder"></script><script id="metamorph-100-end" type="text/x-placeholder"></script>
</tbody></table>
                </ui-content>
        </ui-summary-section>
        <script id="metamorph-124-start" type="text/x-placeholder"></script><script id="metamorph-124-end" type="text/x-placeholder"></script>
        <script id="metamorph-125-start" type="text/x-placeholder"></script><script id="metamorph-125-end" type="text/x-placeholder"></script>
        <script id="metamorph-126-start" type="text/x-placeholder"></script><script id="metamorph-126-end" type="text/x-placeholder"></script>  
        <script id="metamorph-127-start" type="text/x-placeholder"></script>
                <ui-summary-section tabindex="0">
                        <ui-presentation>
                                <h2 id="ember5744" class="ember-view inspect-heading message"><script id="metamorph-230-start" type="text/x-placeholder"></script>History<script id="metamorph-230-end" type="text/x-placeholder"></script></h2>
                        </ui-presentation>
                        <ui-content>
                                <table id="ember5751" class="ember-view details-list"><tbody>
        <script id="metamorph-232-start" type="text/x-placeholder"></script><script id="metamorph-231-start" type="text/x-placeholder"></script>
                <tr>
                        <script id="metamorph-234-start" type="text/x-placeholder"></script><script id="metamorph-233-start" type="text/x-placeholder"></script>
                                <td core-role="icon"><rs-icon id="ember5775" class="ember-view icon" title="2018-Mar-9&nbsp;by system&nbsp;1.0" style=""></rs-icon></td>
                                <td core-role="label" class="" data-bindattr-15="15"><script id="metamorph-235-start" type="text/x-placeholder"></script>2018-Mar-9&nbsp;by system&nbsp;1.0<script id="metamorph-235-end" type="text/x-placeholder"></script>
                                </td><td core-role="value" class="" data-bindattr-16="16">
                                        <script id="metamorph-236-start" type="text/x-placeholder"></script>
                                                <script id="metamorph-237-start" type="text/x-placeholder"></script>original<script id="metamorph-237-end" type="text/x-placeholder"></script>
                                        <script id="metamorph-236-end" type="text/x-placeholder"></script>
                                </td>
                        <script id="metamorph-233-end" type="text/x-placeholder"></script><script id="metamorph-234-end" type="text/x-placeholder"></script>
                </tr>
        <script id="metamorph-231-end" type="text/x-placeholder"></script><script id="metamorph-232-end" type="text/x-placeholder"></script>
</tbody></table>
                        </ui-content>
                </ui-summary-section>
        <script id="metamorph-127-end" type="text/x-placeholder"></script>
</summary-info>
<content-preview>
        <ui-presentation>
                <h2 id="ember4936" class="ember-view inspect-heading message"><script id="metamorph-128-start" type="text/x-placeholder"></script>Preview<script id="metamorph-128-end" type="text/x-placeholder"></script></h2>
        </ui-presentation>
</content-preview>
</div><script id="metamorph-95-end" type="text/x-placeholder"></script>
            <script id="metamorph-94-end" type="text/x-placeholder"></script>
            <script id="metamorph-129-start" type="text/x-placeholder"></script><script id="metamorph-129-end" type="text/x-placeholder"></script>
        </div>
    </div>

There is having Inspect tab names called preview, metadata_global, metadata_contextual, alias, references and permissions, which was mentioned in html.

Inspect.hbr file having the inspector-chooser class:

    <div class="inspectors-view">
        
            <div class="inspector-chooser">
                
                    
                
            </div>
        
        <div class="inspector-view">
            
                
            
            
                
            
            
                
            
        </div>
    </div>

In that I have found the permittedInspectors object class file, it used in the file name called Inspect.js.

Ember.View.extend()
    .named("Inspect")
    .reopen({
        controller: function () {
            return Inspect.controller;
        }.property(),
        templateName: core.url('scripts/Inspect.hbr'),
        classNames: 'inspect-view',
        classNameBindings: [ 'inspectorClassName', 'controller.selectedInspector.working' ],
        inspectorClassName: function () {
                var name = this.get('controller.selectedInspector.name');
                var type = this.get('controller.titleView.type');
                var classes = [];
                if (name) { classes.push(name.dasherize() + '-inspect'); }
                if (type) { classes.push(type.dasherize() + '-inspect'); }
                return classes.join(' ');
        }.property('controller.selectedInspector.name', 'controller.titleView.type')
    });

Inspect.reopenClass({
    Inspector: Ember.Object.extend()
        .reopen({
                name: null,
            icon: null,
            label: null,
            titleView: null,
            bodyView: null,
            actionsView: null,
            isValid: false
        }),
    Heading: core.view.Message.extend()
                .component('inspect-heading', ['key'])
                .reopen({
                        classNames: [ 'inspect-heading' ],
                        tagName: 'h2'
                })
});
Inspect.Inspector.create().named("Inspect.transitionalInspector");
Inspect.reopenClass({
        TitleView: Ember.View.extend({
                title: null
        }).reopenClass({
                type: null,
                isValidFor: function (model, user) {
                return true;
        }
        })
});

Inspect.reopenClass({
    UnhandledInspector: Inspect.Inspector.create({
        icon: 'act_help',
        title: "Unknown",
        bodyView: Ember.View.extend({
            template: Ember.Handlebars.compile("No inspector for object ")
        })
    })
});
Inspect.reopenClass({
    GenericTitleView: Inspect.TitleView.extend({
        template: Ember.Handlebars.compile(""),
        title: function () {
            return this.get('model.displayName') || this.get('model.label') || this.get('model.name');
        }.property('model', 'model.loadState')
    }).reopenClass({
        type: "Generic"
    })
});

Inspect.reopenClass({
    Choice: core.view.Icon.extend({
        size: 24,
        modelBinding: 'inspector.icon',
        titleBinding: 'inspector.tooltip',
        classNameBindings: [ 'active' ],
        active: function () {
            return this.get('controller.selectedInspector') === this.get('inspector');
        }.property('controller.selectedInspector', 'inspector'),
        click: function () {
                this.set('controller.selectedInspector', Inspect.transitionalInspector);
                Ember.run.later(this, function () {
                        this.set('controller.selectedInspector', this.get('inspector'));        
                }, 50);
            
        }
    })
});
    

Ember.Object.extend(Ember.Observable, Ember.ActionHandler)
    .named('Inspect.Controller')
    .reopen({
        parentController: core.controller,
                _actions: {
                        contentItemActionMenu: function (highlight, anchor, context) {
                                var pct = this.get('parentController');
                                context.scope = context.scope || 'inspect';
                                return pct.send('contentItemActionMenu', highlight, anchor, context);
                        }
                },
        content: null,
        inspectors: null,
        titleViews: null,
        selectedInspector: null,
        setup: function () {
            this.set('inspectors', []);
            this.set('titleViews', []);
            this.assignModel();
            this.permittedInspectorsChanged();
        }.on('init'),
        assignModel: function () {
            var model = this.get('content');
            var user = this.get('user');
            var changeInspectors = false;
            this.get('inspectors').forEach(function (inspector) {
                if (inspector.get('model') !== model) {
                    inspector.set('model', model);
                }
                if (inspector.get('user') !== user) {
                    inspector.set('user', user);
                }
            });
        }.observes('content', 'user', 'inspectors.@each.name'),
        permittedInspectors: function () {
            var inspectors = (this.get('inspectors') || []).filter(function (inspector) {
                return inspector.get('isValid');
            });
            if (!inspectors.length) {
                return [ Inspect.UnhandledInspector ];
            }
            console.log(Inspect);
            return inspectors;
        }.property('content', 'inspectors.@each.isValid', 'inspectors.length'),
        showChoosers: function () {
            return this.get('permittedInspectors.length') > 1;
        }.property('permittedInspectors.length'),
        permittedInspectorsChanged: function () {
            var inspector = this.get('selectedInspector');
            if (this.get('permittedInspectors').indexOf(inspector) === -1) {
                this.set('selectedInspector', Inspect.transitionalInspector);
                this.set('selectedInspector', this.get('permittedInspectors.0'));
            }
        }.observes('permittedInspectors'),
        selectedInspectorChanged: function () {
            var selected = this.get('selectedInspector');
            this.get('inspectors').forEach(function (inspector) {
                inspector.set('selected', inspector === selected);
            });
            selected.notifyPropertyChange('model');
            selected.notifyPropertyChange('user');
            // Enforce update of body view, even if two inspectors share it.
            this.notifyPropertyChange('selectedInspector.bodyView');
        }.observes('selectedInspector'),
        userBinding: 'core.model.session.user',
        titleView: function () {
            var model = this.get('content');
            var user = this.get('user');
            return this.get('titleViews').find(function (titleView) {
                if (!titleView.isValidFor) { 
                    console.warn("titleView does not have `isValidFor(model, user)` implemented as a static method.");
                    return false; 
                }
                return titleView.isValidFor(model, user);
            }) || Inspect.GenericTitleView;
        }.property('titleViews', 'content'),
        detailsFullBinding: 'parentController.detailsFull',
        disclosePreviewAndInformation: true,
        disclosePermissions: false,
        discloseMetadata: false,
        discloseAliases: false,
        discloseVersionHistory: false,
        discloseReferences: false,
        discloseClones: false,
        discloseVariants: false,
        stateChanged: Ember.observer(
            function () {
                var items = Inspect.controller.stateChanged.__ember_observes__,
                    state = {},
                    ctl = this;
                items.forEach(function (key) {
                    state[key] = ctl.get(key);
                });
                core.storage.set("core-controller-inspectState", state);
            },
            'disclosePreviewAndInformation',
            'disclosePermissions',
            'discloseMetadata',
            'discloseAliases',
            'discloseVersionHistory',
            'discloseReferences',
            'discloseClones',
            'discloseVariants'
        ),
        actions: {

        }
    })
    .create()
    .named('Inspect.controller')
    .setProperties(core.storage.get("core-controller-inspectState") || {});

Inspect.reopenClass({
    registerTitleView: function (titleView) {
        if (!Ember.View.detect(titleView)) {
            if (titleView.get || titleView.extend) {
                throw new Error("You must pass a subclass of Ember.View or a POJsO to Inspect.registerTitleView.");
            }
            titleView = Ember.View.extend(titleView);
        }
        Inspect.controller.get('titleViews').pushObject(titleView);
    }
});
Inspect.reopenClass({
    registerInspector: function (inspector) {
        if (Inspect.Inspector.detect(inspector)) {
            inspector = inspector.create();
        }
        if (!Inspect.Inspector.detectInstance(inspector)) {
            if (inspector.get || inspector.extend) {
                throw new Error("You must pass an instance of Inspect.Inspector or a POJsO to Inspect.registerInspector.");
            }
            inspector = Inspect.Inspector.extend(inspector).create();
        }
        Inspect.controller.get('inspectors').pushObject(inspector);
        Inspect.controller.assignModel();
    }
});

Inspect.EditableModelFooter = Ember.ContainerView.extend({
    isVisible: function () {
        var enabled = this.get('inspector.canModify') !== false;
        var addEnabled = this.get('inspector.addItem') instanceof Function;
        var saveEnabled = this.get('inspector.save') instanceof Function;
        var revertEnabled = this.get('inspector.revert') instanceof Function;
        return enabled && (addEnabled || saveEnabled || revertEnabled);
    }.property('inspector.canModify', 'inspector.addItem', 'inspector.save', 'inspector.revert'),
    childViews: [
        core.component.UiButton.extend({
            size: 20,
            inspectorBinding: 'parentView.inspector',
            label: function () {
                return this.get('inspector.addItemText') || core.messageTable.get('chrome/inspect/footer/add');
            }.property('inspector.addItemText'),
            isVisible: function () {
                return this.get('inspector.addItem') instanceof Function;
            }.property('inspector.addItem'),
            enabledBinding: 'inspector.canAddItems',
            click: function () {
                this.get('inspector').addItem();
                return false;
            }
        }),
        core.component.UiButton.extend({
            size: 20,           
            inspectorBinding: 'parentView.inspector',
            label: function () {
                return this.get('inspector.saveText') || core.messageTable.get('chrome/inspect/footer/save');
            }.property('inspector.saveText'),
            isVisible: function () {
                return this.get('inspector.save') instanceof Function;
            }.property('inspector.save'),
            enabledBinding: 'inspector.canSave',
            click: function () {
                this.get('inspector').save();
                return false;
            }
        }),
        core.component.UiButton.extend({
            size: 20,
            inspectorBinding: 'parentView.inspector',
            label: function () {
                return this.get('inspector.revertText') || core.messageTable.get('chrome/inspect/footer/revert');
            }.property('inspector.revertText'),
            isVisible: function () {
                return this.get('inspector.revert') instanceof Function;
            }.property('inspector.revert'),
            enabledBinding: 'inspector.canRevert',
            click: function () {
                this.get('inspector').revert();
                return false;
            }
        })
    ]
});

Inspect.InspectIcon = core.view.Icon.extend({
    model: 'inspect',
    size: 24
});

By using this js. I need to hide or disable only the last 4 inspect tabs (metadata_contextual, alias, references and permissions). I want to preview only the first 2 tabs. I'm really new to the ember js. can anyone help me on this. It will appreciable. Thanks in advance