store: add request field to compose object

The compose object should have the initial compose request stored in a
field called request. The id and image_status are independent of the
request so should not be set within it.
This commit is contained in:
Jacob Kozol 2021-04-21 15:31:30 +02:00 committed by Sanne Raymaekers
parent e8192ad3f7
commit 29b684599b
4 changed files with 140 additions and 117 deletions

View file

@ -25,102 +25,114 @@ const store = {
// kept "running" for backward compatibility
'c1cfa347-4c37-49b5-8e73-6aa1d1746cfa': {
id: 'c1cfa347-4c37-49b5-8e73-6aa1d1746cfa',
distribution: 'rhel-8',
image_requests: [
{
architecture: 'x86_64',
image_type: 'ami',
upload_request: {
type: 'aws',
options: {}
request: {
distribution: 'rhel-8',
image_requests: [
{
architecture: 'x86_64',
image_type: 'ami',
upload_request: {
type: 'aws',
options: {}
}
}
}
],
],
},
image_status: {
status: 'running',
},
},
'edbae1c2-62bc-42c1-ae0c-3110ab718f58': {
id: 'edbae1c2-62bc-42c1-ae0c-3110ab718f58',
distribution: 'rhel-8',
image_requests: [
{
architecture: 'x86_64',
image_type: 'ami',
upload_request: {
type: 'aws',
options: {}
request: {
distribution: 'rhel-8',
image_requests: [
{
architecture: 'x86_64',
image_type: 'ami',
upload_request: {
type: 'aws',
options: {}
}
}
}
],
],
},
image_status: {
status: 'pending',
},
},
'42ad0826-30b5-4f64-a24e-957df26fd564': {
id: '42ad0826-30b5-4f64-a24e-957df26fd564',
distribution: 'rhel-8',
image_requests: [
{
architecture: 'x86_64',
image_type: 'ami',
upload_request: {
type: 'aws',
options: {}
request: {
distribution: 'rhel-8',
image_requests: [
{
architecture: 'x86_64',
image_type: 'ami',
upload_request: {
type: 'aws',
options: {}
}
}
}
],
],
},
image_status: {
status: 'building',
},
},
'955944a2-e149-4058-8ac1-35b514cb5a16': {
id: '955944a2-e149-4058-8ac1-35b514cb5a16',
distribution: 'rhel-8',
image_requests: [
{
architecture: 'x86_64',
image_type: 'ami',
upload_request: {
type: 'aws',
options: {}
request: {
distribution: 'rhel-8',
image_requests: [
{
architecture: 'x86_64',
image_type: 'ami',
upload_request: {
type: 'aws',
options: {}
}
}
}
],
],
},
image_status: {
status: 'uploading',
},
},
'f7a60094-b376-4b58-a102-5c8c82dfd18b': {
id: 'f7a60094-b376-4b58-a102-5c8c82dfd18b',
distribution: 'rhel-8',
image_requests: [
{
architecture: 'x86_64',
image_type: 'ami',
upload_request: {
type: 'aws',
options: {}
request: {
distribution: 'rhel-8',
image_requests: [
{
architecture: 'x86_64',
image_type: 'ami',
upload_request: {
type: 'aws',
options: {}
}
}
}
],
],
},
image_status: {
status: 'registering',
},
},
'1579d95b-8f1d-4982-8c53-8c2afa4ab04c': {
id: '1579d95b-8f1d-4982-8c53-8c2afa4ab04c',
distribution: 'rhel-8',
image_requests: [
{
architecture: 'x86_64',
image_type: 'ami',
upload_request: {
type: 'aws',
options: {}
request: {
distribution: 'rhel-8',
image_requests: [
{
architecture: 'x86_64',
image_type: 'ami',
upload_request: {
type: 'aws',
options: {}
}
}
}
],
],
},
image_status: {
status: 'success',
upload_status: {
@ -135,34 +147,38 @@ const store = {
},
'61b0effa-c901-4ee5-86b9-2010b47f1b22': {
id: '61b0effa-c901-4ee5-86b9-2010b47f1b22',
distribution: 'rhel-8',
image_requests: [
{
architecture: 'x86_64',
image_type: 'ami',
upload_request: {
type: 'aws',
options: {}
request: {
distribution: 'rhel-8',
image_requests: [
{
architecture: 'x86_64',
image_type: 'ami',
upload_request: {
type: 'aws',
options: {}
}
}
}
],
],
},
image_status: {
status: 'failure',
},
},
'ca03f120-9840-4959-871e-94a5cb49d1f2': {
id: 'ca03f120-9840-4959-871e-94a5cb49d1f2',
distribution: 'rhel-8',
image_requests: [
{
architecture: 'x86_64',
image_type: 'vhd',
upload_request: {
type: 'gcp',
options: {}
request: {
distribution: 'rhel-8',
image_requests: [
{
architecture: 'x86_64',
image_type: 'vhd',
upload_request: {
type: 'gcp',
options: {}
}
}
}
],
],
},
image_status: {
status: 'success',
upload_status: {
@ -177,34 +193,38 @@ const store = {
},
'551de6f6-1533-4b46-a69f-7924051f9bc6': {
id: '551de6f6-1533-4b46-a69f-7924051f9bc6',
distribution: 'rhel-8',
image_requests: [
{
architecture: 'x86_64',
image_type: 'vhd',
upload_request: {
type: 'azure',
options: {}
request: {
distribution: 'rhel-8',
image_requests: [
{
architecture: 'x86_64',
image_type: 'vhd',
upload_request: {
type: 'azure',
options: {}
}
}
}
],
],
},
image_status: {
status: 'building',
},
},
'77fa8b03-7efb-4120-9a20-da66d68c4494': {
id: '77fa8b03-7efb-4120-9a20-da66d68c4494',
distribution: 'rhel-8',
image_requests: [
{
architecture: 'x86_64',
image_type: 'vhd',
upload_request: {
type: 'azure',
options: {}
request: {
distribution: 'rhel-8',
image_requests: [
{
architecture: 'x86_64',
image_type: 'vhd',
upload_request: {
type: 'azure',
options: {}
}
}
}
],
],
},
image_status: {
status: 'success',
upload_status: {
@ -250,7 +270,7 @@ describe('Images Table', () => {
expect(row.cells[3]).toHaveTextContent(testElement.textContent);
// do the same for the upload/target column
render(<Upload uploadType={ compose.image_requests[0].image_type } />, { container: testElement });
render(<Upload uploadType={ compose.request.image_requests[0].image_type } />, { container: testElement });
expect(row.cells[1]).toHaveTextContent(testElement.textContent);
}
});