apps.websight-package-manager.web-resources.components.PackageStatuses.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of websight-package-manager-view Show documentation
Show all versions of websight-package-manager-view Show documentation
Package Manager View module is responsible for view part of Package Manager.
The newest version!
import React from "/apps/websight-atlaskit-esm/web-resources/react.js";
import { colors } from "/apps/websight-atlaskit-esm/web-resources/@atlaskit/theme.js";
import Tooltip from "/apps/websight-atlaskit-esm/web-resources/@atlaskit/tooltip.js";
import { DateTimeOffset } from "/apps/websight-admin/web-resources/DateUtils.js";
import * as PackageUtil from "../utils/PackageUtil.js";
const statusStyle = {
borderRadius: '3px',
border: '1px solid',
borderColor: colors.N40,
display: 'inline-block',
fontSize: '12px',
margin: '0 5px 1px 0',
lineHeight: '16px',
padding: '0 4px'
};
const defaultStatusStyle = { ...statusStyle,
color: colors.G500
};
const warningStatusStyle = { ...statusStyle,
color: colors.DN30,
backgroundColor: colors.Y100,
border: 'none'
};
const NeverBuild = () => {
return /*#__PURE__*/React.createElement("div", {
style: warningStatusStyle
}, "Never built");
};
const Installed = props => {
return /*#__PURE__*/React.createElement(Tooltip, {
content: props.description
}, /*#__PURE__*/React.createElement("div", {
style: defaultStatusStyle
}, "Installed"));
};
const NotInstalled = () => {
return /*#__PURE__*/React.createElement("div", {
style: warningStatusStyle
}, "Not installed");
};
const Modified = props => {
return /*#__PURE__*/React.createElement(Tooltip, {
content: props.description
}, /*#__PURE__*/React.createElement("div", {
style: warningStatusStyle
}, "Modified"));
};
const statusDescription = status => {
return new DateTimeOffset(status.date).getEnGbDateTimeOffsetString() + ' by ' + status.executedBy;
};
export default class PackageStatuses extends React.Component {
render() {
const {
packageData
} = this.props;
const {
status = {}
} = packageData;
let buildStatus;
let installationStatus;
let modificationStatus;
if (!PackageUtil.isPackageBuilt(packageData)) {
buildStatus = /*#__PURE__*/React.createElement(NeverBuild, null);
} else {
if (PackageUtil.isPackageInstalled(packageData)) {
installationStatus = /*#__PURE__*/React.createElement(Installed, {
description: statusDescription(status.installation)
});
} else {
installationStatus = /*#__PURE__*/React.createElement(NotInstalled, null);
}
if (PackageUtil.isPackageModified(packageData)) {
modificationStatus = /*#__PURE__*/React.createElement(Modified, {
description: statusDescription(status.modification)
});
}
}
return /*#__PURE__*/React.createElement(React.Fragment, null, buildStatus, installationStatus, modificationStatus);
}
}