0

I am recently starting developing in cockpit-project.

I read twice the "cockpit.js: Manifests — Manifest info" documentation. We can read :

You can load manifest info by loading the ./manifest.json file in your package. In addition there is a shortcut, by loading the ../manifests.json you can load all the manifests at once.

Lastly load the ../manifests.js file to register the manifests at the cockpit.manifests global variable.

I cannot figure out what is meant by this in term of code, and even how we are supposed to understand this. I noticed that the object cockpit.manifests is always an empty object. But the variable cockpit.manifests is indeed used in the modules from the github!

If i used the code

import MANIFEST from './manifest.json'
# MANIFEST countains the content of the file ./manifest.json, not overridden by the content of ./override.json

and the code

import MANIFEST from '../manifests.js'
# This cause error : Can't resolve '../manifests.js'

I have tried to use some specificities such as

import CONFIG_DATA from './config.json'
# limited because only one file is loaded and not all the files in a directory, cannot be overridden.
cockpit.spawn(['/opt/my_config_loader.pl']).then(data=> { this.setState(JSON.parse(data)) });
# Complicated because it is quite specific code, cause errors, cause page refreshings, ...

Could you explain how some configuration can be added to cockpit packages?

MUY Belgium
  • 2,330
  • 4
  • 30
  • 46

0 Answers0