Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
ca68141
UUID support
Jul 28, 2021
ddf1565
remove UUID for runtime
Jul 28, 2021
51d65d0
rm useless pkg
Jul 28, 2021
dd6b486
code format
Jul 28, 2021
b673861
add pd controller
Jul 28, 2021
9ddc0d5
add crud UI support
Jul 29, 2021
54021aa
fix corner cases
Jul 30, 2021
3a9498f
code refactor
Jul 31, 2021
6852ea2
format code
Jul 31, 2021
84aab8b
add disk mapper
Aug 2, 2021
5200f78
add feature flag enablePersistentDisk
Aug 3, 2021
33082c9
elaborate Disk API
Aug 3, 2021
5f5f99d
rmv useless code
Aug 3, 2021
6de9588
merge master
Aug 3, 2021
944f130
enable test env
Aug 3, 2021
322d38f
getDisk by user && simplify UI changes
Aug 5, 2021
d3c4010
resolve conflicts with dataproc panel
Aug 5, 2021
8e28744
solve conflicts
Aug 10, 2021
56b51ef
fix bug
Aug 10, 2021
ddf045a
code refactor & fix msg issue
Aug 13, 2021
80e7700
add msg link
Aug 13, 2021
1054c87
fix panel switching issue & fix pd cost estimator & fix delete options
Aug 18, 2021
3d28ec2
simplify delete env option
Aug 18, 2021
691e770
revert nit & spec
Aug 18, 2021
8919c52
nit revert format
Aug 18, 2021
45396e4
revert runtime-panel-spec
Aug 18, 2021
b025d2f
fix code format
Aug 18, 2021
9e8d319
revert lint formater
Aug 18, 2021
12726b3
revert space
Aug 18, 2021
3f7ab8e
revert no new line
Aug 18, 2021
7aaa51c
code refactor & resize pd selector
Aug 18, 2021
b6f47b5
fix bugs of panel switching between dataproc and running gce without PD
Aug 19, 2021
e5cf619
fix enablePD usage
Aug 19, 2021
50c3370
fix bug
Aug 19, 2021
c3d7fff
fix bug & add comments
Aug 19, 2021
faefaa9
use context wrapper to simplify complex state predicate
Aug 20, 2021
7aa8c92
fix unit tests bugs
Aug 21, 2021
675a944
rm standardPdValidator
Aug 21, 2021
47afd21
merge master
Aug 21, 2021
ba4038d
fix runtime-utils-spec bug
Aug 21, 2021
e8d27cb
revert serviceaccounts.rb
Aug 21, 2021
69d7819
fix angular issue
Aug 24, 2021
7519b68
merge master
Aug 24, 2021
01ec952
Merge branch 'master' into yintong/UIForPD
Aug 25, 2021
ce955c6
fix lint issue
Aug 25, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
code refactor & resize pd selector
  • Loading branch information
Yintong Ma committed Aug 18, 2021
commit 7aaa51cff63a0e07ffdfb0f7b911eabd4fccae66
43 changes: 22 additions & 21 deletions ui/src/app/pages/analysis/runtime-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ import {
withUserProfile
} from 'app/utils';
import {
ComputeType, diskPrice, diskPricePerMonth,
ComputeType,
diskPrice,
diskPricePerMonth,
findMachineByName,
Machine,
machineRunningCost,
Expand Down Expand Up @@ -48,7 +50,8 @@ import {
BillingAccountType,
BillingStatus,
CdrVersionTiersResponse,
DataprocConfig, DiskType,
DataprocConfig,
DiskType,
Runtime,
RuntimeConfigurationType,
RuntimeStatus
Expand Down Expand Up @@ -485,11 +488,10 @@ const DiskSizeSelector = ({onChange, disabled, selectedDiskSize, diskSize, idPre
};

const PersistentDiskSizeSelector = ({onChange, disabled, selectedDiskSize, diskSize, idPrefix}) => {
return <FlexColumn>

return <div>
<h3 style={{...styles.sectionHeader, ...styles.bold}} >Persistent Disk (GB)</h3>
<div> Persistent disks store analysis data.
<a href= 'https://support.terra.bio/hc/en-us/articles/360047318551'>Learn more about persistent disks and where your disk is mounted.
<a href= 'https://support.terra.bio/hc/en-us/articles/360047318551'> Learn more about persistent disks and where your disk is mounted.
</a>
</div>
<InputNumber id={`${idPrefix}-disk`}
Expand All @@ -501,7 +503,7 @@ const PersistentDiskSizeSelector = ({onChange, disabled, selectedDiskSize, diskS
inputStyle={styles.inputNumber}
onChange={({value}) => onChange(value)}
/>
</FlexColumn>;
</div>;
};

const DataProcConfigSelector = ({onChange, disabled, dataprocConfig}) => {
Expand Down Expand Up @@ -797,7 +799,7 @@ const CostEstimator = ({
</div>
}>
<div
style={{fontSize: '20px', color: costTextColor}}
style={{fontSize: '15px', color: costTextColor}}
data-test-id='running-cost'
>
{formatUsd(runningCost)}/hr
Expand All @@ -813,7 +815,7 @@ const CostEstimator = ({
</div>
}>
<div
style={{fontSize: '20px', color: costTextColor}}
style={{fontSize: '15px', color: costTextColor}}
data-test-id='storage-cost'
>
{formatUsd(storageCost)}/hr
Expand All @@ -823,7 +825,7 @@ const CostEstimator = ({
<FlexColumn>
<div style={{fontSize: '10px', fontWeight: 600}}>Persistent disk cost</div>
<div
style={{fontSize: '20px', color: costTextColor}}
style={{fontSize: '15px', color: costTextColor}}
data-test-id='pd-cost'
>
{formatUsd(pdSize * diskPrice)}/hr
Expand Down Expand Up @@ -1001,7 +1003,7 @@ export const RuntimePanel = fp.flow(
const machineName = dataprocConfig ? dataprocConfig.masterMachineType : gceConfig.machineType;
const initialMasterMachine = findMachineByName(machineName) || defaultMachineType;
const initialCompute = dataprocConfig ? ComputeType.Dataproc : ComputeType.Standard;
const pdExists = !!persistentDisk;
const pdExists = enablePD && !!persistentDisk;
const pdSize = pdExists ? persistentDisk.size : defaultDiskSize;

// We may encounter a race condition where an existing current runtime has not loaded by the time this panel renders.
Expand Down Expand Up @@ -1063,8 +1065,8 @@ export const RuntimePanel = fp.flow(

const runtimeDiffs = getRuntimeConfigDiffs(initialRuntimeConfig, newRuntimeConfig);
const runtimeChanged = runtimeExists && runtimeDiffs.length > 0;
const pdSizeReduced = pdExists && selectedPdSize < pdSize;
const runtimeExistsWithoutPD = runtimeExists && !pdExists;
const pdSizeReduced = selectedPdSize < pdSize;
const gceWithoutPdExists = runtimeExists && initialCompute === ComputeType.Standard && !pdExists;
const updateMessaging = diffsToUpdateMessaging(runtimeDiffs);


Expand Down Expand Up @@ -1092,7 +1094,7 @@ export const RuntimePanel = fp.flow(
// OR (update an existing runtime with no PD attached).
// TODO(RW-): 'Update an existing runtime with no PD attached' will be cleaned up
// post launch PD when all existing running Runtime shutdown.
if (!enablePD || (pdExists && selectedPdSize >= pdSize && runtimeExists) || runtimeExistsWithoutPD) {
if (!enablePD || (pdExists && !pdSizeReduced && runtimeExists) || gceWithoutPdExists) {
return {
gceConfig: {
machineType: runtime.machine.name,
Expand Down Expand Up @@ -1247,7 +1249,7 @@ export const RuntimePanel = fp.flow(
// where we get 'status' from
const runtimeCanBeUpdated = runtimeChanged
&& [RuntimeStatus.Running, RuntimeStatus.Stopped].includes(status as RuntimeStatus)
&& runtimeCanBeCreated || pdSizeReduced;
&& runtimeCanBeCreated || pdExists && pdSizeReduced;

const renderUpdateButton = () => {
return <Button
Expand Down Expand Up @@ -1301,7 +1303,7 @@ export const RuntimePanel = fp.flow(
</Fragment>
],
[PanelContent.DeleteRuntime, () => {
if (enablePD && pdExists) {
if (pdExists) {
return <ConfirmDeleteRuntimeWithPD
onConfirm={async(runtimeStatusReq) => {
await setRuntimeStatus(runtimeStatusReq);
Expand Down Expand Up @@ -1356,7 +1358,7 @@ export const RuntimePanel = fp.flow(
onChange={(value) => setSelectedMachine(value)}
validMachineTypes={validMainMachineTypes}
machineType={machineName}/>
{(!enablePD && runtimeExistsWithoutPD || selectedCompute !== ComputeType.Standard) ?
{(gceWithoutPdExists || selectedCompute !== ComputeType.Standard) &&
<DiskSizeSelector
idPrefix='runtime'
selectedDiskSize={selectedDiskSize}
Expand All @@ -1365,8 +1367,7 @@ export const RuntimePanel = fp.flow(
}}
disabled={disableControls}
diskSize={diskSize}
/> : null
}
/>}
</div>
<FlexColumn style={{marginTop: '1rem'}}>
<label style={styles.label} htmlFor='runtime-compute'>Compute type</label>
Expand All @@ -1389,7 +1390,7 @@ export const RuntimePanel = fp.flow(
</div>
<div>
<FlexRow style={{justifyContent: 'space-between', marginTop: '.75rem'}}>
{enablePD && selectedCompute === ComputeType.Standard && !runtimeExistsWithoutPD &&
{enablePD && selectedCompute === ComputeType.Standard && !gceWithoutPdExists &&
<div>
<PersistentDiskSizeSelector
idPrefix='runtime'
Expand Down Expand Up @@ -1418,7 +1419,7 @@ export const RuntimePanel = fp.flow(
{getWarningMessageContent()}
</WarningMessage>
}
{enablePD && !runtimeExists && pdExists ?
{!runtimeExists && pdExists ?
<FlexRow style={{justifyContent: 'space-between', marginTop: '.75rem'}}>
<Link
style={{...styles.deleteLink, ...(
Expand All @@ -1439,7 +1440,7 @@ export const RuntimePanel = fp.flow(
aria-label='Delete Environment'
disabled={disableControls || !runtimeExists}
onClick={() => setPanelContent(PanelContent.DeleteRuntime)}>Delete Environment</Link>
{!runtimeExists && !pdSizeReduced ? renderCreateButton() : renderNextButton()}
{!runtimeExists && (pdExists && !pdSizeReduced) ? renderCreateButton() : renderNextButton()}
</FlexRow>
}
</Fragment>],
Expand Down