Skip to content

Commit

Permalink
Merge branch 'main' into N21-2242-course-sync-add-handling-for-substi…
Browse files Browse the repository at this point in the history
…tute-teachers
  • Loading branch information
MBergCap authored Dec 12, 2024
2 parents e28def8 + 3319a03 commit 76deb47
Show file tree
Hide file tree
Showing 95 changed files with 4,111 additions and 894 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"vue-router": "^4.2.4",
"vue3-mq": "^3.1.3",
"vuedraggable": "^4.1.0",
"vuetify": "^3.7.1",
"vuetify": "^3.7.5",
"vuex": "^4.0.2"
},
"devDependencies": {
Expand Down
112 changes: 68 additions & 44 deletions src/components/copy-result-modal/CopyResultModal.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,53 +151,77 @@ describe("@/components/copy-result-modal/CopyResultModal", () => {
);
});

it("should render ctl tools info if root item is a Course and has no failed file ", () => {
const copyResultItems = mockLessonResultItems([]);

const envs = envsFactory.build({
FEATURE_CTL_TOOLS_TAB_ENABLED: true,
});
envConfigModule.setEnvs(envs);
const wrapper = createWrapper({
isOpen: true,
copyResultItems,
copyResultRootItemType: CopyApiResponseTypeEnum.Course,
});

const dialog = wrapper.findComponent(vCustomDialog);
const content = dialog.findComponent(".v-card-text").text();

expect(content).toContain(
"components.molecules.copyResult.ctlTools.info"
);
});

describe("when root item is a Course, has no failed file and CTL_TOOLS_COPY feature flag is enabled", () => {
const setup = () => {
const copyResultItems = mockLessonResultItems([]);
const wrapper = createWrapper({
isOpen: true,
copyResultItems,
copyResultRootItemType: CopyApiResponseTypeEnum.Course,
describe("when there is no failed file and CTL_TOOLS_COPY & CTL_TOOLS_TAB_ENABLED feature flag is enabled", () => {
describe("when the item has element of type external tool", () => {
const setup = () => {
const envs = envsFactory.build({
FEATURE_CTL_TOOLS_TAB_ENABLED: true,
FEATURE_CTL_TOOLS_COPY_ENABLED: true,
});
envConfigModule.setEnvs(envs);

const copyResultItems = mockLessonResultItems([]);
copyResultItems[0].elements.push({
title: "Course External Tool",
type: CopyApiResponseTypeEnum.ExternalTool,
});
copyResultItems[0].type = CopyApiResponseTypeEnum.Course;

const wrapper = createWrapper({
isOpen: true,
copyResultItems,
copyResultRootItemType: CopyApiResponseTypeEnum.Course,
});

return { wrapper };
};

it("should show the warning text for non-copyable course external tools", () => {
const { wrapper } = setup();

const dialog = wrapper.findComponent(vCustomDialog);
const content = dialog.findComponent(".v-card-text").text();

expect(content).toContain(
"components.molecules.copyResult.ctlTools.withFeature.info"
);
});
});

return { wrapper };
};

it("should render ctl tools copy info ", () => {
const envs = envsFactory.build({
FEATURE_CTL_TOOLS_TAB_ENABLED: true,
FEATURE_CTL_TOOLS_COPY_ENABLED: true,
describe("when there is an item of type ExternalToolElement", () => {
const setup = () => {
const envs = envsFactory.build({
FEATURE_CTL_TOOLS_TAB_ENABLED: true,
FEATURE_CTL_TOOLS_COPY_ENABLED: true,
});
envConfigModule.setEnvs(envs);

const copyResultItems = mockLessonResultItems([]);
copyResultItems[0].elements.push({
title: "Board External Tool Element",
type: CopyApiResponseTypeEnum.ExternalToolElement,
});
copyResultItems[0].type = CopyApiResponseTypeEnum.Course;

const wrapper = createWrapper({
isOpen: true,
copyResultItems,
copyResultRootItemType: CopyApiResponseTypeEnum.Course,
});

return { wrapper };
};

it("should show the warning text for non-copyable course external tools", () => {
const { wrapper } = setup();

const dialog = wrapper.findComponent(vCustomDialog);
const content = dialog.findComponent(".v-card-text").text();

expect(content).toContain(
"components.molecules.copyResult.ctlTools.withFeature.info"
);
});
envConfigModule.setEnvs(envs);
const { wrapper } = setup();

const dialog = wrapper.findComponent(vCustomDialog);
const content = dialog.findComponent(".v-card-text").text();

expect(content).toContain(
"components.molecules.copyResult.ctlTools.withFeature.info"
);
});
});

Expand Down
18 changes: 16 additions & 2 deletions src/components/copy-result-modal/CopyResultModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ export default {
title: this.$t("components.molecules.copyResult.label.files"),
},
{
isShow: this.hasFeatureCtlsToolsenabled,
isShow:
this.isFeatureCtlToolsEnabled &&
(this.hasExternalTool || this.hasExternalToolElement),
text: this.externalToolsInfoText,
title: this.$t("components.molecules.copyResult.label.externalTools"),
},
Expand Down Expand Up @@ -178,7 +180,7 @@ export default {
CopyApiResponseTypeEnum.CoursegroupGroup
);
},
hasFeatureCtlsToolsenabled() {
isFeatureCtlToolsEnabled() {
return envConfigModule.getCtlToolsTabEnabled;
},
hasErrors() {
Expand Down Expand Up @@ -206,6 +208,18 @@ export default {
? this.$t("components.molecules.copyResult.ctlTools.withFeature.info")
: this.$t("components.molecules.copyResult.ctlTools.info");
},
hasExternalTool() {
return this.hasElementOfType(
this.items,
CopyApiResponseTypeEnum.ExternalTool
);
},
hasExternalToolElement() {
return this.hasElementOfType(
this.items,
CopyApiResponseTypeEnum.ExternalToolElement
);
},
},
methods: {
hasElementOfType(items, types) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ describe("@/components/copy-result-modal/CopyResultModalListItem", () => {
CopyApiResponseTypeEnum.CollaborativeTextEditorElement,
"components.molecules.copyResult.label.etherpad",
],
[
CopyApiResponseTypeEnum.ExternalToolElement,
"components.molecules.copyResult.label.toolElements",
],
];

map.forEach(([constant, languageConstant]) => {
Expand Down
3 changes: 3 additions & 0 deletions src/components/copy-result-modal/CopyResultModalListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
v-for="element in aggregatedElements()"
:key="element.type"
class="element-info"
data-testid="copy-result-list-item-element-info"
>
<span>
{{ element.count }} {{ element.type }}
Expand Down Expand Up @@ -121,6 +122,8 @@ export default {
return this.$t("components.molecules.copyResult.label.columnBoard");
case CopyApiResponseTypeEnum.DrawingElement:
return this.$t("components.molecules.copyResult.label.tldraw");
case CopyApiResponseTypeEnum.ExternalToolElement:
return this.$t("components.molecules.copyResult.label.toolElements");
default:
return this.$t("components.molecules.copyResult.label.unknown");
}
Expand Down
29 changes: 26 additions & 3 deletions src/components/rooms/RoomExternalToolCard.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<room-base-card
:title="tool.name"
v-if="showTool"
:title="toolName"
:logo-url="tool.logoUrl"
:open-in-new-tab="tool.openInNewTab"
test-id="tool-card"
Expand Down Expand Up @@ -72,15 +73,15 @@ const props = defineProps({
},
});
const emit = defineEmits(["edit", "delete", "error"]);
const emit = defineEmits(["edit", "delete", "error", "refresh"]);
const { t } = useI18n();
const {
fetchContextLaunchRequest,
launchTool,
error: launchError,
} = useExternalToolLaunchState();
} = useExternalToolLaunchState(() => emit("refresh"));
const { isTeacher } = useContextExternalToolConfigurationStatus();
Expand Down Expand Up @@ -122,6 +123,28 @@ const menuItems = [
},
];
const isDeepLinkingTool: ComputedRef = computed(
() => !!props.tool.isLtiDeepLinkingTool
);
const hasDeepLink: ComputedRef = computed(() => !!props.tool.ltiDeepLink);
const toolName: ComputedRef = computed(() => {
if (isDeepLinkingTool.value) {
return hasDeepLink.value
? props.tool.name
: t("feature-board-external-tool-element.placeholder.selectContent", {
toolName: props.tool.name,
});
}
return props.tool.name;
});
const showTool: ComputedRef = computed(
() => !(isDeepLinkingTool.value && !hasDeepLink.value && !isTeacher())
);
const isToolOutdated: ComputedRef = computed(
() =>
props.tool.status.isOutdatedOnScopeSchool ||
Expand Down
Loading

0 comments on commit 76deb47

Please sign in to comment.