Skip to content

Commit

Permalink
GUI S3 Objects lifecycle (#2759): Transition rules tab - sort rules b…
Browse files Browse the repository at this point in the history
…y 'Path'. Mark 'Delete' transitions. Style adjustments
  • Loading branch information
AleksandrGorodetskii committed Aug 26, 2022
1 parent aaa15e5 commit 411a3d0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import {inject} from 'mobx-react';
import {computed} from 'mobx';
import {
Expand Down Expand Up @@ -581,7 +580,6 @@ export class DataStorageEditDialog extends React.Component {
/^s3$/i.test(this.props.dataStorage.type) && (
<Tabs.TabPane key="transitionRules" tab="Transition rules">
<LifeCycleRules
rules={this.props.lifeCycleRules}
storageId={this.props.dataStorage.id}
/>
</Tabs.TabPane>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ class LifeCycleRules extends React.Component {
get rules () {
const {lifeCycleRules} = this.props;
if (lifeCycleRules && lifeCycleRules.loaded && !lifeCycleRules.error) {
return lifeCycleRules.value || [];
return [...(lifeCycleRules.value || [])]
.sort((ruleA, ruleB) => ruleA.pathGlob.localeCompare(ruleB.pathGlob));
}
return [];
}
Expand Down Expand Up @@ -163,7 +164,7 @@ class LifeCycleRules extends React.Component {
return this.createRule(payload);
};

renderRule = (rule, index) => {
renderRule = (rule) => {
const controls = [
<Button
className={styles.controlBtn}
Expand Down Expand Up @@ -215,7 +216,12 @@ class LifeCycleRules extends React.Component {
<td>{rule.pathGlob}</td>
<td>{rule.objectGlob}</td>
<td>
<span>
<span
className={destination === DESTINATIONS.DELETION
? 'cp-error'
: ''
}
>
{destination}
</span>
{(rule.transitions || []).length > 1 ? (
Expand Down Expand Up @@ -266,7 +272,7 @@ class LifeCycleRules extends React.Component {
</tr>
</thead>
<tbody>
{this.rules.map((rule, index) => this.renderRule(rule, index))}
{this.rules.map((rule) => this.renderRule(rule))}
</tbody>
</table>
) : null }
Expand All @@ -292,7 +298,6 @@ class LifeCycleRules extends React.Component {
}

LifeCycleRules.propTypes = {
rules: PropTypes.array,
storageId: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
* limitations under the License.
*/

import React from 'react';
import {DESTINATIONS} from '../life-cycle-edit-modal';

const columns = [{
title: 'Date',
dataIndex: 'date',
Expand All @@ -33,7 +36,17 @@ const columns = [{
}, {
title: 'Destination',
dataIndex: 'destination',
key: 'destination'
key: 'destination',
render: (destination) => (
<span
className={destination === DESTINATIONS.DELETION
? 'cp-error'
: ''
}
>
{destination}
</span>
)
}, {
title: 'Prolongation, days',
dataIndex: 'prolongation',
Expand Down

0 comments on commit 411a3d0

Please sign in to comment.