Browse Source

"Delete" and "Promote to Primary" buttons always inactive (#1966)

resolves #1964

Co-authored-by: Fred Lefévère-Laoide <Fred.Lefevere-Laoide@Taipy.io>
Fred Lefévère-Laoide 7 months ago
parent
commit
7bd62af8fa
1 changed files with 26 additions and 18 deletions
  1. 26 18
      frontend/taipy/src/ScenarioViewer.tsx

+ 26 - 18
frontend/taipy/src/ScenarioViewer.tsx

@@ -382,8 +382,8 @@ const ScenarioViewer = (props: ScenarioViewerProps) => {
         scSequences,
         scTasks,
         scAuthorizedTags,
-        scDeletable,
-        scPromotable,
+        scDeletableReason,
+        scPromotableReason,
         scNotSubmittableReason,
         scNotReadableReason,
         scNotEditableReason,
@@ -891,23 +891,31 @@ const ScenarioViewer = (props: ScenarioViewerProps) => {
                             ) : null}
                             <Grid size={12} container justifyContent="space-between">
                                 {showDelete ? (
-                                    <Button
-                                        variant="outlined"
-                                        color="primary"
-                                        disabled={!active || !valid || !scDeletable}
-                                        onClick={openDeleteDialog}
-                                    >
-                                        DELETE
-                                    </Button>
+                                    <Tooltip title={scDeletableReason}>
+                                        <span>
+                                            <Button
+                                                variant="outlined"
+                                                color="primary"
+                                                disabled={!active || !valid || !!scDeletableReason}
+                                                onClick={openDeleteDialog}
+                                            >
+                                                DELETE
+                                            </Button>
+                                        </span>
+                                    </Tooltip>
                                 ) : null}
-                                <Button
-                                    variant="outlined"
-                                    color="primary"
-                                    disabled={!active || !valid || scPrimary || !scPromotable}
-                                    onClick={openPrimaryDialog}
-                                >
-                                    PROMOTE TO PRIMARY
-                                </Button>
+                                <Tooltip title={scPromotableReason}>
+                                    <span>
+                                        <Button
+                                            variant="outlined"
+                                            color="primary"
+                                            disabled={!active || !valid || scPrimary || !!scPromotableReason}
+                                            onClick={openPrimaryDialog}
+                                        >
+                                            PROMOTE TO PRIMARY
+                                        </Button>
+                                    </span>
+                                </Tooltip>
                             </Grid>
                         </Grid>
                     </AccordionDetails>