breezy-airplane-74201
05/29/2025, 8:53 AMbusy-ability-54059
05/29/2025, 4:33 PMuser menu
- account and api keys
https://github.com/rancher/dashboard/blob/master/shell/edit/token.vue#L120-L124
it does a request to v3/tokens
with the appropriate payload.
Theoretically you could do something like:
this.$store.dispatch(`rancher/create`, {
type: NORMAN.TOKEN,
.... where this the payload needed
}));
just cross-check to what’s going on with the network requestbreezy-airplane-74201
05/30/2025, 9:17 AMbusy-ability-54059
05/30/2025, 10:46 AMbreezy-airplane-74201
05/30/2025, 12:12 PMbusy-ability-54059
05/30/2025, 12:53 PMbreezy-airplane-74201
06/02/2025, 5:33 AMnpm install
, it says the package is added successfully. However:
• I don't see a `node_modules`folder in the project.
• Despite that, I can import the package and use its functions (that function uses Vuex dispatch).
• Ctrl+clicking on the import takes me only to the specific file I used—not the full package or structure.
• The same goes for Axios, where I also don't see node_modules
, but Ctrl+click takes me inside the Axios file. But I can use Axios without any issue.
The real issue:
A function from this custom package tries to dispatch a Vuex action, but I get this runtime error:
TypeError: Cannot read properties of undefined (reading 'dispatch')
It seems like something is off with the package resolution or context. Any idea what might be going wrong here and how to fix it?
NB: The package from GitHub is widely used in our repos and well tested and working.busy-ability-54059
06/02/2025, 9:01 AMyarn
instead of npm
as it’s the package manager that we use with Rancher Dashboard/Extensions.
you can’t see node_modules
folder because we hide it with gitignore
: https://github.com/rancher/dashboard/blob/master/creators/extension/app/files/gitignore#L50
As for the dispatch
, most likely is the context that is wrong… Meaning that’s not the correct way to use the vuex action dispatch
given the context of the file in which you’re trying to use it.
There are quite a few official extensions https://github.com/rancher/ui-plugin-charts/blob/main/manifest.json or https://github.com/rancher/ui-plugin-examples
Take some time to browse through their code and get familiar with the patterns. Unless your really in a very unique situation, I am quite confident you’ll find your usecase/code already developed somewhere in these extensionsbreezy-airplane-74201
06/05/2025, 5:34 AMbusy-ability-54059
06/05/2025, 8:43 AM