Commit 0c9684aa authored by Miguel Rincon's avatar Miguel Rincon

Add a new feature flag to switch environment logs page to vue

- Add switching to haml
- Add switch to gon.features in browser
- Add feature flag to feature/spec
parent 9d866455
import logsBundle from 'ee/logs/logs_bundle';
import KubernetesLogs from '../../../../kubernetes_logs'; import KubernetesLogs from '../../../../kubernetes_logs';
document.addEventListener('DOMContentLoaded', () => { if (gon.features.environmentLogsUseVueUi) {
const kubernetesLogContainer = document.querySelector('.js-kubernetes-logs'); document.addEventListener('DOMContentLoaded', logsBundle);
const kubernetesLog = new KubernetesLogs(kubernetesLogContainer); } else {
document.addEventListener('DOMContentLoaded', () => {
kubernetesLog.getData(); const kubernetesLogContainer = document.querySelector('.js-kubernetes-logs');
}); const kubernetesLog = new KubernetesLogs(kubernetesLogContainer);
kubernetesLog.getData();
});
}
...@@ -9,6 +9,9 @@ module EE ...@@ -9,6 +9,9 @@ module EE
before_action :authorize_read_pod_logs!, only: [:logs] before_action :authorize_read_pod_logs!, only: [:logs]
before_action :environment_ee, only: [:logs] before_action :environment_ee, only: [:logs]
before_action :authorize_create_environment_terminal!, only: [:terminal] before_action :authorize_create_environment_terminal!, only: [:terminal]
before_action do
push_frontend_feature_flag(:environment_logs_use_vue_ui)
end
end end
def logs def logs
......
.js-kubernetes-logs{ data: environment_logs_data(@project, @environment) } - if Feature.enabled?('environment_logs_use_vue_ui')
.build-page-pod-logs #environment-logs{ data: environment_logs_data(@project, @environment) }
.build-trace-container.prepend-top-default - else
.top-bar.js-top-bar.d-flex .js-kubernetes-logs{ data: environment_logs_data(@project, @environment) }
.row .build-page-pod-logs
.form-group.col-6{ role: 'group' } .build-trace-container.prepend-top-default
%label.d-block.pt-0.col-form-label-sm.col-form-label .top-bar.js-top-bar.d-flex
= s_('Environments|Environment') .row
.dropdown.js-environment-dropdown.d-flex .form-group.col-6{ role: 'group' }
%button.dropdown-menu-toggle.d-flex.align-content-center.align-self-center{ type: 'button', data: { toggle: 'dropdown' }, 'aria-expanded': false } %label.d-block.pt-0.col-form-label-sm.col-form-label
= icon('chevron-down') = s_('Environments|Environment')
.dropdown-toggle-text .dropdown.js-environment-dropdown.d-flex
= " ".html_safe %button.dropdown-menu-toggle.d-flex.align-content-center.align-self-center{ type: 'button', data: { toggle: 'dropdown' }, 'aria-expanded': false }
.dropdown-menu.dropdown-menu-selectable.dropdown-menu-drop-up = icon('chevron-down')
.form-group.col-6{ role: 'group' } .dropdown-toggle-text
%label.d-block.pt-0.col-form-label-sm.col-form-label = " ".html_safe
= s_('Environments|Pod logs from') .dropdown-menu.dropdown-menu-selectable.dropdown-menu-drop-up
.dropdown.js-pod-dropdown.d-flex .form-group.col-6{ role: 'group' }
%button.dropdown-menu-toggle.d-flex.align-content-center.align-self-center{ type: 'button', data: { toggle: 'dropdown' }, 'aria-expanded': false } %label.d-block.pt-0.col-form-label-sm.col-form-label
= icon('chevron-down') = s_('Environments|Pod logs from')
.dropdown-toggle-text .dropdown.js-pod-dropdown.d-flex
= " ".html_safe %button.dropdown-menu-toggle.d-flex.align-content-center.align-self-center{ type: 'button', data: { toggle: 'dropdown' }, 'aria-expanded': false }
.dropdown-menu.dropdown-menu-selectable.dropdown-menu-drop-up = icon('chevron-down')
.controllers.align-self-end .dropdown-toggle-text
.has-tooltip.controllers-buttons{ title: _('Scroll to top'), data: { placement: 'top', container: 'body'} } = " ".html_safe
%button.js-scroll-up.btn-scroll.btn-transparent.btn-blank{ type: 'button', disabled: true } .dropdown-menu.dropdown-menu-selectable.dropdown-menu-drop-up
= custom_icon('scroll_up') .controllers.align-self-end
.has-tooltip.controllers-buttons{ title: _('Scroll to bottom'), data: { placement: 'top', container: 'body'} } .has-tooltip.controllers-buttons{ title: _('Scroll to top'), data: { placement: 'top', container: 'body'} }
%button.js-scroll-down.btn-scroll.btn-transparent.btn-blank{ type: 'button', disabled: true } %button.js-scroll-up.btn-scroll.btn-transparent.btn-blank{ type: 'button', disabled: true }
= custom_icon('scroll_down') = custom_icon('scroll_up')
.refresh-control .has-tooltip.controllers-buttons{ title: _('Scroll to bottom'), data: { placement: 'top', container: 'body'} }
.has-tooltip.controllers-buttons{ title: _('Refresh'), data: { placement: 'top', container: 'body'} } %button.js-scroll-down.btn-scroll.btn-transparent.btn-blank{ type: 'button', disabled: true }
%button.js-refresh-log.btn.btn-default.btn-refresh.h-32-px{ type: 'button', disabled: true } = custom_icon('scroll_down')
= sprite_icon('retry') .refresh-control
.has-tooltip.controllers-buttons{ title: _('Refresh'), data: { placement: 'top', container: 'body'} }
%button.js-refresh-log.btn.btn-default.btn-refresh.h-32-px{ type: 'button', disabled: true }
= sprite_icon('retry')
= render 'shared/builds/build_output' = render 'shared/builds/build_output'
...@@ -15,6 +15,7 @@ describe 'Environment > Pod Logs', :js do ...@@ -15,6 +15,7 @@ describe 'Environment > Pod Logs', :js do
before do before do
stub_licensed_features(pod_logs: true) stub_licensed_features(pod_logs: true)
stub_feature_flags(environment_logs_use_vue_ui: false)
create(:cluster, :provided_by_gcp, environment_scope: '*', projects: [project]) create(:cluster, :provided_by_gcp, environment_scope: '*', projects: [project])
create(:deployment, :success, environment: environment) create(:deployment, :success, environment: environment)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment