Sha256: d8df8da17a8e9e23c601440229e580f515f5232eaa61ff26420ef3e6ee1c5790

Contents?: true

Size: 1.68 KB

Versions: 36

Compression:

Stored size: 1.68 KB

Contents

import React from 'react';
import PropTypes from 'prop-types';
import { Alert, Card, Row, Col } from 'patternfly-react';
import { translate as __ } from 'foremanReact/common/I18n';

const ConditionalLink = ({ children, link }) =>
  link ? <a href={link}>{children}</a> : children;

ConditionalLink.propTypes = {
  children: PropTypes.node.isRequired,
  link: PropTypes.string,
};

ConditionalLink.defaultProps = {
  link: null,
};

const Locks = ({ locks }) => (
  <div>
    <Alert type="info">
      {__(
        'You can find resource locks on this page. Exclusive lock marked with locked icon means that no other task can use locked resource while this task is running. Non-exclusive lock marked with unlocked icon means other tasks can access the resource freely, it is only used to indicate the relation of this task with the resource'
      )}
    </Alert>
    <Card.Grid>
      <Row>
        {locks.map((lock, key) => (
          <Col xs={6} sm={4} md={4} key={key}>
            <ConditionalLink link={lock.link}>
              <Card className="card-pf-aggregate-status" accented>
                <Card.Title>
                  <span
                    className={`fa ${
                      lock.exclusive ? 'fa-lock' : 'fa-unlock-alt'
                    }`}
                  />
                  {lock.resource_type}
                </Card.Title>
                <Card.Body>
                  {`id:${lock.resource_id}`}
                  <br />
                </Card.Body>
              </Card>
            </ConditionalLink>
          </Col>
        ))}
      </Row>
    </Card.Grid>
  </div>
);

Locks.propTypes = {
  locks: PropTypes.array,
};

Locks.defaultProps = {
  locks: [],
};

export default Locks;

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
foreman-tasks-8.1.2 webpack/ForemanTasks/Components/TaskDetails/Components/Locks.js
foreman-tasks-8.1.1 webpack/ForemanTasks/Components/TaskDetails/Components/Locks.js
foreman-tasks-8.1.0 webpack/ForemanTasks/Components/TaskDetails/Components/Locks.js
foreman-tasks-8.0.2 webpack/ForemanTasks/Components/TaskDetails/Components/Locks.js
foreman-tasks-8.0.1 webpack/ForemanTasks/Components/TaskDetails/Components/Locks.js
foreman-tasks-8.0.0 webpack/ForemanTasks/Components/TaskDetails/Components/Locks.js
foreman-tasks-7.2.1 webpack/ForemanTasks/Components/TaskDetails/Components/Locks.js
foreman-tasks-7.1.1 webpack/ForemanTasks/Components/TaskDetails/Components/Locks.js
foreman-tasks-7.2.0 webpack/ForemanTasks/Components/TaskDetails/Components/Locks.js
foreman-tasks-7.1.0 webpack/ForemanTasks/Components/TaskDetails/Components/Locks.js
foreman-tasks-6.0.3 webpack/ForemanTasks/Components/TaskDetails/Components/Locks.js
foreman-tasks-7.0.0 webpack/ForemanTasks/Components/TaskDetails/Components/Locks.js
foreman-tasks-6.0.2 webpack/ForemanTasks/Components/TaskDetails/Components/Locks.js
foreman-tasks-6.0.1 webpack/ForemanTasks/Components/TaskDetails/Components/Locks.js
foreman-tasks-6.0.0 webpack/ForemanTasks/Components/TaskDetails/Components/Locks.js
foreman-tasks-5.3.0 webpack/ForemanTasks/Components/TaskDetails/Components/Locks.js