Merge pull request #321 from hashicorp/oss/merge-main-6e96676beb0b610a5d1f3f3ac53ffa0d9c0f9221
[main] OSS to ENT merge of (6e96676)
This commit is contained in:
commit
3a600b0b8c
10 files changed
+42
-52
No files matched your search
@@ -4,7 +4,9 @@
|
||||
}}
|
||||
|
||||
<div class='rose-form-actions' ...attributes>
|
||||
<Rose::Button @style='secondary' {{on 'click' @enableEdit}}>
|
||||
{{@enableEditText}}
|
||||
</Rose::Button>
|
||||
<Hds::Button
|
||||
@text={{@enableEditText}}
|
||||
@color='secondary'
|
||||
{{on 'click' @enableEdit}}
|
||||
/>
|
||||
</div>
|
||||
@@ -3,19 +3,18 @@
|
||||
SPDX-License-Identifier: MPL-2.0
|
||||
}}
|
||||
|
||||
<div class='rose-form-actions' ...attributes>
|
||||
{{! template-lint-disable no-passed-in-event-handlers }}
|
||||
<Rose::Button @disabled={{@submitDisabled}} @submit={{true}} @style='primary'>
|
||||
{{@submitText}}
|
||||
</Rose::Button>
|
||||
|
||||
<Hds::ButtonSet class='rose-form-actions' ...attributes>
|
||||
<Hds::Button
|
||||
@text={{@submitText}}
|
||||
disabled={{@submitDisabled}}
|
||||
type='submit'
|
||||
/>
|
||||
{{#if this.showCancel}}
|
||||
<Rose::Button
|
||||
@disabled={{@cancelDisabled}}
|
||||
@style='secondary'
|
||||
<Hds::Button
|
||||
@text={{@cancelText}}
|
||||
@color='secondary'
|
||||
disabled={{@cancelDisabled}}
|
||||
{{on 'click' @cancel}}
|
||||
>
|
||||
{{@cancelText}}
|
||||
</Rose::Button>
|
||||
/>
|
||||
{{/if}}
|
||||
</div>
|
||||
</Hds::ButtonSet>
|
||||
@@ -4,7 +4,6 @@
|
||||
*/
|
||||
|
||||
import Component from '@glimmer/component';
|
||||
import { computed } from '@ember/object';
|
||||
|
||||
/**
|
||||
* A set of two form action buttons for submit and cancel.
|
||||
@@ -22,7 +21,6 @@ export default class RoseFormActionsComponent extends Component {
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
@computed('args.showCancel')
|
||||
get showCancel() {
|
||||
return this.args.showCancel ?? true;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,9 @@ module('Integration | Component | rose/form/actions', function (hooks) {
|
||||
test('it renders a submit button and a regular button', async function (assert) {
|
||||
assert.expect(2);
|
||||
this.cancel = () => {};
|
||||
await render(hbs`{{rose/form/actions cancel=this.cancel}}`);
|
||||
await render(
|
||||
hbs`{{rose/form/actions cancel=this.cancel submitText='Save' cancelText='Cancel'}}`
|
||||
);
|
||||
assert.ok(find('[type="submit"]'));
|
||||
assert.ok(find('button:not([type="submit"])'));
|
||||
});
|
||||
@@ -23,7 +25,7 @@ module('Integration | Component | rose/form/actions', function (hooks) {
|
||||
assert.expect(2);
|
||||
this.cancel = () => {};
|
||||
await render(
|
||||
hbs`{{rose/form/actions cancel=this.cancel submitDisabled=true cancelDisabled=true}}`
|
||||
hbs`{{rose/form/actions cancel=this.cancel submitDisabled=true cancelDisabled=true submitText='Save' cancelText='Cancel'}}`
|
||||
);
|
||||
assert.ok(find('[type="submit"]:disabled'));
|
||||
assert.ok(find('button:not([type="submit"]):disabled'));
|
||||
@@ -31,7 +33,7 @@ module('Integration | Component | rose/form/actions', function (hooks) {
|
||||
|
||||
test('it optionally does not render the cancel button', async function (assert) {
|
||||
assert.expect(2);
|
||||
await render(hbs`{{rose/form/actions showCancel=false}}`);
|
||||
await render(hbs`{{rose/form/actions submitText='Save' showCancel=false}}`);
|
||||
assert.ok(find('[type="submit"]'));
|
||||
assert.notOk(find('button:not([type="submit"])'));
|
||||
});
|
||||
@@ -39,7 +41,9 @@ module('Integration | Component | rose/form/actions', function (hooks) {
|
||||
test('it executes a function on cancel click', async function (assert) {
|
||||
assert.expect(1);
|
||||
this.cancel = () => assert.ok(true, 'cancel was clicked');
|
||||
await render(hbs`{{rose/form/actions cancel=this.cancel}}`);
|
||||
await render(
|
||||
hbs`{{rose/form/actions cancel=this.cancel submitText='Save' cancelText='Cancel'}}`
|
||||
);
|
||||
await click('button:not([type="submit"])');
|
||||
});
|
||||
});
|
||||
@@ -17,7 +17,7 @@ module(
|
||||
assert.expect(1);
|
||||
this.enableEdit = () => {};
|
||||
await render(
|
||||
hbs`{{rose/form/actions/edit-toggle enableEdit=this.enableEdit}}`
|
||||
hbs`{{rose/form/actions/edit-toggle enableEdit=this.enableEdit enableEditText='Edit'}}`
|
||||
);
|
||||
assert.ok(find('button'));
|
||||
});
|
||||
@@ -26,7 +26,7 @@ module(
|
||||
assert.expect(1);
|
||||
this.enableEdit = () => assert.ok(true, 'edit was clicked');
|
||||
await render(
|
||||
hbs`{{rose/form/actions/edit-toggle enableEdit=this.enableEdit}}`
|
||||
hbs`{{rose/form/actions/edit-toggle enableEdit=this.enableEdit enableEditText='Edit'}}`
|
||||
);
|
||||
await click('button');
|
||||
});
|
||||
|
||||
@@ -3,7 +3,12 @@
|
||||
SPDX-License-Identifier: MPL-2.0
|
||||
}}
|
||||
|
||||
<Rose::Form class='full-width' @cancel={{@cancel}} @onSubmit={{this.submit}}>
|
||||
<Rose::Form
|
||||
class='full-width'
|
||||
@cancel={{@cancel}}
|
||||
@onSubmit={{this.submit}}
|
||||
as |form|
|
||||
>
|
||||
<div class='create-resources-form'>
|
||||
<Hds::Form::TextInput::Field
|
||||
name='targetAddress'
|
||||
@@ -55,14 +60,8 @@
|
||||
<F.Control><Image @name='ssh-target-creation' /></F.Control>
|
||||
</Hds::Form::Fieldset>
|
||||
|
||||
<Hds::ButtonSet>
|
||||
<Hds::Button @text='{{t "actions.save"}}' type='submit' />
|
||||
<Hds::Button
|
||||
@text='{{t "actions.do-this-later"}}'
|
||||
@color='secondary'
|
||||
name='cancel'
|
||||
{{on 'click' @cancel}}
|
||||
/>
|
||||
</Hds::ButtonSet>
|
||||
|
||||
<form.actions
|
||||
@submitText={{t 'actions.save'}}
|
||||
@cancelText={{t 'actions.do-this-later'}}
|
||||
/>
|
||||
</Rose::Form>
|
||||
@@ -170,14 +170,8 @@
|
||||
|
||||
.rose-frame {
|
||||
.rose-form-actions {
|
||||
.rose-button-primary {
|
||||
display: block;
|
||||
margin: 0;
|
||||
.hds-button {
|
||||
width: 100%;
|
||||
|
||||
.rose-button-wrapper {
|
||||
display: inline;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ module('Acceptance | onboarding', function (hooks) {
|
||||
test('redirect user to orgs screen when click do this later', async function (assert) {
|
||||
assert.expect(1);
|
||||
await visit(urls.onboarding);
|
||||
await click('[name="cancel"]');
|
||||
await click('.rose-form-actions [type="button"]');
|
||||
assert.strictEqual(currentURL(), urls.orgs);
|
||||
});
|
||||
});
|
||||
@@ -28,8 +28,8 @@ module('Acceptance | targets | enable session recording', function (hooks) {
|
||||
const TOGGLE_SELECTOR = '[name=target-enable-session-recording]';
|
||||
const LINK_TO_NEW_STORAGE_BUCKET =
|
||||
'.enable-session-recording-toggle .hds-link-standalone';
|
||||
const SAVE_BTN_SELECTOR = '.rose-form-actions .rose-button-primary';
|
||||
const CANCEL_BTN_SELECTOR = '.rose-form-actions .rose-button-secondary';
|
||||
const SAVE_BTN_SELECTOR = '.rose-form-actions [type="submit"]';
|
||||
const CANCEL_BTN_SELECTOR = '.rose-form-actions [type="button"]';
|
||||
|
||||
// Instances
|
||||
const instances = {
|
||||
|
||||
@@ -288,14 +288,8 @@
|
||||
}
|
||||
|
||||
.rose-form-actions {
|
||||
.rose-button-primary {
|
||||
display: block;
|
||||
margin: 0;
|
||||
.hds-button {
|
||||
width: 100%;
|
||||
|
||||
.rose-button-wrapper {
|
||||
display: inline;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user