Skip to content

Commit 8bad447

Browse files
committed
RM-35685: Fixed wrong description of function, logging all messages retrieved from the viewer in project creation, small code improvement.
1 parent a0a067d commit 8bad447

3 files changed

Lines changed: 12 additions & 17 deletions

File tree

dist/index.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,10 +1231,8 @@ class TicsCli {
12311231
if (input === '') {
12321232
throw Error('Parameter `project` is emtpy, TICS cannot run without it.');
12331233
}
1234-
if (mode === tics_1.Mode.QSERVER) {
1235-
if (input === 'auto') {
1236-
throw Error(`Running TICS with project 'auto' is not possible with QServer`);
1237-
}
1234+
if (input === 'auto' && mode === tics_1.Mode.QSERVER) {
1235+
throw Error(`Running TICS with project 'auto' is not possible with QServer`);
12381236
}
12391237
return input;
12401238
}
@@ -3130,8 +3128,8 @@ const response_1 = __nccwpck_require__(93590);
31303128
const url_1 = __nccwpck_require__(71112);
31313129
const http_client_1 = __nccwpck_require__(80939);
31323130
/**
3133-
* Gets the date of the last QServer run the viewer knows of.
3134-
* @throws Error if project cannot be created or does not exist.
3131+
* Creates a project in the viewer if it does not exist.
3132+
* @throws Error if project cannot be created.
31353133
*/
31363134
async function createProject() {
31373135
const createProjectUrl = (0, url_1.joinUrl)(config_1.ticsConfig.baseUrl, `api/public/v1/fapi/Project?cfg=${config_1.ticsConfig.configuration}`);
@@ -3146,8 +3144,8 @@ async function createProject() {
31463144
logger_1.logger.header('Creating/updating the TICS project');
31473145
logger_1.logger.debug(`With ${createProjectUrl}`);
31483146
const response = await http_client_1.httpClient.put(createProjectUrl, JSON.stringify(body));
3149-
if (response.data.alertMessages.length > 0) {
3150-
logger_1.logger.info(response.data.alertMessages[0].header);
3147+
for (const message of response.data.alertMessages) {
3148+
logger_1.logger.info(message.header);
31513149
}
31523150
}
31533151
catch (error) {

src/configuration/tics-cli.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,8 @@ export class TicsCli {
4545
if (input === '') {
4646
throw Error('Parameter `project` is emtpy, TICS cannot run without it.');
4747
}
48-
49-
if (mode === Mode.QSERVER) {
50-
if (input === 'auto') {
51-
throw Error(`Running TICS with project 'auto' is not possible with QServer`);
52-
}
48+
if (input === 'auto' && mode === Mode.QSERVER) {
49+
throw Error(`Running TICS with project 'auto' is not possible with QServer`);
5350
}
5451
return input;
5552
}

src/viewer/project.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import { joinUrl } from '../helper/url';
66
import { httpClient } from './http-client';
77

88
/**
9-
* Gets the date of the last QServer run the viewer knows of.
10-
* @throws Error if project cannot be created or does not exist.
9+
* Creates a project in the viewer if it does not exist.
10+
* @throws Error if project cannot be created.
1111
*/
1212
export async function createProject(): Promise<void> {
1313
const createProjectUrl = joinUrl(ticsConfig.baseUrl, `api/public/v1/fapi/Project?cfg=${ticsConfig.configuration}`);
@@ -22,8 +22,8 @@ export async function createProject(): Promise<void> {
2222
logger.header('Creating/updating the TICS project');
2323
logger.debug(`With ${createProjectUrl}`);
2424
const response = await httpClient.put<HttpBadRequestResponse>(createProjectUrl, JSON.stringify(body));
25-
if (response.data.alertMessages.length > 0) {
26-
logger.info(response.data.alertMessages[0].header);
25+
for (const message of response.data.alertMessages) {
26+
logger.info(message.header);
2727
}
2828
} catch (error: unknown) {
2929
const message = getRetryErrorMessage(error);

0 commit comments

Comments
 (0)