-
Notifications
You must be signed in to change notification settings - Fork 356
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
Conversation
@Jiri-Kremser Cannot apply the following label because they are not recognized: providers/hawkular |
|
@miq-bot add_labels wip |
@miq-bot remove_labels wip |
df5f0aa
to
2e41b79
Compare
@miq-bot add_labels pending_backend |
@miq-bot remove_labels pending_backend |
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' : '') +'.'); |
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 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 |
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 isn't going to work with gettext. You need to use
msg = _("Deployment \"%{deployment_name}\" already exists on this %{parent}") % {:deployment_name => ..., :parent => ...}
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.
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
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.
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 |
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.
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') |
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.
I'm getting a bit lost (not saying the code above is incorrect). Where is _()
being applied to the :msg
strings here?
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.
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
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.
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.
2e41b79
to
f171b21
Compare
f171b21
to
dc1528b
Compare
dc1528b
to
2358fbc
Compare
Checked commits jkremser/manageiq-ui-classic@f9cbd64~...2358fbc with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
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 thatMiddlewareServerGroupController
andMiddlewareServerController
don't have to repeat the code.This shouldn't be merged (or released) sooner than this PR lands into manageiq repo.
todo:
@miq-bot add_labels providers/hawkular, enhancement, euwe/no