Skip to content

Commit 8a7d685

Browse files
Added V2 accessor to config service. Resolves #1185. (#1190)
1 parent 465d888 commit 8a7d685

File tree

10 files changed

+33
-9
lines changed

10 files changed

+33
-9
lines changed

spa/src/app/config/_ngrx/config.state.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class ConfigState {
3030
public static getDefaultState() {
3131

3232
return new ConfigState(
33-
new Config("", "", "", "", "", ""));
33+
new Config("", "", "", "", "", "", ""));
3434
}
3535

3636
/**

spa/src/app/config/config.model.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,31 @@ export class Config {
1313
public readonly portalURL: string;
1414
public readonly deployment: string;
1515
public readonly projectMetaURL: string;
16+
public readonly version: string;
1617

1718
/**
1819
* @param {string} dataURL
1920
* @param {string} dcpHealthCheckUrl
21+
* @param {string} deployment
2022
* @param {string} matrixURL
2123
* @param {string} portalURL
2224
* @param {string} projectMetaURL
25+
* @param {string} version
2326
*/
2427
constructor(dataURL: string,
2528
dcpHealthCheckUrl: string,
29+
deployment: string,
2630
matrixURL: string,
2731
portalURL: string,
2832
projectMetaURL: string,
29-
deployment: string) {
33+
version: string) {
3034

3135
this.dataURL = dataURL;
3236
this.dcpHealthCheckUrl = dcpHealthCheckUrl;
3337
this.matrixURL = matrixURL;
3438
this.deployment = deployment;
3539
this.portalURL = portalURL;
3640
this.projectMetaURL = projectMetaURL;
41+
this.version = version;
3742
}
3843
}

spa/src/app/config/config.service.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export class ConfigService {
2626
private deployment: string;
2727
private projectMetaURL: string;
2828
private store: Store<AppState>;
29+
private version: string;
2930

3031
/**
3132
* @param store {Store<AppState>}
@@ -171,6 +172,16 @@ export class ConfigService {
171172
return this.deployment === "ux-dev";
172173
}
173174

175+
/**
176+
* Returns true if the current environment is a version 2.0 environment.
177+
*
178+
* @returns {boolean}
179+
*/
180+
public isV2(): boolean {
181+
182+
return this.version === "2.0";
183+
}
184+
174185
/**
175186
* Save the data URL as a local variable ogetAPIURLn this instance, and update the corresponding config value in the store.
176187
*
@@ -184,6 +195,7 @@ export class ConfigService {
184195
this.deployment = config.deployment;
185196
this.portalURL = config.portalURL;
186197
this.projectMetaURL = config.projectMetaURL;
198+
this.version = config.version;
187199
this.store.dispatch(new FetchConfigRequestSuccessAction(config));
188200
}
189201
}

spa/src/environments/environment.cgl-dev.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ export const environment = {
55
matrixURL: "https://matrix.data.humancellatlas.org/v0/matrix",
66
portalURL: "https://dev.singlecell.gi.ucsc.edu",
77
projectMetaURL: "https://dev.singlecell.gi.ucsc.edu",
8-
deployment: "cgl-dev"
8+
deployment: "cgl-dev",
9+
version: "2.0"
910
};

spa/src/environments/environment.develop.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ export const environment = {
55
matrixURL: "https://matrix.staging.data.humancellatlas.org/v0/matrix",
66
portalURL: "https://dev.data.humancellatlas.org",
77
projectMetaURL: "https://dev.data.humancellatlas.org",
8-
deployment: "develop"
8+
deployment: "develop",
9+
version: "1.0"
910
};

spa/src/environments/environment.integration.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ export const environment = {
55
matrixURL: "https://matrix.integration.data.humancellatlas.org/v0/matrix",
66
portalURL: "https://integration.data.humancellatlas.org",
77
projectMetaURL: "https://integration.data.humancellatlas.org",
8-
deployment: "integration"
8+
deployment: "integration",
9+
version: "1.0"
910
};

spa/src/environments/environment.prod.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ export const environment = {
55
matrixURL: "https://matrix.data.humancellatlas.org/v0/matrix",
66
portalURL: "https://data.humancellatlas.org",
77
projectMetaURL: "https://data.humancellatlas.org",
8-
deployment: "prod"
8+
deployment: "prod",
9+
version: "1.0"
910
};

spa/src/environments/environment.staging.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ export const environment = {
55
matrixURL: "https://matrix.staging.data.humancellatlas.org/v0/matrix",
66
portalURL: "https://staging.data.humancellatlas.org",
77
projectMetaURL: "https://staging.data.humancellatlas.org",
8-
deployment: "staging"
8+
deployment: "staging",
9+
version: "1.0"
910
};

spa/src/environments/environment.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ export const environment = {
1010
matrixURL: "https://matrix.staging.data.humancellatlas.org/v0/matrix",
1111
portalURL: "https://dev.data.humancellatlas.org",
1212
projectMetaURL: "https://dev.data.humancellatlas.org",
13-
deployment: "local"
13+
deployment: "local",
14+
version: "1.0"
1415
};

spa/src/environments/environment.ux-dev.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ export const environment = {
55
matrixURL: "https://matrix.data.humancellatlas.org/v0/matrix",
66
portalURL: "https://ux-dev.data.humancellatlas.org",
77
projectMetaURL: "https://data.humancellatlas.org",
8-
deployment: "ux-dev"
8+
deployment: "ux-dev",
9+
version: "1.0"
910
};

0 commit comments

Comments
 (0)