mirror of
https://github.com/portainer/portainer.git
synced 2025-07-23 15:29:42 +02:00
feat(kubernetes): add rolling restart button teaser [EE-4510] (#8126)
* rolling restart teaser button * add be only rolling restart * move position of button
This commit is contained in:
parent
a1528475ba
commit
2188005b48
8 changed files with 75 additions and 41 deletions
|
@ -22,6 +22,12 @@
|
||||||
<pr-icon class="vertical-center" icon="'check'" size="'md'" mode="'success'"></pr-icon> copied
|
<pr-icon class="vertical-center" icon="'check'" size="'md'" mode="'success'"></pr-icon> copied
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<yaml-replace class="float-right" feature-id="$ctrl.limitedFeature"></yaml-replace>
|
<be-only-button
|
||||||
|
class="float-right"
|
||||||
|
feature-id="$ctrl.limitedFeature"
|
||||||
|
message="'Applies any changes that you make in the YAML editor by calling the Kubernetes API to patch the relevant resources. Any resource removals or unexpected resource additions that you make in the YAML will be ignored. Note that editing is disabled for resources in namespaces marked as system.'"
|
||||||
|
heading="'Apply YAML changes'"
|
||||||
|
button-text="'Apply changes'"
|
||||||
|
></be-only-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
44
app/kubernetes/react/views/beOnlyButton/index.tsx
Normal file
44
app/kubernetes/react/views/beOnlyButton/index.tsx
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
import { ReactNode } from 'react';
|
||||||
|
|
||||||
|
import { FeatureId } from '@/react/portainer/feature-flags/enums';
|
||||||
|
|
||||||
|
import { Button } from '@@/buttons';
|
||||||
|
import { TooltipWithChildren } from '@@/Tip/TooltipWithChildren';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
featureId: FeatureId;
|
||||||
|
heading: string;
|
||||||
|
message: string;
|
||||||
|
buttonText: string;
|
||||||
|
className?: string;
|
||||||
|
icon?: ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function BEOnlyButton({
|
||||||
|
featureId,
|
||||||
|
heading,
|
||||||
|
message,
|
||||||
|
buttonText,
|
||||||
|
className,
|
||||||
|
icon,
|
||||||
|
}: Props) {
|
||||||
|
return (
|
||||||
|
<TooltipWithChildren
|
||||||
|
className={className}
|
||||||
|
heading={heading}
|
||||||
|
BEFeatureID={featureId}
|
||||||
|
message={message}
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
icon={icon}
|
||||||
|
type="button"
|
||||||
|
color="warninglight"
|
||||||
|
size="small"
|
||||||
|
onClick={() => {}}
|
||||||
|
disabled
|
||||||
|
>
|
||||||
|
{buttonText}
|
||||||
|
</Button>
|
||||||
|
</TooltipWithChildren>
|
||||||
|
);
|
||||||
|
}
|
|
@ -4,7 +4,7 @@ import { r2a } from '@/react-tools/react2angular';
|
||||||
import { withCurrentUser } from '@/react-tools/withCurrentUser';
|
import { withCurrentUser } from '@/react-tools/withCurrentUser';
|
||||||
import { withReactQuery } from '@/react-tools/withReactQuery';
|
import { withReactQuery } from '@/react-tools/withReactQuery';
|
||||||
import { withUIRouter } from '@/react-tools/withUIRouter';
|
import { withUIRouter } from '@/react-tools/withUIRouter';
|
||||||
import { YAMLReplace } from '@/kubernetes/react/views/yamlReplace';
|
import { BEOnlyButton } from '@/kubernetes/react/views/beOnlyButton';
|
||||||
import { IngressesDatatableView } from '@/react/kubernetes/ingresses/IngressDatatable';
|
import { IngressesDatatableView } from '@/react/kubernetes/ingresses/IngressDatatable';
|
||||||
import { CreateIngressView } from '@/react/kubernetes/ingresses/CreateIngressView';
|
import { CreateIngressView } from '@/react/kubernetes/ingresses/CreateIngressView';
|
||||||
|
|
||||||
|
@ -22,8 +22,13 @@ export const viewsModule = angular
|
||||||
r2a(withUIRouter(withReactQuery(withCurrentUser(CreateIngressView))), [])
|
r2a(withUIRouter(withReactQuery(withCurrentUser(CreateIngressView))), [])
|
||||||
)
|
)
|
||||||
.component(
|
.component(
|
||||||
'yamlReplace',
|
'beOnlyButton',
|
||||||
r2a(withUIRouter(withReactQuery(withCurrentUser(YAMLReplace))), [
|
r2a(withUIRouter(withReactQuery(withCurrentUser(BEOnlyButton))), [
|
||||||
'featureId',
|
'featureId',
|
||||||
|
'heading',
|
||||||
|
'message',
|
||||||
|
'buttonText',
|
||||||
|
'className',
|
||||||
|
'icon',
|
||||||
])
|
])
|
||||||
).name;
|
).name;
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
import { FeatureId } from '@/react/portainer/feature-flags/enums';
|
|
||||||
|
|
||||||
import { Button } from '@@/buttons';
|
|
||||||
import { TooltipWithChildren } from '@@/Tip/TooltipWithChildren';
|
|
||||||
|
|
||||||
interface Props {
|
|
||||||
featureId: FeatureId;
|
|
||||||
}
|
|
||||||
export function YAMLReplace({ featureId }: Props) {
|
|
||||||
return (
|
|
||||||
<TooltipWithChildren
|
|
||||||
className="float-right"
|
|
||||||
heading="Apply YAML changes"
|
|
||||||
BEFeatureID={featureId}
|
|
||||||
message="Applies any changes that you make in the YAML editor by calling the Kubernetes API to patch the relevant resources. Any resource removals or unexpected resource additions that you make in the YAML will be ignored. Note that editing is disabled for resources in namespaces marked as system."
|
|
||||||
>
|
|
||||||
<div className="float-right">
|
|
||||||
<Button
|
|
||||||
type="button"
|
|
||||||
color="warninglight"
|
|
||||||
size="small"
|
|
||||||
onClick={() => {}}
|
|
||||||
disabled
|
|
||||||
>
|
|
||||||
Apply changes
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</TooltipWithChildren>
|
|
||||||
);
|
|
||||||
}
|
|
|
@ -214,11 +214,11 @@
|
||||||
<div class="col-sm-12">
|
<div class="col-sm-12">
|
||||||
<rd-widget>
|
<rd-widget>
|
||||||
<rd-widget-body>
|
<rd-widget-body>
|
||||||
<div ng-if="!ctrl.isSystemNamespace()" style="margin-bottom: 15px">
|
<div ng-if="!ctrl.isSystemNamespace()" class="mb-4 flex items-center gap-1">
|
||||||
<button
|
<button
|
||||||
ng-if="!ctrl.isExternalApplication()"
|
ng-if="!ctrl.isExternalApplication()"
|
||||||
type="button"
|
type="button"
|
||||||
class="btn btn-sm btn-light vertical-center"
|
class="btn btn-sm btn-light vertical-center ml-2"
|
||||||
ui-sref="kubernetes.applications.application.edit"
|
ui-sref="kubernetes.applications.application.edit"
|
||||||
style="margin-left: 0"
|
style="margin-left: 0"
|
||||||
data-cy="k8sAppDetail-editAppButton"
|
data-cy="k8sAppDetail-editAppButton"
|
||||||
|
@ -229,18 +229,23 @@
|
||||||
authorization="K8sApplicationDetailsW"
|
authorization="K8sApplicationDetailsW"
|
||||||
ng-if="ctrl.isExternalApplication()"
|
ng-if="ctrl.isExternalApplication()"
|
||||||
type="button"
|
type="button"
|
||||||
class="btn btn-sm btn-light"
|
class="btn btn-sm btn-light ml-2"
|
||||||
ui-sref="kubernetes.applications.application.edit"
|
ui-sref="kubernetes.applications.application.edit"
|
||||||
style="margin-left: 0"
|
|
||||||
data-cy="k8sAppDetail-editAppButton"
|
data-cy="k8sAppDetail-editAppButton"
|
||||||
>
|
>
|
||||||
<pr-icon icon="'code'" class-name="'mr-1'"></pr-icon>Edit External application
|
<pr-icon icon="'code'" class-name="'mr-1'"></pr-icon>Edit External application
|
||||||
</button>
|
</button>
|
||||||
|
<be-only-button
|
||||||
|
icon="'refresh-cw'"
|
||||||
|
feature-id="ctrl.limitedFeature"
|
||||||
|
message="'A rolling restart of the application is performed.'"
|
||||||
|
heading="'Rolling restart'"
|
||||||
|
button-text="'Rolling restart'"
|
||||||
|
></be-only-button>
|
||||||
<button
|
<button
|
||||||
ng-if="ctrl.application.ApplicationType !== ctrl.KubernetesApplicationTypes.POD"
|
ng-if="ctrl.application.ApplicationType !== ctrl.KubernetesApplicationTypes.POD"
|
||||||
type="button"
|
type="button"
|
||||||
class="btn btn-sm btn-light"
|
class="btn btn-sm btn-light ml-2"
|
||||||
style="margin-left: 0"
|
|
||||||
ng-click="ctrl.redeployApplication()"
|
ng-click="ctrl.redeployApplication()"
|
||||||
data-cy="k8sAppDetail-redeployButton"
|
data-cy="k8sAppDetail-redeployButton"
|
||||||
>
|
>
|
||||||
|
@ -250,7 +255,6 @@
|
||||||
ng-if="!ctrl.isExternalApplication()"
|
ng-if="!ctrl.isExternalApplication()"
|
||||||
type="button"
|
type="button"
|
||||||
class="btn btn-sm btn-light"
|
class="btn btn-sm btn-light"
|
||||||
style="margin-left: 0"
|
|
||||||
ng-click="ctrl.rollbackApplication()"
|
ng-click="ctrl.rollbackApplication()"
|
||||||
ng-disabled="ctrl.application.Revisions.length < 2 || ctrl.state.appType !== ctrl.KubernetesDeploymentTypes.APPLICATION_FORM"
|
ng-disabled="ctrl.application.Revisions.length < 2 || ctrl.state.appType !== ctrl.KubernetesDeploymentTypes.APPLICATION_FORM"
|
||||||
data-cy="k8sAppDetail-rollbackButton"
|
data-cy="k8sAppDetail-rollbackButton"
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import angular from 'angular';
|
import angular from 'angular';
|
||||||
import _ from 'lodash-es';
|
import _ from 'lodash-es';
|
||||||
import * as JsonPatch from 'fast-json-patch';
|
import * as JsonPatch from 'fast-json-patch';
|
||||||
|
import { FeatureId } from '@/react/portainer/feature-flags/enums';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
KubernetesApplicationDataAccessPolicies,
|
KubernetesApplicationDataAccessPolicies,
|
||||||
|
@ -350,6 +351,8 @@ class KubernetesApplicationController {
|
||||||
}
|
}
|
||||||
|
|
||||||
async onInit() {
|
async onInit() {
|
||||||
|
this.limitedFeature = FeatureId.K8S_ROLLING_RESTART;
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
activeTab: 0,
|
activeTab: 0,
|
||||||
currentName: this.$state.$current.name,
|
currentName: this.$state.$current.name,
|
||||||
|
|
|
@ -35,4 +35,5 @@ export enum FeatureId {
|
||||||
CUSTOM_LOGIN_BANNER = 'custom-login-banner',
|
CUSTOM_LOGIN_BANNER = 'custom-login-banner',
|
||||||
ENFORCE_DEPLOYMENT_OPTIONS = 'k8s-enforce-deployment-options',
|
ENFORCE_DEPLOYMENT_OPTIONS = 'k8s-enforce-deployment-options',
|
||||||
K8S_ADM_ONLY_USR_INGRESS_DEPLY = 'k8s-admin-only-ingress-deploy',
|
K8S_ADM_ONLY_USR_INGRESS_DEPLY = 'k8s-admin-only-ingress-deploy',
|
||||||
|
K8S_ROLLING_RESTART = 'k8s-rolling-restart',
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ export async function init(edition: Edition) {
|
||||||
[FeatureId.K8S_EDIT_YAML]: Edition.BE,
|
[FeatureId.K8S_EDIT_YAML]: Edition.BE,
|
||||||
[FeatureId.ENFORCE_DEPLOYMENT_OPTIONS]: Edition.BE,
|
[FeatureId.ENFORCE_DEPLOYMENT_OPTIONS]: Edition.BE,
|
||||||
[FeatureId.K8S_ADM_ONLY_USR_INGRESS_DEPLY]: Edition.BE,
|
[FeatureId.K8S_ADM_ONLY_USR_INGRESS_DEPLY]: Edition.BE,
|
||||||
|
[FeatureId.K8S_ROLLING_RESTART]: Edition.BE,
|
||||||
};
|
};
|
||||||
|
|
||||||
state.currentEdition = currentEdition;
|
state.currentEdition = currentEdition;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue