Skip to content

Commit

Permalink
Merge pull request #64 from zowe/embed-license
Browse files Browse the repository at this point in the history
Adding the License Agreement in Zen
  • Loading branch information
1000TurquoisePogs committed Oct 30, 2023
2 parents dc338b1 + 03f8780 commit a13f1d8
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import JsonForm from '../../common/JsonForms';
import { IResponse } from '../../../../types/interfaces';
import ProgressCard from '../../common/ProgressCard';
import CheckCircleOutlineIcon from '@mui/icons-material/CheckCircleOutline';
import LicenseDialog from "./LicenseDialog";

const InstallationType = () => {

Expand All @@ -34,6 +35,8 @@ const InstallationType = () => {
const [paxPath, setPaxPath] = useState("");
const [smpePath, setSmpePath] = useState("");
const [smpePathValidated, setSmpePathValidated] = useState(false);
const [showLicense, setShowLicense] = useState(false);
const [agreeLicense, setAgreeLicense] = useState(false);

const installationArgs = useAppSelector(selectInstallationArgs);
const version = useAppSelector(selectZoweVersion);
Expand All @@ -42,14 +45,25 @@ const InstallationType = () => {
const inputRef = useRef<HTMLInputElement>(null);

useEffect(() => {
if((installValue === "upload" && paxPath == "") || installValue === "smpe" && installationArgs.smpeDir == ""){
if((installValue === "download" && agreeLicense == false) || (installValue === "upload" && paxPath == "") || installValue === "smpe" && installationArgs.smpeDir == ""){
dispatch(setNextStepEnabled(false));
} else {
dispatch(setNextStepEnabled(true));
}

}, [installValue, paxPath, installationArgs]);
}, [installValue, paxPath, installationArgs, agreeLicense]);

const showLicenseAgreement = () => {
setShowLicense(true);
}

const licenseAgreement = (agree: any) => {
setAgreeLicense(false);
if(agree) {
setAgreeLicense(true);
}
setShowLicense(false);
}

return (
<ContainerCard title="Installation Type" description="Please select the desired install method">
Expand Down Expand Up @@ -98,9 +112,15 @@ const InstallationType = () => {
}}>Validate location</Button>
{smpePathValidated ? <CheckCircleOutlineIcon color="success" sx={{ fontSize: 32 }}/> : <Typography sx={{color: "gray"}}>{'Enter a valid path.'}</Typography> }
</FormControl>}
{installValue === "download" && <Typography id="position-2" sx={{ mb: 1, whiteSpace: 'pre-wrap' }} color="text.secondary">
{`Zen will download the latest Zowe convenience build in PAX archive format from `}<Link href="zowe.org">{'https://zowe.org'}</Link>
</Typography>}
{installValue === "download" &&
<div>
<Typography id="position-2" sx={{ mb: 1, whiteSpace: 'pre-wrap' }} color="text.secondary">
{`Zen will download the latest Zowe convenience build in PAX archive format from `}
<Link href="zowe.org">{'https://zowe.org'}</Link>
</Typography>
<Button style={{ color: 'white', backgroundColor: '#1976d2', fontSize: 'small'}} onClick={showLicenseAgreement}>License Agreement</Button>
{showLicense && <LicenseDialog isAgreementVisible={true} licenseAgreement={licenseAgreement}/>}
</div>}
{installValue === "upload" && <Typography id="position-2" sx={{ mb: 1, whiteSpace: 'pre-wrap' }} color="text.secondary">
{`Select a local Zowe PAX file (offline installation).`}
</Typography>}
Expand Down
19 changes: 19 additions & 0 deletions src/renderer/components/stages/installation/License.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Copyright Contributors to the Zowe Project.
*/

export const licenseHeader = "By clicking on I agree, you agree that (1) you have had the opportunity to review the terms of the agreement presented below and (2) such terms govern this transaction. If you do not agree, click I disagree.";

export const licenseContent = "These binary files (including any associated documentation and source code, the Binaries) have been compiled from source files, and are made available to you by Zowe Binary Project a Series of LF Projects, LLC (the Project). The Binaries have been made available for your convenience pursuant to the terms of applicable open source licenses (the Applicable Licenses) free of charge to you. You agree that your access, installation, copying, distribution and use of the Binaries are subject to the terms of the Applicable Licenses, including without limitation all disclaimers of warranties, limitations of liability and obligations to provide notices or source code contained in such Applicable Licenses.";

export const licenseMainConetnt = "Furthermore, you agree that the project disclaims all warranties of any kind with respect to the binaries, including fitness for a particular purpose, merchantability and non-infringement. Use of the binaries is at the user’s risk and discretion, and under no circumstances shall the project have (1) any liability to any party for any use or attempted use of the binaries or any other cause, whether direct, indirect, special, consequential, punitive, or otherwise, and regardless of any form or cause of action; or (2) any obligation to provide support for the binaries or any use of the binaries."

export const licenseLinkText = "Applicable License";

export const licenseLink = "https://github.com/zowe/zowe.github.io/blob/master/LICENSE";
45 changes: 45 additions & 0 deletions src/renderer/components/stages/installation/LicenseDialog.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Copyright Contributors to the Zowe Project.
*/

import { useState, useEffect, useRef } from "react";
import { Button, Dialog, DialogActions, DialogContent, DialogTitle } from '@mui/material';
import { licenseHeader, licenseContent, licenseMainConetnt, licenseLinkText, licenseLink} from './License';

const LicenseDialog = ({isAgreementVisible, licenseAgreement}: any) => {
const [licenseText, setLicenseText] = useState('');

return (
<div>
<Dialog
open={isAgreementVisible}
onClose={() => {licenseAgreement(-1)}}
PaperProps={{
style: {
width: '100vw',
borderRadius: '15px'
},
}}>
<DialogTitle sx={{color: '#0678c6', fontSize: 'medium'}}>End User Liscense Agreement for Zowe</DialogTitle>
<DialogContent sx={{paddingBottom: '0', fontSize: '15px'}}>
<p>{licenseHeader}</p>
<p>{licenseContent}</p>
<b >{licenseMainConetnt}</b>
<p>{licenseLinkText}<a href={licenseLink} target="_blank">{licenseLink}</a></p>
</DialogContent>
<DialogActions>
<Button onClick={() => { licenseAgreement(1)} }>Agree</Button>
<Button onClick={() => { licenseAgreement(0)} }>Disagree</Button>
</DialogActions>
</Dialog>
</div>
);
};

export default LicenseDialog;

0 comments on commit a13f1d8

Please sign in to comment.