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

feat(xo-web/home): set description on bulk snapshot #3933

Merged
merged 5 commits into from
Feb 6, 2019

Conversation

Rajaa-BARHTAOUI
Copy link
Contributor

@Rajaa-BARHTAOUI Rajaa-BARHTAOUI commented Feb 4, 2019

fixes #3925

Check list

Check items when done or if not relevant

  • PR reference the relevant issue (e.g. Fixes #007)
  • if UI changes, a screenshot has been added to the PR
  • CHANGELOG:
    • enhancement/bug fix entry added
    • list of packages to release updated (${name} v${new version})
  • documentation updated
  • I have tested added/updated features (and impacted code)

Process

  1. create a PR as soon as possible
  2. mark it as WiP: (Work in Progress) if not ready to be merged
  3. when you want a review, add a reviewer
  4. if necessary, update your PR, and re- add a reviewer

Screenshots

capture du 2019-02-04 11-07-57

packages/xo-web/src/common/xo/snapshot-vm-modal/index.js Outdated Show resolved Hide resolved
@@ -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 },
Copy link
Member

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>
Copy link
Member

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(vm, id) =>

@Rajaa-BARHTAOUI Rajaa-BARHTAOUI force-pushed the descption-bulk-snapshot branch 2 times, most recently from 418f5eb to 4dbfa46 Compare February 4, 2019 14:49
}

const generateName = buildTemplate(namePattern, {
const RULES = {
Copy link
Member

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 : {},
Copy link
Member

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?

Copy link
Contributor Author

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)
Copy link
Member

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.

@pdonias pdonias merged commit 4ab1de9 into vatesfr:master Feb 6, 2019
@pdonias pdonias mentioned this pull request Apr 9, 2019
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.

[Home] Set description on bulk snapshot
2 participants