Skip to content

Commit 932f7b7

Browse files
committed
store/course: record "source"
1 parent 8eed770 commit 932f7b7

File tree

6 files changed

+37
-19
lines changed

6 files changed

+37
-19
lines changed

src/packages/next/components/store/run-limit.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function RunLimit({
3434
if (!showExplanations) return;
3535

3636
switch (source) {
37-
case "license":
37+
case "site-license":
3838
return (
3939
<div style={{ marginTop: "5px" }}>
4040
{boost ? (
@@ -76,7 +76,7 @@ export function RunLimit({
7676
}
7777

7878
switch (source) {
79-
case "license":
79+
case "site-license":
8080
return (
8181
<>
8282
<Divider plain>Simultaneous Project Upgrades</Divider>
@@ -129,12 +129,12 @@ function EditRunLimit({
129129
value,
130130
onChange,
131131
disabled,
132-
type,
132+
source,
133133
}: {
134134
value?: number;
135135
onChange: (run_limit: number) => void;
136136
disabled?: boolean;
137-
type: LicenseSource;
137+
source: LicenseSource;
138138
}) {
139139
return (
140140
<IntegerSlider
@@ -144,9 +144,9 @@ function EditRunLimit({
144144
max={300}
145145
maxText={MAX_ALLOWED_RUN_LIMIT}
146146
onChange={onChange}
147-
units={type === "course" ? "students" : "projects"}
147+
units={source === "course" ? "students" : "projects"}
148148
presets={
149-
type === "course"
149+
source === "course"
150150
? [10, 25, 50, 75, 100, 125, 150, 200]
151151
: [1, 2, 10, 50, 100, 250, 500]
152152
}

src/packages/next/components/store/site-license.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export default function SiteLicense({ noAccount, source }: Props) {
8383
</Title>
8484
{router.query.id == null && (
8585
<>
86-
{source === "license" && (
86+
{source === "site-license" && (
8787
<div>
8888
<Paragraph style={{ fontSize: "12pt" }}>
8989
<A href="https://doc.cocalc.com/licenses.html">

src/packages/next/tsconfig.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,16 @@
3333
"locales/*/*.json",
3434
"locales/en/common.ts"
3535
],
36-
"exclude": ["node_modules", "public", "styles", "dist"],
36+
"exclude": [
37+
"node_modules",
38+
"public",
39+
"styles",
40+
"dist",
41+
".next",
42+
"target",
43+
"locales",
44+
"software-inventory"
45+
],
3746
"references": [
3847
{ "path": "../backend" },
3948
{ "path": "../database" },

src/packages/util/licenses/purchase/purchase-info.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export default function getPurchaseInfo(
2727
disk,
2828
member,
2929
uptime,
30+
source,
3031
boost = false,
3132
} = conf;
3233
return {
@@ -47,6 +48,7 @@ export default function getPurchaseInfo(
4748
boost,
4849
title,
4950
description,
51+
source,
5052
};
5153

5254
case "vm":

src/packages/util/licenses/purchase/types.ts

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
/*
2+
* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
3+
* License: MS-RSL – see LICENSE.md for details
4+
*/
5+
6+
import type { Uptime } from "@cocalc/util/consts/site-license";
7+
import type { DedicatedDisk, DedicatedVM } from "@cocalc/util/types/dedicated";
8+
import type {
9+
CustomDescription,
10+
LicenseSource,
11+
Period,
12+
} from "@cocalc/util/upgrades/shopping";
13+
114
export type User = "academic" | "business";
215
export type Upgrade = "basic" | "standard" | "max" | "custom";
316
export type Subscription = "no" | "monthly" | "yearly";
@@ -45,15 +58,6 @@ export interface StartEndDatesWithStrings {
4558
end: Date | string;
4659
}
4760

48-
/*
49-
* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
50-
* License: MS-RSL – see LICENSE.md for details
51-
*/
52-
53-
import type { Uptime } from "@cocalc/util/consts/site-license";
54-
import type { DedicatedDisk, DedicatedVM } from "@cocalc/util/types/dedicated";
55-
import type { CustomDescription, Period } from "../../upgrades/shopping";
56-
5761
interface Version {
5862
version: string; // it's just a string with no special interpretation.
5963
}
@@ -81,9 +85,12 @@ interface PurchaseInfoQuota0 {
8185
run_limit?: number;
8286
}
8387

88+
type PurchseInfoSource = { source?: LicenseSource };
89+
8490
export type PurchaseInfoQuota = PurchaseInfoQuota0 &
8591
CustomDescription &
86-
StartEndDates;
92+
StartEndDates &
93+
PurchseInfoSource;
8794

8895
export type PurchaseInfoVoucher = {
8996
type: "vouchers";

src/packages/util/upgrades/shopping.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export type VMCostProps = {
2727
};
2828

2929
// the store's source page from where a site-license has been created
30-
export type LicenseSource = "license" | "course";
30+
export type LicenseSource = "site-license" | "course";
3131

3232
export type QuotaCostProps = {
3333
type: "quota";

0 commit comments

Comments
 (0)