Skip to content

Commit

Permalink
N21-2100 AI Features (#3348)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvinOehlerkingCap authored Aug 6, 2024
1 parent 4362659 commit 557a2d3
Show file tree
Hide file tree
Showing 11 changed files with 112 additions and 20 deletions.
29 changes: 29 additions & 0 deletions src/components/organisms/administration/PrivacySettings.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const searchStrings = {
learnStore: "admin-school-toggle-learning-store",
rocketChat: "toggle_chat",
videoconference: "toggle_video_conference",
aiTutor: "toggle_ai_tutor",
};

const getWrapper = (props = generateProps()) => {
Expand Down Expand Up @@ -171,6 +172,34 @@ describe("PrivacySettings", () => {
});
});

describe("when env var for aiTutor is true", () => {
it("should display aiTutor feature switch", () => {
const envs = envsFactory.build({
FEATURE_AI_TUTOR_ENABLED: true,
});
envConfigModule.setEnvs(envs);
const wrapper = getWrapper();

expect(
wrapper.findAll(`[data-testid=${searchStrings.aiTutor}]`)
).toHaveLength(1);
});
});

describe("when env var for aiTutor is false", () => {
it("should hide aiTutor feature switch", () => {
const envs = envsFactory.build({
FEATURE_AI_TUTOR_ENABLED: false,
});
envConfigModule.setEnvs(envs);
const wrapper = getWrapper();

expect(
wrapper.findAll(`[data-testid=${searchStrings.aiTutor}]`)
).toHaveLength(0);
});
});

describe("when env var for rocketchat is true", () => {
it("should display rocketchat feature switch", () => {
const envs = envsFactory.build({
Expand Down
34 changes: 34 additions & 0 deletions src/components/organisms/administration/PrivacySettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,36 @@
</p>
</v-col>
</v-row>
<v-row v-if="aiTutorEnabled">
<v-col>
<v-switch
:model-value="features.aiTutor"
:label="
$t(
'pages.administration.school.index.privacySettings.labels.aiTutor'
)
"
:aria-label="
$t(
'pages.administration.school.index.privacySettings.labels.aiTutor'
)
"
:true-icon="mdiCheck"
class="ml-1 mt-0"
data-testid="toggle_ai_tutor"
@update:modelValue="
($event) => $emit('update-feature-settings', $event, 'aiTutor')
"
/>
<p class="switch-hint">
{{
$t(
"pages.administration.school.index.privacySettings.longText.aiTutor"
)
}}
</p>
</v-col>
</v-row>
</div>
</template>

Expand Down Expand Up @@ -164,6 +194,10 @@ const videoConferenceEnabled = computed(
() => envConfigModule.getEnv.FEATURE_VIDEOCONFERENCE_ENABLED
);
const aiTutorEnabled = computed(
() => envConfigModule.getEnv.FEATURE_AI_TUTOR_ENABLED
);
const rocketChatEnabled = computed(
() => envConfigModule.getEnv.ROCKETCHAT_SERVICE_ENABLED
);
Expand Down
4 changes: 4 additions & 0 deletions src/locales/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1121,6 +1121,8 @@ export default {
"Sichtbarkeit von Schüler:innen für Lehrkräfte aktivieren",
"pages.administration.school.index.privacySettings.labels.videoConference":
"Videokonferenzen für Kurse und Teams aktivieren",
"pages.administration.school.index.privacySettings.labels.aiTutor":
"KI-Tutor an Schule aktivieren",
"pages.administration.school.index.privacySettings.longText.chatFunction":
"Sind Chats an deiner Schule aktiviert, können Team-Admins im jeweiligen Team die Chatfunktion gezielt freischalten.",
"pages.administration.school.index.privacySettings.longText.configurabilityInfoText":
Expand All @@ -1135,6 +1137,8 @@ export default {
"Wenn diese Option nicht aktiviert ist, können die Lehrkräfte ausschließlich die Klassen sowie deren Schülerinnen und Schüler sehen, in denen sie Mitglied sind.",
"pages.administration.school.index.privacySettings.longText.videoConference":
"Sind Videokonferenzen an deiner Schule aktiviert, können Lehrkräfte ihrem Kurs im Bereich Tools das Videokonferenz-Tool hinzufügen und dann von dort aus Videokonferenzen für alle Kursteilnehmer:innen starten. Team-Admins können die Videokonferenzfunktion im jeweiligen Team aktivieren. Team-Leiter:innen und Team-Admins können dann Videokonferenzen zu Terminen hinzufügen und starten.",
"pages.administration.school.index.privacySettings.longText.aiTutor":
"Ist der KI-Tutor an deiner Schule aktiviert, können Lehrkräfte in ihren Bereichen den KI-Tutor hinzufügen.",
"pages.administration.school.index.privacySettings":
"Datenschutzeinstellungen",
"pages.administration.school.index.schoolIsCurrentlyDrawing":
Expand Down
4 changes: 4 additions & 0 deletions src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1112,6 +1112,8 @@ export default {
"Activate student visibility for teachers",
"pages.administration.school.index.privacySettings.labels.videoConference":
"Activate video conferencing for courses and teams",
"pages.administration.school.index.privacySettings.labels.aiTutor":
"Activate AI tutor at school",
"pages.administration.school.index.privacySettings.longText.chatFunction":
"If chats are enabled at your school, team administrators can selectively unlock the chat function respectively for their team.",
"pages.administration.school.index.privacySettings.longText.configurabilityInfoText":
Expand All @@ -1126,6 +1128,8 @@ export default {
"If this option is not enabled, teachers can only see the classes and their students in which they are members.",
"pages.administration.school.index.privacySettings.longText.videoConference":
"If video conferencing is enabled at your school, teachers can add the video conferencing tool to their course in the Tools section and then start video conferencing for all course participants from there. Team administrators can activate the video conference function in the respective team. Team leaders and team admins can then add and start video conferences for appointments.",
"pages.administration.school.index.privacySettings.longText.aiTutor":
"If AI Tutor is activated at your school, teachers can add the AI Tutor in their areas.",
"pages.administration.school.index.privacySettings": "Privacy Settings",
"pages.administration.school.index.schoolIsCurrentlyDrawing":
"Your school is currently getting",
Expand Down
4 changes: 4 additions & 0 deletions src/locales/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1143,6 +1143,8 @@ export default {
"Activar la visibilidad de los estudiantes para los profesores",
"pages.administration.school.index.privacySettings.labels.videoConference":
"Activar videoconferencias para cursos y equipos",
"pages.administration.school.index.privacySettings.labels.aiTutor":
"Activar tutor de IA en la escuela",
"pages.administration.school.index.privacySettings.longText.chatFunction":
"Si los chats están habilitados en tu escuela, los administradores del equipo pueden desbloquear la función de chat de manera selectiva y respectivamente para su equipo.",
"pages.administration.school.index.privacySettings.longText.configurabilityInfoText":
Expand All @@ -1157,6 +1159,8 @@ export default {
"Si esta opción no está activada, los profesores sólo podrán ver las clases y sus alumnos de las que son miembros.",
"pages.administration.school.index.privacySettings.longText.videoConference":
"Si la videoconferencia está habilitada en tu escuela, los profesores pueden añadir la herramienta de videoconferencia a su curso en la sección Herramientas y entonces podrán iniciar desde allí videoconferencias para todos los participantes del curso. Los administradores del equipo pueden activar la función de videoconferencia en el equipo respectivo. Los líderes de equipo y los administradores de equipo pueden añadir e iniciar videoconferencias para citas.",
"pages.administration.school.index.privacySettings.longText.aiTutor":
"Si AI Tutor está activado en tu escuela, los profesores pueden agregar AI Tutor en sus áreas.",
"pages.administration.school.index.privacySettings":
"Configuración de la privacidad",
"pages.administration.school.index.schoolIsCurrentlyDrawing":
Expand Down
4 changes: 4 additions & 0 deletions src/locales/uk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1127,6 +1127,8 @@ export default {
"Активувати видимість учнів для вчителів",
"pages.administration.school.index.privacySettings.labels.videoConference":
"Активувати відеоконференції для курсів і команд",
"pages.administration.school.index.privacySettings.labels.aiTutor":
"Активуйте репетитора ШІ в школі",
"pages.administration.school.index.privacySettings.longText.chatFunction":
"Якщо у вашому навчальному закладі увімкнені чати, адміністратори команд можуть вибірково увімкнути функцію чату для своєї команди.",
"pages.administration.school.index.privacySettings.longText.configurabilityInfoText":
Expand All @@ -1141,6 +1143,8 @@ export default {
"Якщо цю опцію не ввімкнено, вчителі бачитимуть лише ті класи та учнів, учасниками яких вони є.",
"pages.administration.school.index.privacySettings.longText.videoConference":
"Якщо у вашій школі увімкнено відеоконференцію, викладачі можуть додати інструмент для відеоконференцій до свого курсу у розділі «Інструменти», а потім запустити відеоконференцію для всіх учасників курсу. Адміністратори команд можуть активувати функцію відеоконференції у відповідній команді. Після цього керівники команд та адміністратори команд зможуть додавати та розпочинати відеоконференції для зустрічей.",
"pages.administration.school.index.privacySettings.longText.aiTutor":
"Якщо AI Tutor активовано у вашій школі, вчителі можуть додати AI Tutor у своїх областях.",
"pages.administration.school.index.privacySettings":
"Параметри конфіденційності",
"pages.administration.school.index.schoolIsCurrentlyDrawing":
Expand Down
9 changes: 8 additions & 1 deletion src/serverApi/v3/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1138,6 +1138,12 @@ export interface ConfigResponse {
* @memberof ConfigResponse
*/
FEATURE_SCHULCONNEX_MEDIA_LICENSE_ENABLED: boolean;
/**
*
* @type {boolean}
* @memberof ConfigResponse
*/
FEATURE_AI_TUTOR_ENABLED: boolean;
}
/**
*
Expand Down Expand Up @@ -6316,7 +6322,8 @@ export enum SchoolFeature {
LdapUniventionMigrationSchool = 'ldapUniventionMigrationSchool',
OauthProvisioningEnabled = 'oauthProvisioningEnabled',
ShowOutdatedUsers = 'showOutdatedUsers',
EnableLdapSyncDuringMigration = 'enableLdapSyncDuringMigration'
EnableLdapSyncDuringMigration = 'enableLdapSyncDuringMigration',
AiTutor = 'aiTutor'
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/store/env-config-defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,5 @@ export const defaultConfigEnvs: ConfigResponse = {
FEATURE_MEDIA_SHELF_ENABLED: false,
BOARD_COLLABORATION_URI: "ws://localhost:4450",
FEATURE_SCHULCONNEX_MEDIA_LICENSE_ENABLED: false,
FEATURE_AI_TUTOR_ENABLED: false,
};
18 changes: 10 additions & 8 deletions src/store/schools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
FederalStateResponse,
SchoolApiFactory,
SchoolApiInterface,
SchoolFeature,
SchoolResponse,
SchoolSystemResponse,
SchoolUpdateBodyParams,
Expand Down Expand Up @@ -57,14 +58,15 @@ export default class SchoolsModule extends VuexModule {
purpose: undefined,
features: [],
featureObject: {
rocketChat: false,
videoconference: false,
studentVisibility: false,
ldapUniventionMigrationSchool: false,
showOutdatedUsers: false,
enableLdapSyncDuringMigration: false,
oauthProvisioningEnabled: false,
nextcloud: false,
[SchoolFeature.RocketChat]: false,
[SchoolFeature.Videoconference]: false,
[SchoolFeature.StudentVisibility]: false,
[SchoolFeature.LdapUniventionMigrationSchool]: false,
[SchoolFeature.ShowOutdatedUsers]: false,
[SchoolFeature.EnableLdapSyncDuringMigration]: false,
[SchoolFeature.OauthProvisioningEnabled]: false,
[SchoolFeature.Nextcloud]: false,
[SchoolFeature.AiTutor]: false,
},
instanceFeatures: [],
permissions: {},
Expand Down
7 changes: 4 additions & 3 deletions src/store/schools.unit.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as serverApi from "@/serverApi/v3/api";
import { SystemsApiInterface } from "@/serverApi/v3/api";
import { SchoolFeature, SystemsApiInterface } from "@/serverApi/v3/api";
import { authModule, envConfigModule } from "@/store";
import { initializeAxios } from "@/utils/api";
import { envsFactory, meResponseFactory } from "@@/tests/test-utils";
Expand All @@ -8,7 +8,7 @@ import { schoolSystemResponseFactory } from "@@/tests/test-utils/factory/schoolS
import { mockApiResponse } from "@@/tests/test-utils/mockApiResponse";
import { mockSchool } from "@@/tests/test-utils/mockObjects";
import setupStores from "@@/tests/test-utils/setupStores";
import { DeepMocked, createMock } from "@golevelup/ts-jest";
import { createMock, DeepMocked } from "@golevelup/ts-jest";
import { AxiosError, AxiosInstance } from "axios";
import AuthModule from "./auth";
import EnvConfigModule from "./env-config";
Expand Down Expand Up @@ -99,7 +99,7 @@ describe("schools module", () => {
);
const schoolsModule = new SchoolsModule({});

const expectedFeatureObject = {
const expectedFeatureObject: Record<SchoolFeature, boolean> = {
rocketChat: true,
videoconference: true,
studentVisibility: false,
Expand All @@ -108,6 +108,7 @@ describe("schools module", () => {
enableLdapSyncDuringMigration: false,
oauthProvisioningEnabled: false,
nextcloud: false,
aiTutor: false,
};

await schoolsModule.fetchSchool();
Expand Down
18 changes: 10 additions & 8 deletions tests/test-utils/mockObjects.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { SchoolFeature } from "@/serverApi/v3";
import { School } from "@/store/types/schools";

export const mockSchool: School = {
Expand Down Expand Up @@ -33,14 +34,15 @@ export const mockSchool: School = {
purpose: undefined,
features: [],
featureObject: {
rocketChat: false,
videoconference: false,
studentVisibility: false,
ldapUniventionMigrationSchool: false,
showOutdatedUsers: false,
enableLdapSyncDuringMigration: false,
nextcloud: false,
oauthProvisioningEnabled: false,
[SchoolFeature.RocketChat]: false,
[SchoolFeature.Videoconference]: false,
[SchoolFeature.StudentVisibility]: false,
[SchoolFeature.LdapUniventionMigrationSchool]: false,
[SchoolFeature.ShowOutdatedUsers]: false,
[SchoolFeature.EnableLdapSyncDuringMigration]: false,
[SchoolFeature.OauthProvisioningEnabled]: false,
[SchoolFeature.Nextcloud]: false,
[SchoolFeature.AiTutor]: false,
},
instanceFeatures: [],
permissions: {},
Expand Down

0 comments on commit 557a2d3

Please sign in to comment.