Backporting environments helper
Allowing the EE to override a helper function to pass more data to vue
This commit is contained in:
parent
1a31933188
commit
3e60798e11
3 changed files with 14 additions and 8 deletions
|
@ -15,11 +15,11 @@ export default () =>
|
|||
const environmentsData = document.querySelector(this.$options.el).dataset;
|
||||
|
||||
return {
|
||||
endpoint: environmentsData.endpoint,
|
||||
folderName: environmentsData.folderName,
|
||||
endpoint: environmentsData.environmentsDataEndpoint,
|
||||
folderName: environmentsData.environmentsDataFolderName,
|
||||
cssContainerClass: environmentsData.cssClass,
|
||||
canCreateDeployment: parseBoolean(environmentsData.canCreateDeployment),
|
||||
canReadEnvironment: parseBoolean(environmentsData.canReadEnvironment),
|
||||
canCreateDeployment: parseBoolean(environmentsData.environmentsDataCanCreateDeployment),
|
||||
canReadEnvironment: parseBoolean(environmentsData.environmentsDataCanReadEnvironment),
|
||||
};
|
||||
},
|
||||
render(createElement) {
|
||||
|
|
|
@ -7,6 +7,15 @@ module EnvironmentsHelper
|
|||
}
|
||||
end
|
||||
|
||||
def environments_folder_list_view_data
|
||||
{
|
||||
"endpoint" => folder_project_environments_path(@project, @folder, format: :json),
|
||||
"folder-name" => @folder,
|
||||
"can-create-deployment" => can?(current_user, :create_deployment, @project).to_s,
|
||||
"can-read-environment" => can?(current_user, :read_environment, @project).to_s,
|
||||
}
|
||||
end
|
||||
|
||||
def metrics_data(project, environment)
|
||||
{
|
||||
"settings-path" => edit_project_service_path(project, 'prometheus'),
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
- @no_container = true
|
||||
- page_title _("Environments")
|
||||
|
||||
#environments-folder-list-view{ data: { endpoint: folder_project_environments_path(@project, @folder, format: :json),
|
||||
"folder-name" => @folder,
|
||||
"can-create-deployment" => can?(current_user, :create_deployment, @project).to_s,
|
||||
"can-read-environment" => can?(current_user, :read_environment, @project).to_s,
|
||||
#environments-folder-list-view{ data: { environments_data: environments_folder_list_view_data,
|
||||
"css-class" => container_class } }
|
||||
|
|
Loading…
Reference in a new issue