Skip to content

Commit

Permalink
[frontend] Fix spacing for tags (#1112)
Browse files Browse the repository at this point in the history
  • Loading branch information
savacano28 authored and johanah29 committed Jul 16, 2024
1 parent 1ca55e6 commit 40c0b3a
Show file tree
Hide file tree
Showing 23 changed files with 153 additions and 127 deletions.
1 change: 1 addition & 0 deletions openbas-front/src/admin/components/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ const Dashboard = () => {
searchPaginationInput={searchPaginationInput}
setSearchPaginationInput={setSearchPaginationInput}
hasHeader={false}
variant={'reduced-view'}
/>
</Paper>
</Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ const AssetGroupDialogAdding: FunctionComponent<Props> = ({
</ListItemIcon>
<ListItemText
primary={assetGroup.asset_group_name}
secondary={assetGroup.asset_group_description}
secondary={truncate(assetGroup.asset_group_description, 30)}
/>
<ItemTags variant="list" tags={assetGroup.asset_group_tags} />
<ItemTags variant="reduced-view" tags={assetGroup.asset_group_tags} />
</ListItemButton>
);
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ const inlineStyles: Record<string, CSSProperties> = {
width: '20%',
},
asset_group_description: {
width: '25%',
width: '20%',
},
asset_group_assets: {
width: '35%',
},
asset_group_tags: {
width: '20%',
width: '25%',
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const AssetGroupsList: FunctionComponent<Props> = ({
className={classes.bodyItem}
style={inlineStyles.asset_group_tags}
>
<ItemTags variant="list" tags={assetGroup.asset_group_tags} />
<ItemTags variant="reduced-view" tags={assetGroup.asset_group_tags} />
</div>
</>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,14 @@ const EndpointsDialogAdding: FunctionComponent<Props> = ({
<ListItemText
primary={
<div style={{ display: 'flex', alignItems: 'center' }}>
<div className={classes.bodyItem} style={{ width: '50%' }}>
<div className={classes.bodyItem} style={{ width: '45%' }}>
{endpoint.asset_name}
</div>
<div className={classes.bodyItem} style={{ width: '25%' }}>
<div className={classes.bodyItem} style={{ width: '20%' }}>
<PlatformIcon platform={endpoint.endpoint_platform} width={20} marginRight={10} /> {endpoint.endpoint_platform}
</div>
<div className={classes.bodyItem} style={{ width: '25%' }}>
<ItemTags variant="list" tags={endpoint.asset_tags} />
<div className={classes.bodyItem} style={{ width: '35%' }}>
<ItemTags variant="reduced-view" tags={endpoint.asset_tags} />
</div>
</div>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ const useStyles = makeStyles(() => ({

const inlineStyles: Record<string, CSSProperties> = {
asset_name: {
width: '40%',
width: '35%',
},
asset_platform: {
width: '20%',
width: '15%',
display: 'flex',
alignItems: 'center',
},
asset_tags: {
width: '25%',
width: '35%',
},
asset_type: {
width: '10%',
Expand Down Expand Up @@ -97,7 +97,7 @@ const EndpointsList: FunctionComponent<Props> = ({
className={classes.bodyItem}
style={inlineStyles.asset_tags}
>
<ItemTags variant="list" tags={endpoint.asset_tags} />
<ItemTags variant="reduced-view" tags={endpoint.asset_tags} />
</div>
<div
className={classes.bodyItem}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ const InjectAddDocuments: FunctionComponent<Props> = ({
secondary={document.document_description}
/>
<ItemTags
variant="list"
variant="reduced-view"
tags={document.document_tags}
/>
</ListItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ const InjectAddTeams: FunctionComponent<Props> = ({
secondary={team.team_description}
/>
<ItemTags
variant="list"
variant="reduced-view"
tags={team.team_tags}
/>
</ListItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1159,7 +1159,7 @@ class InjectDefinition extends Component {
className={classes.bodyItem}
style={inlineStyles.team_tags}
>
<ItemTags variant="list" tags={[]} />
<ItemTags variant="reduced-view" tags={[]} />
</div>
</>
}
Expand Down Expand Up @@ -1319,7 +1319,7 @@ class InjectDefinition extends Component {
style={inlineStyles.challenge_tags}
>
<ItemTags
variant="list"
variant="reduced-view"
tags={challenge.challenge_tags}
/>
</div>
Expand Down Expand Up @@ -1490,7 +1490,7 @@ class InjectDefinition extends Component {
style={inlineStyles.document_tags}
>
<ItemTags
variant="list"
variant="reduced-view"
tags={document.document_tags}
/>
</div>
Expand Down
10 changes: 6 additions & 4 deletions openbas-front/src/admin/components/common/injects/Injects.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const headerStyles = {
},
inject_depends_duration: {
float: 'left',
width: '20%',
width: '18%',
fontSize: 12,
fontWeight: '700',
},
Expand All @@ -90,12 +90,13 @@ const headerStyles = {
},
inject_enabled: {
float: 'left',
width: '15%',
width: '12%',
fontSize: 12,
fontWeight: '700',
},
inject_tags: {
float: 'left',
width: '20%',
fontSize: 12,
fontWeight: '700',
},
Expand All @@ -120,7 +121,7 @@ const inlineStyles = {
},
inject_depends_duration: {
float: 'left',
width: '20%',
width: '18%',
height: 20,
whiteSpace: 'nowrap',
overflow: 'hidden',
Expand All @@ -138,14 +139,15 @@ const inlineStyles = {
},
inject_enabled: {
float: 'left',
width: '15%',
width: '12%',
height: 20,
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
},
inject_tags: {
float: 'left',
width: '20%',
height: 20,
whiteSpace: 'nowrap',
overflow: 'hidden',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const useStyles = makeStyles((theme: Theme) => ({
},
column: {
display: 'grid',
gridTemplateColumns: '2fr 1fr 1fr 1fr',
gridTemplateColumns: '2fr 1fr 1fr 2fr',
},
bodyItem: {
fontSize: theme.typography.h3.fontSize,
Expand Down Expand Up @@ -59,7 +59,7 @@ const InjectTeamsList: FunctionComponent<Props> = ({
{team.team_users_enabled_number}
</div>
<div className={classes.bodyItem}>
<ItemTags variant="list" tags={team.team_tags} />
<ItemTags variant="reduced-view" tags={team.team_tags} />
</div>
</div>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ const AddTeams: React.FC<Props> = ({ addedTeamIds, onAddTeams }) => {
primary={team.team_name}
secondary={team.organization_name}
/>
<ItemTags variant="list" tags={team.team_tags} />
<ItemTags variant="reduced-view" tags={team.team_tags} />
</ListItem>
);
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,19 @@ const headerStylesContextual: Record<string, CSSProperties> = {
},
team_users_number: {
float: 'left',
width: '12%',
width: '10%',
fontSize: 12,
fontWeight: '700',
},
team_users_enabled_number: {
float: 'left',
width: '12%',
width: '10%',
fontSize: 12,
fontWeight: '700',
},
team_tags: {
float: 'left',
width: '25%',
width: '29%',
fontSize: 12,
fontWeight: '700',
},
Expand All @@ -92,23 +92,23 @@ const inlineStylesContextual: Record<string, CSSProperties> = {
},
team_users_number: {
float: 'left',
width: '12%',
width: '10%',
height: 20,
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
},
team_users_enabled_number: {
float: 'left',
width: '12%',
width: '10%',
height: 20,
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
},
team_tags: {
float: 'left',
width: '25%',
width: '29%',
height: 20,
whiteSpace: 'nowrap',
overflow: 'hidden',
Expand Down Expand Up @@ -263,7 +263,7 @@ const ContextualTeams: React.FC<Props> = ({ teamIds }) => {
className={classes.bodyItem}
style={inlineStylesContextual.team_tags}
>
<ItemTags variant="list" tags={team.team_tags} />
<ItemTags variant="reduced-view" tags={team.team_tags} />
</div>
<div
className={classes.bodyItem}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ const TeamAddPlayers: React.FC<Props> = ({ addedUsersIds, teamId }) => {
primary={resolveUserName(user)}
secondary={user.organization_name}
/>
<ItemTags variant="list" tags={user.user_tags} />
<ItemTags variant="reduced-view" tags={user.user_tags} />
</ListItem>
);
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,15 @@ const inlineStyles: Record<string, CSSProperties> = {
},
user_organization: {
float: 'left',
width: '20%',
width: '18%',
height: 20,
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
},
user_tags: {
float: 'left',
width: '23%',
width: '25%',
height: 20,
whiteSpace: 'nowrap',
overflow: 'hidden',
Expand Down Expand Up @@ -407,7 +407,7 @@ const TeamPlayers: React.FC<Props> = ({ teamId, handleClose }) => {
className={classes.bodyItem}
style={inlineStyles.user_tags}
>
<ItemTags variant="list" tags={user.user_tags} />
<ItemTags variant="reduced-view" tags={user.user_tags} />
</div>
</>
}
Expand Down
4 changes: 2 additions & 2 deletions openbas-front/src/admin/components/components/teams/Teams.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ const inlineStyles: Record<string, CSSProperties> = {
width: '25%',
},
team_description: {
width: '25%',
width: '20%',
},
team_users_number: {
width: '10%',
},
team_tags: {
width: '20%',
width: '25%',
},
team_updated_at: {
width: '20%',
Expand Down
2 changes: 1 addition & 1 deletion openbas-front/src/admin/components/payloads/Payloads.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ const Payloads = () => {
style={inlineStyles.payload_tags}
>
<ItemTags
variant="list"
variant="reduced-view"
tags={payload.payload_tags}
/>
</div>
Expand Down
4 changes: 2 additions & 2 deletions openbas-front/src/admin/components/scenarios/Scenarios.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ const inlineStyles: Record<string, CSSProperties> = {
width: '12%',
},
scenario_platforms: {
width: '12%',
width: '10%',
cursor: 'default',
},
scenario_tags: {
width: '15%',
width: '18%',
},
scenario_updated_at: {
width: '10%',
Expand Down
Loading

0 comments on commit 40c0b3a

Please sign in to comment.