Skip to content

Commit

Permalink
Show inherits on UI
Browse files Browse the repository at this point in the history
  • Loading branch information
amitaibu committed Sep 2, 2024
1 parent 2d1601d commit b59e405
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions ihp-ide/IHP/IDE/SchemaDesigner/View/Layout.hs
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,7 @@ renderColumnSelector tableName columns statements = [hsx|
</tbody>
</table>

<div>
Inherits: {inherits}
</div>
{maybeInherits}

{suggestedColumnsSection tableName columns}
</section>
Expand All @@ -251,19 +249,23 @@ renderColumnSelector tableName columns statements = [hsx|
{renderColumnIndexes tableName statements}
</table>
|]
Nothing -> [hsx||]
Nothing -> ""

auth :: Html
auth = renderPolicies tableName statements

inherits = statements
|> find (\case
StatementCreateTable CreateTable { name } | name == tableName -> True
_ -> False)
-- Get the table that this table inherits from
|> \case
Just (StatementCreateTable CreateTable { inherits }) -> inherits
_ -> Nothing
maybeInherits =
statements
|> find \case
StatementCreateTable CreateTable { name } | name == tableName -> True
_ -> False
|> \case
Just (StatementCreateTable CreateTable { inherits = Just parentTableName }) ->
[hsx|<div>
This table <code>inherits</code> from table <code>{parentTableName}<code>
</div>|]
_ -> ""



suggestedColumnsSection :: Text -> [(Int, Column)] -> Html
Expand Down

0 comments on commit b59e405

Please sign in to comment.