Commit 68fe7aa6 authored by Miguel Rincon's avatar Miguel Rincon

Disable time window while envs load

parent f0b119c0
...@@ -195,6 +195,8 @@ export default { ...@@ -195,6 +195,8 @@ export default {
> >
<gl-dropdown <gl-dropdown
id="time-window-dropdown" id="time-window-dropdown"
ref="time-window-dropdown"
:disabled="environments.isLoading"
:text="timeWindow.options[timeWindow.current].label" :text="timeWindow.options[timeWindow.current].label"
class="d-flex" class="d-flex"
toggle-class="dropdown-menu-toggle" toggle-class="dropdown-menu-toggle"
......
...@@ -44,6 +44,8 @@ describe('EnvironmentLogs', () => { ...@@ -44,6 +44,8 @@ describe('EnvironmentLogs', () => {
const findEnvironmentsDropdown = () => wrapper.find('.js-environments-dropdown'); const findEnvironmentsDropdown = () => wrapper.find('.js-environments-dropdown');
const findPodsDropdown = () => wrapper.find('.js-pods-dropdown'); const findPodsDropdown = () => wrapper.find('.js-pods-dropdown');
const findSearchBar = () => wrapper.find('.js-logs-search'); const findSearchBar = () => wrapper.find('.js-logs-search');
const findTimeWindowDropdown = () => wrapper.find({ ref: 'time-window-dropdown' });
const findLogControlButtons = () => wrapper.find({ name: 'log-control-buttons-stub' }); const findLogControlButtons = () => wrapper.find({ name: 'log-control-buttons-stub' });
const findLogTrace = () => wrapper.find('.js-log-trace'); const findLogTrace = () => wrapper.find('.js-log-trace');
...@@ -140,6 +142,10 @@ describe('EnvironmentLogs', () => { ...@@ -140,6 +142,10 @@ describe('EnvironmentLogs', () => {
expect(findSearchBar().attributes('disabled')).toEqual('true'); expect(findSearchBar().attributes('disabled')).toEqual('true');
}); });
it('displays a disabled time window dropdown', () => {
expect(findTimeWindowDropdown().attributes('disabled')).toEqual('true');
});
it('does not update buttons state', () => { it('does not update buttons state', () => {
expect(updateControlBtnsMock).not.toHaveBeenCalled(); expect(updateControlBtnsMock).not.toHaveBeenCalled();
}); });
...@@ -162,8 +168,10 @@ describe('EnvironmentLogs', () => { ...@@ -162,8 +168,10 @@ describe('EnvironmentLogs', () => {
initWrapper(); initWrapper();
}); });
it("doesn't display the search bar", () => { it("doesn't display the search bar or time windows dropdown", () => {
expect(findSearchBar().exists()).toEqual(false); expect(findSearchBar().exists()).toEqual(false);
expect(findTimeWindowDropdown().exists()).toEqual(false);
expect(wrapper.find('#environments-dropdown-fg').attributes('class')).toEqual('col-6'); expect(wrapper.find('#environments-dropdown-fg').attributes('class')).toEqual('col-6');
expect(wrapper.find('#pods-dropdown-fg').attributes('class')).toEqual('col-6'); expect(wrapper.find('#pods-dropdown-fg').attributes('class')).toEqual('col-6');
}); });
...@@ -265,6 +273,11 @@ describe('EnvironmentLogs', () => { ...@@ -265,6 +273,11 @@ describe('EnvironmentLogs', () => {
expect(wrapper.find('#search-fg').attributes('class')).toEqual('col-3'); expect(wrapper.find('#search-fg').attributes('class')).toEqual('col-3');
}); });
it('displays and enables the time window dropdown', () => {
expect(findTimeWindowDropdown().exists()).toEqual(true);
expect(findTimeWindowDropdown().attributes('disabled')).toEqual(undefined);
});
it('update control buttons state', () => { it('update control buttons state', () => {
expect(updateControlBtnsMock).toHaveBeenCalledTimes(1); expect(updateControlBtnsMock).toHaveBeenCalledTimes(1);
}); });
......
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