Skip to content

Commit

Permalink
[SR] SLM create and edit policies (#43390) (#44172)
Browse files Browse the repository at this point in the history
* add buttons and links to create/edit policy

* set up add policy form

* start create policy form, including loading/error states and redirect for repository select field. add inline option to SectionLoading. add actions prop to SectionError

* add snapshot name field

* Change page title upon app navigation, improve breadcrumbs

* Add on cancel to policy form, reorder fields

* Add simple cron field

* First pass at create/edit policy functionality

* Adjust permissions for SLM tab

* Adjust no snapshots prompt based on if policies exist or not

* Add selectable indices to policy form

* Move cron editor from rollup jobs to ES UI shared folder

* Used shared cron editor for slm policy create/edit

* Adjust copies; add duplicate schedule warning callout

* Surface in progress information

* Fix doc link for 7.x

* Fix rollup tests

* Copy edits from review

* Add ES endpoint to request review

* Remove unused imports

* Fix i18n by cleaning up typo'd text

* Remove unused import

* Fix permissions and i18n

* Revert change to Logistics copy

* Fix bugs and PR feedback

* Add cancel button to form and add comment for list

* Adjust timeout comment

* Fix bug with list of indices in detail panel when clicking through table

* Add comment about EUI bug
  • Loading branch information
jen-huang authored Aug 27, 2019
1 parent 9194883 commit 925f216
Show file tree
Hide file tree
Showing 84 changed files with 3,696 additions and 708 deletions.
3 changes: 2 additions & 1 deletion .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"tsvb": "src/legacy/core_plugins/metrics",
"kbnESQuery": "packages/kbn-es-query",
"inspector": "src/plugins/inspector",
"kibana-react": "src/plugins/kibana_react"
"kibana-react": "src/plugins/kibana_react",
"esUi": "src/plugins/es_ui_shared"
},
"exclude": ["src/legacy/ui/ui_render/ui_render_mixin.js"],
"translations": []
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* 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
*
* 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
* specific language governing permissions and limitations
* under the License.
*/

import React, { Fragment } from 'react';
Expand All @@ -27,12 +40,12 @@ export const CronDaily = ({
<EuiFormRow
label={(
<FormattedMessage
id="xpack.rollupJobs.cronEditor.cronDaily.fieldTimeLabel"
id="esUi.cronEditor.cronDaily.fieldTimeLabel"
defaultMessage="Time"
/>
)}
fullWidth
data-test-subj="rollupCronFrequencyConfiguration"
data-test-subj="cronFrequencyConfiguration"
>
<EuiFlexGroup gutterSize="xs">
<EuiFlexItem grow={false}>
Expand All @@ -45,13 +58,13 @@ export const CronDaily = ({
<EuiText size="xs">
<strong>
<FormattedMessage
id="xpack.rollupJobs.cronEditor.cronDaily.fieldHour.textAtLabel"
id="esUi.cronEditor.cronDaily.fieldHour.textAtLabel"
defaultMessage="At"
/>
</strong>
</EuiText>
)}
data-test-subj="rollupJobCreateFrequencyDailyHourSelect"
data-test-subj="cronFrequencyDailyHourSelect"
/>
</EuiFlexItem>

Expand All @@ -68,7 +81,7 @@ export const CronDaily = ({
</strong>
</EuiText>
)}
data-test-subj="rollupJobCreateFrequencyDailyMinuteSelect"
data-test-subj="cronFrequencyDailyMinuteSelect"
/>
</EuiFlexItem>
</EuiFlexGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* 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
*
* 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
* specific language governing permissions and limitations
* under the License.
*/

import React, { Component, Fragment } from 'react';
Expand All @@ -27,7 +40,7 @@ import {
WEEK,
MONTH,
YEAR,
} from '../../../../../services';
} from './services';

import { CronHourly } from './cron_hourly';
import { CronDaily } from './cron_daily';
Expand Down Expand Up @@ -331,7 +344,7 @@ export class CronEditor extends Component {
<EuiFormRow
label={(
<FormattedMessage
id="xpack.rollupJobs.cronEditor.fieldFrequencyLabel"
id="esUi.cronEditor.fieldFrequencyLabel"
defaultMessage="Frequency"
/>
)}
Expand All @@ -346,13 +359,13 @@ export class CronEditor extends Component {
<EuiText size="xs">
<strong>
<FormattedMessage
id="xpack.rollupJobs.cronEditor.textEveryLabel"
id="esUi.cronEditor.textEveryLabel"
defaultMessage="Every"
/>
</strong>
</EuiText>
)}
data-test-subj="rollupJobCreateFrequencySelect"
data-test-subj="cronFrequencySelect"
/>
</EuiFormRow>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* 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
*
* 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
* specific language governing permissions and limitations
* under the License.
*/

import React, { Fragment } from 'react';
import PropTypes from 'prop-types';
import { FormattedMessage } from '@kbn/i18n/react';

import {
EuiFormRow,
EuiSelect,
EuiText,
} from '@elastic/eui';

export const CronHourly = ({
minute,
minuteOptions,
onChange,
}) => (
<Fragment>
<EuiFormRow
label={(
<FormattedMessage
id="esUi.cronEditor.cronHourly.fieldTimeLabel"
defaultMessage="Minute"
/>
)}
fullWidth
data-test-subj="cronFrequencyConfiguration"
>
<EuiSelect
options={minuteOptions}
value={minute}
onChange={e => onChange({ minute: e.target.value })}
fullWidth
prepend={(
<EuiText size="xs">
<strong>
<FormattedMessage
id="esUi.cronEditor.cronHourly.fieldMinute.textAtLabel"
defaultMessage="At"
/>
</strong>
</EuiText>
)}
data-test-subj="cronFrequencyHourlyMinuteSelect"
/>
</EuiFormRow>
</Fragment>
);

CronHourly.propTypes = {
minute: PropTypes.string.isRequired,
minuteOptions: PropTypes.array.isRequired,
onChange: PropTypes.func.isRequired,
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* 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
*
* 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
* specific language governing permissions and limitations
* under the License.
*/

import React, { Fragment } from 'react';
Expand Down Expand Up @@ -29,12 +42,12 @@ export const CronMonthly = ({
<EuiFormRow
label={(
<FormattedMessage
id="xpack.rollupJobs.cronEditor.cronMonthly.fieldDateLabel"
id="esUi.cronEditor.cronMonthly.fieldDateLabel"
defaultMessage="Date"
/>
)}
fullWidth
data-test-subj="rollupCronFrequencyConfiguration"
data-test-subj="cronFrequencyConfiguration"
>
<EuiSelect
options={dateOptions}
Expand All @@ -45,25 +58,25 @@ export const CronMonthly = ({
<EuiText size="xs">
<strong>
<FormattedMessage
id="xpack.rollupJobs.cronEditor.cronMonthly.textOnTheLabel"
id="esUi.cronEditor.cronMonthly.textOnTheLabel"
defaultMessage="On the"
/>
</strong>
</EuiText>
)}
data-test-subj="rollupJobCreateFrequencyMonthlyDateSelect"
data-test-subj="cronFrequencyMonthlyDateSelect"
/>
</EuiFormRow>

<EuiFormRow
label={(
<FormattedMessage
id="xpack.rollupJobs.cronEditor.cronMonthly.fieldTimeLabel"
id="esUi.cronEditor.cronMonthly.fieldTimeLabel"
defaultMessage="Time"
/>
)}
fullWidth
data-test-subj="rollupCronFrequencyConfiguration"
data-test-subj="cronFrequencyConfiguration"
>
<EuiFlexGroup gutterSize="xs">
<EuiFlexItem grow={false}>
Expand All @@ -76,13 +89,13 @@ export const CronMonthly = ({
<EuiText size="xs">
<strong>
<FormattedMessage
id="xpack.rollupJobs.cronEditor.cronMonthly.fieldHour.textAtLabel"
id="esUi.cronEditor.cronMonthly.fieldHour.textAtLabel"
defaultMessage="At"
/>
</strong>
</EuiText>
)}
data-test-subj="rollupJobCreateFrequencyMonthlyHourSelect"
data-test-subj="cronFrequencyMonthlyHourSelect"
/>
</EuiFlexItem>

Expand All @@ -99,7 +112,7 @@ export const CronMonthly = ({
</strong>
</EuiText>
)}
data-test-subj="rollupJobCreateFrequencyMonthlyMinuteSelect"
data-test-subj="cronFrequencyMonthlyMinuteSelect"
/>
</EuiFlexItem>
</EuiFlexGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* 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
*
* 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
* specific language governing permissions and limitations
* under the License.
*/

import React, { Fragment } from 'react';
Expand Down Expand Up @@ -29,12 +42,12 @@ export const CronWeekly = ({
<EuiFormRow
label={(
<FormattedMessage
id="xpack.rollupJobs.cronEditor.cronWeekly.fieldDateLabel"
id="esUi.cronEditor.cronWeekly.fieldDateLabel"
defaultMessage="Day"
/>
)}
fullWidth
data-test-subj="rollupCronFrequencyConfiguration"
data-test-subj="cronFrequencyConfiguration"
>
<EuiSelect
options={dayOptions}
Expand All @@ -45,25 +58,25 @@ export const CronWeekly = ({
<EuiText size="xs">
<strong>
<FormattedMessage
id="xpack.rollupJobs.cronEditor.cronWeekly.textOnLabel"
id="esUi.cronEditor.cronWeekly.textOnLabel"
defaultMessage="On"
/>
</strong>
</EuiText>
)}
data-test-subj="rollupJobCreateFrequencyWeeklyDaySelect"
data-test-subj="cronFrequencyWeeklyDaySelect"
/>
</EuiFormRow>

<EuiFormRow
label={(
<FormattedMessage
id="xpack.rollupJobs.cronEditor.cronWeekly.fieldTimeLabel"
id="esUi.cronEditor.cronWeekly.fieldTimeLabel"
defaultMessage="Time"
/>
)}
fullWidth
data-test-subj="rollupCronFrequencyConfiguration"
data-test-subj="cronFrequencyConfiguration"
>
<EuiFlexGroup gutterSize="xs">
<EuiFlexItem grow={false}>
Expand All @@ -76,13 +89,13 @@ export const CronWeekly = ({
<EuiText size="xs">
<strong>
<FormattedMessage
id="xpack.rollupJobs.cronEditor.cronWeekly.fieldHour.textAtLabel"
id="esUi.cronEditor.cronWeekly.fieldHour.textAtLabel"
defaultMessage="At"
/>
</strong>
</EuiText>
)}
data-test-subj="rollupJobCreateFrequencyWeeklyHourSelect"
data-test-subj="cronFrequencyWeeklyHourSelect"
/>
</EuiFlexItem>

Expand All @@ -99,7 +112,7 @@ export const CronWeekly = ({
</strong>
</EuiText>
)}
data-test-subj="rollupJobCreateFrequencyWeeklyMinuteSelect"
data-test-subj="cronFrequencyWeeklyMinuteSelect"
/>
</EuiFlexItem>
</EuiFlexGroup>
Expand Down
Loading

0 comments on commit 925f216

Please sign in to comment.