fix(deploy): return to referring view [EE-5345] (#8763)

* fix(deploy): return to referring view [EE-5345]

* no-underline -> no-decoration

---------

Co-authored-by: testa113 <testa113>
pull/8851/head
Ali 2023-04-26 11:23:15 +12:00 committed by GitHub
parent 9b287f3020
commit 3e654ff9b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 37 additions and 11 deletions

View File

@ -293,15 +293,12 @@ angular.module('portainer.kubernetes', ['portainer.app', registriesModule, custo
const deploy = { const deploy = {
name: 'kubernetes.deploy', name: 'kubernetes.deploy',
url: '/deploy?templateId', url: '/deploy?templateId&referrer',
views: { views: {
'content@': { 'content@': {
component: 'kubernetesDeployView', component: 'kubernetesDeployView',
}, },
}, },
params: {
templateId: '',
},
}; };
const resourcePools = { const resourcePools = {

View File

@ -89,7 +89,7 @@
ng-if="$ctrl.isPrimary" ng-if="$ctrl.isPrimary"
type="button" type="button"
class="btn btn-sm btn-primary vertical-center !ml-0 h-fit" class="btn btn-sm btn-primary vertical-center !ml-0 h-fit"
ui-sref="kubernetes.deploy" ui-sref="kubernetes.deploy({ referrer: 'kubernetes.applications' })"
data-cy="k8sApp-deployFromManifestButton" data-cy="k8sApp-deployFromManifestButton"
> >
<pr-icon icon="'plus'" class-name="'!h-3'"></pr-icon>Create from manifest <pr-icon icon="'plus'" class-name="'!h-3'"></pr-icon>Create from manifest

View File

@ -37,7 +37,12 @@
<button type="button" class="btn btn-sm btn-secondary vertical-center !ml-0" ui-sref="kubernetes.configurations.new" data-cy="k8sConfig-addConfigWithFormButton"> <button type="button" class="btn btn-sm btn-secondary vertical-center !ml-0" ui-sref="kubernetes.configurations.new" data-cy="k8sConfig-addConfigWithFormButton">
<pr-icon icon="'plus'" class-name="'!h-3'"></pr-icon>Add with form <pr-icon icon="'plus'" class-name="'!h-3'"></pr-icon>Add with form
</button> </button>
<button type="button" class="btn btn-sm btn-primary vertical-center !ml-0" ui-sref="kubernetes.deploy" data-cy="k8sConfig-deployFromManifestButton"> <button
type="button"
class="btn btn-sm btn-primary vertical-center !ml-0"
ui-sref="kubernetes.deploy({ referrer: 'kubernetes.configurations' })"
data-cy="k8sConfig-deployFromManifestButton"
>
<pr-icon icon="'plus'" class-name="'!h-3'"></pr-icon>Create from manifest <pr-icon icon="'plus'" class-name="'!h-3'"></pr-icon>Create from manifest
</button> </button>
</div> </div>

View File

@ -36,7 +36,12 @@
<button type="button" class="btn btn-sm btn-secondary !ml-0" ui-sref="kubernetes.resourcePools.new" data-cy="k8sNamespace-addNamespaceWithFormButton"> <button type="button" class="btn btn-sm btn-secondary !ml-0" ui-sref="kubernetes.resourcePools.new" data-cy="k8sNamespace-addNamespaceWithFormButton">
<pr-icon icon="'plus'" class-name="'!h-3'"></pr-icon>Add with form <pr-icon icon="'plus'" class-name="'!h-3'"></pr-icon>Add with form
</button> </button>
<button type="button" class="btn btn-sm btn-primary !ml-0" ui-sref="kubernetes.deploy" data-cy="k8sNamespace-deployFromManifestButton"> <button
type="button"
class="btn btn-sm btn-primary !ml-0"
ui-sref="kubernetes.deploy({ referrer: 'kubernetes.resourcePools' })"
data-cy="k8sNamespace-deployFromManifestButton"
>
<pr-icon icon="'plus'" class-name="'!h-3'"></pr-icon>Create from manifest <pr-icon icon="'plus'" class-name="'!h-3'"></pr-icon>Create from manifest
</button> </button>
</div> </div>

View File

@ -30,7 +30,12 @@
<pr-icon icon="'trash-2'"></pr-icon> <pr-icon icon="'trash-2'"></pr-icon>
Remove Remove
</button> </button>
<button type="button" class="btn btn-sm btn-primary vertical-center !ml-0" ui-sref="kubernetes.deploy" data-cy="k8sVolume-deployFromManifestButton"> <button
type="button"
class="btn btn-sm btn-primary vertical-center !ml-0"
ui-sref="kubernetes.deploy({ referrer: 'kubernetes.volumes' })"
data-cy="k8sVolume-deployFromManifestButton"
>
<pr-icon icon="'plus'" class-name="'!h-3'"></pr-icon> <pr-icon icon="'plus'" class-name="'!h-3'"></pr-icon>
Create from manifest Create from manifest
</button> </button>

View File

@ -283,6 +283,12 @@ class KubernetesDeployController {
this.Notifications.success('Success', 'Manifest successfully deployed'); this.Notifications.success('Success', 'Manifest successfully deployed');
this.state.isEditorDirty = false; this.state.isEditorDirty = false;
if (this.$state.params.referrer) {
this.$state.go(this.$state.params.referrer);
return;
}
this.$state.go('kubernetes.applications'); this.$state.go('kubernetes.applications');
} catch (err) { } catch (err) {
this.Notifications.error('Unable to deploy manifest', err, 'Unable to deploy resources'); this.Notifications.error('Unable to deploy manifest', err, 'Unable to deploy resources');

View File

@ -168,7 +168,7 @@ function TableActions({ selectedItems }: TableActionsProps) {
return ( return (
<div className="servicesDatatable-actions"> <div className="servicesDatatable-actions">
<Authorized authorizations="K8sServiceW"> <Authorized authorizations="K8sServicesW">
<Button <Button
className="btn-wrapper" className="btn-wrapper"
color="dangerlight" color="dangerlight"
@ -179,7 +179,11 @@ function TableActions({ selectedItems }: TableActionsProps) {
Remove Remove
</Button> </Button>
<Link to="kubernetes.deploy" className="space-left"> <Link
to="kubernetes.deploy"
params={{ referrer: 'kubernetes.services' }}
className="space-left hover:no-decoration"
>
<Button className="btn-wrapper" color="primary" icon="plus"> <Button className="btn-wrapper" color="primary" icon="plus">
Create from manifest Create from manifest
</Button> </Button>

View File

@ -94,7 +94,11 @@ export function IngressDatatable() {
</Link> </Link>
</Authorized> </Authorized>
<Authorized authorizations="K8sIngressesW"> <Authorized authorizations="K8sIngressesW">
<Link to="kubernetes.deploy" className="space-left no-decoration"> <Link
to="kubernetes.deploy"
className="space-left no-decoration"
params={{ referrer: 'kubernetes.ingresses' }}
>
<Button icon={Plus} className="btn-wrapper"> <Button icon={Plus} className="btn-wrapper">
Create from manifest Create from manifest
</Button> </Button>