-
Notifications
You must be signed in to change notification settings - Fork 262
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
feat(xo-web/home): set description on bulk snapshot #3933
feat(xo-web/home): set description on bulk snapshot #3933
Conversation
packages/xo-server/src/api/vm.js
Outdated
@@ -773,6 +778,7 @@ export const snapshot = defer(async function( | |||
snapshot.params = { | |||
id: { type: 'string' }, | |||
name: { type: 'string', optional: true }, | |||
description: { type: 'string', optional: true }, |
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.
Sort.
return { | ||
names: mapValues(this.props.vms, generateName), | ||
names, | ||
descriptions, | ||
saveMemory, | ||
} | ||
} | ||
|
||
render() { | ||
return ( | ||
<div> |
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.
Container
|
||
const names = [] | ||
const descriptions = [] | ||
forEach(this.props.vms, ({ id, ...vm }) => { |
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.
(vm, id) =>
418f5eb
to
4dbfa46
Compare
} | ||
|
||
const generateName = buildTemplate(namePattern, { | ||
const RULES = { |
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.
Put it outside the class.
}) | ||
|
||
return { | ||
names: mapValues(this.props.vms, generateName), | ||
names: namePattern !== '' ? names : {}, | ||
descriptions: descriptionPattern !== '' ? descriptions : {}, |
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.
Is this the behaviour we want? If the user explicitly removes the default text from the input and leaves it empty, doesn't it mean that he wants the snapshots' descriptions to be empty?
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.
The description will be the description of the VM, if the user removes the default text.
const descriptions = [] | ||
forEach(this.props.vms, (vm, id) => { | ||
names[id] = generateName(vm) | ||
descriptions[id] = generateDescription(vm) |
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.
It would be nice to not run this when we'll eventually return {}
anyway.
bd3da7f
to
d6edd5e
Compare
fixes #3925
Check list
Fixes #007
)${name} v${new version}
)Process
WiP:
(Work in Progress) if not ready to be mergedScreenshots