feat(rbac): Add toggle for additive kubernetes RBAC policy [C9S-177] (#2814)

This commit is contained in:
Cara Ryan
2026-06-11 13:44:43 +12:00
committed by GitHub
parent 1cd6017df6
commit ade5b2a3db
4 changed files with 13 additions and 58 deletions
+13 -18
View File
@@ -39,27 +39,22 @@
</div>
</div>
<div class="form-group" ng-if="ctrl.formValues.Namespace">
<label for="target_namespace" class="col-lg-2 col-sm-3 control-label text-left">Namespace</label>
<div class="col-sm-9 col-lg-10">
<div class="mb-1">
<k8s-registry-access-notice ng-if="!ctrl.formValues.namespace_toggle" namespace="ctrl.formValues.Namespace"></k8s-registry-access-notice>
<div ng-if="!ctrl.formValues.namespace_toggle">
<div class="form-group" ng-if="ctrl.formValues.Namespace">
<div class="col-sm-12">
<k8s-registry-access-notice namespace="ctrl.formValues.Namespace"></k8s-registry-access-notice>
</div>
<namespace-portainer-select
ng-if="!ctrl.formValues.namespace_toggle"
is-disabled="ctrl.formValues.namespace_toggle || ctrl.state.isNamespaceInputDisabled"
value="ctrl.formValues.Namespace"
on-change="(ctrl.onChangeNamespace)"
options="ctrl.namespaceOptions"
></namespace-portainer-select>
<span ng-if="ctrl.formValues.namespace_toggle" class="small text-muted pt-[7px]">Namespaces specified in the manifest will be used</span>
</div>
<namespace-selector
values="ctrl.formValues.Namespace"
on-change="(ctrl.onChangeNamespace)"
validation-data="{namespaceOptionCount: ctrl.namespaces.length}"
></namespace-selector>
</div>
<div class="form-group" ng-if="!ctrl.formValues.Namespace">
<div class="col-sm-12 small text-warning">
<pr-icon icon="'alert-triangle'" mode="'warning'"></pr-icon>
You do not have access to any namespace. Contact your administrator to get access to a namespace.
<div class="form-group" ng-if="ctrl.formValues.namespace_toggle">
<label class="col-lg-2 col-sm-3 control-label text-left">Namespace</label>
<div class="col-sm-9 col-lg-10">
<span class="small text-muted pt-[7px]">Namespaces specified in the manifest will be used</span>
</div>
</div>
@@ -371,10 +371,6 @@ class KubernetesDeployController {
if (this.namespaces.length > 0) {
this.formValues.Namespace = this.namespaces[0].Name;
}
this.namespaceOptions = _.map(namespaces, (namespace) => ({
label: namespace.Name,
value: namespace.Name,
}));
} catch (err) {
this.Notifications.error('Failure', err, 'Unable to load namespaces data');
}
-10
View File
@@ -7,7 +7,6 @@ import { withUIRouter } from '@/react-tools/withUIRouter';
import { AnnotationsBeTeaser } from '@/react/kubernetes/annotations/AnnotationsBeTeaser';
import { withFormValidation } from '@/react-tools/withFormValidation';
import { withControlledInput } from '@/react-tools/withControlledInput';
import { NamespacePortainerSelect } from '@/react/kubernetes/applications/components/NamespaceSelector/NamespaceSelector';
import {
EnvironmentVariablesFieldset,
@@ -212,15 +211,6 @@ export const ngModule = angular
'onBlur',
])
)
.component(
'namespacePortainerSelect',
r2a(NamespacePortainerSelect, [
'value',
'onChange',
'isDisabled',
'options',
])
)
.component(
'porSlider',
r2a(Slider, [
@@ -58,29 +58,3 @@ export function NamespaceSelector({
</FormControl>
);
}
/** NamespacePortainerSelect is exported for use by angular views, so that the data-cy attribute is set correctly */
export function NamespacePortainerSelect({
value,
onChange,
isDisabled,
options,
}: {
value: string;
onChange: (value: string) => void;
isDisabled: boolean;
options: { label: string; value: string }[];
}) {
return (
<PortainerSelect
value={value}
options={options}
onChange={onChange}
disabled={isDisabled}
noOptionsMessage={() => 'No namespaces found'}
placeholder="No namespaces found" // will only show when there are no options
inputId="namespace-selector"
data-cy="namespace-select"
/>
);
}