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

Query for validator image tags #238

Merged
merged 1 commit into from
Jul 15, 2022

Conversation

SvenDowideit
Copy link
Member

@SvenDowideit SvenDowideit commented Jul 15, 2022

closes #166

@SvenDowideit SvenDowideit added this to the 0.4.0 milestone Jul 15, 2022
@SvenDowideit SvenDowideit force-pushed the use-query-for-validator-image-tags branch from 32e2933 to 6462f67 Compare July 15, 2022 02:26
@SvenDowideit SvenDowideit force-pushed the use-query-for-validator-image-tags branch from 6462f67 to 29b0899 Compare July 15, 2022 02:31
@nathanleclaire
Copy link
Contributor

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) => {
Copy link
Contributor

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

Copy link
Contributor

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 });
Copy link
Contributor

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 });
Copy link
Contributor

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[]>([]);
Copy link
Contributor

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....',
Copy link
Contributor

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...
Copy link
Contributor

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>
);

@nathanleclaire
Copy link
Contributor

Too cool!! Left a couple comments / info items, will leave it to you to give it a final trim and merge

@nathanleclaire
Copy link
Contributor

filed #242 for a follow up

@nathanleclaire
Copy link
Contributor

I want to keep using v1.10.27 on airplane wifi so i'm gonna merge this and follow up can happen in more PRs 😅

@nathanleclaire nathanleclaire merged commit e5be196 into main Jul 15, 2022
@nathanleclaire nathanleclaire deleted the use-query-for-validator-image-tags branch July 15, 2022 16:52
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.

[validator] get a list of validator image tags to allow the user to pick from
2 participants