Skip to content

Remove licensor component #16983

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
/install/installer/pkg/components/ws-manager-bridge @gitpod-io/engineering-webapp
/install/installer/pkg/components/ws-proxy @gitpod-io/engineering-workspace
/install/installer/pkg/config/versions @gitpod-io/engineering-ide
/components/licensor @gitpod-io/engineering-webapp
/components/local-app-api @csweichel @akosyakov
/components/local-app @gitpod-io/engineering-ide
/components/openvsx-proxy @gitpod-io/engineering-ide
Expand Down
2 changes: 1 addition & 1 deletion WORKSPACE.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ defaultArgs:
jbBackendVersion: "latest"
REPLICATED_API_TOKEN: ""
REPLICATED_APP: ""
dockerVersion: 20.10.17
dockerVersion: 20.10.23
dockerComposeVersion: "2.16.0-gitpod.0"
provenance:
enabled: true
Expand Down
3 changes: 0 additions & 3 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ flags:
components-image-builder-app:
paths:
- components/image-builder/
components-licensor-app:
paths:
- components/licensor/
components-local-app-api-go-lib:
paths:
- components/local-app-api/go/
Expand Down
118 changes: 6 additions & 112 deletions components/dashboard/src/admin/License.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@ export default function License() {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

const featureList = license?.enabledFeatures;
const features = license?.features;

// if user seats is 0, it means that there is no user limit in the license
const userLimit = license?.seats === 0 ? "Unlimited" : license?.seats;
const userLimit = "Unlimited";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ do we need the License page at all?
cc. @geropl and @atduarte

We can do that as a follow-up.


const [licenseLevel, paid, statusMessage] = license ? getSubscriptionLevel(license) : defaultMessage();

Expand All @@ -49,20 +45,6 @@ export default function License() {
<span>
{licenseLevel}
{paid}
<div className="mt-4 font-semibold text-sm">Available features:</div>
<div className="flex flex-col items-start text-sm">
{features &&
features.map((feat: string) => (
<span className="inline-flex space-x-1">
{featureList?.includes(feat) ? (
<CheckSvg fill="currentColor" className="self-center mt-1" />
) : (
<XSvg fill="currentColor" className="self-center h-2 mt-1" />
)}
<span>{capitalizeInitials(feat)}</span>
</span>
))}
</div>
</span>
</Card>
<SolidCard className="w-72 h-64">
Expand All @@ -71,18 +53,6 @@ export default function License() {
<p className="dark:text-gray-500 font-semibold">Registered Users</p>
<span className="dark:text-gray-300 text-lg">{license?.userCount || 0}</span>
<span className="dark:text-gray-500 text-gray-400 pt-1 text-lg"> / {userLimit} </span>
<p className="dark:text-gray-500 pt-2 font-semibold">License Type</p>
<h4 className="dark:text-gray-300 text-lg">{capitalizeInitials(license?.type || "")}</h4>
<a
className="gp-link flex flex-row mr-2 justify-end font-semibold space-x-2 mt-6"
href="https://www.gitpod.io/self-hosted"
target="_blank"
>
<span className="text-sm">Compare Plans</span>
<div className="self-end">
<LinkSvg />
</div>
</a>
</span>
</SolidCard>
</div>
Expand All @@ -91,26 +61,8 @@ export default function License() {
);
}

function capitalizeInitials(str: string): string {
return str
.split("-")
.map((item) => {
return item.charAt(0).toUpperCase() + item.slice(1);
})
.join(" ");
}

function getSubscriptionLevel(license: LicenseInfo): ReactElement[] {
switch (license.plan) {
case "prod":
case "trial":
return professionalPlan(license.userCount || 0, license.seats, license.plan == "trial", license.validUntil);
case "community":
return communityPlan(license.userCount || 0, license.seats, license.fallbackAllowed);
default: {
return defaultMessage();
}
}
return professionalPlan(license.userCount || 0);
}

function licenseLevel(level: string): ReactElement {
Expand All @@ -136,16 +88,9 @@ function defaultMessage(): ReactElement[] {
return [licenseLevel("Inactive"), additionalLicenseInfo("Free"), alertMessage()];
}

function professionalPlan(userCount: number, seats: number, trial: boolean, validUntil: string): ReactElement[] {
const alertMessage = (aboveLimit: boolean) => {
return aboveLimit ? (
<span className="text-red-700 dark:text-red-400 flex font-semibold items-center">
<div>You have exceeded the usage limit.</div>
<div className="flex justify-right my-4 mr-2 ml-4">
<Alert className="h-6 w-6" />
</div>
</span>
) : (
function professionalPlan(userCount: number): ReactElement[] {
const alertMessage = () => {
return (
<span className="text-green-600 dark:text-green-400 flex font-semibold items-center">
<div>You have an active professional license.</div>
<div className="flex justify-right my-4 mr-2 ml-4">
Expand All @@ -155,56 +100,5 @@ function professionalPlan(userCount: number, seats: number, trial: boolean, vali
);
};

// seats === 0 means unlimited number of users
const aboveLimit: boolean = seats === 0 ? false : userCount > seats;

const licenseTitle = () => {
const expDate = new Date(validUntil);
if (typeof expDate.getTime !== "function") {
return trial ? additionalLicenseInfo("Trial") : additionalLicenseInfo("Paid");
} else {
return additionalLicenseInfo(
"Expires on " +
expDate.toLocaleDateString("en-DB", { year: "numeric", month: "short", day: "numeric" }),
);
}
};

return [licenseLevel("Professional"), licenseTitle(), alertMessage(aboveLimit)];
}

function communityPlan(userCount: number, seats: number, fallbackAllowed: boolean): ReactElement[] {
const alertMessage = (aboveLimit: boolean) => {
if (aboveLimit) {
return fallbackAllowed ? (
<div className="text-gray-600 dark:text-gray-50 flex font-semibold items-center">
<div>No active license. You are using community edition.</div>
<div className="my-4 mr-2 ml-4">
<Success className="h-8 w-8" />
</div>
</div>
) : (
<span className="text-red-700 dark:text-red-400 flex font-semibold items-center">
<div>No active license. You have exceeded the usage limit.</div>
<div className="flex justify-right my-4 mr-2 ml-4">
<Alert className="h-8 w-8" />
</div>
</span>
);
} else {
return (
<span className="text-green-600 dark:text-green-400 flex font-semibold items-center">
<div>You are using the free community edition.</div>
<div className="flex justify-right my-4 mr-2 ml-4">
<Success fill="green" className="h-8 w-8" />
</div>
</span>
);
}
};

// seats === 0 means unlimited number of users
const aboveLimit: boolean = seats === 0 ? false : userCount > seats;

return [licenseLevel("Community"), additionalLicenseInfo("Free"), alertMessage(aboveLimit)];
return [licenseLevel("Professional"), additionalLicenseInfo("Paid"), alertMessage()];
}
19 changes: 0 additions & 19 deletions components/gitpod-protocol/src/license-protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,19 @@
export interface LicenseValidationResult {
valid: boolean;
msg?: string;
issue?: LicenseIssue;
}

export type LicenseIssue = "seats-exhausted";

export interface LicenseInfo {
key: string;
seats: number;
userCount?: number;
valid: boolean;
validUntil: string;
plan?: string;
features?: string[];
enabledFeatures?: string[];
type?: string;
errorMsg?: string;
fallbackAllowed: boolean;
}

export interface GetLicenseInfoResult {
isAdmin: boolean;
licenseInfo: LicenseInfo;
}

export enum LicenseFeature {
CreateSnapshot = "create-snapshot",
// room for more
}

export interface LicenseService {
validateLicense(): Promise<LicenseValidationResult>;
getLicenseInfo(): Promise<GetLicenseInfoResult>;
adminGetLicense(): Promise<LicenseInfo>;
licenseIncludesFeature(feature: LicenseFeature): Promise<boolean>;
}
2 changes: 0 additions & 2 deletions components/licensor/.gitignore

This file was deleted.

16 changes: 0 additions & 16 deletions components/licensor/BUILD.yaml

This file was deleted.

69 changes: 0 additions & 69 deletions components/licensor/ee/cmd/genkey.go

This file was deleted.

27 changes: 0 additions & 27 deletions components/licensor/ee/cmd/root.go

This file was deleted.

Loading