Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hide detailed disclosure information by default #6587

Merged

Conversation

garyverhaegen-da
Copy link
Contributor

@garyverhaegen-da garyverhaegen-da commented Jul 2, 2020

As requested by @shaul-da, this PR hides the information added by @hurryabit in #6571 behind a checkbox, and reverts to plain "X"s by default (checkbox unchecked).

CHANGELOG_BEGIN

  • [DAML Studio] The new S/O/W/D information is hidden behind a top-level checkbox (next to Show archived). When that checkbox is not checked (which is the default), we display X's as before.

CHANGELOG_END

@garyverhaegen-da
Copy link
Contributor Author

Opening the scenario view on the default skeleton:
Screenshot 2020-07-02 at 16 12

Checking the box reveals the detailed information:
Screenshot 2020-07-02 at 16 12 1

When the box is checked, hover behaves as of #6571; when the box is not checked, there is no hover behaviour for the X's.
Screenshot 2020-07-02 at 16 13

@@ -845,8 +845,8 @@ renderRow world parties NodeInfo{..} =
| party `S.member` niDivulgences = ("D", Just "Divulged")
| otherwise = ("-", Nothing)
in
H.td H.! A.class_ "disclosure" $ H.div H.! A.class_ "tooltip" $ do
H.text label
H.td H.! (A.class_ (H.textValue $ T.pack $ concat $ ["disclosure"] <> [" disclosed" | isJust mbHint])) $ H.div H.! A.class_ "tooltip" $ do
Copy link
Contributor

@hurryabit hurryabit Jul 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of the disclosed class? It seems unused.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed it is. It should not be. Its purpose is to scope the replacement by X to only the disclosed cells, i.e. not replace -. It seems like I forgot to do that. I'll add it :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed by

$ git add -p
diff --git a/compiler/daml-extension/src/webview.css b/compiler/daml-extension/src/webview.css
index 05d9bd785..8060f088c 100644
--- a/compiler/daml-extension/src/webview.css
+++ b/compiler/daml-extension/src/webview.css
@@ -31,10 +31,10 @@ td.disclosure {
 tr.archived td.disclosure {
   text-decoration: none;
 }
-.hidden_disclosure td.disclosure span {
+.hidden_disclosure td.disclosed.disclosure span {
   display: none;
 }
-.hidden_disclosure td.disclosure:after {
+.hidden_disclosure td.disclosed.disclosure:after {
   content: 'X';
 }
 th {
(1/1) Stage this hunk [y,n,q,a,d,s,e,?]? y

Screenshot 2020-07-02 at 19 33

Screenshot 2020-07-02 at 19 33 1

Copy link
Contributor

@hurryabit hurryabit Jul 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks great! One suggestion to simplify the code:

Suggested change
H.td H.! (A.class_ (H.textValue $ T.pack $ concat $ ["disclosure"] <> [" disclosed" | isJust mbHint])) $ H.div H.! A.class_ "tooltip" $ do
H.td H.! A.class_ (H.textValue $ T.unwords $ "disclosure" : ["disclosed" | isJust mbHint]) $ H.div H.! A.class_ "tooltip" $ do

I'm a bit sad we can't do

A.td H.! A.class_ "disclosure" H.!? (isJust mbHint, A.class_ "disclosed") $ ...

but unfortunately, the blaze library does not combine multiple class attributes. 😞

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be fair to Blaze, that's really a quirk of the HTML standard: the class attribute looks like a string but is really a list. AFAIK it's the only one that behaves like that, other attributes don't have any "merge" semantics, so this would require a lot of special-casing.

@garyverhaegen-da garyverhaegen-da force-pushed the scenario-results-switch-disclosure-details branch from b8ae8d6 to d17807b Compare July 2, 2020 17:32
Copy link
Contributor

@cocreature cocreature left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Copy link
Contributor

@hurryabit hurryabit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's awesome. Thanks for getting your webdev foo out so quickly. 😃

@@ -845,8 +845,8 @@ renderRow world parties NodeInfo{..} =
| party `S.member` niDivulgences = ("D", Just "Divulged")
| otherwise = ("-", Nothing)
in
H.td H.! A.class_ "disclosure" $ H.div H.! A.class_ "tooltip" $ do
H.text label
H.td H.! (A.class_ (H.textValue $ T.pack $ concat $ ["disclosure"] <> [" disclosed" | isJust mbHint])) $ H.div H.! A.class_ "tooltip" $ do
Copy link
Contributor

@hurryabit hurryabit Jul 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks great! One suggestion to simplify the code:

Suggested change
H.td H.! (A.class_ (H.textValue $ T.pack $ concat $ ["disclosure"] <> [" disclosed" | isJust mbHint])) $ H.div H.! A.class_ "tooltip" $ do
H.td H.! A.class_ (H.textValue $ T.unwords $ "disclosure" : ["disclosed" | isJust mbHint]) $ H.div H.! A.class_ "tooltip" $ do

I'm a bit sad we can't do

A.td H.! A.class_ "disclosure" H.!? (isJust mbHint, A.class_ "disclosed") $ ...

but unfortunately, the blaze library does not combine multiple class attributes. 😞

As requested by @shaul-da, this PR hides the information added by
@hurryabit in #6571 behind a checkbox, and reverts to plain "X"s by
default (checkbox unchecked).

CHANGELOG_BEGIN
- [DAML Studio] The new S/O/W/D information is hidden behind a top-level
  checkbox (next to Show archived). When that checkbox is not checked
  (which is the default), we display X's as before.
CHANGELOG_END
@garyverhaegen-da garyverhaegen-da force-pushed the scenario-results-switch-disclosure-details branch from d17807b to 205149d Compare July 3, 2020 09:40
@garyverhaegen-da garyverhaegen-da merged commit 2cbd498 into master Jul 3, 2020
@garyverhaegen-da garyverhaegen-da deleted the scenario-results-switch-disclosure-details branch July 3, 2020 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants