Skip to content

Commit

Permalink
NVSHAS-6381: UI: In multiple group mode change zero-drif should not b…
Browse files Browse the repository at this point in the history
…e allowed to changed if zero-drift status is different.
  • Loading branch information
xzhang authored and Gary Duan committed May 4, 2022
1 parent 5e41192 commit 99c80c9
Show file tree
Hide file tree
Showing 4 changed files with 174 additions and 103 deletions.
161 changes: 92 additions & 69 deletions admin/webapp/root/app/views/group.html
Original file line number Diff line number Diff line change
Expand Up @@ -442,90 +442,113 @@ <h2 class="text-dark">{{'service.SWITCH_MODE' | translate | capitalizeEach}}</h2
<md-dialog-content style="overflow: visible" class="mt-lg">
<div class="col-sm-12 ">
<div class="col-sm-8">
<div
class="radio-inline c-radio mr-lg"
ng-class="inputMaskDisabledClass"
>
<label
class="text-gray-label"
<div class="pull-left mr-lg">
<div
class="radio-inline c-radio mr-lg"
ng-class="inputMaskDisabledClass"
>
<input
type="radio"
name="mode"
value="discover"
ng-model="switch.mode"
ng-click="switchServiceMode('Discover')"
/>
<span
class="fa fa-binoculars text-discover"
<label
class="text-gray-label"
ng-class="inputMaskDisabledClass"
/>{{'topbar.mode.LEARNING' | translate}}
</label>
</div>
<div
class="radio-inline c-radio pl-sm mr-lg"
ng-class="inputMaskDisabledClass"
>
<label
class="text-gray-label"
>
<input
type="radio"
name="mode"
value="discover"
ng-model="switch.mode"
ng-disabled="isViolatedSwitch"
ng-click="switchServiceMode('Discover')"
/>
<span
class="fa fa-binoculars text-discover"
ng-class="inputMaskDisabledClass"
/>{{'topbar.mode.LEARNING' | translate}}
</label>
</div>
<div
class="radio-inline c-radio pl-sm mr-lg"
ng-class="inputMaskDisabledClass"
>
<input
type="radio"
name="mode"
value="monitor"
ng-model="switch.mode"
ng-click="switchServiceMode('Monitor')"
/>
<span
class="fa fa-bell text-monitor"
<label
class="text-gray-label"
ng-class="inputMaskDisabledClass"
/>{{'topbar.mode.EVALUATION' | translate}}
</label>
</div>
<div
class="radio-inline c-radio pl-sm"
ng-class="inputMaskDisabledClass"
>
<label
class="text-gray-label"
>
<input
type="radio"
name="mode"
value="monitor"
ng-model="switch.mode"
ng-disabled="isViolatedSwitch"
ng-click="switchServiceMode('Monitor')"
/>
<span
class="fa fa-bell text-monitor"
ng-class="inputMaskDisabledClass"
/>{{'topbar.mode.EVALUATION' | translate}}
</label>
</div>
<div
class="radio-inline c-radio pl-sm"
ng-class="inputMaskDisabledClass"
>
<input
type="radio"
name="mode"
value="protect"
ng-model="switch.mode"
ng-click="switchServiceMode('Protect')"
/>
<span
class="fa fa-shield text-protect"
<label
class="text-gray-label"
ng-class="inputMaskDisabledClass"
/>{{'topbar.mode.ENFORCE' | translate}}
</label>
>
<input
type="radio"
name="mode"
value="protect"
ng-model="switch.mode"
ng-disabled="isViolatedSwitch"
ng-click="switchServiceMode('Protect')"
/>
<span
class="fa fa-shield text-protect"
ng-class="inputMaskDisabledClass"
/>{{'topbar.mode.ENFORCE' | translate}}
</label>
</div>
</div>
<div class="text-warning text-sm pull-left">
{{zeroDriftHint}}
</div>
</div>
<div class="col-sm-12 mt-lg">
<div
class="radio-inline c-radio pl-sm md-switch2"
ng-class="inputMaskDisabledClass"
>
<md-icon md-svg-src="app/img/icons/anchor.svg"
aria-label="Zero Drift"></md-icon>
<label class="text-gray-label">
{{'audit.gridHeader.ZERO_DRIFT' | translate}}
<div class="pull-left mr-lg">
<label class="radio-inline c-radio text-gray-label"
ng-class="inputMaskDisabledClass">
<input
type="checkbox"
id="zeroDrift"
type="radio"
name="zero-drift-switch"
ng-model="switch.zeroDrift"
ng-true-value="'zero-drift'"
ng-false-value="'basic'"
value="zero-drift"
ng-click="switchZeroDrift()"
required
/>
<span class="toggle hand" ng-disabled="!isNewServiceModeAuthorized"></span>
<span class="fa fa-check text-discover"
ng-class="inputMaskDisabledClass" />
{{'group.ZERO_DRIFT' | translate}}
</label>
<div class="text-muted text-sm mb-lg pull-right">
{{'setting.ZERODRIFT_COMMENT' | translate}}
</div>
<label class="radio-inline c-radio text-gray-label"
ng-class="inputMaskDisabledClass">
<input
id="basic"
type="radio"
name="zero-drift-switch"
ng-model="switch.zeroDrift"
value="basic"
ng-click="switchZeroDrift()"
required
/>
<span class="fa fa-check text-discover"
ng-class="inputMaskDisabledClass" />
{{'group.BASIC' | translate}}
</label>
</div>
<div class="text-muted text-sm mb-lg pull-left">
{{'group.ZERODRIFT_COMMENT' | translate}}
</div>
</div>
<div class="col-sm-12 pb-sm" ng-show="noModeList.length > 0">
Expand All @@ -541,7 +564,7 @@ <h2 class="text-dark">{{'service.SWITCH_MODE' | translate | capitalizeEach}}</h2
</div>
<div class="col-sm-12 pb-sm">
<button class="btn btn-wide btn-default pull-right"
ng-disabled="!switchModeForm.$dirty || !switch.mode"
ng-disabled="!switchModeForm.$dirty || (!switch.mode && !switch.zeroDrift)"
ng-click="updateServiceMode()">
<em class="fa fa-send mr-sm"></em>{{'setting.SUBMIT' | translate}}
</button>
Expand Down
13 changes: 9 additions & 4 deletions admin/webapp/root/app_src/i18n/en/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1869,6 +1869,11 @@
"SELECT_ALL_ALERT": "The selection contains 'nodes' group. Please confirm if you want to switch this group to ",
"SWITCH_MODE_DISABLED": "Policy mode in following {{noModeGroupCount}} group(s) cannot be switched.",
"SCORED_DISABLED": "Cannot turn on/off scorable attribute for one or more currently selected groups.",
"ZERODRIFT_COMMENT": "Enable/disable automated protection that prevents processes and file system drift for selected groups.",
"ZERO_DRIFT_HINT": "To disable zeroDrift we need switch the mode to discover",
"ZERO_DRIFT": "Zero Drift",
"NO_CHANGE": "No Change",
"BASIC": "Basic",
"MODE_NODES": " mode or unselect it.",
"SWITCH_SCORABLE": "Scorable",
"RESPONSE_RULES": "Response rules",
Expand Down Expand Up @@ -2695,7 +2700,7 @@
"WEBHOOKS": "Webhooks",
"CLUSTER": "Cluster",
"CLUSTER_COMMENT": "Used to identify the cluster in notifications",
"ZERODRIFT_COMMENT": "For new Groups, enable/disable automated process and file protections based drift detection from the original image.",
"ZERODRIFT_COMMENT": "Enable/disable automated protection that prevents processes and file system drift for new groups.",
"CLUSTER_NAME": "Cluster Name:",
"SERVER": "Server",
"PROTOCOL": "Protocol",
Expand Down Expand Up @@ -2737,10 +2742,10 @@
"IMPORT_FAILED": "Import failed ",
"NEW_SERVICE_POLICY_MODE": "Default mode for new services",
"NEW_SERVICE": "New Services Mode",
"NEW_SERVICE_COMMENT": "The default services mode for new Groups detected which have not been previously learned or configured.",
"NEW_SERVICE_COMMENT": "The default policy mode for new groups that have not been previously detected.",
"NET_SERVICE_POLICY_MODE": "Network Service Policy Mode",
"MODE_AUTO_SWITCH": "Service Group Mode Automation",
"MODE_AUTO_SWITCH_HINT": "Promotes a Group’s protection Mode based on elapsed time and criteria. Does not apply to CRD created Groups.",
"MODE_AUTO_SWITCH_HINT": "Promote groups' policy mode automatically. This does not affect CRD created groups.",
"D2M": "Discover to Monitor",
"M2P": "Monitor to Protect",
"D2M_HINT": "Criteria: Elapsed time for learning all network and process activity of at least one live pod in the Group.",
Expand Down Expand Up @@ -2820,7 +2825,7 @@
"OPENID": "Configure single sign on using OpenID Connect.",
"ENABLED_NET_POLICY_MODE": "The selected policy mode will apply globally to the network rules for all groups, and each Group’s individual policy mode will only apply to process and file rules.",
"ENABLED_NET_POLICY_MODE_GROUP": " mode will apply globally to the network rules for all groups, and each Group’s individual policy mode will only apply to process and file rules.",
"DISABLED_NET_POLICY_MODE": "Per group level policy mode will apply to network rules, process and file rules"
"DISABLED_NET_POLICY_MODE": "Set the network policy mode at the global level"
}
},
"ldap": {
Expand Down
13 changes: 9 additions & 4 deletions admin/webapp/root/app_src/i18n/zh_cn/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -1868,6 +1868,11 @@
"SELECT_ALL_ALERT": "已选组里含有 \"nodes\" 组, 请确认是否将此组切换成",
"SWITCH_MODE_DISABLED": "以下{{noModeGroupCount}}组上策略模式不能被切换",
"SCORED_DISABLED": "在一些现在选中的组上评分属性不能被开关",
"ZERODRIFT_COMMENT": "启用/禁用防止选定组的进程和文件系统漂移的自动保护.",
"ZERO_DRIFT_HINT": "禁用ZeroDrift时需要将模式转换为学习",
"ZERO_DRIFT": "Zero Drift",
"NO_CHANGE": "不更改",
"BASIC": "基本",
"MODE_NODES": "模式或者不选择此组的。",
"SWITCH_SCORABLE": "参与评分",
"RESPONSE_RULES": "响应规则",
Expand Down Expand Up @@ -2694,7 +2699,7 @@
"WEBHOOK": "网络挂接",
"CLUSTER": "集群",
"CLUSTER_COMMENT": "用于在通知里识别集群",
"ZERODRIFT_COMMENT": "对于新的组, 启用/禁用基于从原始镜像Drift检测自动处理和文件保护.",
"ZERODRIFT_COMMENT": "启用/禁用防止新建组的进程和文件系统漂移的自动保护.",
"CLUSTER_NAME": "集群名:",
"SERVER": "服务器",
"PROTOCOL": "协议",
Expand Down Expand Up @@ -2736,10 +2741,10 @@
"IMPORT_FAILED": "输入失败 ",
"NEW_SERVICE_POLICY_MODE": "新增服务的策略模式",
"NEW_SERVICE": "新增服务",
"NEW_SERVICE_COMMENT": "为检测出之前没有学习或配置的新组的默认服务模式.",
"NEW_SERVICE_COMMENT": "新建组的默认策略模式没有被提前监测到.",
"NET_SERVICE_POLICY_MODE": "网络服务策略模式",
"MODE_AUTO_SWITCH": "服务组模式自动化",
"MODE_AUTO_SWITCH_HINT": "基于消耗时间和条件的升级组的保护模式. 它不应用于CRD创建的组.",
"MODE_AUTO_SWITCH_HINT": "自动升级组的策略模式. 这不会影响CRD创建的组.",
"D2M": "学习模式到监视模式",
"M2P": "监视模式到保护模式",
"D2M_HINT": "条件: 学习全部网络的消耗时间和至少组里的一个活跃Pod处理活动.",
Expand Down Expand Up @@ -2819,7 +2824,7 @@
"OPENID": "用OpenID Connect配置单一登录.",
"ENABLED_NET_POLICY_MODE": "选定的策略模式将全局地应用于所有组的网络规则上, 每个组各自的策略模式将只应用于进程和文件规则上.",
"ENABLED_NET_POLICY_MODE_GROUP": "模式将全局地应用于所有组的网络规则上, 每个组各自的策略模式将只应用于进程和文件规则上.",
"DISABLED_NET_POLICY_MODE": "各组的策略模式将应用在网络规则,进程及文件规则上"
"DISABLED_NET_POLICY_MODE": "在全局级别设置网络策略模式"
}
},
"ldap": {
Expand Down
Loading

0 comments on commit 99c80c9

Please sign in to comment.