mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
# Backport This will backport the following commits from `main` to `8.11`: - [[EDR Workflows] An empty note section in read mode (#168338)](https://github.com/elastic/kibana/pull/168338) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Konrad Szwarc","email":"konrad.szwarc@elastic.co"},"sourceCommit":{"committedDate":"2023-10-11T14:16:11Z","message":"[EDR Workflows] An empty note section in read mode (#168338)\n\nhttps://github.com/elastic/kibana/issues/168318\r\n\r\nDon't render Note section in View mode (no write permissions) if no note\r\nto show.\r\n\r\n\r\n","sha":"bf1357cb8b716e66031a4da12db7097fe6aa31b3","branchLabelMapping":{"^v8.12.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","Team:Defend Workflows","v8.11.0","v8.12.0"],"number":168338,"url":"https://github.com/elastic/kibana/pull/168338","mergeCommit":{"message":"[EDR Workflows] An empty note section in read mode (#168338)\n\nhttps://github.com/elastic/kibana/issues/168318\r\n\r\nDon't render Note section in View mode (no write permissions) if no note\r\nto show.\r\n\r\n\r\n","sha":"bf1357cb8b716e66031a4da12db7097fe6aa31b3"}},"sourceBranch":"main","suggestedTargetBranches":["8.11"],"targetPullRequestStates":[{"branch":"8.11","label":"v8.11.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.12.0","labelRegex":"^v8.12.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/168338","number":168338,"mergeCommit":{"message":"[EDR Workflows] An empty note section in read mode (#168338)\n\nhttps://github.com/elastic/kibana/issues/168318\r\n\r\nDon't render Note section in View mode (no write permissions) if no note\r\nto show.\r\n\r\n\r\n","sha":"bf1357cb8b716e66031a4da12db7097fe6aa31b3"}}]}] BACKPORT--> Co-authored-by: Konrad Szwarc <konrad.szwarc@elastic.co>
This commit is contained in:
parent
b01320b419
commit
0e06567fd3
2 changed files with 132 additions and 72 deletions
|
@ -197,47 +197,99 @@ describe(
|
|||
});
|
||||
|
||||
describe('Renders read only protection updates for user without write permissions', () => {
|
||||
let indexedPolicy: IndexedFleetEndpointPolicyResponse;
|
||||
let policy: PolicyData;
|
||||
const oneWeekAgo = moment.utc().subtract(1, 'weeks');
|
||||
describe('With note field', () => {
|
||||
let indexedPolicy: IndexedFleetEndpointPolicyResponse;
|
||||
let policy: PolicyData;
|
||||
const oneWeekAgo = moment.utc().subtract(1, 'weeks');
|
||||
|
||||
beforeEach(() => {
|
||||
login(ROLE.endpoint_security_policy_management_read);
|
||||
disableExpandableFlyoutAdvancedSettings();
|
||||
getEndpointIntegrationVersion().then((version) => {
|
||||
createAgentPolicyTask(version).then((data) => {
|
||||
indexedPolicy = data;
|
||||
policy = indexedPolicy.integrationPolicies[0];
|
||||
setCustomProtectionUpdatesManifestVersion(policy.id, oneWeekAgo.format('YYYY-MM-DD'));
|
||||
setCustomProtectionUpdatesNote(policy.id, testNote);
|
||||
beforeEach(() => {
|
||||
login(ROLE.endpoint_security_policy_management_read);
|
||||
disableExpandableFlyoutAdvancedSettings();
|
||||
getEndpointIntegrationVersion().then((version) => {
|
||||
createAgentPolicyTask(version).then((data) => {
|
||||
indexedPolicy = data;
|
||||
policy = indexedPolicy.integrationPolicies[0];
|
||||
setCustomProtectionUpdatesManifestVersion(
|
||||
policy.id,
|
||||
oneWeekAgo.format('YYYY-MM-DD')
|
||||
);
|
||||
setCustomProtectionUpdatesNote(policy.id, testNote);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
if (indexedPolicy) {
|
||||
cy.task('deleteIndexedFleetEndpointPolicies', indexedPolicy);
|
||||
}
|
||||
});
|
||||
|
||||
it('should render the protection updates tab content', () => {
|
||||
loadProtectionUpdatesUrl(policy.id);
|
||||
cy.getByTestSubj('protection-updates-manifest-switch').should('not.exist');
|
||||
cy.getByTestSubj('protection-updates-state-view-mode');
|
||||
cy.getByTestSubj('protection-updates-manifest-name-title');
|
||||
|
||||
cy.getByTestSubj('protection-updates-manifest-name-deployed-version-title');
|
||||
cy.getByTestSubj('protection-updates-deployed-version').contains(
|
||||
oneWeekAgo.format('MMMM DD, YYYY')
|
||||
);
|
||||
cy.getByTestSubj('protection-updates-manifest-name-version-to-deploy-title');
|
||||
cy.getByTestSubj('protection-updates-version-to-deploy-view-mode');
|
||||
cy.getByTestSubj('protection-updates-version-to-deploy-picker').should('not.exist');
|
||||
|
||||
cy.getByTestSubj('protection-updates-manifest-name-note-title');
|
||||
cy.getByTestSubj('protection-updates-manifest-note').should('not.exist');
|
||||
cy.getByTestSubj('protection-updates-manifest-note-view-mode').contains(testNote);
|
||||
cy.getByTestSubj('protectionUpdatesSaveButton').should('be.disabled');
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
if (indexedPolicy) {
|
||||
cy.task('deleteIndexedFleetEndpointPolicies', indexedPolicy);
|
||||
}
|
||||
});
|
||||
describe('Without note field', () => {
|
||||
let indexedPolicy: IndexedFleetEndpointPolicyResponse;
|
||||
let policy: PolicyData;
|
||||
const oneWeekAgo = moment.utc().subtract(1, 'weeks');
|
||||
|
||||
it('should render the protection updates tab content', () => {
|
||||
loadProtectionUpdatesUrl(policy.id);
|
||||
cy.getByTestSubj('protection-updates-manifest-switch').should('not.exist');
|
||||
cy.getByTestSubj('protection-updates-state-view-mode');
|
||||
cy.getByTestSubj('protection-updates-manifest-name-title');
|
||||
beforeEach(() => {
|
||||
login(ROLE.endpoint_security_policy_management_read);
|
||||
disableExpandableFlyoutAdvancedSettings();
|
||||
getEndpointIntegrationVersion().then((version) => {
|
||||
createAgentPolicyTask(version).then((data) => {
|
||||
indexedPolicy = data;
|
||||
policy = indexedPolicy.integrationPolicies[0];
|
||||
setCustomProtectionUpdatesManifestVersion(
|
||||
policy.id,
|
||||
oneWeekAgo.format('YYYY-MM-DD')
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
cy.getByTestSubj('protection-updates-manifest-name-deployed-version-title');
|
||||
cy.getByTestSubj('protection-updates-deployed-version').contains(
|
||||
oneWeekAgo.format('MMMM DD, YYYY')
|
||||
);
|
||||
cy.getByTestSubj('protection-updates-manifest-name-version-to-deploy-title');
|
||||
cy.getByTestSubj('protection-updates-version-to-deploy-view-mode');
|
||||
cy.getByTestSubj('protection-updates-version-to-deploy-picker').should('not.exist');
|
||||
afterEach(() => {
|
||||
if (indexedPolicy) {
|
||||
cy.task('deleteIndexedFleetEndpointPolicies', indexedPolicy);
|
||||
}
|
||||
});
|
||||
|
||||
cy.getByTestSubj('protection-updates-manifest-name-note-title');
|
||||
cy.getByTestSubj('protection-updates-manifest-note').should('not.exist');
|
||||
cy.getByTestSubj('protection-updates-manifest-note-view-mode').contains(testNote);
|
||||
cy.getByTestSubj('protectionUpdatesSaveButton').should('be.disabled');
|
||||
it('should render the protection updates tab content', () => {
|
||||
loadProtectionUpdatesUrl(policy.id);
|
||||
cy.getByTestSubj('protection-updates-manifest-switch').should('not.exist');
|
||||
cy.getByTestSubj('protection-updates-state-view-mode');
|
||||
cy.getByTestSubj('protection-updates-manifest-name-title');
|
||||
|
||||
cy.getByTestSubj('protection-updates-manifest-name-deployed-version-title');
|
||||
cy.getByTestSubj('protection-updates-deployed-version').contains(
|
||||
oneWeekAgo.format('MMMM DD, YYYY')
|
||||
);
|
||||
cy.getByTestSubj('protection-updates-manifest-name-version-to-deploy-title');
|
||||
cy.getByTestSubj('protection-updates-version-to-deploy-view-mode');
|
||||
cy.getByTestSubj('protection-updates-version-to-deploy-picker').should('not.exist');
|
||||
|
||||
cy.getByTestSubj('protection-updates-manifest-name-note-title').should('not.exist');
|
||||
cy.getByTestSubj('protection-updates-manifest-note').should('not.exist');
|
||||
cy.getByTestSubj('protection-updates-manifest-note-view-mode').should('not.exist');
|
||||
cy.getByTestSubj('protectionUpdatesSaveButton').should('be.disabled');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -330,46 +330,54 @@ export const ProtectionUpdatesLayout = React.memo<ProtectionUpdatesLayoutProps>(
|
|||
|
||||
<EuiSpacer size="l" />
|
||||
{renderVersionToDeployPicker()}
|
||||
|
||||
<EuiSpacer size="m" />
|
||||
<EuiFlexGroup direction="row" gutterSize="none" alignItems="center">
|
||||
<EuiTitle size="xxs" data-test-subj={'protection-updates-manifest-name-note-title'}>
|
||||
<h5>
|
||||
{i18n.translate('xpack.securitySolution.endpoint.protectionUpdates.note.label', {
|
||||
defaultMessage: 'Note',
|
||||
})}
|
||||
</h5>
|
||||
</EuiTitle>
|
||||
<EuiIconTip
|
||||
position="right"
|
||||
content={
|
||||
<>
|
||||
<FormattedMessage
|
||||
id="xpack.securitySolution.endpoint.protectionUpdates.note.tooltip"
|
||||
defaultMessage="You can add an optional note to explain the reason for selecting a particular policy version."
|
||||
/>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
</EuiFlexGroup>
|
||||
<EuiSpacer size="m" />
|
||||
{canWritePolicyManagement ? (
|
||||
<EuiTextArea
|
||||
value={note}
|
||||
disabled={getNoteInProgress || createNoteInProgress}
|
||||
onChange={(e) => setNote(e.target.value)}
|
||||
fullWidth
|
||||
rows={3}
|
||||
placeholder={i18n.translate(
|
||||
'xpack.securitySolution.endpoint.protectionUpdates.note.placeholder',
|
||||
{
|
||||
defaultMessage: 'Add relevant information about update here',
|
||||
}
|
||||
{(canWritePolicyManagement || note) && (
|
||||
<>
|
||||
<EuiSpacer size="m" />
|
||||
<EuiFlexGroup direction="row" gutterSize="none" alignItems="center">
|
||||
<EuiTitle size="xxs" data-test-subj={'protection-updates-manifest-name-note-title'}>
|
||||
<h5>
|
||||
{i18n.translate(
|
||||
'xpack.securitySolution.endpoint.protectionUpdates.note.label',
|
||||
{
|
||||
defaultMessage: 'Note',
|
||||
}
|
||||
)}
|
||||
</h5>
|
||||
</EuiTitle>
|
||||
<EuiIconTip
|
||||
position="right"
|
||||
content={
|
||||
<>
|
||||
<FormattedMessage
|
||||
id="xpack.securitySolution.endpoint.protectionUpdates.note.tooltip"
|
||||
defaultMessage="You can add an optional note to explain the reason for selecting a particular policy version."
|
||||
/>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
</EuiFlexGroup>
|
||||
<EuiSpacer size="m" />
|
||||
{canWritePolicyManagement ? (
|
||||
<EuiTextArea
|
||||
value={note}
|
||||
disabled={getNoteInProgress || createNoteInProgress}
|
||||
onChange={(e) => setNote(e.target.value)}
|
||||
fullWidth
|
||||
rows={3}
|
||||
placeholder={i18n.translate(
|
||||
'xpack.securitySolution.endpoint.protectionUpdates.note.placeholder',
|
||||
{
|
||||
defaultMessage: 'Add relevant information about update here',
|
||||
}
|
||||
)}
|
||||
data-test-subj={'protection-updates-manifest-note'}
|
||||
/>
|
||||
) : (
|
||||
<EuiText data-test-subj={'protection-updates-manifest-note-view-mode'}>
|
||||
{note}
|
||||
</EuiText>
|
||||
)}
|
||||
data-test-subj={'protection-updates-manifest-note'}
|
||||
/>
|
||||
) : (
|
||||
<EuiText data-test-subj={'protection-updates-manifest-note-view-mode'}>{note}</EuiText>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue