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

[3.12-8.0] Extend add new agent component #866

Draft
wants to merge 5 commits into
base: 3.12-8.0
Choose a base branch
from
Draft
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 @@ -290,6 +290,16 @@ define(['../module'], function(module) {
}
}
],
agentsInfo: [
'$requestService',
'$state',
async $requestService => {
try {
const result = await $requestService.apiReq('/agents/summary')
return result
} catch (err) {} //eslint-disable-line
}
],
isAdmin: [
'$currentDataService',
async $currentDataService => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
<div flex layout="column" class="mozilla-table-size-85 wz-white-background" ng-class="{'cursor-wait': multipleSelectorLoading}">
<!-- Register a new agent component -->
<div flex ng-if="showRegisterGuide" class="md-padding" layout="column"
layout-align="start space-around">
<div class="wz-margin-auto title-register-agent" ng-if="!wazuhNotReadyYet">
<span class="font-size-20">Deploy a new agent</span>
<span class="close-register-agent cursor-pointer" ng-click="showRegisterAgent()"><i class="fa fa-times" aria-hidden="true"></i>&nbsp;close</span>
</div>
<wz-register-agent></wz-register-agent>
</div>
<!-- End Register a new agent component-->


<div ng-if="!showRegisterGuide" flex layout="column" class="mozilla-table-size-85 wz-white-background" ng-class="{'cursor-wait': multipleSelectorLoading}">
<md-content flex layout="column" class="overflow-hidden wz-white-background">
<div layout="row" class="layout-row layout-align-end wz-white-background">
<div class='wz-breadcrumb-margin'>
Expand All @@ -13,6 +25,17 @@
<div class="loader"></div>
</div>

<!-- Show warning when agents count is 0 -->
<div ng-if="agentsCountTotal === 0">
<div flex class="euiCallOut euiCallOut--warning" style="margin:20px;">
<div class="euiCallOutHeader">
<wz-svg icon="callOutHeader"></wz-svg>
<span class="euiCallOutHeader__title">There are no agents registered to this manager. <a class="cursor-pointer green-href" ng-click="showRegisterAgent()">Deploy a new agent</a></span>
</div>
</div>
</div>
<!-- End show warning when agents count is 0-->

<!-- Headline -->
<div ng-show="!loadingRing" layout="column" layout-padding ng-if="!currentGroup || !currentGroup.name">
<div layout="row">
Expand Down Expand Up @@ -229,6 +252,4 @@
</wz-multiple-selector>
</div>
</div>
</div>
</md-content>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ define(['../../module', 'FileSaver'], function(controllers) {
$reportingService,
$groupHandler,
extensions,
agentsInfo,
isAdmin
) {
this.scope = $scope
Expand All @@ -49,7 +50,10 @@ define(['../../module', 'FileSaver'], function(controllers) {
groupConf: true,
agentsList: true
}
this.scope.showRegisterGuide = false
this.scope.agentsCountTotal = agentsInfo.data.data.Total - 1
this.scope.showModulesToExport = () => this.showModulesToExport()
this.scope.showRegisterAgent = () => this.showRegisterAgent()
this.scope.keyEquivalences = key => this.keyEquivalences(key)
this.scope.selectAll = value => this.selectAll(value)
this.scope.checkAllDisabled = () => this.checkAllDisabled()
Expand Down Expand Up @@ -613,6 +617,17 @@ define(['../../module', 'FileSaver'], function(controllers) {
this.scope.$applyAsync()
return
}

/**
* Shows/hide the register agent guide
*/
showRegisterAgent() {
try {
this.scope.showRegisterGuide = !this.scope.showRegisterGuide
} catch (error) {
console.error('Error showing the register agent guide ', error)
}
}

/*
* Get the key equivalences
Expand Down
Loading