-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed no agent alert spawn with selected agent in agent welcome (#7029)
* Fixed no-agent spawn * Added Changelog --------- Co-authored-by: Federico Rodriguez <federico.rodriguez@wazuh.com>
- Loading branch information
1 parent
930e5d5
commit 05ebac5
Showing
3 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
plugins/main/public/components/common/hocs/withAgentSync.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Wazuh app - React HOCs handles rendering errors | ||
* Copyright (C) 2015-2022 Wazuh, Inc. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Find more information about this on the LICENSE file. | ||
*/ | ||
|
||
import React, { useState, useEffect } from 'react'; | ||
import { PinnedAgentManager } from '../../wz-agent-selector/wz-agent-selector-service'; | ||
import { withGuardAsync } from './withGuard'; | ||
|
||
export const withAgentSync = WrappedComponent => props => { | ||
const [loading, setLoading] = useState(true); | ||
useEffect(() => { | ||
const pinnedAgentManager = new PinnedAgentManager(); | ||
pinnedAgentManager.syncPinnedAgentSources().finally(() => { | ||
setLoading(false); | ||
}); | ||
}, []); | ||
return loading ? null : <WrappedComponent {...props}></WrappedComponent>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters