You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
portainer/app/kubernetes/store/namespace.js

22 lines
673 B

// singleton pattern as:
// * we don't want to use AngularJS DI to fetch the single instance
// * we need to use the Store in static functions / non-instanciated classes
const storeNamespaces = {};
/**
* Check if a namespace of the store is system or not
* @param {String} name Namespace name
* @returns Boolean
*/
export function isSystem(name) {
return storeNamespaces[name] && storeNamespaces[name].IsSystem;
}
/**
* Called from KubernetesNamespaceService.get()
* @param {KubernetesNamespace[]} namespaces list of namespaces to update in Store
*/
export function updateNamespaces(namespaces) {
namespaces.forEach((ns) => (storeNamespaces[ns.Name] = ns));
}