From d1cae1464d1cdcd3078100608115a0a0f6bb4a96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Thu, 14 Nov 2024 12:27:00 +0100 Subject: [PATCH] MOBILE-4653 chore: Migrate site plugins to standalone components --- .../services/handlers/module.ts | 3 +- src/core/features/compile/services/compile.ts | 12 +++-- src/core/features/course/services/course.ts | 3 +- src/core/features/settings/pages/dev/dev.ts | 2 +- .../assign-feedback/assign-feedback.ts | 7 +++ .../assign-submission/assign-submission.ts | 7 +++ .../siteplugins/components/block/block.ts | 8 +++ .../components/components.module.ts | 40 --------------- .../components/course-format/course-format.ts | 8 +++ .../components/module-index/module-index.ts | 10 ++++ .../only-title-block/only-title-block.ts | 3 ++ .../plugin-content/plugin-content.ts | 7 +++ .../question-behaviour/question-behaviour.ts | 7 +++ .../components/question/question.ts | 7 +++ .../quiz-access-rule/quiz-access-rule.ts | 7 +++ .../user-profile-field/user-profile-field.ts | 7 +++ .../workshop-assessment-strategy.ts | 7 +++ .../core-siteplugins-course-option.html | 3 +- .../pages/course-option/course-option.ts | 8 ++- .../pages/module-index/module-index.ts | 9 +++- .../siteplugins/pages/plugin/plugin.ts | 9 +++- .../siteplugins/services/siteplugins-init.ts | 6 +-- .../siteplugins/siteplugins.module.ts | 51 ++++++++++++------- 23 files changed, 152 insertions(+), 79 deletions(-) diff --git a/src/addons/mod/bigbluebuttonbn/services/handlers/module.ts b/src/addons/mod/bigbluebuttonbn/services/handlers/module.ts index b458cc618..7d6d0ba6c 100644 --- a/src/addons/mod/bigbluebuttonbn/services/handlers/module.ts +++ b/src/addons/mod/bigbluebuttonbn/services/handlers/module.ts @@ -18,7 +18,6 @@ import { CoreModuleHandlerBase } from '@features/course/classes/module-base-hand import { CoreCourseModuleData } from '@features/course/services/course-helper'; import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@features/course/services/module-delegate'; import { CoreSitePluginsModuleHandler } from '@features/siteplugins/classes/handlers/module-handler'; -import { CoreSitePlugins } from '@features/siteplugins/services/siteplugins'; import { makeSingleton } from '@singletons'; import { AddonModBBBIndexComponent } from '../../components/index'; import { AddonModBBB } from '../bigbluebuttonbn'; @@ -60,6 +59,8 @@ export class AddonModBBBModuleHandlerService extends CoreModuleHandlerBase imple return true; } + const { CoreSitePlugins } = await import('@features/siteplugins/services/siteplugins'); + // Native support not available in this site. Check if it's supported by site plugin. this.sitePluginHandler = CoreSitePlugins.getModuleHandlerInstance(this.modName); // Change the handler name to be able to retrieve the plugin data in component. diff --git a/src/core/features/compile/services/compile.ts b/src/core/features/compile/services/compile.ts index d142682cf..75838e6db 100644 --- a/src/core/features/compile/services/compile.ts +++ b/src/core/features/compile/services/compile.ts @@ -103,7 +103,6 @@ import { CoreSharedModule } from '@/core/shared.module'; import { CoreCourseComponentsModule } from '@features/course/components/components.module'; import { CoreCourseDirectivesModule } from '@features/course/directives/directives.module'; import { CoreCoursesComponentsModule } from '@features/courses/components/components.module'; -import { CoreSitePluginsDirectivesModule } from '@features/siteplugins/directives/directives.module'; import { CoreUserComponentsModule } from '@features/user/components/components.module'; import { CoreQuestionComponentsModule } from '@features/question/components/components.module'; import { CoreBlockComponentsModule } from '@features/block/components/components.module'; @@ -132,8 +131,11 @@ import { CorePromisedValue } from '@classes/promised-value'; import { CorePlatform } from '@services/platform'; import { CoreAutoLogoutService } from '@features/autologout/services/autologout'; -import { CoreSitePluginsProvider } from '@features/siteplugins/services/siteplugins'; -import { getSitePluginsExportedObjects } from '@features/siteplugins/siteplugins.module'; +import { + getSitePluginsDirectives, + getSitePluginsExportedObjects, + getSitePluginsServices, +} from '@features/siteplugins/siteplugins.module'; import { CoreError } from '@classes/errors/error'; /** @@ -161,7 +163,6 @@ export class CoreCompileProvider { CoreBlockComponentsModule, CoreEditorComponentsModule, CoreSearchComponentsModule, - CoreSitePluginsDirectivesModule, ]; protected readonly LAZY_IMPORTS = [ @@ -170,6 +171,7 @@ export class CoreCompileProvider { getModWorkshopComponentModules, getCoreStandaloneComponents, getCourseStandaloneComponents, + getSitePluginsDirectives, ]; protected componentId = 0; @@ -399,6 +401,7 @@ export class CoreCompileProvider { getNotesServices(), getNotificationsServices(), getPrivateFilesServices(), + getSitePluginsServices(), ]); const lazyLibraries = services.flat(); @@ -406,7 +409,6 @@ export class CoreCompileProvider { return [ ...lazyLibraries, CoreAutoLogoutService, - CoreSitePluginsProvider, ...this.OTHER_SERVICES, ]; } diff --git a/src/core/features/course/services/course.ts b/src/core/features/course/services/course.ts index 25ae38048..2c3bf812e 100644 --- a/src/core/features/course/services/course.ts +++ b/src/core/features/course/services/course.ts @@ -47,7 +47,6 @@ import { CoreCourseHelper, CoreCourseModuleData, CoreCourseModuleCompletionData import { CoreCourseFormatDelegate } from './format-delegate'; import { CoreCronDelegate } from '@services/cron'; import { CoreCourseLogCronHandler } from './handlers/log-cron'; -import { CoreSitePlugins } from '@features/siteplugins/services/siteplugins'; import { CoreCourseAutoSyncData, CoreCourseSyncProvider } from './sync'; import { CoreTagItem } from '@features/tag/services/tag'; import { CoreNavigationOptions, CoreNavigator } from '@services/navigator'; @@ -1437,6 +1436,8 @@ export class CoreCourseProvider { return; } + const { CoreSitePlugins } = await import('@features/siteplugins/services/siteplugins'); + const loading = await CoreLoadings.show(); // Wait for site plugins to be fetched. diff --git a/src/core/features/settings/pages/dev/dev.ts b/src/core/features/settings/pages/dev/dev.ts index 29123a57d..6f781f668 100644 --- a/src/core/features/settings/pages/dev/dev.ts +++ b/src/core/features/settings/pages/dev/dev.ts @@ -21,7 +21,6 @@ import { ONBOARDING_DONE, } from '@features/login/constants'; import { CoreSettingsHelper } from '@features/settings/services/settings-helper'; -import { CoreSitePlugins } from '@features/siteplugins/services/siteplugins'; import { CoreUserTours } from '@features/usertours/services/user-tours'; import { CoreCacheManager } from '@services/cache-manager'; import { CoreConfig } from '@services/config'; @@ -124,6 +123,7 @@ export class CoreSettingsDevPage implements OnInit { } }); + const { CoreSitePlugins } = await import('@features/siteplugins/services/siteplugins'); this.sitePlugins = CoreSitePlugins.getCurrentSitePluginList().map((plugin) => ({ addon: plugin.addon, component: plugin.component, diff --git a/src/core/features/siteplugins/components/assign-feedback/assign-feedback.ts b/src/core/features/siteplugins/components/assign-feedback/assign-feedback.ts index 26050d2d6..1780c3c12 100644 --- a/src/core/features/siteplugins/components/assign-feedback/assign-feedback.ts +++ b/src/core/features/siteplugins/components/assign-feedback/assign-feedback.ts @@ -18,6 +18,8 @@ import { AddonModAssignAssign, AddonModAssignPlugin, AddonModAssignSubmission } import { AddonModAssignFeedbackDelegate } from '@addons/mod/assign/services/feedback-delegate'; import { CoreSitePluginsCompileInitComponent } from '@features/siteplugins/classes/compile-init-component'; import { toBoolean } from '@/core/transforms/boolean'; +import { CoreCompileHtmlComponentModule } from '@features/compile/components/compile-html/compile-html.module'; +import { CoreSharedModule } from '@/core/shared.module'; /** * Component that displays an assign feedback plugin created using a site plugin. @@ -26,6 +28,11 @@ import { toBoolean } from '@/core/transforms/boolean'; selector: 'core-site-plugins-assign-feedback', templateUrl: 'core-siteplugins-assign-feedback.html', styles: [':host { display: contents; }'], + standalone: true, + imports: [ + CoreSharedModule, + CoreCompileHtmlComponentModule, + ], }) export class CoreSitePluginsAssignFeedbackComponent extends CoreSitePluginsCompileInitComponent implements OnInit { diff --git a/src/core/features/siteplugins/components/assign-submission/assign-submission.ts b/src/core/features/siteplugins/components/assign-submission/assign-submission.ts index 6fdf3d7be..f6780ab71 100644 --- a/src/core/features/siteplugins/components/assign-submission/assign-submission.ts +++ b/src/core/features/siteplugins/components/assign-submission/assign-submission.ts @@ -18,6 +18,8 @@ import { AddonModAssignAssign, AddonModAssignPlugin, AddonModAssignSubmission } import { AddonModAssignSubmissionDelegate } from '@addons/mod/assign/services/submission-delegate'; import { CoreSitePluginsCompileInitComponent } from '@features/siteplugins/classes/compile-init-component'; import { toBoolean } from '@/core/transforms/boolean'; +import { CoreCompileHtmlComponentModule } from '@features/compile/components/compile-html/compile-html.module'; +import { CoreSharedModule } from '@/core/shared.module'; /** * Component that displays an assign submission plugin created using a site plugin. @@ -26,6 +28,11 @@ import { toBoolean } from '@/core/transforms/boolean'; selector: 'core-site-plugins-assign-submission', templateUrl: 'core-siteplugins-assign-submission.html', styles: [':host { display: contents; }'], + standalone: true, + imports: [ + CoreSharedModule, + CoreCompileHtmlComponentModule, + ], }) export class CoreSitePluginsAssignSubmissionComponent extends CoreSitePluginsCompileInitComponent implements OnInit { diff --git a/src/core/features/siteplugins/components/block/block.ts b/src/core/features/siteplugins/components/block/block.ts index 624924ec1..70f703550 100644 --- a/src/core/features/siteplugins/components/block/block.ts +++ b/src/core/features/siteplugins/components/block/block.ts @@ -18,6 +18,8 @@ import { CoreBlockBaseComponent } from '@features/block/classes/base-block-compo import { CoreBlockDelegate } from '@features/block/services/block-delegate'; import { CoreSitePlugins, CoreSitePluginsContent } from '@features/siteplugins/services/siteplugins'; import { CoreSitePluginsPluginContentComponent } from '../plugin-content/plugin-content'; +import { CoreCompileHtmlComponentModule } from '@features/compile/components/compile-html/compile-html.module'; +import { CoreSharedModule } from '@/core/shared.module'; /** * Component that displays the index of a course format site plugin. @@ -26,6 +28,12 @@ import { CoreSitePluginsPluginContentComponent } from '../plugin-content/plugin- selector: 'core-site-plugins-block', templateUrl: 'core-siteplugins-block.html', styles: [':host { display: contents; }'], + standalone: true, + imports: [ + CoreSharedModule, + CoreCompileHtmlComponentModule, + CoreSitePluginsPluginContentComponent, + ], }) export class CoreSitePluginsBlockComponent extends CoreBlockBaseComponent implements OnChanges { diff --git a/src/core/features/siteplugins/components/components.module.ts b/src/core/features/siteplugins/components/components.module.ts index b9482e300..d78b787ce 100644 --- a/src/core/features/siteplugins/components/components.module.ts +++ b/src/core/features/siteplugins/components/components.module.ts @@ -16,53 +16,13 @@ import { NgModule } from '@angular/core'; import { CoreSharedModule } from '@/core/shared.module'; import { CoreCompileHtmlComponentModule } from '@features/compile/components/compile-html/compile-html.module'; -import { CoreSitePluginsPluginContentComponent } from './plugin-content/plugin-content'; -import { CoreSitePluginsModuleIndexComponent } from './module-index/module-index'; -import { CoreSitePluginsCourseFormatComponent } from './course-format/course-format'; -import { CoreSitePluginsUserProfileFieldComponent } from './user-profile-field/user-profile-field'; -import { CoreSitePluginsQuestionComponent } from './question/question'; -import { CoreSitePluginsQuestionBehaviourComponent } from './question-behaviour/question-behaviour'; -import { CoreSitePluginsQuizAccessRuleComponent } from './quiz-access-rule/quiz-access-rule'; -import { CoreSitePluginsAssignFeedbackComponent } from './assign-feedback/assign-feedback'; -import { CoreSitePluginsAssignSubmissionComponent } from './assign-submission/assign-submission'; -import { CoreSitePluginsWorkshopAssessmentStrategyComponent } from './workshop-assessment-strategy/workshop-assessment-strategy'; -import { CoreSitePluginsBlockComponent } from './block/block'; -import { CoreSitePluginsOnlyTitleBlockComponent } from './only-title-block/only-title-block'; import { CoreCourseComponentsModule } from '@features/course/components/components.module'; @NgModule({ - declarations: [ - CoreSitePluginsPluginContentComponent, - CoreSitePluginsModuleIndexComponent, - CoreSitePluginsBlockComponent, - CoreSitePluginsOnlyTitleBlockComponent, - CoreSitePluginsCourseFormatComponent, - CoreSitePluginsUserProfileFieldComponent, - CoreSitePluginsQuestionComponent, - CoreSitePluginsQuestionBehaviourComponent, - CoreSitePluginsQuizAccessRuleComponent, - CoreSitePluginsAssignFeedbackComponent, - CoreSitePluginsAssignSubmissionComponent, - CoreSitePluginsWorkshopAssessmentStrategyComponent, - ], imports: [ CoreSharedModule, CoreCompileHtmlComponentModule, CoreCourseComponentsModule, ], - exports: [ - CoreSitePluginsPluginContentComponent, - CoreSitePluginsModuleIndexComponent, - CoreSitePluginsBlockComponent, - CoreSitePluginsOnlyTitleBlockComponent, - CoreSitePluginsCourseFormatComponent, - CoreSitePluginsUserProfileFieldComponent, - CoreSitePluginsQuestionComponent, - CoreSitePluginsQuestionBehaviourComponent, - CoreSitePluginsQuizAccessRuleComponent, - CoreSitePluginsAssignFeedbackComponent, - CoreSitePluginsAssignSubmissionComponent, - CoreSitePluginsWorkshopAssessmentStrategyComponent, - ], }) export class CoreSitePluginsComponentsModule {} diff --git a/src/core/features/siteplugins/components/course-format/course-format.ts b/src/core/features/siteplugins/components/course-format/course-format.ts index 26e2de463..ac3e78a03 100644 --- a/src/core/features/siteplugins/components/course-format/course-format.ts +++ b/src/core/features/siteplugins/components/course-format/course-format.ts @@ -20,6 +20,8 @@ import { CoreCourseFormatDelegate } from '@features/course/services/format-deleg import { CoreCourseAnyCourseData } from '@features/courses/services/courses'; import { CoreSitePlugins, CoreSitePluginsContent } from '@features/siteplugins/services/siteplugins'; import { CoreSitePluginsPluginContentComponent } from '../plugin-content/plugin-content'; +import { CoreCompileHtmlComponentModule } from '@features/compile/components/compile-html/compile-html.module'; +import { CoreSharedModule } from '@/core/shared.module'; /** * Component that displays the index of a course format site plugin. @@ -28,6 +30,12 @@ import { CoreSitePluginsPluginContentComponent } from '../plugin-content/plugin- selector: 'core-site-plugins-course-format', templateUrl: 'core-siteplugins-course-format.html', styles: [':host { display: contents; }'], + standalone: true, + imports: [ + CoreSharedModule, + CoreCompileHtmlComponentModule, + CoreSitePluginsPluginContentComponent, + ], }) export class CoreSitePluginsCourseFormatComponent implements OnChanges { diff --git a/src/core/features/siteplugins/components/module-index/module-index.ts b/src/core/features/siteplugins/components/module-index/module-index.ts index 8e8704030..4e4daec16 100644 --- a/src/core/features/siteplugins/components/module-index/module-index.ts +++ b/src/core/features/siteplugins/components/module-index/module-index.ts @@ -31,6 +31,9 @@ import { import { CoreModals } from '@services/modals'; import { CoreUtils } from '@services/utils/utils'; import { CoreSitePluginsPluginContentComponent, CoreSitePluginsPluginContentLoadedData } from '../plugin-content/plugin-content'; +import { CoreCompileHtmlComponentModule } from '@features/compile/components/compile-html/compile-html.module'; +import { CoreCourseComponentsModule } from '@features/course/components/components.module'; +import { CoreSharedModule } from '@/core/shared.module'; /** * Component that displays the index of a module site plugin. @@ -39,6 +42,13 @@ import { CoreSitePluginsPluginContentComponent, CoreSitePluginsPluginContentLoad selector: 'core-site-plugins-module-index', templateUrl: 'core-siteplugins-module-index.html', styles: [':host { display: contents; }'], + standalone: true, + imports: [ + CoreSharedModule, + CoreCompileHtmlComponentModule, + CoreCourseComponentsModule, + CoreSitePluginsPluginContentComponent, + ], }) export class CoreSitePluginsModuleIndexComponent implements OnInit, OnDestroy, CoreCourseModuleMainComponent { diff --git a/src/core/features/siteplugins/components/only-title-block/only-title-block.ts b/src/core/features/siteplugins/components/only-title-block/only-title-block.ts index 34a6ce1dc..580190880 100644 --- a/src/core/features/siteplugins/components/only-title-block/only-title-block.ts +++ b/src/core/features/siteplugins/components/only-title-block/only-title-block.ts @@ -19,6 +19,7 @@ import { CoreBlockBaseComponent } from '@features/block/classes/base-block-compo import { CoreBlockDelegate } from '@features/block/services/block-delegate'; import { CoreSitePlugins, CoreSitePluginsUserHandlerData } from '@features/siteplugins/services/siteplugins'; import { CoreNavigator } from '@services/navigator'; +import { CoreSharedModule } from '@/core/shared.module'; /** * Component to render blocks with only a title and link. @@ -27,6 +28,8 @@ import { CoreNavigator } from '@services/navigator'; selector: 'core-siteplugins-only-title-block', templateUrl: 'core-siteplugins-only-title-block.html', styles: [':host { display: contents; }'], + standalone: true, + imports: [CoreSharedModule], }) export class CoreSitePluginsOnlyTitleBlockComponent extends CoreBlockBaseComponent implements OnInit { diff --git a/src/core/features/siteplugins/components/plugin-content/plugin-content.ts b/src/core/features/siteplugins/components/plugin-content/plugin-content.ts index 6a501b8d8..3081f82e8 100644 --- a/src/core/features/siteplugins/components/plugin-content/plugin-content.ts +++ b/src/core/features/siteplugins/components/plugin-content/plugin-content.ts @@ -35,6 +35,8 @@ import { CoreDomUtils } from '@services/utils/dom'; import { CoreEvents } from '@singletons/events'; import { CoreSites, CoreSitesReadingStrategy } from '@services/sites'; import { CORE_SITE_PLUGINS_UPDATE_COURSE_CONTENT } from '@features/siteplugins/constants'; +import { CoreCompileHtmlComponentModule } from '@features/compile/components/compile-html/compile-html.module'; +import { CoreSharedModule } from '@/core/shared.module'; /** * Component to render a site plugin content. @@ -43,6 +45,11 @@ import { CORE_SITE_PLUGINS_UPDATE_COURSE_CONTENT } from '@features/siteplugins/c selector: 'core-site-plugins-plugin-content', templateUrl: 'core-siteplugins-plugin-content.html', styles: [':host { display: contents; }'], + standalone: true, + imports: [ + CoreSharedModule, + CoreCompileHtmlComponentModule, + ], }) export class CoreSitePluginsPluginContentComponent implements OnInit, DoCheck { diff --git a/src/core/features/siteplugins/components/question-behaviour/question-behaviour.ts b/src/core/features/siteplugins/components/question-behaviour/question-behaviour.ts index 382051be7..206ec1574 100644 --- a/src/core/features/siteplugins/components/question-behaviour/question-behaviour.ts +++ b/src/core/features/siteplugins/components/question-behaviour/question-behaviour.ts @@ -13,8 +13,10 @@ // limitations under the License. import { ContextLevel } from '@/core/constants'; +import { CoreSharedModule } from '@/core/shared.module'; import { toBoolean } from '@/core/transforms/boolean'; import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; +import { CoreCompileHtmlComponentModule } from '@features/compile/components/compile-html/compile-html.module'; import { CoreQuestionBehaviourDelegate } from '@features/question/services/behaviour-delegate'; import { CoreQuestionBehaviourButton, CoreQuestionQuestion } from '@features/question/services/question-helper'; @@ -27,6 +29,11 @@ import { CoreSitePluginsCompileInitComponent } from '@features/siteplugins/class selector: 'core-site-plugins-question-behaviour', templateUrl: 'core-siteplugins-question-behaviour.html', styles: [':host { display: contents; }'], + standalone: true, + imports: [ + CoreSharedModule, + CoreCompileHtmlComponentModule, + ], }) export class CoreSitePluginsQuestionBehaviourComponent extends CoreSitePluginsCompileInitComponent implements OnInit { diff --git a/src/core/features/siteplugins/components/question/question.ts b/src/core/features/siteplugins/components/question/question.ts index 686080ced..45d0249f1 100644 --- a/src/core/features/siteplugins/components/question/question.ts +++ b/src/core/features/siteplugins/components/question/question.ts @@ -13,8 +13,10 @@ // limitations under the License. import { ContextLevel } from '@/core/constants'; +import { CoreSharedModule } from '@/core/shared.module'; import { toBoolean } from '@/core/transforms/boolean'; import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; +import { CoreCompileHtmlComponentModule } from '@features/compile/components/compile-html/compile-html.module'; import { AddonModQuizQuestion } from '@features/question/classes/base-question-component'; import { CoreQuestionDelegate } from '@features/question/services/question-delegate'; @@ -28,6 +30,11 @@ import { CoreSitePluginsCompileInitComponent } from '@features/siteplugins/class selector: 'core-site-plugins-question', templateUrl: 'core-siteplugins-question.html', styles: [':host { display: contents; }'], + standalone: true, + imports: [ + CoreSharedModule, + CoreCompileHtmlComponentModule, + ], }) export class CoreSitePluginsQuestionComponent extends CoreSitePluginsCompileInitComponent implements OnInit { diff --git a/src/core/features/siteplugins/components/quiz-access-rule/quiz-access-rule.ts b/src/core/features/siteplugins/components/quiz-access-rule/quiz-access-rule.ts index a030e888c..5f0515b78 100644 --- a/src/core/features/siteplugins/components/quiz-access-rule/quiz-access-rule.ts +++ b/src/core/features/siteplugins/components/quiz-access-rule/quiz-access-rule.ts @@ -19,6 +19,8 @@ import { AddonModQuizAccessRuleDelegate } from '@addons/mod/quiz/services/access import { AddonModQuizAttemptWSData, AddonModQuizQuizWSData } from '@addons/mod/quiz/services/quiz'; import { CoreSitePluginsCompileInitComponent } from '@features/siteplugins/classes/compile-init-component'; import { toBoolean } from '@/core/transforms/boolean'; +import { CoreCompileHtmlComponentModule } from '@features/compile/components/compile-html/compile-html.module'; +import { CoreSharedModule } from '@/core/shared.module'; /** * Component that displays a quiz access rule created using a site plugin. @@ -27,6 +29,11 @@ import { toBoolean } from '@/core/transforms/boolean'; selector: 'core-site-plugins-quiz-access-rule', templateUrl: 'core-siteplugins-quiz-access-rule.html', styles: [':host { display: contents; }'], + standalone: true, + imports: [ + CoreSharedModule, + CoreCompileHtmlComponentModule, + ], }) export class CoreSitePluginsQuizAccessRuleComponent extends CoreSitePluginsCompileInitComponent implements OnInit { diff --git a/src/core/features/siteplugins/components/user-profile-field/user-profile-field.ts b/src/core/features/siteplugins/components/user-profile-field/user-profile-field.ts index 17a804768..d9366fd7a 100644 --- a/src/core/features/siteplugins/components/user-profile-field/user-profile-field.ts +++ b/src/core/features/siteplugins/components/user-profile-field/user-profile-field.ts @@ -13,9 +13,11 @@ // limitations under the License. import { ContextLevel } from '@/core/constants'; +import { CoreSharedModule } from '@/core/shared.module'; import { toBoolean } from '@/core/transforms/boolean'; import { Component, OnInit, Input } from '@angular/core'; import { FormGroup } from '@angular/forms'; +import { CoreCompileHtmlComponentModule } from '@features/compile/components/compile-html/compile-html.module'; import { AuthEmailSignupProfileField } from '@features/login/services/login-helper'; import { CoreSitePluginsCompileInitComponent } from '@features/siteplugins/classes/compile-init-component'; @@ -29,6 +31,11 @@ import { CoreUserProfileFieldDelegate } from '@features/user/services/user-profi selector: 'core-site-plugins-user-profile-field', templateUrl: 'core-siteplugins-user-profile-field.html', styles: [':host { display: contents; }'], + standalone: true, + imports: [ + CoreSharedModule, + CoreCompileHtmlComponentModule, + ], }) export class CoreSitePluginsUserProfileFieldComponent extends CoreSitePluginsCompileInitComponent implements OnInit { diff --git a/src/core/features/siteplugins/components/workshop-assessment-strategy/workshop-assessment-strategy.ts b/src/core/features/siteplugins/components/workshop-assessment-strategy/workshop-assessment-strategy.ts index db0fc6949..10bf13cf7 100644 --- a/src/core/features/siteplugins/components/workshop-assessment-strategy/workshop-assessment-strategy.ts +++ b/src/core/features/siteplugins/components/workshop-assessment-strategy/workshop-assessment-strategy.ts @@ -12,11 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +import { CoreSharedModule } from '@/core/shared.module'; import { toBoolean } from '@/core/transforms/boolean'; import { AddonWorkshopAssessmentStrategyDelegate } from '@addons/mod/workshop/services/assessment-strategy-delegate'; import { AddonModWorkshopGetAssessmentFormFieldsParsedData } from '@addons/mod/workshop/services/workshop'; import { AddonModWorkshopSubmissionAssessmentWithFormData } from '@addons/mod/workshop/services/workshop-helper'; import { Component, OnInit, Input } from '@angular/core'; +import { CoreCompileHtmlComponentModule } from '@features/compile/components/compile-html/compile-html.module'; import { CoreSitePluginsCompileInitComponent } from '@features/siteplugins/classes/compile-init-component'; /** @@ -26,6 +28,11 @@ import { CoreSitePluginsCompileInitComponent } from '@features/siteplugins/class selector: 'core-siteplugins-workshop-assessment-strategy', templateUrl: 'core-siteplugins-workshop-assessment-strategy.html', styles: [':host { display: contents; }'], + standalone: true, + imports: [ + CoreSharedModule, + CoreCompileHtmlComponentModule, + ], }) export class CoreSitePluginsWorkshopAssessmentStrategyComponent extends CoreSitePluginsCompileInitComponent implements OnInit { diff --git a/src/core/features/siteplugins/pages/course-option/core-siteplugins-course-option.html b/src/core/features/siteplugins/pages/course-option/core-siteplugins-course-option.html index d34f71c55..55f943654 100644 --- a/src/core/features/siteplugins/pages/course-option/core-siteplugins-course-option.html +++ b/src/core/features/siteplugins/pages/course-option/core-siteplugins-course-option.html @@ -1,6 +1,5 @@ - + { + const { CoreSitePluginsDirectivesModule } = await import('./directives/directives.module'); + + return [CoreSitePluginsDirectivesModule]; +} + +/** + * Get shared files services. + * + * @returns Returns shared files services. + */ +export async function getSitePluginsServices(): Promise[]> { + const { CoreSitePluginsProvider } = await import('@features/siteplugins/services/siteplugins'); + + return [ + CoreSitePluginsProvider, + ]; +} + /** * Get site plugins exported objects. * @@ -67,7 +85,7 @@ export async function getSitePluginsExportedObjects(): Promise import('@features/siteplugins/pages/plugin/plugin'), canDeactivate: [canLeaveGuard], }, ]; @@ -75,7 +93,7 @@ const routes: Routes = [ const homeRoutes: Routes = [ { path: `${CORE_SITE_PLUGINS_PATH}/homecontent/:component/:method`, - component: CoreSitePluginsPluginPage, + loadComponent: () => import('@features/siteplugins/pages/plugin/plugin'), canDeactivate: [canLeaveGuard], }, ]; @@ -83,7 +101,7 @@ const homeRoutes: Routes = [ const courseIndexRoutes: Routes = [ { path: `${CORE_SITE_PLUGINS_PATH}/:handlerUniqueName`, - component: CoreSitePluginsCourseOptionPage, + loadComponent: () => import('@features/siteplugins/pages/course-option/course-option'), canDeactivate: [canLeaveGuard], }, ]; @@ -91,7 +109,7 @@ const courseIndexRoutes: Routes = [ const moduleRoutes: Routes = [ { path: `${CORE_SITE_PLUGINS_PATH}/module/:courseId/:cmId`, - component: CoreSitePluginsModuleIndexPage, + loadComponent: () => import('@features/siteplugins/pages/module-index/module-index'), canDeactivate: [canLeaveGuard], }, ]; @@ -102,19 +120,14 @@ const moduleRoutes: Routes = [ CoreCourseIndexRoutingModule.forChild({ children: courseIndexRoutes }), CoreMainMenuHomeRoutingModule.forChild({ children: homeRoutes }), CoreSitePreferencesRoutingModule.forChild(routes), - CoreSitePluginsComponentsModule, - CoreSharedModule, - ], - declarations: [ - CoreSitePluginsPluginPage, - CoreSitePluginsCourseOptionPage, - CoreSitePluginsModuleIndexPage, ], providers: [ { provide: APP_INITIALIZER, multi: true, - useValue: () => { + useValue: async () => { + const { CoreSitePluginsInit } = await import('./services/siteplugins-init'); + CoreSitePluginsInit.init(); }, },