Skip to content

Commit 2114062

Browse files
AlexTugarevroboquat
authored andcommitted
DO NOT MERGE THIS
1 parent 9d5713a commit 2114062

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

components/dashboard/src/service/service.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ import { createWindowMessageConnection } from '@gitpod/gitpod-protocol/lib/messa
1010
import { JsonRpcProxyFactory } from '@gitpod/gitpod-protocol/lib/messaging/proxy-factory';
1111
import { GitpodHostUrl } from '@gitpod/gitpod-protocol/lib/util/gitpod-host-url';
1212
import { log } from '@gitpod/gitpod-protocol/lib/util/logging';
13+
import { gitpodServiceMock } from './service-mock';
1314

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

17+
// @ts-ignore
1618
function createGitpodService<C extends GitpodClient, S extends GitpodServer>() {
1719
if (window.top !== window.self && process.env.NODE_ENV === 'production') {
1820
const connection = createWindowMessageConnection('gitpodServer', window.parent, '*');
@@ -51,7 +53,14 @@ function createGitpodService<C extends GitpodClient, S extends GitpodServer>() {
5153
function getGitpodService(): GitpodService {
5254
const w = window as any;
5355
const _gp = w._gp || (w._gp = {});
54-
const service = _gp.gitpodService || (_gp.gitpodService = createGitpodService());
56+
const createService = () => {
57+
if (window.location.search.includes("mock")) {
58+
return gitpodServiceMock;
59+
} else {
60+
return createGitpodService();
61+
}
62+
}
63+
const service = _gp.gitpodService || (_gp.gitpodService = createService());
5564
return service;
5665
}
5766

components/licensor/typescript/ee/src/index.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66

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

1111
export const LicenseKeySource = Symbol("LicenseKeySource");
@@ -38,27 +38,30 @@ export class LicenseEvaluator {
3838

3939
public async reloadLicense() {
4040
this.dispose()
41-
await this.init()
41+
// await this.init()
4242
}
4343

4444
public validate(): { msg?: string, valid: boolean } {
45-
const v = validate(this.instanceID);
46-
if (v.valid) {
45+
// const v = validate(this.instanceID);
46+
// if (v.valid) {
4747
return { valid: true };
48-
}
49-
return { msg: v.msg, valid: false };
48+
// }
49+
// return { msg: v.msg, valid: false };
5050
}
5151

5252
public isEnabled(feature: Feature): boolean {
53-
return isEnabled(this.instanceID, feature);
53+
// return isEnabled(this.instanceID, feature);
54+
return true;
5455
}
5556

5657
public hasEnoughSeats(seats: number): boolean {
57-
return hasEnoughSeats(this.instanceID, seats);
58+
// return hasEnoughSeats(this.instanceID, seats);
59+
return true;
5860
}
5961

6062
public canUsePrebuild(totalPrebuildSecondsSpent: number): boolean {
61-
return canUsePrebuild(this.instanceID, totalPrebuildSecondsSpent);
63+
// return canUsePrebuild(this.instanceID, totalPrebuildSecondsSpent);
64+
return true;
6265
}
6366

6467
public inspect(): LicensePayload {

0 commit comments

Comments
 (0)