transition to target lists when the resource creation is successful (#1134)

* feat: 🎸  redirect the user to target lists within the project after successfully creating a resource.
This commit is contained in:
Dharini Jeeva authored and GitHub committed 2022-06-14 12:32:04 -07:00
1 parent a5da593f07
commit 8bdd4416fc
5 files changed
+26 -8

No files matched your search

@@ -1,9 +1,19 @@
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
export default class OnboardingQuickSetupCreateResourcesSuccessRoute extends Route {
// =methods
@service router;
model() {
return this.modelFor('onboarding.quick-setup.create-resources');
}
@action
showTargetList(scope) {
const {
project: { id: scopeID },
} = scope;
this.router.transitionTo('scopes.scope.targets', scopeID);
}
}
+4
View File
@@ -282,12 +282,15 @@
margin-bottom: 0;
margin-top: sizing.rems(xl);
}
.create-resources {
display: block;
width: sizing.rems(xl) * 15;
.rose-form-fieldset {
margin-top: sizing.rems(xl);
}
.rose-frame-body {
p {
color: var(--ui-gray);
@@ -298,6 +301,7 @@
.create-resource-cards {
display: flex;
justify-content: space-between;
.rose-form-input {
width: sizing.rems(xl) * 6;
}
@@ -63,6 +63,13 @@
<Rose::Icon @name='flight-icons/svg/docs-link-16' @size='medium' />
{{t 'onboarding.success.links.api'}}
</a>
<Rose::Button
class='success-button'
@style='primary'
{{on 'click' (route-action 'showTargetList' @model)}}
>
{{t 'actions.done'}}
</Rose::Button>
</:body>
</Rose::Frame>
</Rose::Layout::Centered>
@@ -63,7 +63,6 @@ module('Acceptance | credential-libraries | create', function (hooks) {
this.server.schema.credentialLibraries.all().models.length;
authenticateSession({});
});
test('visiting credential libraries', async function (assert) {
assert.expect(2);
await visit(urls.credentialLibraries);
@@ -1,5 +1,5 @@
import { module, test } from 'qunit';
import { visit, currentURL, click } from '@ember/test-helpers';
import { visit, find } from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { authenticateSession } from 'ember-simple-auth/test-support';
@@ -15,16 +15,14 @@ module(
});
const urls = {
createResources:
'/scopes/global/onboarding/quick-setup/create-resources/success',
createResources: '/onboarding/quick-setup/create-resources/success',
targets: '/scopes/global/targets',
};
test.skip('clicking done takes user to targets screen', async function (assert) {
test('check if the done button is present', async function (assert) {
assert.expect(1);
await visit(urls.createResources);
await click('.success-button');
assert.equal(currentURL(), urls.targets);
assert.ok(find('.success-button'));
});
}
);