mirror of
https://github.com/portainer/portainer.git
synced 2025-07-22 06:49:40 +02:00
feat(k8s/resource-pool): add the ability to mark/unmark resource pool as system (#5360)
* 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>
This commit is contained in:
parent
5ab98f41f1
commit
1830a80a61
45 changed files with 675 additions and 154 deletions
|
@ -1,21 +1,33 @@
|
|||
import _ from 'lodash-es';
|
||||
import angular from 'angular';
|
||||
|
||||
class KubernetesNamespaceHelper {
|
||||
/* @ngInject */
|
||||
constructor(KUBERNETES_SYSTEM_NAMESPACES, KUBERNETES_DEFAULT_NAMESPACE) {
|
||||
this.KUBERNETES_SYSTEM_NAMESPACES = KUBERNETES_SYSTEM_NAMESPACES;
|
||||
this.KUBERNETES_DEFAULT_NAMESPACE = KUBERNETES_DEFAULT_NAMESPACE;
|
||||
import { KUBERNETES_DEFAULT_NAMESPACE, KUBERNETES_DEFAULT_SYSTEM_NAMESPACES } from 'Kubernetes/models/namespace/models';
|
||||
import { isSystem } from 'Kubernetes/store/namespace';
|
||||
|
||||
export default class KubernetesNamespaceHelper {
|
||||
/**
|
||||
* Check if namespace is system or not
|
||||
* @param {String} namespace Namespace (string name) to evaluate
|
||||
* @returns Boolean
|
||||
*/
|
||||
static isSystemNamespace(namespace) {
|
||||
return isSystem(namespace);
|
||||
}
|
||||
|
||||
isSystemNamespace(namespace) {
|
||||
return _.includes(this.KUBERNETES_SYSTEM_NAMESPACES, namespace);
|
||||
/**
|
||||
* Check if namespace is default or not
|
||||
* @param {String} namespace Namespace (string name) to evaluate
|
||||
* @returns Boolean
|
||||
*/
|
||||
static isDefaultNamespace(namespace) {
|
||||
return namespace === KUBERNETES_DEFAULT_NAMESPACE;
|
||||
}
|
||||
|
||||
isDefaultNamespace(namespace) {
|
||||
return namespace === this.KUBERNETES_DEFAULT_NAMESPACE;
|
||||
/**
|
||||
* Check if namespace is one of the default system namespaces
|
||||
* @param {String} namespace Namespace (string name) to evaluate
|
||||
* @returns Boolean
|
||||
*/
|
||||
static isDefaultSystemNamespace(namespace) {
|
||||
return _.includes(KUBERNETES_DEFAULT_SYSTEM_NAMESPACES, namespace);
|
||||
}
|
||||
}
|
||||
|
||||
export default KubernetesNamespaceHelper;
|
||||
angular.module('portainer.app').service('KubernetesNamespaceHelper', KubernetesNamespaceHelper);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue