mirror of
https://github.com/portainer/portainer.git
synced 2025-07-19 13:29:41 +02:00
* feat(k8s/resource-pool): add the ability to mark/unmark resource pool as system fix(kube/ns): check label to see if namespace is system refactor(k8s/namespaces): rename variables feat(kubernetes): toggle system state in the server (#5361) fix(app/resource-pool): UI fixes feat(app/resource-pool): add confirmation modal when unamrking system namespace * refactor(app): review changes * feat(app/namespaces): introduce store to retrieve namespace system status without changing all the kubernetes models refactor(app/namespaces): remove unused code first introduced for system tagging fix(app/namespaces): cache namespaces to retrieve system status regardless of namespace reference format refactor(app): migrate namespace store from helper to a separate singleton refactor(app): remove KubernetesNamespaceHelper from DI cycle * refactor(app): normalize usage of KubernetesNamespaceHelper functions * refactor(app/k8s): change namespace store to functions instead of class Co-authored-by: LP B <xAt0mZ@users.noreply.github.com>
21 lines
673 B
JavaScript
21 lines
673 B
JavaScript
// 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));
|
|
}
|