Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(orb-ui): Remove duplicated logic on policy view polling control #2621

Merged
merged 1 commit into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import { STRINGS } from 'assets/text/strings';
import { Subscription } from 'rxjs';
import yaml from 'js-yaml';
import { AgentGroup } from 'app/common/interfaces/orb/agent.group.interface';
import { filter } from 'rxjs/operators';
import { PolicyDuplicateComponent } from '../duplicate/agent.policy.duplicate.confirmation';
import { NbDialogService } from '@nebular/theme';
import { updateMenuItems } from 'app/pages/pages-menu';
Expand All @@ -36,7 +35,7 @@ import { AgentPolicyDeleteComponent } from '../delete/agent.policy.delete.compon
templateUrl: './agent.policy.view.component.html',
styleUrls: ['./agent.policy.view.component.scss'],
})
export class AgentPolicyViewComponent implements OnInit, OnDestroy, OnChanges {
export class AgentPolicyViewComponent implements OnInit, OnDestroy {
strings = STRINGS.agents;

isLoading: boolean;
Expand Down Expand Up @@ -94,9 +93,6 @@ export class AgentPolicyViewComponent implements OnInit, OnDestroy, OnChanges {
this.lastUpdate = new Date();
}

ngOnChanges(): void {
this.orb.refreshNow();
}

isEditMode() {
return Object.values(this.editMode).reduce(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { AgentGroupDetailsComponent } from 'app/pages/fleet/groups/details/agent
import { SinkDetailsComponent } from 'app/pages/sinks/details/sink.details.component';
import { Subscription } from 'rxjs';
import { AgentMatchComponent } from 'app/pages/fleet/agents/match/agent.match.component';
import { OrbService } from 'app/common/services/orb.service';

@Component({
selector: 'ngx-policy-datasets',
Expand All @@ -44,9 +45,6 @@ export class PolicyDatasetsComponent
@Input()
policy: AgentPolicy;

@Output()
refreshPolicy: EventEmitter<string>;

isLoading: boolean;

subscription: Subscription;
Expand Down Expand Up @@ -86,8 +84,8 @@ export class PolicyDatasetsComponent
protected route: ActivatedRoute,
protected datasetService: DatasetPoliciesService,
private notificationsService: NotificationsService,
private orb: OrbService,
) {
this.refreshPolicy = new EventEmitter<string>();
this.datasets = [];
this.errors = {};
}
Expand Down Expand Up @@ -163,7 +161,7 @@ export class PolicyDatasetsComponent
})
.onClose.subscribe((resp) => {
if (resp === DATASET_RESPONSE.CREATED) {
this.refreshPolicy.emit('refresh-from-dataset');
this.orb.refreshNow();
}
});
}
Expand All @@ -182,7 +180,7 @@ export class PolicyDatasetsComponent
})
.onClose.subscribe((resp) => {
if (resp !== DATASET_RESPONSE.CANCELED) {
this.refreshPolicy.emit('refresh-from-dataset');
this.orb.refreshNow();
}
});
}
Expand Down Expand Up @@ -232,7 +230,7 @@ export class PolicyDatasetsComponent
'',
);
});
this.refreshPolicy.emit('refresh-from-dataset');
this.orb.refreshNow();
}
});
}
Expand Down