Skip to content

Commit

Permalink
feat(ui): remove counterLabel and hide element in header (#123)
Browse files Browse the repository at this point in the history
* feat(ui): remove counterLabel component and hid Framework and Algoritm if they haven't valida data

* feat(ui): remove all CountLabel add align category feature table
  • Loading branch information
dvalleri authored Jul 22, 2024
1 parent 762e1ac commit c3a744c
Show file tree
Hide file tree
Showing 18 changed files with 121 additions and 165 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ function DataDriftList() {

return (
<Spinner fullHeight fullWidth>
<CountLabel />

<Virtuoso
data={items}
itemContent={(idx, item) => (<FeatureRow key={idx} item={item} />)}
Expand All @@ -36,17 +34,6 @@ function DataDriftList() {
);
}

function CountLabel() {
const items = useGetFilteredFeatures();
const label = items.length <= 1 ? 'Record' : 'Records';

return (
<label>
{`${label} ${items.length}`}
</label>
);
}

function FeatureRow({ item }) {
const pinType = (item.driftCalc.hasDrift) ? 'filled-error' : 'filled';
const isError = (item.driftCalc.hasDrift) ? 'is-error' : '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,17 @@ const columns = [
{
title: 'Count',
key: 'count',
width: '8rem',
width: '6rem',
dataIndex: 'count',
},
{
title: '',
key: 'frequency',
width: '8rem',

render: (data) => {
const formattedFrequency = Math.floor(data.frequency * 100);
const formattedReferenceFrequency = (data.referenceFrequency) ? Math.floor(data.referenceFrequency * 100) : 0;

width: '5rem',
align: 'right',
render: ({ frequency, referenceFrequency }) => {
const formattedFrequency = Math.floor(frequency * 100);
const formattedReferenceFrequency = (referenceFrequency) ? Math.floor(referenceFrequency * 100) : 0;
return (
<div className="flex flex-col items-end gap-1">
<div>
Expand All @@ -35,14 +34,15 @@ const columns = [
</div>
);
},

},
{
title: 'Frequency',
key: 'frequency',
width: '12rem',
render: (data) => {
const formattedFrequency = Math.floor(data.frequency * 100);
const formattedReferenceFrequency = (data.referenceFrequency) ? Math.floor(data.referenceFrequency * 100) : 0;
render: ({ frequency, referenceFrequency }) => {
const formattedFrequency = Math.floor(frequency * 100);
const formattedReferenceFrequency = (referenceFrequency) ? Math.floor(referenceFrequency * 100) : 0;
return (
<div className="flex flex-col gap-2">
<BarChart
Expand All @@ -59,6 +59,7 @@ const columns = [
</div>
);
},

},
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ function DataQualityList() {

return (
<Spinner className="mb-16" fullHeight fullWidth>
<CountLabel />

<Virtuoso
data={items}
itemContent={(index, item) => {
Expand All @@ -50,17 +48,6 @@ function DataQualityList() {
);
}

function CountLabel() {
const items = useGetFilteredFeatures();
const label = items.length <= 1 ? 'Record' : 'Records';

return (
<label>
{`${label} ${items.length}`}
</label>
);
}

function NumericalFeature({ item }) {
const dataset = item?.histogram;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,32 @@ const columns = [
{
title: 'Count',
key: 'count',
width: '8rem',
width: '6rem',
dataIndex: 'count',
},
{
title: 'Frequency (%)',
title: '',
key: 'frequency',
width: '5rem',
align: 'right',
render: ({ frequency }) => {
const formattedFrequency = Math.floor(frequency * 100);
return (
<div>
{formattedFrequency}
%
</div>
);
},
},
{
title: 'Frequency',
key: 'frequency',
width: '12rem',
render: ({ frequency }) => {
const formattedFrequency = Math.floor(frequency * 100);
return (
<BarChart
content={`${formattedFrequency}%`}
type="secondary"
value={formattedFrequency}
width="100%"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ function DataQualityList() {

return (
<Spinner fullHeight fullWidth>
<CountLabel />

<Virtuoso
data={items}
itemContent={(index, item) => {
Expand All @@ -51,17 +49,6 @@ function DataQualityList() {
);
}

function CountLabel() {
const items = useGetFilteredFeatures();
const label = items.length <= 1 ? 'Record' : 'Records';

return (
<label>
{`${label} ${items.length}`}
</label>
);
}

function NumericalFeature({ item }) {
const dataset = item?.histogram ?? [];

Expand Down
12 changes: 10 additions & 2 deletions ui/src/container/models/Details/header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,11 @@ function Framework() {
const { uuid } = useParams();

const { data } = useGetModelByUUIDQuery({ uuid });
const framework = data?.frameworks ?? '--';
const framework = data?.frameworks;

if (!framework) {
return false;
}

if (framework.length > STATUS_SELECTOR_MAX_LEN) {
return (
Expand All @@ -130,7 +134,11 @@ function Algorithm() {
const { uuid } = useParams();

const { data } = useGetModelByUUIDQuery({ uuid });
const algorithm = data?.algorithm ?? '--';
const algorithm = data?.algorithm;

if (!algorithm) {
return false;
}

if (algorithm.length > STATUS_SELECTOR_MAX_LEN) {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ function DataDriftList() {

return (
<Spinner fullHeight fullWidth>
<CountLabel />

<Virtuoso
data={items}
itemContent={(idx, item) => (<FeatureRow key={idx} item={item} />)}
Expand All @@ -36,17 +34,6 @@ function DataDriftList() {
);
}

function CountLabel() {
const items = useGetFilteredFeatures();
const label = items.length <= 1 ? 'Record' : 'Records';

return (
<label>
{`${label} ${items.length}`}
</label>
);
}

function FeatureRow({ item }) {
const pinType = (item.driftCalc.hasDrift) ? 'filled-error' : 'filled';
const isError = (item.driftCalc.hasDrift) ? 'is-error' : '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,17 @@ const columns = [
{
title: 'Count',
key: 'count',
width: '8rem',
width: '6rem',
dataIndex: 'count',
},
{
title: '',
key: 'frequency',
width: '8rem',

render: (data) => {
const formattedFrequency = Math.floor(data.frequency * 100);
const formattedReferenceFrequency = (data.referenceFrequency) ? Math.floor(data.referenceFrequency * 100) : 0;

width: '5rem',
align: 'right',
render: ({ frequency, referenceFrequency }) => {
const formattedFrequency = Math.floor(frequency * 100);
const formattedReferenceFrequency = (referenceFrequency) ? Math.floor(referenceFrequency * 100) : 0;
return (
<div className="flex flex-col items-end gap-1">
<div>
Expand All @@ -35,14 +34,15 @@ const columns = [
</div>
);
},

},
{
title: 'Frequency',
key: 'frequency',
width: '12rem',
render: (data) => {
const formattedFrequency = Math.floor(data.frequency * 100);
const formattedReferenceFrequency = (data.referenceFrequency) ? Math.floor(data.referenceFrequency * 100) : 0;
render: ({ frequency, referenceFrequency }) => {
const formattedFrequency = Math.floor(frequency * 100);
const formattedReferenceFrequency = (referenceFrequency) ? Math.floor(referenceFrequency * 100) : 0;
return (
<div className="flex flex-col gap-2">
<BarChart
Expand All @@ -59,6 +59,7 @@ const columns = [
</div>
);
},

},
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ function DataQualityList() {

return (
<Spinner className="mb-16" fullHeight fullWidth>
<CountLabel />

<Virtuoso
data={items}
itemContent={(index, item) => {
Expand All @@ -50,17 +48,6 @@ function DataQualityList() {
);
}

function CountLabel() {
const items = useGetFilteredFeatures();
const label = items.length <= 1 ? 'Record' : 'Records';

return (
<label>
{`${label} ${items.length}`}
</label>
);
}

function NumericalFeature({ item }) {
const dataset = item?.histogram;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,23 @@ function SearchChart() {
mode="multiple"
onChange={handleOnSelect}
options={options}
placeholder={<FontAwesomeIcon icon={faSearch} />}
placeholder={(
<div className="flex flex-row items-center justify-between gap-4">
<div>
Please select one or more of the
{' '}

{items.length}

{' '}
available class

</div>

<FontAwesomeIcon icon={faSearch} />

</div>
)}
/>
</FormField>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,32 @@ const columns = [
{
title: 'Count',
key: 'count',
width: '8rem',
width: '6rem',
dataIndex: 'count',
},
{
title: 'Frequency (%)',
title: '',
key: 'frequency',
width: '5rem',
align: 'right',
render: ({ frequency }) => {
const formattedFrequency = Math.floor(frequency * 100);
return (
<div>
{formattedFrequency}
%
</div>
);
},
},
{
title: 'Frequency',
key: 'frequency',
width: '12rem',
render: ({ frequency }) => {
const formattedFrequency = Math.floor(frequency * 100);
return (
<BarChart
content={`${formattedFrequency}%`}
type="secondary"
value={formattedFrequency}
width="100%"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ function DataQualityList() {
}

return (
<Spinner fullHeight fullWidth>
<CountLabel />

<Spinner className="mb-16" fullHeight fullWidth>
<Virtuoso
data={items}
itemContent={(index, item) => {
Expand All @@ -51,17 +49,6 @@ function DataQualityList() {
);
}

function CountLabel() {
const items = useGetFilteredFeatures();
const label = items.length <= 1 ? 'Record' : 'Records';

return (
<label>
{`${label} ${items.length}`}
</label>
);
}

function NumericalFeature({ item }) {
const dataset = item?.histogram ?? [];

Expand Down
Loading

0 comments on commit c3a744c

Please sign in to comment.