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

UI for server group deployments #23

Merged
merged 6 commits into from
Feb 2, 2017

Conversation

jkremser
Copy link
Member

@jkremser jkremser commented Dec 23, 2016

This PR adds the ability to deploy a war file into whole server group and also prepares the ground for the following operations on the server group like starting, stopping, etc.

A lot of the functionality was common with deploying into servers. Therefore the (angular) js controllers are now used in both contexts. Also the MiddlewareDeploymentsMixin was introduced so that MiddlewareServerGroupController and MiddlewareServerController don't have to repeat the code.

This shouldn't be merged (or released) sooner than this PR lands into manageiq repo.

todo:

  • reuse the existing haml file for deploying into servers

@miq-bot add_labels providers/hawkular, enhancement, euwe/no

@miq-bot
Copy link
Member

miq-bot commented Dec 23, 2016

@Jiri-Kremser Cannot apply the following label because they are not recognized: providers/hawkular

@jkremser
Copy link
Member Author

10 files checked, 72 offenses detected
ho ho ho 🎅

@jkremser
Copy link
Member Author

@miq-bot add_labels wip

@miq-bot miq-bot added the wip label Dec 23, 2016
@jkremser jkremser changed the title [WIP] UI for server group deployments UI for server group deployments Jan 4, 2017
@jkremser
Copy link
Member Author

jkremser commented Jan 4, 2017

@miq-bot remove_labels wip

@jkremser jkremser force-pushed the server-group-deployments branch from df5f0aa to 2e41b79 Compare January 4, 2017 16:22
@miq-bot miq-bot removed the wip label Jan 5, 2017
@jkremser
Copy link
Member Author

jkremser commented Jan 5, 2017

@miq-bot add_labels pending_backend

@jkremser
Copy link
Member Author

@miq-bot remove_labels pending_backend

@jkremser
Copy link
Member Author

The backend part has been merged.

note: this was check that it works ManageIQ/manageiq#13173 (comment)

@@ -21,7 +23,8 @@ function MwAddDeploymentController($scope, $http, miqService) {
miqService.miqFlash(result.data.status, result.data.msg);
},
function() { // error
miqService.miqFlash('error', 'Unable to deploy "' + data.runtimeName + '" on this server.');
miqService.miqFlash('error', 'Unable to deploy "' + data.runtimeName + '" on this server' +
(isGroupDeployment ? ' group' : '') +'.');
Copy link
Contributor

Choose a reason for hiding this comment

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

The content of the miqFlash() here needs to be inside a __() so that it's correctly translated. Since this
is a dynamic string, you also need to use sprintf(_("Whatever %s %s"), data..., data...)

if params['forceDeploy'] == 'false'
existing_deployment = find_existing_deployment
unless existing_deployment.nil?
msg = 'Deployment "%s" already exists on this ' + parent_entity_name
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't going to work with gettext. You need to use

msg = _("Deployment \"%{deployment_name}\" already exists on this %{parent}") % {:deployment_name => ..., :parent => ...}

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, in general, it is a bad practice to put two english strings together and expect it to work in other locales.
In the end, the two translated strings put together will just look odd. In this case, I suggest we have:

msg = if @is_server
        _("Full string %{some_placeholder} end of the string.")
      else
        _("The other variant %{some_placeholder} the other end of the string.")
      end

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, makes sense from the linguistic POV. But isn't it too strict? With this reasoning, we should get rid of all those strings that have more than one variable in it (other than name or id).

I did the change as you proposed, but it looks odd in the code.


def run_it(operation)
run_specific_operation(@klass.operations.fetch(operation), @entity_id)
msg = 'Deployment "%s" has been initiated on this ' + parent_entity_name
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above.


before_action :check_privileges
before_action :get_session_data
after_action :cleanup_action
after_action :set_session_data

OPERATIONS = {
:middleware_server_group_reload => {:op => :reload_middleware_server_group,
:msg => N_('Reload')
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm getting a bit lost (not saying the code above is incorrect). Where is _() being applied to the :msg strings here?

Copy link
Member Author

@jkremser jkremser Jan 24, 2017

Choose a reason for hiding this comment

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

I am not the author of the concept, but afaik these are actually the strings that get plugged into sentences. Here is an example where it's being used https://git.io/vMbLs

Copy link
Contributor

Choose a reason for hiding this comment

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

One more thing -- if that's what it is, then in

add_flash(_("%{operation} initiated for selected server(s)") % {:operation => operation_info.fetch(:msg)})

you need to apply _() on operation_info.fetch(:msg) otherwise the operation string
won't be translated.

@mzazrivec mzazrivec self-assigned this Jan 23, 2017
@jkremser jkremser force-pushed the server-group-deployments branch from 2e41b79 to f171b21 Compare January 24, 2017 11:04
@jkremser jkremser force-pushed the server-group-deployments branch from f171b21 to dc1528b Compare February 1, 2017 15:29
@jkremser jkremser force-pushed the server-group-deployments branch from dc1528b to 2358fbc Compare February 1, 2017 15:37
@miq-bot
Copy link
Member

miq-bot commented Feb 1, 2017

Checked commits jkremser/manageiq-ui-classic@f9cbd64~...2358fbc with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
8 files checked, 0 offenses detected
Everything looks good. 🍪

@mzazrivec mzazrivec added this to the Sprint 54 Ending Feb 13, 2017 milestone Feb 2, 2017
@mzazrivec mzazrivec merged commit 276f397 into ManageIQ:master Feb 2, 2017
@jkremser jkremser deleted the server-group-deployments branch February 2, 2017 12:54
israel-hdez added a commit to israel-hdez/manageiq-ui-classic that referenced this pull request Jan 5, 2018
…-deployments"

This reverts commit 276f397, reversing
changes made to d92ebc3.
israel-hdez added a commit to israel-hdez/manageiq-ui-classic that referenced this pull request Jan 11, 2018
…-deployments"

This reverts commit 276f397, reversing
changes made to d92ebc3.
israel-hdez added a commit to israel-hdez/manageiq-ui-classic that referenced this pull request Jan 15, 2018
…-deployments"

This reverts commit 276f397, reversing
changes made to d92ebc3.
israel-hdez added a commit to israel-hdez/manageiq-ui-classic that referenced this pull request Jan 17, 2018
…-deployments"

This reverts commit 276f397, reversing
changes made to d92ebc3.
israel-hdez added a commit to israel-hdez/manageiq-ui-classic that referenced this pull request Jan 19, 2018
…-deployments"

This reverts commit 276f397, reversing
changes made to d92ebc3.
israel-hdez added a commit to israel-hdez/manageiq-ui-classic that referenced this pull request Jan 22, 2018
…-deployments"

This reverts commit 276f397, reversing
changes made to d92ebc3.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants