samedi 4 novembre 2023

Why does ember data store share tokens between 2 webb apps iny domain?

0

I have 2 differents applications in ember.js both connect to the same api: "host1:3000/appA" and "host2:3001/appB". I use nginx so that the client can access appA and appB through a single domain, that is: "mydomain.com/appA" and "mydomain.com/appB". Everything is correct but the applications are sharing "store" ember objects. So if I login into appA, I also login into appB. How can I prevent session sharing between applications?.

I used this code from nginx, but does't work:

location /appA {
  proxy_pass http://host1:3000;
  proxy_cookie_path /appA /appA;
}

location /appB {
  proxy_pass http://host2:3001;
  proxy_cookie_path /appB /appB;
}



vendredi 3 novembre 2023

Uncaught Error: Could not find module `@ember/application` imported from `web-app/app`

What might be the reason for this error?

Please can anyone help? This is how my app-boot.js looks

      if (!runningTests) {
        require("web-app/app")["default"].create({"name":"web-app","version":"0.0.0+9380b4bc"});
      }
    

I have been upgrading my ember version. My whole app is stuck




ember-component-css in production env on ember 5.3.0 have no styleNamespace

When I am using ember-component-css in development env - everything works fine, I got class prefix in each style when i am using .

Example:

<div class=''> // <div class='hjsdf6_class-name-from-component'>
</div>

But when I am using my app with production env i got:

<div class='hjsdf6_ '>
</div>

In component.js:

import podNames from 'ember-component-css/pod-names'

  get styleNamespace() {
    return podNames['class-name-from-component']
  }

So, may be it is not a bug. May be it is a feature?...




mercredi 18 octobre 2023

how to get the previous routename in ember 2.16 to used in back button

i have a analytic route in ember this can be accessed from two routes (example user page and profile page) the below code is used to redirect to the analytic route

The problem is that i have a back button in the analytic page i want to send the user to the page from where the call is originated (i.e) if the user got to the analytic page from user page the back button should go to user page and if the user got to analytic page from profile page the back button should lead to profile page.

i dont want to mess the current code so i will be glad if the solution is in the form of action which returns the string of previous page. so that i could just call the action in place where i could give the dest page name.




samedi 14 octobre 2023

Ember-cli not using global version

This might actually more npm/node than just an EmberJS question.

Simply speaking I ran npm install -g ember-cli. However, when I check the version using ember --version, it shows me

ember-cli: 3.10.1
node: 18.18.2
os: darwin x64

That is definitely not the version I installed, because if i do npm ls -g --depth=0 to check my global packages, I get:

├── corepack@0.19.0
├── ember-cli@5.3.0
└── npm@10.2.0

To sanity check, i ran npm uninstall -g ember-cli and running npm ls -g --depth=0 again got

├── corepack@0.19.0
└── npm@10.2.0

So now, confirming that the global package is removed, I ran ember --version expecting the system to say ember is not installed, but instead i still get:

ember-cli: 3.10.1
node: 18.18.2
os: darwin x64

This leads me to believe there is some other installation of Ember on this computer and it's being used instead of the global version and I'd really like to just remove it - how do I find and remove it?

Useful context may be: I use NVM and Brew, although even in the past I didn't attempt to install ember with anything but the official installation direction of npm install -g ember-cli.




mardi 19 septembre 2023

How to create Ember Service that fetches data from Apollo GraphQL Server

I successfully fetched data from Apollo GraphQL Server in Amber route using ember-apollo-client. I tried the same approach to have a service fetching data but I'm getting Uncaught TypeError: this.apollo.query is not a function from app/services/nav-categories.js.

Minimal Working Example

Start a new app using

$ ember new super-rentals --lang en
$ ember generate service nav-categories

Configure Apollo end point in config/environment.js:

module.exports = function (environment) {
  const ENV = {
    ...

    apollo: {
      apiURL: 'http://localhost:4000',
    }
  };

app/gql/queries/allCategories.graphql:

query AllCategories {
  categories {
    name
  }
}

app/services/nav-categories.js:

import Service from '@ember/service';
import { queryManager } from "ember-apollo-client";
import allCategories from "super-rentals/gql/queries/allCategories.graphql";

export default class NavCategoriesService extends Service {
  constructor() {
    super();
    this.apollo = queryManager();
    this.categories = this.apollo.query({ query: allCategories });
  }
}

app/components/my-header.js:

import Component from '@glimmer/component';
import { service } from '@ember/service';

export default class CartContentsComponent extends Component {
  // Will load the service defined in: app/services/nav-categories.js
  @service navCategories;
}

app/components/my-header.hbs:

<ul>

  <li></li>

</ul>

app/templates/application.hbs:

<MyHeader></MyHeader>




mercredi 23 août 2023

Unable to close module dropdown of parent application on clicking anywhere in child application UI screen rendered in Ifaram

I am facing problem to close module dropdown on clicking anywhere in child application UI screen.
I am not be able to handle click Outside functionality for dropdown elements defined in Parent application after clicking on the IFrame which loads child application inside Parent application as I have an application built using Ember JS. Inside that I have another application plugin using IFrame created using React JS. I wanted to hide the rendered dropdown from the parent application by clicking inside the IFrame where the child application is presented.
Can anyone provide a solution to achieve it?