-
Notifications
You must be signed in to change notification settings - Fork 7
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
Query for validator image tags #238
Conversation
32e2933
to
6462f67
Compare
Signed-off-by: Sven Dowideit <[email protected]>
6462f67
to
29b0899
Compare
cool!! looking over |
async function getImageTags(imageName: string): Promise<string[]> { | ||
const url = `https://hub.docker.com/v2/repositories/${imageName}/tags/`; | ||
|
||
const promise = new Promise<string>((resolve, reject) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is OK for now, I think if we do more we should maybe look at axios for a promise based wrapper. I think that's what the cool kids are doing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yea also, a good thing to know about, is Node's util.promisify. Won't work for https.get
, but for other items like the Node exec library, you can wrap those with a promise using that helper.
@@ -37,7 +37,7 @@ ipcMain.on( | |||
'main', | |||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | |||
async (event: Electron.IpcMainEvent, method: string, msg: any) => { | |||
logger.info('IPC event', { method, ...msg }); | |||
// logger.info('IPC event', { method, ...msg }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FINGER WAG!
@@ -60,7 +60,7 @@ ipcMain.on( | |||
if (typeof loggedRes === 'string') { | |||
loggedRes = { res: `${loggedRes.slice(0, MAX_STRING_LOG_LENGTH)}...` }; | |||
} | |||
logger.info('OK', { method, ...loggedRes }); | |||
// logger.info('OK', { method, ...loggedRes }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why take these out? Too chatty?
@@ -37,9 +39,25 @@ const Validator = () => { | |||
const validator = useAppSelector(selectValidatorNetworkState); | |||
const validatorImageName = 'cryptoworkbench/solana-amman'; | |||
const [validatorImageTag, setValidatorImageTag] = useState<string>(''); | |||
const [validatorImageTags, setValidatorImageTags] = useState<string[]>([]); | |||
// const [validatorImageTags, setValidatorImageTags] = useState<string[]>([]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rm
); | ||
|
||
const validatorImageTags = validatorImageTagsData || [ | ||
'Image list loading....', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could maybe throw a spinner in here
'Image list loading....', | ||
]; | ||
|
||
// TODO: not sure how to tell the user if we fail to get the list of image tags... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you could make the embedded bit JSX instead of a string and use error text? FWIW, you can do stuff like:
const tagDropdownDisplay = (
<div className="text-red-500">
An error occurred getting image tags.
</div>
);
return (
<div>{tagDropdownDisplay}</div>
);
Too cool!! Left a couple comments / info items, will leave it to you to give it a final trim and merge |
filed #242 for a follow up |
I want to keep using |
closes #166