temp: bug in region selector causing failing test

This commit is contained in:
Jai Bhagat
2022-02-10 10:55:32 -05:00
parent 898cda014e
commit 793f9c26d3
10 changed files with 42 additions and 47 deletions

View File

@@ -12,8 +12,7 @@
<li>
<LinkTo
@route="jobs.job.index"
@model={{trigger.data.result.plainId}}
@query={{hash namespace=(or trigger.data.result.namespace.name "default")}}
@model={{trigger.data.result}}
data-test-breadcrumb={{"jobs.job.index"}}
>
<dl>
@@ -30,8 +29,7 @@
<li>
<LinkTo
@route="jobs.job.index"
@model={{this.job.plainId}}
@query={{hash namespace=(or this.job.namespace.name "default")}}
@model={{this.job}}
data-test-breadcrumb={{"jobs.job.index"}}
data-test-job-breadcrumb
>

View File

@@ -26,8 +26,6 @@ export default class JobRow extends Component {
@action
gotoJob() {
const { job } = this;
this.router.transitionTo('jobs.job', job.plainId, {
queryParams: { namespace: job.get('namespace.name') },
});
this.router.transitionTo('jobs.job.index', job);
}
}

View File

@@ -11,13 +11,16 @@ export default class JobRoute extends Route {
@service token;
serialize(model) {
debugger;
return { job_name: JSON.parse(model.get('id')).join('@') };
}
model(params, transition) {
const namespace = transition.to.queryParams.namespace || 'default';
const name = params.job_name;
const fullId = JSON.stringify([name, namespace]);
model(params) {
const url = params.job_name.split('@');
const namespace = url.pop();
const name = url.join('');
const fullId = JSON.stringify([name, namespace || 'default']);
return this.store
.findRecord('job', fullId, { reload: true })

View File

@@ -172,17 +172,6 @@
{{row.model.source}}
{{/if}}
</td>
<td data-test-volume-destination>
<code>
{{row.model.destination}}
</code>
</td>
<td data-test-volume-permissions>
{{if row.model.readOnly "Read" "Read/Write"}}
</td>
<td data-test-volume-client-source>
{{row.model.source}}
</td>
</tr>
</t.body>
</ListTable>

View File

@@ -24,12 +24,20 @@
</a>
{{/if}}
{{#if this.system.agent.config.UI.Consul.BaseUIURL}}
<a data-test-header-consul-link href={{this.system.agent.config.UI.Consul.BaseUIURL}} class="navbar-item">
<a
data-test-header-consul-link
href={{this.system.agent.config.UI.Consul.BaseUIURL}}
class="navbar-item"
>
Consul
</a>
{{/if}}
{{#if this.system.agent.config.UI.Vault.BaseUIURL}}
<a data-test-header-vault-link href={{this.system.agent.config.UI.Vault.BaseUIURL}} class="navbar-item">
<a
data-test-header-vault-link
href={{this.system.agent.config.UI.Vault.BaseUIURL}}
class="navbar-item"
>
Vault
</a>
{{/if}}
@@ -50,4 +58,4 @@
{{yield}}
</ul>
</nav>
</div>
</div>

View File

@@ -1,10 +1,5 @@
<td data-test-job-name>
<LinkTo
@route="jobs.job"
@model={{this.job}}
@query={{hash namespace=this.job.namespace.id}}
class="is-primary"
>
<LinkTo @route="jobs.job.index" @model={{this.job}} class="is-primary">
{{this.job.name}}
</LinkTo>
</td>

View File

@@ -1,4 +1,4 @@
{{page-title "Jobs"}}
{{!-- {{page-title "Jobs"}}
<section class="section">
<div class="toolbar">
<div class="toolbar-item">
@@ -44,7 +44,10 @@
@options={{this.optionsNamespaces}}
@selection={{this.qpNamespace}}
@onSelect={{action
(queue (action this.cacheNamespace) (action this.setFacetQueryParam "qpNamespace"))
(queue
(action this.cacheNamespace)
(action this.setFacetQueryParam "qpNamespace")
)
}}
/>
{{/if}}
@@ -202,4 +205,4 @@
{{/if}}
</div>
{{/if}}
</section>
</section> --}}

View File

@@ -152,6 +152,7 @@ module('Acceptance | regions (many)', function (hooks) {
await Allocation.visit({ id: server.db.allocations[0].id });
await this.pauseTest();
await selectChoose('[data-test-region-switcher-parent]', newRegion);
assert.ok(currentURL().includes('/jobs?'), 'Back at the jobs page');

View File

@@ -34,12 +34,12 @@ module('Acceptance | volume detail', function (hooks) {
});
test('it passes an accessibility audit', async function (assert) {
await VolumeDetail.visit({ id: volume.id });
await VolumeDetail.visit({ id: `${volume.id}@default` });
await a11yAudit(assert);
});
test('/csi/volumes/:id should have a breadcrumb trail linking back to Volumes and Storage', async function (assert) {
await VolumeDetail.visit({ id: volume.id });
await VolumeDetail.visit({ id: `${volume.id}@default` });
assert.equal(Layout.breadcrumbFor('csi.index').text, 'Storage');
assert.equal(Layout.breadcrumbFor('csi.volumes').text, 'Volumes');
@@ -54,7 +54,7 @@ module('Acceptance | volume detail', function (hooks) {
});
test('/csi/volumes/:id should list additional details for the volume below the title', async function (assert) {
await VolumeDetail.visit({ id: volume.id });
await VolumeDetail.visit({ id: `${volume.id}@default` });
assert.ok(
VolumeDetail.health.includes(
@@ -75,7 +75,7 @@ module('Acceptance | volume detail', function (hooks) {
writeAllocations.forEach((alloc) => assignWriteAlloc(volume, alloc));
readAllocations.forEach((alloc) => assignReadAlloc(volume, alloc));
await VolumeDetail.visit({ id: volume.id });
await VolumeDetail.visit({ id: `${volume.id}@default` });
assert.equal(VolumeDetail.writeAllocations.length, writeAllocations.length);
writeAllocations
@@ -95,7 +95,7 @@ module('Acceptance | volume detail', function (hooks) {
writeAllocations.forEach((alloc) => assignWriteAlloc(volume, alloc));
readAllocations.forEach((alloc) => assignReadAlloc(volume, alloc));
await VolumeDetail.visit({ id: volume.id });
await VolumeDetail.visit({ id: `${volume.id}@default` });
assert.equal(VolumeDetail.readAllocations.length, readAllocations.length);
readAllocations
@@ -126,7 +126,7 @@ module('Acceptance | volume detail', function (hooks) {
0
);
await VolumeDetail.visit({ id: volume.id });
await VolumeDetail.visit({ id: `${volume.id}@default` });
VolumeDetail.writeAllocations.objectAt(0).as((allocationRow) => {
assert.equal(
@@ -198,28 +198,28 @@ module('Acceptance | volume detail', function (hooks) {
const allocation = server.create('allocation');
assignWriteAlloc(volume, allocation);
await VolumeDetail.visit({ id: volume.id });
await VolumeDetail.visit({ id: `${volume.id}@default` });
await VolumeDetail.writeAllocations.objectAt(0).visit();
assert.equal(currentURL(), `/allocations/${allocation.id}`);
});
test('when there are no write allocations, the table presents an empty state', async function (assert) {
await VolumeDetail.visit({ id: volume.id });
await VolumeDetail.visit({ id: `${volume.id}@default` });
assert.ok(VolumeDetail.writeTableIsEmpty);
assert.equal(VolumeDetail.writeEmptyState.headline, 'No Write Allocations');
});
test('when there are no read allocations, the table presents an empty state', async function (assert) {
await VolumeDetail.visit({ id: volume.id });
await VolumeDetail.visit({ id: `${volume.id}@default` });
assert.ok(VolumeDetail.readTableIsEmpty);
assert.equal(VolumeDetail.readEmptyState.headline, 'No Read Allocations');
});
test('the constraints table shows access mode and attachment mode', async function (assert) {
await VolumeDetail.visit({ id: volume.id });
await VolumeDetail.visit({ id: `${volume.id}@default` });
assert.equal(VolumeDetail.constraints.accessMode, volume.accessMode);
assert.equal(

View File

@@ -93,7 +93,7 @@ module('Acceptance | volumes list', function (hooks) {
assert.equal(volumeRow.controllerHealth, controllerHealthStr);
assert.equal(
volumeRow.nodeHealth,
`${nodeHealthStr} (${volume.nodesHealthy}/${volume.nodesExpected})`
`${nodeHealthStr} ( ${volume.nodesHealthy} / ${volume.nodesExpected} )`
);
assert.equal(volumeRow.provider, volume.provider);
assert.equal(volumeRow.allocations, readAllocs.length + writeAllocs.length);
@@ -110,7 +110,7 @@ module('Acceptance | volumes list', function (hooks) {
await VolumesList.volumes.objectAt(0).clickName();
assert.equal(
currentURL(),
`/csi/volumes/${volume.id}?namespace=${secondNamespace.id}`
`/csi/volumes/${volume.id}@${secondNamespace.id}`
);
await VolumesList.visit({ namespace: '*' });
@@ -119,7 +119,7 @@ module('Acceptance | volumes list', function (hooks) {
await VolumesList.volumes.objectAt(0).clickRow();
assert.equal(
currentURL(),
`/csi/volumes/${volume.id}?namespace=${secondNamespace.id}`
`/csi/volumes/${volume.id}@${secondNamespace.id}`
);
});