Skip to content
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

Revert "DO NOT MERGE THIS" #4957

Merged
merged 1 commit into from
Jul 26, 2021
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
11 changes: 1 addition & 10 deletions components/dashboard/src/service/service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ import { createWindowMessageConnection } from '@gitpod/gitpod-protocol/lib/messa
import { JsonRpcProxyFactory } from '@gitpod/gitpod-protocol/lib/messaging/proxy-factory';
import { GitpodHostUrl } from '@gitpod/gitpod-protocol/lib/util/gitpod-host-url';
import { log } from '@gitpod/gitpod-protocol/lib/util/logging';
import { gitpodServiceMock } from './service-mock';

export const gitpodHostUrl = new GitpodHostUrl(window.location.toString());

// @ts-ignore
function createGitpodService<C extends GitpodClient, S extends GitpodServer>() {
if (window.top !== window.self && process.env.NODE_ENV === 'production') {
const connection = createWindowMessageConnection('gitpodServer', window.parent, '*');
Expand Down Expand Up @@ -53,14 +51,7 @@ function createGitpodService<C extends GitpodClient, S extends GitpodServer>() {
function getGitpodService(): GitpodService {
const w = window as any;
const _gp = w._gp || (w._gp = {});
const createService = () => {
if (window.location.search.includes("mock")) {
return gitpodServiceMock;
} else {
return createGitpodService();
}
}
const service = _gp.gitpodService || (_gp.gitpodService = createService());
const service = _gp.gitpodService || (_gp.gitpodService = createGitpodService());
return service;
}

Expand Down
21 changes: 9 additions & 12 deletions components/licensor/typescript/ee/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { injectable, inject, postConstruct } from 'inversify';
import { init, Instance, dispose, inspect, validate } from "./nativemodule";
import { init, Instance, dispose, isEnabled, hasEnoughSeats, canUsePrebuild, inspect, validate } from "./nativemodule";
import { Feature, LicensePayload } from './api';

export const LicenseKeySource = Symbol("LicenseKeySource");
Expand Down Expand Up @@ -38,30 +38,27 @@ export class LicenseEvaluator {

public async reloadLicense() {
this.dispose()
// await this.init()
await this.init()
}

public validate(): { msg?: string, valid: boolean } {
// const v = validate(this.instanceID);
// if (v.valid) {
const v = validate(this.instanceID);
if (v.valid) {
return { valid: true };
// }
// return { msg: v.msg, valid: false };
}
return { msg: v.msg, valid: false };
}

public isEnabled(feature: Feature): boolean {
// return isEnabled(this.instanceID, feature);
return true;
return isEnabled(this.instanceID, feature);
}

public hasEnoughSeats(seats: number): boolean {
// return hasEnoughSeats(this.instanceID, seats);
return true;
return hasEnoughSeats(this.instanceID, seats);
}

public canUsePrebuild(totalPrebuildSecondsSpent: number): boolean {
// return canUsePrebuild(this.instanceID, totalPrebuildSecondsSpent);
return true;
return canUsePrebuild(this.instanceID, totalPrebuildSecondsSpent);
}

public inspect(): LicensePayload {
Expand Down