From 9b3888916971368ddfd692d5f0427e919df670d4 Mon Sep 17 00:00:00 2001
From: Zhaoxinxin <107842350+Liam-Zhao@users.noreply.github.com>
Date: Fri, 16 Aug 2024 17:56:28 +0800
Subject: [PATCH] feat: preheat remove piece length (#381)
Signed-off-by: zhaoxinxin <1186037180@qq.com>
---
cypress/e2e/job/preheats/create-preheat.cy.ts | 29 ---------
cypress/e2e/job/preheats/preheat.cy.ts | 29 +++------
.../fixtures/job/preheats/create-preheat.json | 10 ---
.../job/preheats/failure-preheat.json | 1 -
.../job/preheats/failure-preheats.json | 4 --
.../job/preheats/pagination-preheats.json | 1 -
.../job/preheats/pending-preheat.json | 1 -
.../job/preheats/pending-preheats.json | 1 -
cypress/fixtures/job/preheats/preheats.json | 10 ---
.../job/preheats/success-preheat.json | 1 -
.../job/preheats/success-preheats.json | 6 --
public/icons/job/preheat/piece-length.svg | 6 --
src/components/job/preheats/new.tsx | 64 ++-----------------
src/components/job/preheats/show.tsx | 22 -------
src/lib/api.ts | 4 --
15 files changed, 15 insertions(+), 174 deletions(-)
delete mode 100644 public/icons/job/preheat/piece-length.svg
diff --git a/cypress/e2e/job/preheats/create-preheat.cy.ts b/cypress/e2e/job/preheats/create-preheat.cy.ts
index cbd22cbf..70b2f6d3 100644
--- a/cypress/e2e/job/preheats/create-preheat.cy.ts
+++ b/cypress/e2e/job/preheats/create-preheat.cy.ts
@@ -269,35 +269,6 @@ describe('Create preheat', () => {
cy.get('#url').clear();
cy.get('#url').type('https://docs');
- // Should display message pieceLength the validation error.
- cy.get('#pieceLength').clear();
-
- cy.get('#save').click();
- cy.get('#pieceLength-helper-text')
- .should('be.visible')
- .and('have.text', 'Fill in the number, the length is 4-1024 MiB.');
-
- cy.get('#pieceLength').type('3');
-
- cy.get('#save').click();
-
- // Show verification error message.
- cy.get('#pieceLength-helper-text')
- .should('be.visible')
- .and('have.text', 'Fill in the number, the length is 4-1024 MiB.');
-
- cy.get('#pieceLength').clear();
- cy.get('#pieceLength').type('1025');
- // Show verification error message.
- cy.get('#pieceLength-helper-text')
- .should('be.visible')
- .and('have.text', 'Fill in the number, the length is 4-1024 MiB.');
-
- cy.get('#pieceLength').clear();
- cy.get('#pieceLength').type('10');
-
- cy.get('#pieceLength-helper-text').should('not.exist');
-
// Should display message tag the validation error.
cy.get('#tag').type(url);
diff --git a/cypress/e2e/job/preheats/preheat.cy.ts b/cypress/e2e/job/preheats/preheat.cy.ts
index 018df4c0..76c72d0f 100644
--- a/cypress/e2e/job/preheats/preheat.cy.ts
+++ b/cypress/e2e/job/preheats/preheat.cy.ts
@@ -95,22 +95,19 @@ describe('Preheat', () => {
cy.get(':nth-child(4) > .show_informationContent__wKGxa').should('have.text', 'http://dock.io/preheat/test');
- // Show preheat Piece Length.
- cy.get(':nth-child(5) > .show_informationContent__wKGxa').should('have.text', '1002 MiB');
-
// Show preheat filter.
- cy.get(':nth-child(6) > .show_informationContent__wKGxa').children().should('have.length', 2);
+ cy.get(':nth-child(5) > .show_informationContent__wKGxa').children().should('have.length', 2);
- cy.get(':nth-child(6) > .show_informationContent__wKGxa > :nth-child(1) > .MuiChip-label').should(
+ cy.get(':nth-child(5) > .show_informationContent__wKGxa > :nth-child(1) > .MuiChip-label').should(
'have.text',
'Expires',
);
// Show preheat tag.
- cy.get(':nth-child(7) > .show_informationContent__wKGxa').should('have.text', 'prheat tag');
+ cy.get(':nth-child(6) > .show_informationContent__wKGxa').should('have.text', 'prheat tag');
// Show preheat hearder.
- cy.get(':nth-child(8) > .MuiPaper-root').children().should('have.length', 1);
+ cy.get(':nth-child(7) > .MuiPaper-root').children().should('have.length', 1);
cy.get('.css-172ywp3').should('have.text', 'Connection');
cy.get('.css-ft9ciy').should('have.text', 'keep-alive');
@@ -119,7 +116,7 @@ describe('Preheat', () => {
cy.get('.show_schedulerClustersID__iQd1s').should('have.text', 1);
// Show preheat Created At.
- cy.get(':nth-child(10) > .MuiChip-root').should('have.text', '2023-12-13 19:58:53');
+ cy.get(':nth-child(9) > .MuiChip-root').should('have.text', '2023-12-13 19:58:53');
// Click the show error log button.
cy.get('#status > .MuiButtonBase-root').click();
@@ -142,9 +139,6 @@ describe('Preheat', () => {
// Show preheat id.
cy.get(':nth-child(1) > .show_informationContent__wKGxa').should('have.text', 8);
- // Show piece lenght.
- cy.get(':nth-child(5) > .show_informationContent__wKGxa').should('have.text', '4 MiB');
-
// Show preheat status.
cy.get('#status')
.should('have.text', 'SUCCESS')
@@ -153,7 +147,7 @@ describe('Preheat', () => {
.and('not.exist');
// Show preheat hearder.
- cy.get(':nth-child(8) > .MuiPaper-root').children().should('have.length', 2);
+ cy.get(':nth-child(7) > .MuiPaper-root').children().should('have.length', 2);
});
it('should display detailed preheat pending information', () => {
@@ -192,7 +186,7 @@ describe('Preheat', () => {
.and('not.exist');
// Show preheat hearder.
- cy.get(':nth-child(8) > .MuiPaper-root').children().should('have.length', 1);
+ cy.get(':nth-child(7) > .MuiPaper-root').children().should('have.length', 1);
cy.wait(6000);
@@ -268,9 +262,6 @@ describe('Preheat', () => {
cy.get('.css-2imjyh > .MuiTypography-root').should('have.text', '-');
- // Show preheat piece lenght.
- cy.get(':nth-child(5) > .show_informationContent__wKGxa').should('have.text', '0 MiB');
-
// Show preheat tag.
cy.get(':nth-child(6) > .show_informationContent__wKGxa.MuiBox-root > .MuiTypography-root').should(
'have.text',
@@ -284,7 +275,7 @@ describe('Preheat', () => {
cy.get('.show_schedulerClustersID__iQd1s').should('have.text', '-');
// Show preheat Created At.
- cy.get(':nth-child(10) > .show_informationContent__wKGxa').should('have.text', '-');
+ cy.get(':nth-child(9) > .show_informationContent__wKGxa').should('have.text', '-');
});
});
@@ -350,7 +341,7 @@ describe('Preheat', () => {
cy.get('.show_schedulerClustersID__iQd1s').should('have.text', '-');
// Show preheat Created At.
- cy.get(':nth-child(10) > .show_informationContent__wKGxa').should('have.text', '-');
+ cy.get(':nth-child(9) > .show_informationContent__wKGxa').should('have.text', '-');
});
it('when the status is pending, preheat API error response', () => {
@@ -389,7 +380,7 @@ describe('Preheat', () => {
.and('not.exist');
// Show preheat hearder.
- cy.get(':nth-child(8) > .MuiPaper-root').children().should('have.length', 1);
+ cy.get(':nth-child(7) > .MuiPaper-root').children().should('have.length', 1);
cy.wait(6000);
diff --git a/cypress/fixtures/job/preheats/create-preheat.json b/cypress/fixtures/job/preheats/create-preheat.json
index 29afe491..4f9bfd3d 100644
--- a/cypress/fixtures/job/preheats/create-preheat.json
+++ b/cypress/fixtures/job/preheats/create-preheat.json
@@ -14,7 +14,6 @@
"Authorization": "Bearer yJhbGciOiJSUzI1NiIsImtpZCI6IjNEWT"
},
"password": "",
- "pieceLength": 1050673152,
"platform": "",
"tag": "",
"type": "file",
@@ -70,7 +69,6 @@
"Authorization": "Bearer yJhbGciOiJSUzI1NiIsImtpZCI6IjNEWT"
},
"password": "",
- "pieceLength": 1050673152,
"platform": "",
"tag": "",
"type": "file",
@@ -126,7 +124,6 @@
"Authorization": "Bearer yJhbGciOiJSUzI1NiIsImtpZCI6IjNEWT"
},
"password": "",
- "pieceLength": 1050673152,
"platform": "",
"tag": "",
"type": "file",
@@ -182,7 +179,6 @@
"Authorization": "Bearer yJhbGciOiJSUzI1NiIsImtpZCI6IjNEWT"
},
"password": "",
- "pieceLength": 1050673152,
"platform": "",
"tag": "",
"type": "file",
@@ -238,7 +234,6 @@
"Authorization": "Bearer yJhbGciOiJSUzI1NiIsImtpZCI6IjNEWT"
},
"password": "",
- "pieceLength": 1050673152,
"platform": "",
"tag": "",
"type": "file",
@@ -294,7 +289,6 @@
"Authorization": "Bearer yJhbGciOiJSUzI1NiIsImtpZCI6IjNEWT"
},
"password": "",
- "pieceLength": 1050673152,
"platform": "",
"tag": "",
"type": "file",
@@ -350,7 +344,6 @@
"Authorization": "Bearer yJhbGciOiJSUzI1NiIsImtpZCI6IjNEWT"
},
"password": "",
- "pieceLength": 1050673152,
"platform": "",
"tag": "",
"type": "file",
@@ -406,7 +399,6 @@
"Authorization": "Bearer yJhbGciOiJSUzI1NiIsImtpZCI6IjNEWT"
},
"password": "",
- "pieceLength": 1050673152,
"platform": "",
"tag": "",
"type": "file",
@@ -462,7 +454,6 @@
"Authorization": "Bearer yJhbGciOiJSUzI1NiIsImtpZCI6IjNEWT"
},
"password": "",
- "pieceLength": 1050673152,
"platform": "",
"tag": "",
"type": "file",
@@ -518,7 +509,6 @@
"Authorization": "Bearer yJhbGciOiJSUzI1NiIsImtpZCI6IjNEWT"
},
"password": "",
- "pieceLength": 1050673152,
"platform": "",
"tag": "",
"type": "file",
diff --git a/cypress/fixtures/job/preheats/failure-preheat.json b/cypress/fixtures/job/preheats/failure-preheat.json
index d55f7d1f..c7253338 100644
--- a/cypress/fixtures/job/preheats/failure-preheat.json
+++ b/cypress/fixtures/job/preheats/failure-preheat.json
@@ -13,7 +13,6 @@
"Connection": "keep-alive"
},
"password": "",
- "pieceLength": 1050673152,
"platform": "",
"tag": "prheat tag",
"type": "file",
diff --git a/cypress/fixtures/job/preheats/failure-preheats.json b/cypress/fixtures/job/preheats/failure-preheats.json
index 93226871..4adadde3 100644
--- a/cypress/fixtures/job/preheats/failure-preheats.json
+++ b/cypress/fixtures/job/preheats/failure-preheats.json
@@ -14,7 +14,6 @@
"Authorization": "Bearer yJhbGciOiJSUzI1NiIsImtpZCI6IjNEWT"
},
"password": "",
- "pieceLength": 1050673152,
"platform": "",
"tag": "",
"type": "file",
@@ -70,7 +69,6 @@
"Authorization": "Bearer yJhbGciOiJSUzI1NiIsImtpZCI6IjNEWT"
},
"password": "",
- "pieceLength": 1050673152,
"platform": "",
"tag": "",
"type": "file",
@@ -126,7 +124,6 @@
"Authorization": "Bearer yJhbGciOiJSUzI1NiIsImtpZCI6IjNEWT"
},
"password": "",
- "pieceLength": 1050673152,
"platform": "",
"tag": "",
"type": "file",
@@ -182,7 +179,6 @@
"Authorization": "Bearer yJhbGciOiJSUzI1NiIsImtpZCI6IjNEWT"
},
"password": "",
- "pieceLength": 1050673152,
"platform": "",
"tag": "",
"type": "file",
diff --git a/cypress/fixtures/job/preheats/pagination-preheats.json b/cypress/fixtures/job/preheats/pagination-preheats.json
index 9c9c3c1b..301eadb0 100644
--- a/cypress/fixtures/job/preheats/pagination-preheats.json
+++ b/cypress/fixtures/job/preheats/pagination-preheats.json
@@ -14,7 +14,6 @@
"Authorization": "Bearer yJhbGciOiJSUzI1NiIsImtpZCI6IjNEWT"
},
"password": "",
- "pieceLength": 1050673152,
"platform": "",
"tag": "",
"type": "file",
diff --git a/cypress/fixtures/job/preheats/pending-preheat.json b/cypress/fixtures/job/preheats/pending-preheat.json
index ae427e3d..39b70c50 100644
--- a/cypress/fixtures/job/preheats/pending-preheat.json
+++ b/cypress/fixtures/job/preheats/pending-preheat.json
@@ -13,7 +13,6 @@
"Connection": "keep-alive"
},
"password": "",
- "pieceLength": 4194304,
"platform": "",
"tag": "prheat tag",
"type": "file",
diff --git a/cypress/fixtures/job/preheats/pending-preheats.json b/cypress/fixtures/job/preheats/pending-preheats.json
index b70c7fde..04a31d72 100644
--- a/cypress/fixtures/job/preheats/pending-preheats.json
+++ b/cypress/fixtures/job/preheats/pending-preheats.json
@@ -14,7 +14,6 @@
"Authorization": "Bearer yJhbGciOiJSUzI1NiIsImtpZCI6IjNEWT"
},
"password": "",
- "pieceLength": 1050673152,
"platform": "",
"tag": "",
"type": "file",
diff --git a/cypress/fixtures/job/preheats/preheats.json b/cypress/fixtures/job/preheats/preheats.json
index af7947e1..aa3d38d3 100644
--- a/cypress/fixtures/job/preheats/preheats.json
+++ b/cypress/fixtures/job/preheats/preheats.json
@@ -14,7 +14,6 @@
"Authorization": "Bearer yJhbGciOiJSUzI1NiIsImtpZCI6IjNEWT"
},
"password": "",
- "pieceLength": 1050673152,
"platform": "",
"tag": "",
"type": "file",
@@ -70,7 +69,6 @@
"Authorization": "Bearer yJhbGciOiJSUzI1NiIsImtpZCI6IjNEWT"
},
"password": "",
- "pieceLength": 1050673152,
"platform": "",
"tag": "",
"type": "file",
@@ -126,7 +124,6 @@
"Authorization": "Bearer yJhbGciOiJSUzI1NiIsImtpZCI6IjNEWT"
},
"password": "",
- "pieceLength": 1050673152,
"platform": "",
"tag": "",
"type": "file",
@@ -182,7 +179,6 @@
"Authorization": "Bearer yJhbGciOiJSUzI1NiIsImtpZCI6IjNEWT"
},
"password": "",
- "pieceLength": 1050673152,
"platform": "",
"tag": "",
"type": "file",
@@ -238,7 +234,6 @@
"Authorization": "Bearer yJhbGciOiJSUzI1NiIsImtpZCI6IjNEWT"
},
"password": "",
- "pieceLength": 1050673152,
"platform": "",
"tag": "",
"type": "file",
@@ -294,7 +289,6 @@
"Authorization": "Bearer yJhbGciOiJSUzI1NiIsImtpZCI6IjNEWT"
},
"password": "",
- "pieceLength": 1050673152,
"platform": "",
"tag": "",
"type": "file",
@@ -350,7 +344,6 @@
"Authorization": "Bearer yJhbGciOiJSUzI1NiIsImtpZCI6IjNEWT"
},
"password": "",
- "pieceLength": 1050673152,
"platform": "",
"tag": "",
"type": "file",
@@ -406,7 +399,6 @@
"Authorization": "Bearer yJhbGciOiJSUzI1NiIsImtpZCI6IjNEWT"
},
"password": "",
- "pieceLength": 1050673152,
"platform": "",
"tag": "",
"type": "file",
@@ -462,7 +454,6 @@
"Authorization": "Bearer yJhbGciOiJSUzI1NiIsImtpZCI6IjNEWT"
},
"password": "",
- "pieceLength": 1050673152,
"platform": "",
"tag": "",
"type": "file",
@@ -518,7 +509,6 @@
"Authorization": "Bearer yJhbGciOiJSUzI1NiIsImtpZCI6IjNEWT"
},
"password": "",
- "pieceLength": 1050673152,
"platform": "",
"tag": "",
"type": "file",
diff --git a/cypress/fixtures/job/preheats/success-preheat.json b/cypress/fixtures/job/preheats/success-preheat.json
index ff10ea32..ffe2c29c 100644
--- a/cypress/fixtures/job/preheats/success-preheat.json
+++ b/cypress/fixtures/job/preheats/success-preheat.json
@@ -14,7 +14,6 @@
"Connection": "keep-alive"
},
"password": "",
- "pieceLength": 4194304,
"platform": "",
"tag": "",
"type": "file",
diff --git a/cypress/fixtures/job/preheats/success-preheats.json b/cypress/fixtures/job/preheats/success-preheats.json
index 3e75fa88..c5f6f013 100644
--- a/cypress/fixtures/job/preheats/success-preheats.json
+++ b/cypress/fixtures/job/preheats/success-preheats.json
@@ -14,7 +14,6 @@
"Authorization": "Bearer yJhbGciOiJSUzI1NiIsImtpZCI6IjNEWT"
},
"password": "",
- "pieceLength": 1050673152,
"platform": "",
"tag": "",
"type": "file",
@@ -70,7 +69,6 @@
"Authorization": "Bearer yJhbGciOiJSUzI1NiIsImtpZCI6IjNEWT"
},
"password": "",
- "pieceLength": 1050673152,
"platform": "",
"tag": "",
"type": "file",
@@ -126,7 +124,6 @@
"Authorization": "Bearer yJhbGciOiJSUzI1NiIsImtpZCI6IjNEWT"
},
"password": "",
- "pieceLength": 1050673152,
"platform": "",
"tag": "",
"type": "file",
@@ -182,7 +179,6 @@
"Authorization": "Bearer yJhbGciOiJSUzI1NiIsImtpZCI6IjNEWT"
},
"password": "",
- "pieceLength": 1050673152,
"platform": "",
"tag": "",
"type": "file",
@@ -238,7 +234,6 @@
"Authorization": "Bearer yJhbGciOiJSUzI1NiIsImtpZCI6IjNEWT"
},
"password": "",
- "pieceLength": 1050673152,
"platform": "",
"tag": "",
"type": "file",
@@ -294,7 +289,6 @@
"Authorization": "Bearer yJhbGciOiJSUzI1NiIsImtpZCI6IjNEWT"
},
"password": "",
- "pieceLength": 1050673152,
"platform": "",
"tag": "",
"type": "file",
diff --git a/public/icons/job/preheat/piece-length.svg b/public/icons/job/preheat/piece-length.svg
deleted file mode 100644
index db5e807e..00000000
--- a/public/icons/job/preheat/piece-length.svg
+++ /dev/null
@@ -1,6 +0,0 @@
-
\ No newline at end of file
diff --git a/src/components/job/preheats/new.tsx b/src/components/job/preheats/new.tsx
index b36539c7..f033f1dd 100644
--- a/src/components/job/preheats/new.tsx
+++ b/src/components/job/preheats/new.tsx
@@ -43,7 +43,6 @@ export default function NewPreheat() {
const [bioError, setBioError] = useState(false);
const [urlError, setURLError] = useState(false);
const [tagError, setTagError] = useState(false);
- const [pieceLengthError, setPieceLengthError] = useState(false);
const [filterError, setFilterError] = useState(false);
const [loadingButton, setLoadingButton] = useState(false);
const [headers, setheaders] = useState>([]);
@@ -115,48 +114,6 @@ export default function NewPreheat() {
];
const argsForm = [
- {
- formProps: {
- id: 'pieceLength',
- label: 'Piece Length',
- name: 'pieceLength',
- type: 'number',
- required: true,
- defaultValue: 4,
- autoComplete: 'family-name',
- placeholder: 'Enter your piece length',
- helperText: pieceLengthError ? 'Fill in the number, the length is 4-1024 MiB.' : '',
- error: pieceLengthError,
- InputProps: {
- endAdornment: (
- <>
- MiB
-
-
-
- >
- ),
- },
- onChange: (e: any) => {
- changeValidate(e.target.value, argsForm[0]);
- },
- },
- syncError: false,
- setError: setPieceLengthError,
-
- validate: (value: string) => {
- const reg = /^(?:[4-9]|[1-9]\d{1,2}|10[0-1]\d|102[0-4])$/;
- return reg.test(value);
- },
- },
{
formProps: {
id: 'tag',
@@ -184,7 +141,7 @@ export default function NewPreheat() {
),
},
onChange: (e: any) => {
- changeValidate(e.target.value, argsForm[1]);
+ changeValidate(e.target.value, argsForm[0]);
},
},
syncError: false,
@@ -216,7 +173,7 @@ export default function NewPreheat() {
),
},
onChange: (e: any) => {
- changeValidate(e.target.value, argsForm[2]);
+ changeValidate(e.target.value, argsForm[1]);
},
},
syncError: false,
@@ -235,13 +192,13 @@ export default function NewPreheat() {
value: filter,
options: [],
onChange: (_e: any, newValue: any) => {
- if (!argsForm[3].formProps.error) {
+ if (!argsForm[2].formProps.error) {
setFilter(newValue);
}
},
onInputChange: (e: any) => {
setFilterHelperText('Fill in the characters, the length is 0-100.');
- changeValidate(e.target.value, argsForm[3]);
+ changeValidate(e.target.value, argsForm[2]);
},
renderTags: (value: any, getTagProps: any) =>
@@ -306,7 +263,6 @@ export default function NewPreheat() {
const bio = event.currentTarget.elements.description.value;
const url = event.currentTarget.elements.url.value;
const tag = event.currentTarget.elements.tag.value;
- const pieceLength = event.currentTarget.elements.pieceLength.value;
const filterText = event.currentTarget.elements.filteredQueryParams.value;
const filters = filter.join('&');
@@ -370,7 +326,6 @@ export default function NewPreheat() {
type: 'file',
url: url,
tag: tag,
- pieceLength: pieceLength * 1024 * 1024,
filteredQueryParams: filters,
headers: headerList,
},
@@ -520,7 +475,7 @@ export default function NewPreheat() {
/>
-
+
{argsForm.map((item) => {
return (
@@ -565,15 +520,6 @@ export default function NewPreheat() {
/>
)}
/>
- ) : item.formProps.id === 'pieceLength' ? (
-
) : item.formProps.id === 'tag' ? (
: preheat?.args?.url || '-'}
-
-
-
-
- Piece Length
-
-
-
- {isLoading ? (
-
- ) : (
- `${
- Number(preheat?.args?.pieceLength) >= 4194304 ? Number(preheat?.args?.pieceLength) / 1024 / 1024 : '0'
- } MiB` || '0 MiB'
- )}
-
-
diff --git a/src/lib/api.ts b/src/lib/api.ts
index dd27ab0b..bef73551 100644
--- a/src/lib/api.ts
+++ b/src/lib/api.ts
@@ -672,7 +672,6 @@ export interface JobsResponse {
tag: string;
type: string;
url: string;
- pieceLength: number;
};
result: {
CreatedAt: string;
@@ -736,7 +735,6 @@ export interface getJobResponse {
tag: string;
type: string;
url: string;
- pieceLength: number;
password: string;
platform: string;
username: string;
@@ -788,7 +786,6 @@ interface createJobRequest {
url: string;
tag: string;
filteredQueryParams: string;
- pieceLength: number;
headers?: { [key: string]: string } | null;
};
scheduler_cluster_ids: Array;
@@ -809,7 +806,6 @@ interface cerateJobResponse {
tag: string;
type: string;
url: string;
- pieceLength: number;
};
result: string;
}