@@ -15,7 +15,7 @@ import { Icon } from "@cocalc/frontend/components/icon";
15
15
import { describeQuotaFromInfo } from "@cocalc/util/licenses/describe-quota" ;
16
16
import { CostInputPeriod } from "@cocalc/util/licenses/purchase/types" ;
17
17
import { 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" ;
19
19
import { Alert , Button , Checkbox , Popconfirm , Space , Table } from "antd" ;
20
20
import A from "components/misc/A" ;
21
21
import Loading from "components/share/loading" ;
@@ -27,7 +27,6 @@ import { useRouter } from "next/router";
27
27
import { useEffect , useMemo , useState } from "react" ;
28
28
import { computeCost } from "@cocalc/util/licenses/store/compute-cost" ;
29
29
import OtherItems from "./other-items" ;
30
- import { EditRunLimit } from "./run-limit" ;
31
30
import { describeItem , describePeriod , DisplayCost } from "./site-license-cost" ;
32
31
import type {
33
32
ProductDescription ,
@@ -438,11 +437,8 @@ function DescriptionColumnSiteLicense(props: DCProps) {
438
437
id,
439
438
cost,
440
439
description,
441
- updating,
442
- reload,
443
440
compact,
444
441
project_id,
445
- style,
446
442
readOnly,
447
443
} = props ;
448
444
if (
@@ -455,10 +451,6 @@ function DescriptionColumnSiteLicense(props: DCProps) {
455
451
throw Error ( "BUG -- incorrect typing" ) ;
456
452
}
457
453
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
- ) ;
462
454
if ( cost == null ) {
463
455
// don't crash when used on deprecated items
464
456
return < pre > { JSON . stringify ( description , undefined , 2 ) } </ pre > ;
@@ -468,51 +460,6 @@ function DescriptionColumnSiteLicense(props: DCProps) {
468
460
throw Error ( "incorrect typing" ) ;
469
461
}
470
462
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
-
516
463
function renderProjectID ( ) : JSX . Element | null {
517
464
if ( ! project_id || ! isValidUUID ( project_id ) ) return null ;
518
465
return (
@@ -534,20 +481,7 @@ function DescriptionColumnSiteLicense(props: DCProps) {
534
481
< div >
535
482
< div >
536
483
{ 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
- ) }
549
484
</ div >
550
- { renderEditRunLimit ( ) }
551
485
{ renderProjectID ( ) }
552
486
</ div >
553
487
) ;
@@ -573,21 +507,21 @@ function DescriptionColumnSiteLicense(props: DCProps) {
573
507
</ div >
574
508
) }
575
509
{ 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 ( ) } { " " }
585
519
</ div >
586
- { ! readOnly && (
520
+ { ! readOnly && (
587
521
< >
588
522
< Button
589
- style = { { marginRight : "5px" } }
590
- onClick = { ( ) => {
523
+ style = { { marginRight : "5px" } }
524
+ onClick = { ( ) => {
591
525
const page = editPage ( ) ;
592
526
router . push ( `/store/${ page } ?id=${ id } ` ) ;
593
527
} }
0 commit comments