From 9cea9cf5de50b24f5b10f62dde8e04244947f7bd Mon Sep 17 00:00:00 2001 From: joaoguilherme2003 Date: Mon, 28 Aug 2023 15:09:28 -0300 Subject: [PATCH] fix(orb-ui): #1098 Users can't redo CREATE request after a error --- .../datasets/policies.agent/add/agent.policy.add.component.ts | 1 + ui/src/app/pages/fleet/agents/add/agent.add.component.ts | 4 ++++ .../app/pages/fleet/groups/add/agent.group.add.component.ts | 3 +++ ui/src/app/pages/sinks/add/sink-add.component.ts | 3 +++ 4 files changed, 11 insertions(+) diff --git a/ui/src/app/pages/datasets/policies.agent/add/agent.policy.add.component.ts b/ui/src/app/pages/datasets/policies.agent/add/agent.policy.add.component.ts index a0ea52d47..025583845 100644 --- a/ui/src/app/pages/datasets/policies.agent/add/agent.policy.add.component.ts +++ b/ui/src/app/pages/datasets/policies.agent/add/agent.policy.add.component.ts @@ -328,6 +328,7 @@ kind: collection`; 'Failed to create Agent Policy', `Error: ${error.status} - ${error.statusText} - ${error.error.error}`, ); + this.isRequesting = false; }, ); } diff --git a/ui/src/app/pages/fleet/agents/add/agent.add.component.ts b/ui/src/app/pages/fleet/agents/add/agent.add.component.ts index 667977482..7d4d86512 100644 --- a/ui/src/app/pages/fleet/agents/add/agent.add.component.ts +++ b/ui/src/app/pages/fleet/agents/add/agent.add.component.ts @@ -9,6 +9,7 @@ import { NotificationsService } from 'app/common/services/notifications/notifica import { AgentKeyComponent } from '../key/agent.key.component'; import { Tags } from 'app/common/interfaces/orb/tag'; + @Component({ selector: 'ngx-agent-add-component', templateUrl: './agent.add.component.html', @@ -127,6 +128,9 @@ export class AgentAddComponent { } else { this.agentsService.addAgent(payload).subscribe((resp) => { this.openKeyModal(resp); + }, + (error) => { + this.isRequesting = false; }); } } diff --git a/ui/src/app/pages/fleet/groups/add/agent.group.add.component.ts b/ui/src/app/pages/fleet/groups/add/agent.group.add.component.ts index 733543773..60e337cc4 100644 --- a/ui/src/app/pages/fleet/groups/add/agent.group.add.component.ts +++ b/ui/src/app/pages/fleet/groups/add/agent.group.add.component.ts @@ -300,6 +300,9 @@ export class AgentGroupAddComponent '', ); this.goBack(); + }, + (error) => { + this.isRequesting = false; }); } } diff --git a/ui/src/app/pages/sinks/add/sink-add.component.ts b/ui/src/app/pages/sinks/add/sink-add.component.ts index 45a8ead89..d368dd044 100644 --- a/ui/src/app/pages/sinks/add/sink-add.component.ts +++ b/ui/src/app/pages/sinks/add/sink-add.component.ts @@ -88,6 +88,9 @@ export class SinkAddComponent { this.sinksService.addSink(payload).subscribe(() => { this.notificationsService.success('Sink successfully created', ''); this.goBack(); + }, + (error) => { + this.isRequesting = false; }); }