MNT-22687- Add new aosPlugin variable to hide or show the AOS plugin (#2382)

* MNT-22687- Add new aosPlugin variable to hide or show the AOS plugin

* MNT-22687 - Added a new interface to extend the RuleContext from ADF

* MNT-22687 - Removed carriage return and added whitespaces

* MNT-22687 - Removed carriage returns

* MNT-22687 - Fixed PR Comments
Completed documentation, removed environment variable from the package.json, added plugins section in the app.config.json.tpl

* MNT-22687 - Created a new service to deal with the new functionality. Reverted the old approach.

* MNT-22687 - Reverted missing file

* MNT-22687 - Reverted missing file

* MNT-22687 - Removed variable replacement

* MNT-22687 - Included environment variables in the README.md file
This commit is contained in:
Antonio Felix
2022-02-08 13:18:28 +00:00
committed by GitHub
parent 9b8ae32aad
commit fce8857585
9 changed files with 198 additions and 4 deletions

View File

@@ -70,3 +70,11 @@ Update `app.extensions.json` and append a reference to the plugin definition:
"$references": ["aos.plugin.json"]
}
```
## Disable and Enable the extension after it is installed
There's an environment that can disable or enable the installed extension.
In the `app.config.json` file there's a `aosPlugin` boolean variable where you can toggle the value `false` or `true` if you want to hide or show the extension.
The extension is enabled by default.

View File

@@ -28,6 +28,7 @@ import { NgModule } from '@angular/core';
import { EffectsModule } from '@ngrx/effects';
import { AosEffects } from './effects/aos.effects';
import { TranslationService } from '@alfresco/adf-core';
import { AlfrescoOfficeExtensionService } from 'projects/aca-shared/src/lib/services/alfresco-office-extension.service';
import { canOpenWithOffice } from './evaluators';
@NgModule({
@@ -35,10 +36,16 @@ import { canOpenWithOffice } from './evaluators';
providers: [provideExtensionConfig(['aos.plugin.json'])]
})
export class AosExtensionModule {
constructor(extensions: ExtensionService, translation: TranslationService) {
constructor(extensions: ExtensionService, translation: TranslationService, aosService: AlfrescoOfficeExtensionService) {
translation.addTranslationFolder('adf-office-services-ext', 'assets/adf-office-services-ext');
extensions.setEvaluators({
'aos.canOpenWithOffice': canOpenWithOffice
});
if (!aosService.isAosPluginEnabled()) {
extensions.setEvaluators({
'aos.canOpenWithOffice': () => false
});
} else {
extensions.setEvaluators({
'aos.canOpenWithOffice': canOpenWithOffice
});
}
}
}