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 pluginInfo: PluginInterface,
|
||||||
private alfrescoJsApi: any
|
private alfrescoJsApi: any
|
||||||
) {
|
) {
|
||||||
this.governanceHealth = new GovernanceHealth(this.alfrescoJsApi);
|
this.governanceHealth = new GovernanceHealth(this.pluginInfo, this.alfrescoJsApi);
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkRecordManagement() {
|
async checkRecordManagement() {
|
||||||
let pluginStatus;
|
|
||||||
|
|
||||||
const isAvailable = await this.governanceHealth.isRecordManagementAvailable();
|
const isAvailable = await this.governanceHealth.isRecordManagementAvailable();
|
||||||
if (!isAvailable) {
|
if (!isAvailable) {
|
||||||
await this.governanceHealth.createRecordManagementSite();
|
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 { logger } from '../logger';
|
||||||
|
import { PluginInterface } from './plugin-model';
|
||||||
|
|
||||||
export class GovernanceHealth {
|
export class GovernanceHealth {
|
||||||
constructor(private alfrescoJsApi: any) {}
|
constructor(private pluginInfo: PluginInterface, private alfrescoJsApi: any) {}
|
||||||
|
|
||||||
async isRecordManagementAvailable() {
|
async isRecordManagementAvailable() {
|
||||||
try {
|
try {
|
||||||
@@ -9,6 +10,7 @@ export class GovernanceHealth {
|
|||||||
logger.info(
|
logger.info(
|
||||||
`Record Management site is present: ${site.entry.title}`
|
`Record Management site is present: ${site.entry.title}`
|
||||||
);
|
);
|
||||||
|
console.table([{ PluginName: this.pluginInfo.name, Status: 'Active', RecordManagement: 'Available' }]);
|
||||||
return true;
|
return true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(
|
logger.error(
|
||||||
@@ -16,6 +18,7 @@ export class GovernanceHealth {
|
|||||||
JSON.parse(error.message).error.errorKey
|
JSON.parse(error.message).error.errorKey
|
||||||
}`
|
}`
|
||||||
);
|
);
|
||||||
|
console.table([{ PluginName: this.pluginInfo.name, Status: 'Inactive', RecordManagement: 'Not available'}]);
|
||||||
return false;
|
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.
|
const opts = { skipAddToFavorites: false }; // | Flag to indicate whether the RM site should not be added to the user's site favorites.
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
logger.info('Trying to create Record Management site...');
|
||||||
const site = await this.alfrescoJsApi.gsCore.gsSitesApi.createRMSite(
|
const site = await this.alfrescoJsApi.gsCore.gsSitesApi.createRMSite(
|
||||||
body,
|
body,
|
||||||
opts
|
opts
|
||||||
);
|
);
|
||||||
logger.info('Record Management site: created' + site);
|
logger.info('Record Management site: created' + site);
|
||||||
|
console.table([{ PluginName: this.pluginInfo.name, Status: 'Active', RecordManagement: 'Created'}]);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(
|
logger.error(
|
||||||
`Record Management site creation failed: ${
|
`Record Management site creation failed: ${
|
||||||
JSON.parse(error.message).error.errorKey
|
JSON.parse(error.message).error.errorKey
|
||||||
}`
|
}`
|
||||||
);
|
);
|
||||||
|
console.table([{ PluginName: this.pluginInfo.name, Status: 'Inactive', RecordManagement: 'Not created'}]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user