Skip to content

Commit

Permalink
Adding the License Agreement in Zen
Browse files Browse the repository at this point in the history
  • Loading branch information
sakshibobade21 committed Oct 23, 2023
1 parent dc338b1 commit 89aa97a
Show file tree
Hide file tree
Showing 3 changed files with 69 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 && (agree == 1 || (agreeLicense && agree == -1))) {
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 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
9 changes: 9 additions & 0 deletions src/renderer/components/stages/installation/License.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
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.";

Check failure on line 1 in src/renderer/components/stages/installation/License.ts

View workflow job for this annotation

GitHub Actions / lint

missing header

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";
35 changes: 35 additions & 0 deletions src/renderer/components/stages/installation/LicenseDialog.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { useState, useEffect, useRef } from "react";

Check failure on line 1 in src/renderer/components/stages/installation/LicenseDialog.tsx

View workflow job for this annotation

GitHub Actions / lint

missing header
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',
},
}}>
<DialogTitle sx={{color: '#0678c6'}}>End User Liscense Agreement for Zowe</DialogTitle>
<DialogContent sx={{paddingBottom: '0'}}>
<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>
<Button onClick={() => { licenseAgreement(-1)} }>Close</Button>
</DialogActions>
</Dialog>
</div>
);
};

export default LicenseDialog;

0 comments on commit 89aa97a

Please sign in to comment.