diff --git a/changes/1627-fix-edit-label-platform b/changes/1627-fix-edit-label-platform new file mode 100644 index 0000000000..90f0bf6f65 --- /dev/null +++ b/changes/1627-fix-edit-label-platform @@ -0,0 +1 @@ +Disable select platform dropdown for edit label page \ No newline at end of file diff --git a/cypress/integration/all/app/labelflow.spec.ts b/cypress/integration/all/app/labelflow.spec.ts index 4f2547cf9d..a84becdf7c 100644 --- a/cypress/integration/all/app/labelflow.spec.ts +++ b/cypress/integration/all/app/labelflow.spec.ts @@ -40,9 +40,9 @@ describe("Label flow", () => { .click() .type("{selectall}{backspace}Select all usernames on Mac."); - cy.findByText(/select one/i).click(); + cy.findByText(/select one/i).should("not.exist"); - cy.findAllByText(/macos/i).click(); + cy.findByText(/label platforms are immutable/i).should("exist"); cy.findByRole("button", { name: /update label/i }).click(); diff --git a/frontend/components/forms/LabelForm/LabelForm.jsx b/frontend/components/forms/LabelForm/LabelForm.jsx index 5c1a47a866..8f03f97b96 100644 --- a/frontend/components/forms/LabelForm/LabelForm.jsx +++ b/frontend/components/forms/LabelForm/LabelForm.jsx @@ -13,6 +13,13 @@ import validate from "components/forms/LabelForm/validate"; const baseClass = "label-form"; +const PLATFORM_STRINGS = { + darwin: "macOS", + windows: "MS Windows", + ubuntu: "Ubuntu Linux", + centos: "CentOS Linux", +}; + class LabelForm extends Component { static propTypes = { baseError: PropTypes.string, @@ -74,6 +81,8 @@ class LabelForm extends Component { ? "Label queries are immutable. To change the query, delete this label and create a new one." : ""; + const { platform } = fields; + if (isBuiltin) { return (
@@ -109,7 +118,7 @@ class LabelForm extends Component { label="Description" type="textarea" /> - {!isManual && ( + {!isManual && !isEdit && (
)} + {isEdit && platform && ( +
+

Platform

+

+ {!platform.value + ? "All platforms" + : PLATFORM_STRINGS[platform.value]} +

+

+ Label platforms are immutable. To change the platform, delete this + label and create a new one. +

+
+ )}