Commit 6253eb78 authored by David Diederich's avatar David Diederich
Browse files

Merge branch 'fix_Anthos_logger_minio' into 'master'

fix: Anthos logger, MinIO list objects, and search Datasets by gtags

See merge request !467
parents b8ddc6dc e1d9843d
Pipeline #135342 passed with stages
in 4 minutes and 18 seconds
......@@ -13,10 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import { getLogger } from 'log4js';
import { AbstractLogger, LoggerFactory } from '../../logger';
import { AnthosConfig } from './config';
// fetch logger and export
@LoggerFactory.register('anthos')
......@@ -24,16 +21,17 @@ export class AnthosLogger extends AbstractLogger {
public info(data: any): void {
// tslint:disable-next-line:no-logger
logger.info(data);
console.log(data);
}
public debug(data: any): void {
// tslint:disable-next-line:no-logger
logger.debug(data);
console.debug(data);
}
public error(data: any): void {
logger.error(data);
// tslint:disable-next-line:no-logger
console.error(data);
}
// [TODO] this method should report a metrics using CSP SDK
......@@ -41,9 +39,3 @@ export class AnthosLogger extends AbstractLogger {
return;
}
}
export const logger = getLogger();
export function config() {
logger.level = AnthosConfig.LOGGER_LEVEL;
}
......@@ -57,8 +57,8 @@ const datastorePSQLMapper: object = {
'<': 'lt',
'>': 'gt',
'<=': 'lte',
'>=': 'gte'
'>=': 'gte',
'CONTAINS': 'array_contains'
}
......@@ -227,7 +227,7 @@ export class PostgreSQLDAO extends AbstractJournal {
}
public getQueryFilterSymbolContains(): string {
return '=';
return 'CONTAINS';
}
}
......@@ -394,7 +394,12 @@ class PostgreJSONDataSQLFilter {
}
const psqlOperator = datastorePSQLMapper[this.operator];
filter['data'][psqlOperator] = this.value;
// Prisma for PostgreSQL requires a value to be an array if the operator is 'array_contains'
if (this.operator === 'CONTAINS') {
filter['data'][psqlOperator] = [this.value];
} else {
filter['data'][psqlOperator] = this.value;
}
return filter as FilterExpression;
}
......
......@@ -185,7 +185,7 @@ export class MinIOStorage extends AbstractStorage {
}
);
const listedObjects = await this.s3.send(listCommand);
if (listedObjects.Contents.length === 0)
if (typeof(listedObjects.Contents) === 'undefined' || listedObjects.Contents.length === 0)
return;
const deleteParams = {
......@@ -263,7 +263,8 @@ export class MinIOStorage extends AbstractStorage {
const listCommand = new ListObjectsCommand(params);
const listedObjects = await this.s3.send(listCommand);
if (listedObjects.Contents.length === 0) return;
if (typeof(listedObjects.Contents) === 'undefined' || listedObjects.Contents.length === 0)
return;
const deleteParams = {
Bucket: this.minioBucket,
......@@ -342,7 +343,7 @@ export class MinIOStorage extends AbstractStorage {
try {
const listCommand = new ListObjectsCommand(params);
const listedObjects = await this.s3.send(listCommand);
if (listedObjects.Contents.length === 0)
if (typeof(listedObjects.Contents) === 'undefined' || listedObjects.Contents.length === 0)
return false;
return true;
} catch (err) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment