mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ACA-4266] Improve governance plugin check logs (#6656)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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'}]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user