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

feat: Refactor task output details #280

Merged
merged 7 commits into from
Feb 28, 2024
Merged

Conversation

Milouu
Copy link
Contributor

@Milouu Milouu commented Nov 10, 2023

Description

  • Refactors task outputs section in task drawer to be more consistent with the task inputs section
  • Displays awaited outputs when task is not completed yet
  • Adds permissions details for task I/Os so that users know easily which org can access their assets
  • Adds tooltip with explanation on non-availability when an item is transient (= deleted asap to save storage)
  • Changes lock icons by disabled download buttons
  • Adds tooltip with explanation when download is blocked because the modelExportEnabled property in the config is set to false
  • Adds tooltip describing the kind of asset when hovering on asset icon
  • Aligns every download actions

Closes FL-1175

Screenshots

Capture d’écran 2023-11-10 à 12 01 22 Capture d’écran 2023-11-10 à 12 01 57 Capture d’écran 2023-11-10 à 12 04 02 Capture d’écran 2023-11-10 à 12 04 14

@Milouu Milouu requested review from HamdyD, jmorel and a team as code owners November 10, 2023 10:55
Copy link

linear bot commented Nov 10, 2023

FL-1175 Show details of task outputs in the front

Context

Task outputs permission and transient property are not shown today in the frontend:

image.png

More information on Design Outputs in Substra frontend Notion page.

Specification

Mockups → Task information improvements

Task Information Panel - Task information improvements (Figma)

User story

As a data Scientist or R&D member, I want to understand the tasks, so I need to know all details of the tasks that are processed in a project.

Technical specs

Input and output line properties

Properties are always in the same order. Download and Copy/paste button are always on the same vertical alignment, same for the chevron.

Left alignment :

  1. Kind (Icon) - mandatory
  2. Name (Balise code) - mandatory
  3. File name or link or value (Text)
  4. Permissions (Icon : group-line) - mandatory

Right :

  1. Number and kind of available data/sub-elements or transient property (Text)
  2. Download (Icon : download-line)
  3. Accordion (Icon : arrow-right-s-line) - only in Inputs available

Icon Set

Different kinds :

Sub elements

(only for Inputs)

Default view :

number and the kind on the first line

→ sub-elements are hidden

Capture d’écran 2023-09-14 à 18.01.33.png

Clicking on line or arrow:

→ sub-elements are listed by their filename

→ sub-elements have no available action

Capture d’écran 2023-09-14 à 18.01.19.png

Transient property

permissions

Text display for incompleted tasks :

→ "Transient item" with an information icon

Capture d’écran 2023-09-14 à 17.27.26.png

Text display for completed tasks :

→ "No longer available" with an information icon

Capture d’écran 2023-09-14 à 17.27.36.png

Hovering properties

Information icon of a transient element

→ tooltip "Transient items are deleted after use to save storage"

Capture d’écran 2023-09-14 à 15.40.55.png

Download button

→ tooltip “Download [kind]

Capture d’écran 2023-09-15 à 09.50.23.png

Download disabled button

→ tooltip “Restricted download

Capture d’écran 2023-09-15 à 11.13.36.png

Kind icon

→ tooltip “[Kind]

Capture d’écran 2023-09-14 à 15.01.50.png

Permissions icon

→ tooltip “Accessible by [username1], [username2]

Capture d’écran 2023-09-14 à 17.20.06.png

General Section

Adapt the vertical alignment on the right for the buttons Download and Copy/Past :

image 2.png

@Milouu Milouu marked this pull request as draft November 10, 2023 11:09
@Milouu Milouu marked this pull request as ready for review January 8, 2024 10:01
@Milouu Milouu force-pushed the feat/task-output-details branch from 201b5e9 to a1cd868 Compare January 15, 2024 09:24
Copy link
Contributor

@HamdyD HamdyD left a comment

Choose a reason for hiding this comment

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

Added some small comments to lighten the code

const TaskIOPermissions = ({
permissions,
}: {
permissions?: PermissionsT | null;
Copy link
Contributor

Choose a reason for hiding this comment

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

Not mandatory: instead of defining the prop types inline, you could define them separately for better readability and reusability if more come:

type TaskIOPermissionsProps = {
    permissions?: PermissionsT | null;
};

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True. I made the choice to not declare a type as it is only used here and it only contains permissions 👍

}: {
permissions?: PermissionsT | null;
}): JSX.Element => {
let label = '';
Copy link
Contributor

@HamdyD HamdyD Jan 17, 2024

Choose a reason for hiding this comment

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

The label calculation could be wrapped in a useMemo hook. This would ensure that the label is only recalculated when the permissions prop changes, potentially improving performance.

To be tested but it could be something like that:

const label = useMemo(() => {
        if (!permissions) {
            return 'No permissions available yet';
        }
        if (permissions === null || permissions?.download.public) {
            return 'Accessible by everyone';
        }
        if (permissions.download?.authorized_ids.length) {
            return `Accessible by ${permissions?.download.authorized_ids.join()}`;
        }
        return 'Accessible by owner only';
    }, [permissions]);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the label calculation isn't heavy enough to justify the use of useMemo :)

</Table>
</TableContainer>
{taskLoading || !task ? (
<Skeleton height="50px" width="457px"></Skeleton>
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe an oversight, can't it be a self closing tag?
<Skeleton height="50px" width="457px" />

@thbcmlowk
Copy link
Contributor

Ready to be merged. Waiting for end of merge freeze. Thanks @Milouu !

@thbcmlowk thbcmlowk force-pushed the feat/task-output-details branch from 17bf18b to 6ff1c85 Compare February 28, 2024 14:23
@thbcmlowk
Copy link
Contributor

/e2e --tests=sdk,frontend

@Owlfred
Copy link

Owlfred commented Feb 28, 2024

End to end tests: ✔️ SUCCESS

Awesome! 🎉

@thbcmlowk thbcmlowk merged commit 0d55ef8 into main Feb 28, 2024
3 checks passed
@thbcmlowk thbcmlowk deleted the feat/task-output-details branch February 28, 2024 15:00
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.

4 participants