@@ -15,7 +15,7 @@ import { Icon } from "@cocalc/frontend/components/icon";
1515import { describeQuotaFromInfo } from "@cocalc/util/licenses/describe-quota" ;
1616import { CostInputPeriod } from "@cocalc/util/licenses/purchase/types" ;
1717import { money } from "@cocalc/util/licenses/purchase/utils" ;
18- import { capitalize , currency , isValidUUID , plural , round2up } from "@cocalc/util/misc" ;
18+ import { capitalize , currency , isValidUUID , round2up } from "@cocalc/util/misc" ;
1919import { Alert , Button , Checkbox , Popconfirm , Space , Table } from "antd" ;
2020import A from "components/misc/A" ;
2121import Loading from "components/share/loading" ;
@@ -27,7 +27,6 @@ import { useRouter } from "next/router";
2727import { useEffect , useMemo , useState } from "react" ;
2828import { computeCost } from "@cocalc/util/licenses/store/compute-cost" ;
2929import OtherItems from "./other-items" ;
30- import { EditRunLimit } from "./run-limit" ;
3130import { describeItem , describePeriod , DisplayCost } from "./site-license-cost" ;
3231import type {
3332 ProductDescription ,
@@ -438,11 +437,8 @@ function DescriptionColumnSiteLicense(props: DCProps) {
438437 id,
439438 cost,
440439 description,
441- updating,
442- reload,
443440 compact,
444441 project_id,
445- style,
446442 readOnly,
447443 } = props ;
448444 if (
@@ -455,10 +451,6 @@ function DescriptionColumnSiteLicense(props: DCProps) {
455451 throw Error ( "BUG -- incorrect typing" ) ;
456452 }
457453 const router = useRouter ( ) ;
458- const [ editRunLimit , setEditRunLimit ] = useState < boolean > ( false ) ;
459- const [ runLimit , setRunLimit ] = useState < number > (
460- description . type == "quota" ? description . run_limit ?? 0 : 0 ,
461- ) ;
462454 if ( cost == null ) {
463455 // don't crash when used on deprecated items
464456 return < pre > { JSON . stringify ( description , undefined , 2 ) } </ pre > ;
@@ -468,51 +460,6 @@ function DescriptionColumnSiteLicense(props: DCProps) {
468460 throw Error ( "incorrect typing" ) ;
469461 }
470462
471- const showRunLimitEditor =
472- description . type !== "disk" && description . type !== "vm" ;
473-
474- function renderEditRunLimit ( ) : JSX . Element | null {
475- if ( ! editRunLimit ) return null ;
476- return (
477- < div
478- style = { {
479- border : "1px solid #eee" ,
480- padding : "15px" ,
481- margin : "15px 0" ,
482- background : "white" ,
483- ...style ,
484- } }
485- >
486- < Icon
487- name = "times"
488- style = { { float : "right" } }
489- onClick = { ( ) => {
490- setEditRunLimit ( false ) ;
491- } }
492- />
493- { ! readOnly && (
494- < >
495- < EditRunLimit value = { runLimit } onChange = { setRunLimit } />
496- < Button
497- type = "primary"
498- style = { { marginTop : "15px" } }
499- onClick = { async ( ) => {
500- setEditRunLimit ( false ) ;
501- await apiPost ( "/shopping/cart/edit" , {
502- id,
503- description : { ...description , run_limit : runLimit } ,
504- } ) ;
505- await reload ( ) ;
506- } }
507- >
508- Save
509- </ Button >
510- </ >
511- ) }
512- </ div >
513- ) ;
514- }
515-
516463 function renderProjectID ( ) : JSX . Element | null {
517464 if ( ! project_id || ! isValidUUID ( project_id ) ) return null ;
518465 return (
@@ -534,20 +481,7 @@ function DescriptionColumnSiteLicense(props: DCProps) {
534481 < div >
535482 < div >
536483 { describeQuotaFromInfo ( input ) }
537- { showRunLimitEditor && ! editRunLimit && (
538- < >
539- < br />
540- < Button
541- onClick = { ( ) => setEditRunLimit ( true ) }
542- disabled = { updating }
543- style = { { marginBottom : "5px" } }
544- >
545- { runLimit } simultaneous running { plural ( runLimit , "project" ) }
546- </ Button >
547- </ >
548- ) }
549484 </ div >
550- { renderEditRunLimit ( ) }
551485 { renderProjectID ( ) }
552486 </ div >
553487 ) ;
@@ -573,21 +507,21 @@ function DescriptionColumnSiteLicense(props: DCProps) {
573507 </ div >
574508 ) }
575509 { description . description && < div > { description . description } </ div > }
576- < div >
577- < b >
578- { input . subscription == "no"
579- ? describePeriod ( { quota : input } )
580- : capitalize ( input . subscription ) + " subscription" }
581- </ b >
582- </ div >
583- < div style = { DESCRIPTION_STYLE } >
584- { compact || readOnly ? describeItem ( { info : input } ) : editableQuota ( ) } { " " }
510+ < div style = { DESCRIPTION_STYLE } >
511+ < div style = { { marginBottom : '8px' } } >
512+ < b >
513+ { input . subscription == "no"
514+ ? describePeriod ( { quota : input } )
515+ : capitalize ( input . subscription ) + " subscription" }
516+ </ b >
517+ </ div >
518+ { compact || readOnly ? describeItem ( { info : input } ) : editableQuota ( ) } { " " }
585519 </ div >
586- { ! readOnly && (
520+ { ! readOnly && (
587521 < >
588522 < Button
589- style = { { marginRight : "5px" } }
590- onClick = { ( ) => {
523+ style = { { marginRight : "5px" } }
524+ onClick = { ( ) => {
591525 const page = editPage ( ) ;
592526 router . push ( `/store/${ page } ?id=${ id } ` ) ;
593527 } }
0 commit comments