-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,36 @@ | ||
import ButtonSpinner from 'components/ButtonSpinner'; | ||
import React from 'react'; | ||
|
||
interface ProgressBarProps { | ||
percentFilled: number; | ||
interface LoadingBarProps { | ||
total?: number; | ||
success?: number; | ||
failure?: number; | ||
text?: string; | ||
} | ||
|
||
const ProgressBar: React.FC<ProgressBarProps> = function ({ | ||
const LoadingBar: React.FC<LoadingBarProps> = function ({ | ||
total = null, | ||
success = 0, | ||
failure = 0, | ||
text = 'Embedding' | ||
}) { | ||
const successPercentage = (total != null ? (success / total) * 100 : 0) || 0; | ||
const failurePercentage = (total != null ? (failure / total) * 100 : 0) || 0; | ||
return ( | ||
<div className='mb-6 h-6 max-w-[300px]'> | ||
<div className='max-w-[300px] relative top-[22px] -mt-6 text-center text-sm text-white px-2'> | ||
{text} ({successPercentage.toFixed(1)}%) | ||
<ButtonSpinner size={14} className='ms-2 -me-1' /> | ||
</div> | ||
<div className='flex flex-row overflow-hidden rounded-full bg-gray-400 dark:bg-neutral-600'> | ||
<span className={'h-6 bg-green-500'} style={{ width: `${successPercentage}%` }} /> | ||
<span | ||
className={'h-6 line bg-red-500'} | ||
style={{ left: `${failurePercentage}%`, width: `${failurePercentage}%` }} | ||
/> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
|
||
return ( | ||
<div className="my-2 mx-1 max-w-[300px]"> | ||
<div> | ||
|
||
</div> | ||
</div> | ||
) | ||
} | ||
export default LoadingBar; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,40 @@ | ||
import ButtonSpinner from 'components/ButtonSpinner'; | ||
import React from 'react'; | ||
|
||
interface LoadingBarProps { | ||
total?: number; | ||
success?: number; | ||
failure?: number; | ||
text?: string; | ||
interface ProgressBarProps { | ||
max: number; | ||
Check failure Code scanning / ESLint Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Error
Replace ···· with ↹
|
||
filled: number; | ||
Check failure Code scanning / ESLint Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Error
Replace ···· with ↹
|
||
text: string; | ||
Check failure Code scanning / ESLint Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Error
Replace ···· with ↹
|
||
numberText?: string; | ||
Check failure Code scanning / ESLint Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Error
Replace ···· with ↹
|
||
} | ||
|
||
const LoadingBar: React.FC<LoadingBarProps> = function ({ | ||
total = null, | ||
success = 0, | ||
failure = 0, | ||
text = 'Embedding' | ||
const ProgressBar: React.FC<ProgressBarProps> = function ({ | ||
max, | ||
Check failure Code scanning / ESLint Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Error
Replace ···· with ↹
|
||
filled, | ||
Check failure Code scanning / ESLint Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Error
Replace ···· with ↹
|
||
text, | ||
Check failure Code scanning / ESLint Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Error
Replace ···· with ↹
|
||
numberText = text | ||
Check failure Code scanning / ESLint Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Error
Replace ···· with ↹
|
||
}) { | ||
const successPercentage = (total != null ? (success / total) * 100 : 0) || 0; | ||
const failurePercentage = (total != null ? (failure / total) * 100 : 0) || 0; | ||
return ( | ||
<div className='mb-6 h-6 max-w-[300px]'> | ||
<div className='max-w-[300px] relative top-[22px] -mt-6 text-center text-sm text-white px-2'> | ||
{text} ({successPercentage.toFixed(1)}%) | ||
<ButtonSpinner size={14} className='ms-2 -me-1' /> | ||
</div> | ||
<div className='flex flex-row overflow-hidden rounded-full bg-gray-400 dark:bg-neutral-600'> | ||
<span className={'h-6 bg-green-500'} style={{ width: `${successPercentage}%` }} /> | ||
<span | ||
className={'h-6 line bg-red-500'} | ||
style={{ left: `${failurePercentage}%`, width: `${failurePercentage}%` }} | ||
/> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
const percentage = filled/max * 100 | ||
|
||
Check failure Code scanning / ESLint Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Error
Replace ····const·percentage·=·filled/max·\*·100⏎ with ↹const·percentage·=·(filled·/·max)·\*·100;
|
||
export default LoadingBar; | ||
|
||
return ( | ||
Check failure Code scanning / ESLint Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Error
Replace ···· with ↹
|
||
<div className='border-2 rounded-lg shadow-md'> | ||
Check failure Code scanning / ESLint Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Error
Replace ······ with ↹↹
|
||
<div className='mx-4 my-6'> | ||
Check failure Code scanning / ESLint Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Error
Replace ········ with ↹↹↹
|
||
<h4 className="sr-only">Status</h4> | ||
Check failure Code scanning / ESLint Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Error
Replace ··········<h4·className="sr-only" with ↹↹↹↹<h4·className='sr-only'
|
||
<p className="text-lg font-bold text-gray-900">{text}</p> | ||
Check failure Code scanning / ESLint Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Error
Replace ··········<p·className="text-lg·font-bold·text-gray-900" with ↹↹↹↹<p·className='text-lg·font-bold·text-gray-900'
|
||
<div aria-hidden="true" className="mt-6"> | ||
Check failure Code scanning / ESLint Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Error
Replace ··········<div·aria-hidden="true"·className="mt-6" with ↹↹↹↹<div·aria-hidden='true'·className='mt-6'
|
||
<div className="overflow-hidden rounded-full bg-gray-200"> | ||
Check failure Code scanning / ESLint Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Error
Replace ············<div·className="overflow-hidden·rounded-full·bg-gray-200" with ↹↹↹↹↹<div·className='overflow-hidden·rounded-full·bg-gray-200'
|
||
<div style={{ width: percentage.toString() + "%" }} className="h-2 rounded-full bg-indigo-600" /> | ||
Check failure Code scanning / ESLint Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Error
Replace ··············<div·style={{·width:·percentage.toString()·+·"%"·}}·className="h-2·rounded-full·bg-indigo-600"· with ↹↹↹↹↹↹<div⏎↹↹↹↹↹↹↹style={{·width:·percentage.toString()·+·'%'·}}⏎↹↹↹↹↹↹↹className='h-2·rounded-full·bg-indigo-600'⏎↹↹↹↹↹↹
|
||
</div> | ||
Check failure Code scanning / ESLint Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Error
Replace ············ with ↹↹↹↹↹
|
||
<div className="mt-6 hidden grid-cols-4 text-sm font-medium text-gray-600 sm:grid"> | ||
Check failure Code scanning / ESLint Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Error
Replace ············<div·className="mt-6·hidden·grid-cols-4·text-sm·font-medium·text-gray-600·sm:grid" with ↹↹↹↹↹<div·className='mt-6·hidden·grid-cols-4·text-sm·font-medium·text-gray-600·sm:grid'
|
||
<div className="text-indigo-600">{'Currently Used: ' + filled.toString() + " " + numberText}</div> | ||
Check failure Code scanning / ESLint Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Error
Replace ··············<div·className="text-indigo-600">{'Currently·Used:·'·+·filled.toString()·+·"·"·+·numberText} with ↹↹↹↹↹↹<div·className='text-indigo-600'>⏎↹↹↹↹↹↹↹{'Currently·Used:·'·+·filled.toString()·+·'·'·+·numberText}⏎↹↹↹↹↹↹
|
||
<div className="text-center text-indigo-600"></div> | ||
Check failure Code scanning / ESLint Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Error
Replace ··············<div·className="text-center·text-indigo-600" with ↹↹↹↹↹↹<div·className='text-center·text-indigo-600'
|
||
<div className="text-center"></div> | ||
Check failure Code scanning / ESLint Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Error
Replace ··············<div·className="text-center" with ↹↹↹↹↹↹<div·className='text-center'
|
||
<div className="text-right">{'Maximum Available: ' + max.toString() + " " + numberText}</div> | ||
Check failure Code scanning / ESLint Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Error
Replace ··············<div·className="text-right">{'Maximum·Available:·'·+·max.toString()·+·"·"·+·numberText} with ↹↹↹↹↹↹<div·className='text-right'>⏎↹↹↹↹↹↹↹{'Maximum·Available:·'·+·max.toString()·+·'·'·+·numberText}⏎↹↹↹↹↹↹
|
||
</div> | ||
Check failure Code scanning / ESLint Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Error
Replace ············ with ↹↹↹↹↹
|
||
</div> | ||
Check failure Code scanning / ESLint Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Error
Replace ·········· with ↹↹↹↹
|
||
</div> | ||
Check failure Code scanning / ESLint Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Error
Replace ········ with ↹↹↹
|
||
</div> | ||
Check failure Code scanning / ESLint Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Error
Replace ······ with ↹↹
|
||
) | ||
Check failure Code scanning / ESLint Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Error
Replace ····) with ↹);
|
||
} | ||
Check failure Code scanning / ESLint Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Error
Insert ;
|
||
|
||
export default ProgressBar; | ||
Check failure Code scanning / ESLint Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Error
Insert ⏎
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,6 @@ | |
"path": "." | ||
} | ||
], | ||
"settings": {} | ||
"settings": { | ||
} | ||
} |