mardi 30 avril 2019

Data on Route not reloading / refetching from API

Say I have index and edit routes. From index, I selected item and redirected to edit route. Then when I change data on form field on edit route and click the back arrow on my browser, the changes made reflected on index which should not because save button was not clicked.

But when index route is refreshed the changes made don't reflect which is right. Now how could the index route reload the data without refreshing the page.




Does my remote server (Amazon EC2) need 2 different servers running to run EmberJS and Spring Boot?

It seems that for EmberJS we need a server to run, usually on localhost:4040.

Spring Boot needs its own server for run of coarse on localhost:8080.

Is this really necessary to run 2 different servers on a remote server or even recommended?

Why can't I just get the javascript from the EmberJS and put it in my Spring Boot project. As in go to the static resources folder and put the EmberJS files there?

Why do we really need a server for EmberJS in the first place? It's front end code to be read by a browser?

If none of this is recommended then how do we use EmberJS and Spring Boot together on one server? Everywhere I see uses EmberJS on its own server and does a cross request to localhost:8080 for spring boot.

I am relatively new to Web App Dev so some jargon may go over my head.




How to fix "Unexpected end of JSON"

I had my users page displaying users but then when I stopped working on the code for a while and came back to it I am getting an error which says "Error while processing route: users Unexpected end of JSON input SyntaxError: Unexpected end of JSON input" and also "Uncaught SyntaxError: Unexpected end of JSON input"

I don't know where to start on trying to fix this issue.

Here is the front-end code in the route file users.js:

model() {
    return this.get("store").findAll("user");
  },

Here is the api code in the users controller:

# GET /users
  def index
    render jsonapi: User.all
  end




Can I use Deno with Ember-Cli?

I recently found Deno and I am very interested in using it with my Ember-CLI projects. I know Deno is still very unstable, but I would like to know if at this point it would be advisable to attempt to migrate from node to deno for even a small project. I couldn't find information about progress in that direction and I want to start working on it.

Is this possible, because I don't think my code can compile right now?




lundi 29 avril 2019

Send POST request from ember to specified URL

I am new to full stack development, and having an issue with a web application I'm working on for my employer. I was tasked with creating a fairly simple application that we can scale over time. For now all that it needs to do is take data from one of our databases, and pass it to a front end application. Using this front-end app our workers should be able to double check the information passed in, and make sure it has been properly translated to a new format. After it is translated I want to send an HTTP POST request to our new systems back-end and have it add this new data via the REST API. Essentially it's an application that was used for practice to get me more acquainted with full stack development while making an effective tool to transfer mass data from one system to another. I can't seem to figure out how to set up something in ember.js to send that POST request to somewhere other than my back-end though.




How to customize paper-select component?

I need to customize paper-elements like paper-select and paper-select with search, but don't really know is it possible and if so how exactly to do it.

I tried this https://ember-power-select.com/docs/styles/, but doesn't work (yes, we have scss). I tried the same example as on the link and instead of a blue border it created a grey one. And for sure this grey border isn't related to the

$ember-power-select-border-color: #64A5ED;

selector in app.scss, because the same grey border appears for this import along:

@import 'ember-power-select';

without any selectors at all. One of the task is to move placeholder from center to the left corner of the input. But ::placeholder { flex: left } does not work. Also I don't have strong computer science background, so I would highly appreciate if you explain this as simple as possible.




dimanche 28 avril 2019

Computed property is only firing once

I have a service called screen-size which has a property called width. This property is the value of the window width and will update on a resize event.

This works fine. In a component, I have a computed property that I want to update when this value changes like so...

nameStyle: computed('screenSizeService.width', function()
{
    console.log('in computed');
    return this.getFontSize(2.5, 2, null, null, this.$())
}),

This is only running once at the beginning unless I do this...

nameStyle: computed('screenSizeService.width', function()
{
    this.get('screenSizeService.width');
    console.log('in computed');
    return this.getFontSize(2.5, 2, null, null, this.$())
}),

Then it runs correctly. The value of nameStyle has no direct relation to the screen width, but the container width which changes when the screen width changes.

This is why i read from the screen width.

Why would I need to get the value in order for it to work? Why wouldnt it just computed from when it changes and run that function?