Skip to content

Commit

Permalink
Merge branch 'master' into monitoring/multiple_alerts
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Jul 22, 2020
2 parents 309240f + 8b27b1e commit 2c9fc5d
Show file tree
Hide file tree
Showing 11 changed files with 109 additions and 99 deletions.
60 changes: 55 additions & 5 deletions test/functional/page_objects/login_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,76 @@
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { delay } from 'bluebird';
import { FtrProviderContext } from '../ftr_provider_context';

export function LoginPageProvider({ getService }: FtrProviderContext) {
const testSubjects = getService('testSubjects');
const log = getService('log');
const find = getService('find');

const regularLogin = async (user: string, pwd: string) => {
await testSubjects.setValue('loginUsername', user);
await testSubjects.setValue('loginPassword', pwd);
await testSubjects.click('loginSubmit');
await find.waitForDeletedByCssSelector('.kibanaWelcomeLogo');
await find.byCssSelector('[data-test-subj="kibanaChrome"]', 60000); // 60 sec waiting
};

const samlLogin = async (user: string, pwd: string) => {
try {
await find.clickByButtonText('Login using SAML');
await find.setValue('input[name="email"]', user);
await find.setValue('input[type="password"]', pwd);
await find.clickByCssSelector('.auth0-label-submit');
await find.byCssSelector('[data-test-subj="kibanaChrome"]', 60000); // 60 sec waiting
} catch (err) {
log.debug(`${err} \nFailed to find Auth0 login page, trying the Auth0 last login page`);
await find.clickByCssSelector('.auth0-lock-social-button');
}
};

class LoginPage {
async login(user: string, pwd: string) {
await testSubjects.setValue('loginUsername', user);
await testSubjects.setValue('loginPassword', pwd);
await testSubjects.click('loginSubmit');
if (
process.env.VM === 'ubuntu18_deb_oidc' ||
process.env.VM === 'ubuntu16_deb_desktop_saml'
) {
await samlLogin(user, pwd);
return;
}

await regularLogin(user, pwd);
}

async logoutLogin(user: string, pwd: string) {
await this.logout();
await this.sleep(3002);
await this.login(user, pwd);
}

async logout() {
await testSubjects.click('userMenuButton');
await this.sleep(500);
await testSubjects.click('logoutLink');
log.debug('### found and clicked log out--------------------------');
await this.sleep(8002);
}

async sleep(sleepMilliseconds: number) {
log.debug(`... sleep(${sleepMilliseconds}) start`);
await delay(sleepMilliseconds);
log.debug(`... sleep(${sleepMilliseconds}) end`);
}
}

Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/lists/common/constants.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const OPERATOR = 'included';
export const ENTRY_VALUE = 'some host name';
export const MATCH = 'match';
export const MATCH_ANY = 'match_any';
export const MAX_IMPORT_PAYLOAD_BYTES = 40000000;
export const MAX_IMPORT_PAYLOAD_BYTES = 9000000;
export const IMPORT_BUFFER_SIZE = 1000;
export const LIST = 'list';
export const EXISTS = 'exists';
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/lists/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const ConfigSchema = schema.object({
importBufferSize: schema.number({ defaultValue: 1000, min: 1 }),
listIndex: schema.string({ defaultValue: '.lists' }),
listItemIndex: schema.string({ defaultValue: '.items' }),
maxImportPayloadBytes: schema.number({ defaultValue: 40000000, min: 1 }),
maxImportPayloadBytes: schema.number({ defaultValue: 9000000, min: 1 }),
});

export type ConfigType = TypeOf<typeof ConfigSchema>;
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ function getClusterSource(documentSource: IESSource, documentStyle: IVectorStyle
geoField: documentSource.getGeoFieldName(),
requestType: RENDER_AS.POINT,
});
clusterSourceDescriptor.applyGlobalQuery = documentSource.getApplyGlobalQuery();
clusterSourceDescriptor.metrics = [
{
type: AGG_TYPE.COUNT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ export class ESGeoGridSource extends AbstractESAggSource {
bounds: makeESBbox(bufferedExtent),
field: this._descriptor.geoField,
precision,
size: DEFAULT_MAX_BUCKETS_LIMIT,
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ export const useDeleteAction = () => {
);
if (ip !== undefined) {
setIndexPatternExists(true);
} else {
setIndexPatternExists(false);
}
} catch (e) {
const { toasts } = notifications;
Expand Down Expand Up @@ -101,7 +103,7 @@ export const useDeleteAction = () => {

// Check if an user has permission to delete the index & index pattern
checkUserIndexPermission();
}, []);
}, [isModalVisible]);

const closeModal = () => setModalVisible(false);
const deleteAndCloseModal = () => {
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/security_solution/cypress/tasks/es_archiver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

export const esArchiverLoadEmptyKibana = () => {
cy.exec(
`node ../../../scripts/es_archiver empty_kibana load empty--dir ../../test/security_solution_cypress/es_archives --config ../../../test/functional/config.js --es-url ${Cypress.env(
`node ../../../scripts/es_archiver load empty_kibana --dir ../../test/security_solution_cypress/es_archives --config ../../../test/functional/config.js --es-url ${Cypress.env(
'ELASTICSEARCH_URL'
)} --kibana-url ${Cypress.config().baseUrl}`
);
Expand All @@ -30,7 +30,7 @@ export const esArchiverUnload = (folder: string) => {

export const esArchiverUnloadEmptyKibana = () => {
cy.exec(
`node ../../../scripts/es_archiver unload empty_kibana empty--dir ../../test/security_solution_cypress/es_archives --config ../../../test/functional/config.js --es-url ${Cypress.env(
`node ../../../scripts/es_archiver unload empty_kibana --dir ../../test/security_solution_cypress/es_archives --config ../../../test/functional/config.js --es-url ${Cypress.env(
'ELASTICSEARCH_URL'
)} --kibana-url ${Cypress.config().baseUrl}`
);
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 10 additions & 50 deletions x-pack/plugins/uptime/public/state/actions/overview_filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { createAction } from 'redux-actions';
import { OverviewFilters } from '../../../common/runtime_types';

export const FETCH_OVERVIEW_FILTERS = 'FETCH_OVERVIEW_FILTERS';
export const FETCH_OVERVIEW_FILTERS_FAIL = 'FETCH_OVERVIEW_FILTERS_FAIL';
export const FETCH_OVERVIEW_FILTERS_SUCCESS = 'FETCH_OVERVIEW_FILTERS_SUCCESS';
export const SET_OVERVIEW_FILTERS = 'SET_OVERVIEW_FILTERS';

export interface GetOverviewFiltersPayload {
dateRangeStart: string;
dateRangeEnd: string;
Expand All @@ -22,52 +18,16 @@ export interface GetOverviewFiltersPayload {
tags: string[];
}

interface GetOverviewFiltersFetchAction {
type: typeof FETCH_OVERVIEW_FILTERS;
payload: GetOverviewFiltersPayload;
}

interface GetOverviewFiltersSuccessAction {
type: typeof FETCH_OVERVIEW_FILTERS_SUCCESS;
payload: OverviewFilters;
}

interface GetOverviewFiltersFailAction {
type: typeof FETCH_OVERVIEW_FILTERS_FAIL;
payload: Error;
}

interface SetOverviewFiltersAction {
type: typeof SET_OVERVIEW_FILTERS;
payload: OverviewFilters;
}

export type OverviewFiltersAction =
| GetOverviewFiltersFetchAction
| GetOverviewFiltersSuccessAction
| GetOverviewFiltersFailAction
| SetOverviewFiltersAction;
export type OverviewFiltersPayload = GetOverviewFiltersPayload & Error & OverviewFilters;

export const fetchOverviewFilters = (
payload: GetOverviewFiltersPayload
): GetOverviewFiltersFetchAction => ({
type: FETCH_OVERVIEW_FILTERS,
payload,
});
export const fetchOverviewFilters = createAction<GetOverviewFiltersPayload>(
'FETCH_OVERVIEW_FILTERS'
);

export const fetchOverviewFiltersFail = (error: Error): GetOverviewFiltersFailAction => ({
type: FETCH_OVERVIEW_FILTERS_FAIL,
payload: error,
});
export const fetchOverviewFiltersFail = createAction<Error>('FETCH_OVERVIEW_FILTERS_FAIL');

export const fetchOverviewFiltersSuccess = (
filters: OverviewFilters
): GetOverviewFiltersSuccessAction => ({
type: FETCH_OVERVIEW_FILTERS_SUCCESS,
payload: filters,
});
export const fetchOverviewFiltersSuccess = createAction<OverviewFilters>(
'FETCH_OVERVIEW_FILTERS_SUCCESS'
);

export const setOverviewFilters = (filters: OverviewFilters): SetOverviewFiltersAction => ({
type: SET_OVERVIEW_FILTERS,
payload: filters,
});
export const setOverviewFilters = createAction<OverviewFilters>('SET_OVERVIEW_FILTERS');
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import { takeLatest } from 'redux-saga/effects';
import {
FETCH_OVERVIEW_FILTERS,
fetchOverviewFilters as fetchAction,
fetchOverviewFiltersFail,
fetchOverviewFiltersSuccess,
} from '../actions';
Expand All @@ -15,7 +15,7 @@ import { fetchEffectFactory } from './fetch_effect';

export function* fetchOverviewFiltersEffect() {
yield takeLatest(
FETCH_OVERVIEW_FILTERS,
String(fetchAction),
fetchEffectFactory(fetchOverviewFilters, fetchOverviewFiltersSuccess, fetchOverviewFiltersFail)
);
}
69 changes: 33 additions & 36 deletions x-pack/plugins/uptime/public/state/reducers/overview_filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { handleActions, Action } from 'redux-actions';
import { OverviewFilters } from '../../../common/runtime_types';
import {
FETCH_OVERVIEW_FILTERS,
FETCH_OVERVIEW_FILTERS_FAIL,
FETCH_OVERVIEW_FILTERS_SUCCESS,
OverviewFiltersAction,
SET_OVERVIEW_FILTERS,
fetchOverviewFilters,
fetchOverviewFiltersFail,
fetchOverviewFiltersSuccess,
setOverviewFilters,
GetOverviewFiltersPayload,
OverviewFiltersPayload,
} from '../actions';

export interface OverviewFiltersState {
Expand All @@ -30,34 +32,29 @@ const initialState: OverviewFiltersState = {
loading: false,
};

export function overviewFiltersReducer(
state = initialState,
action: OverviewFiltersAction
): OverviewFiltersState {
switch (action.type) {
case FETCH_OVERVIEW_FILTERS:
return {
...state,
loading: true,
};
case FETCH_OVERVIEW_FILTERS_SUCCESS:
return {
...state,
filters: action.payload,
loading: false,
};
case FETCH_OVERVIEW_FILTERS_FAIL:
return {
...state,
errors: [...state.errors, action.payload],
loading: false,
};
case SET_OVERVIEW_FILTERS:
return {
...state,
filters: action.payload,
};
default:
return state;
}
}
export const overviewFiltersReducer = handleActions<OverviewFiltersState, OverviewFiltersPayload>(
{
[String(fetchOverviewFilters)]: (state, _action: Action<GetOverviewFiltersPayload>) => ({
...state,
loading: true,
}),

[String(fetchOverviewFiltersSuccess)]: (state, action: Action<OverviewFilters>) => ({
...state,
filters: action.payload,
loading: false,
}),

[String(fetchOverviewFiltersFail)]: (state, action: Action<Error>) => ({
...state,
errors: [...state.errors, action.payload],
loading: false,
}),

[String(setOverviewFilters)]: (state, action: Action<OverviewFilters>) => ({
...state,
filters: action.payload,
}),
},
initialState
);

0 comments on commit 2c9fc5d

Please sign in to comment.