From 5148094ec3a23d7868483a6115aba2d29ebebc16 Mon Sep 17 00:00:00 2001 From: siva kumar Date: Wed, 10 Feb 2021 16:32:57 +0530 Subject: [PATCH] [ACA-4266] Improve governance plugin check logs (#6656) --- lib/cli/scripts/plugins/governance-check-plugin.ts | 9 +-------- lib/cli/scripts/plugins/governance-health.ts | 8 +++++++- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/cli/scripts/plugins/governance-check-plugin.ts b/lib/cli/scripts/plugins/governance-check-plugin.ts index 638246d86d..ec542e58c3 100644 --- a/lib/cli/scripts/plugins/governance-check-plugin.ts +++ b/lib/cli/scripts/plugins/governance-check-plugin.ts @@ -7,20 +7,13 @@ export class GovernanceCheckPlugin { private pluginInfo: PluginInterface, private alfrescoJsApi: any ) { - this.governanceHealth = new GovernanceHealth(this.alfrescoJsApi); + this.governanceHealth = new GovernanceHealth(this.pluginInfo, this.alfrescoJsApi); } async checkRecordManagement() { - let pluginStatus; - const isAvailable = await this.governanceHealth.isRecordManagementAvailable(); if (!isAvailable) { await this.governanceHealth.createRecordManagementSite(); - pluginStatus = [{ PluginName: this.pluginInfo.name, Status: 'Active', RecordManagement: 'Created'}]; - console.table(pluginStatus); - } else { - pluginStatus = [{ PluginName: this.pluginInfo.name, Status: 'Active', RecordManagement: 'Available' }]; - console.table(pluginStatus); } } } diff --git a/lib/cli/scripts/plugins/governance-health.ts b/lib/cli/scripts/plugins/governance-health.ts index 373bb95834..616599803b 100644 --- a/lib/cli/scripts/plugins/governance-health.ts +++ b/lib/cli/scripts/plugins/governance-health.ts @@ -1,7 +1,8 @@ import { logger } from '../logger'; +import { PluginInterface } from './plugin-model'; export class GovernanceHealth { - constructor(private alfrescoJsApi: any) {} + constructor(private pluginInfo: PluginInterface, private alfrescoJsApi: any) {} async isRecordManagementAvailable() { try { @@ -9,6 +10,7 @@ export class GovernanceHealth { logger.info( `Record Management site is present: ${site.entry.title}` ); + console.table([{ PluginName: this.pluginInfo.name, Status: 'Active', RecordManagement: 'Available' }]); return true; } catch (error) { logger.error( @@ -16,6 +18,7 @@ export class GovernanceHealth { JSON.parse(error.message).error.errorKey }` ); + console.table([{ PluginName: this.pluginInfo.name, Status: 'Inactive', RecordManagement: 'Not available'}]); return false; } } @@ -25,17 +28,20 @@ export class GovernanceHealth { const opts = { skipAddToFavorites: false }; // | Flag to indicate whether the RM site should not be added to the user's site favorites. try { + logger.info('Trying to create Record Management site...'); const site = await this.alfrescoJsApi.gsCore.gsSitesApi.createRMSite( body, opts ); logger.info('Record Management site: created' + site); + console.table([{ PluginName: this.pluginInfo.name, Status: 'Active', RecordManagement: 'Created'}]); } catch (error) { logger.error( `Record Management site creation failed: ${ JSON.parse(error.message).error.errorKey }` ); + console.table([{ PluginName: this.pluginInfo.name, Status: 'Inactive', RecordManagement: 'Not created'}]); } } }