From 029bda1bd3a7b1f0c933b351695ba1ca5186c1c0 Mon Sep 17 00:00:00 2001 From: Rishichandra Wawhal Date: Wed, 11 Mar 2020 22:10:46 +0530 Subject: [PATCH] console: disable renaming action relationships (#4072) --- CHANGELOG.md | 1 + .../Components/TypeRelationship.js | 31 +++++++++++++------ 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 70b8a42a99f..d99a2c74064 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ ### Other changes +- console: disable editing action relationships - cli: fix typo in cli example for squash (fix #4047) (#4049) - console: fix run_sql migration modal messaging (close #4020) (#4060) - docs: add note on pg versions for actions (#4034) diff --git a/console/src/components/Services/Actions/Relationships/Components/TypeRelationship.js b/console/src/components/Services/Actions/Relationships/Components/TypeRelationship.js index e0a8668b397..68bc669f0e0 100644 --- a/console/src/components/Services/Actions/Relationships/Components/TypeRelationship.js +++ b/console/src/components/Services/Actions/Relationships/Components/TypeRelationship.js @@ -118,6 +118,15 @@ const RelationshipEditor = ({ // rel name input const getRelNameInput = () => { + /* + There is no neat solution to renaming a relationship. + This is because name is the only unique identifier of a relationship. + TODO FIXME + */ + const isDisabled = !!existingRelConfig; + const relNameInputTitle = isDisabled + ? 'A relationship cannot be renamed. Please drop and re-create if you really must.' + : undefined; return (
@@ -129,6 +138,8 @@ const RelationshipEditor = ({ className={`${styles.select} form-control ${styles.add_pad_left}`} placeholder="Enter relationship name" data-test="rel-name" + disabled={isDisabled} + title={relNameInputTitle} value={name} />
@@ -180,17 +191,17 @@ const RelationshipEditor = ({ disabled={!name} > {// default unselected option - refSchema === '' && ( - - )} + refSchema === '' && ( + + )} {// all reference schema options - orderedSchemaList.map((rs, j) => ( - - ))} + orderedSchemaList.map((rs, j) => ( + + ))}
);