mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
* [ACA-4227] Create a generic script to check plugin status before running e2e tests by plugin name * * Added governace env check * * Added AAE plugin check * * Updated script * small improvements, add uiName parameter for the command * * Fixed comments * * Moved check-plugin script in the common place * * Added table format to show plugin status Co-authored-by: adomi <ardit.domi@alfresco.com>
56 lines
2.0 KiB
TypeScript
56 lines
2.0 KiB
TypeScript
import { PluginInterface } from './plugin-model';
|
|
import { logger } from '../logger';
|
|
import { ProcessAutomationHealth } from './process-automation-health';
|
|
|
|
export class ProcessAutomationCheckPlugin {
|
|
processAutomationHealth: ProcessAutomationHealth;
|
|
|
|
constructor(
|
|
private plugInInfo: PluginInterface,
|
|
private alfrescoJsApi: any
|
|
) {
|
|
this.processAutomationHealth = new ProcessAutomationHealth(
|
|
this.plugInInfo,
|
|
this.alfrescoJsApi
|
|
);
|
|
}
|
|
|
|
async checkProcessAutomationPlugin() {
|
|
let pluginStatus;
|
|
try {
|
|
const isPluginEnabled = await this.processAutomationHealth.isPluginEnabledFromAppConfiguration();
|
|
const isBackendActive = await this.processAutomationHealth.checkBackendHealth();
|
|
|
|
if (isPluginEnabled && isBackendActive) {
|
|
logger.info(
|
|
`The plugin ${
|
|
this.plugInInfo.name
|
|
} has been correctly configured`
|
|
);
|
|
|
|
pluginStatus = [{ PluginName: this.plugInInfo.name, Status: 'Active', BE: 'Enabled', FE: 'Enabled' }];
|
|
console.table(pluginStatus);
|
|
} else {
|
|
this.logConfigurationError();
|
|
pluginStatus = [{ PluginName: this.plugInInfo.name, Status: 'Inactive', BE: isBackendActive ? 'Enabled' : 'Disabled', FE: isPluginEnabled ? 'Enabled' : 'Disabled' }];
|
|
console.table(pluginStatus);
|
|
process.exit(1);
|
|
}
|
|
} catch (e) {
|
|
this.logConfigurationError(e);
|
|
pluginStatus = [{ PluginName: this.plugInInfo.name, Status: 'Inactive', BE: 'Disabled', FE: 'Disabled' }];
|
|
console.table(pluginStatus);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
private logConfigurationError(error?: any) {
|
|
logger.error(
|
|
`The plugin ${
|
|
this.plugInInfo.name
|
|
} has not been correctly configured`,
|
|
error
|
|
);
|
|
}
|
|
}
|