Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

N21-1506 sharing ctl tools #3461

Merged
merged 27 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
06356a8
share options modal, test and locales
IgorCapCoder Nov 25, 2024
cf2fa93
Merge branch 'main' into N21-1506-sharing-ctl-tools
IgorCapCoder Nov 26, 2024
7cc36b0
import modal, test and locales
IgorCapCoder Nov 26, 2024
a199cd0
update node version
IgorCapCoder Nov 26, 2024
c9e1f88
CopyResultModal, test, de-locales - ToDo: other locales
IgorCapCoder Nov 28, 2024
913d55f
Revert: CopyResultModal, test, de-locales - ToDo: other locales
IgorCapCoder Nov 29, 2024
966ded2
modify a locale
IgorCapCoder Nov 29, 2024
9f96acc
fix i18n tests
IgorCapCoder Nov 29, 2024
4610cd5
Merge branch 'main' into N21-1506-sharing-ctl-tools
IgorCapCoder Nov 29, 2024
adda424
Merge branch 'main' into N21-1506-sharing-ctl-tools
IgorCapCoder Dec 1, 2024
c8feea0
N21-1506 add data-testid
GordonNicholasCap Dec 2, 2024
65947e0
requested changes
IgorCapCoder Dec 2, 2024
4fb0ac3
...
IgorCapCoder Dec 2, 2024
a7d1895
Merge branch 'main' into N21-1506-sharing-ctl-tools
IgorCapCoder Dec 2, 2024
1b96a7a
...
IgorCapCoder Dec 2, 2024
a4ec323
requested changes locale keys
IgorCapCoder Dec 3, 2024
711efc0
add data-testid
MBergCap Dec 4, 2024
5eb17e0
add data-testid
MBergCap Dec 4, 2024
58ead6e
requested changes locales, <p>
IgorCapCoder Dec 4, 2024
6172c9b
N21-1506 show copy failed board external tool elements in copy result…
GordonNicholasCap Dec 4, 2024
381461a
N21-1506 show report when failing to copy course tools
GordonNicholasCap Dec 5, 2024
a7b726f
Merge branch 'main' into N21-1506-sharing-ctl-tools
IgorCapCoder Dec 5, 2024
172da66
- move deleted element warning alert below element
IgorCapCoder Dec 5, 2024
41b0cc9
N21-1506 fix missing warning text for failed board tools copy
GordonNicholasCap Dec 5, 2024
c49b78e
Merge branch 'main' into N21-1506-sharing-ctl-tools
GordonNicholasCap Dec 5, 2024
3f38e58
Merge branch 'main' into N21-1506-sharing-ctl-tools
GordonNicholasCap Dec 5, 2024
cc42f04
N21-1506 review changes
GordonNicholasCap Dec 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/components/share/ImportModal.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import ImportModal from "@/components/share/ImportModal.vue";
import EnvConfigModule from "@/store/env-config";
import { ENV_CONFIG_MODULE_KEY } from "@/utils/inject";
import { createModuleMocks } from "@@/tests/test-utils/mock-store-module";
import { mount } from "@vue/test-utils";
import {
createTestingI18n,
createTestingVuetify,
} from "@@/tests/test-utils/setup";
import { mount } from "@vue/test-utils";

describe("@components/share/ImportModal", () => {
const setup = (envConfigModuleGetter?: Partial<EnvConfigModule>) => {
Expand Down Expand Up @@ -122,11 +122,11 @@ describe("@components/share/ImportModal", () => {
`[data-testid="import-modal-external-tools-info"]`
);

expect(infoText.attributes("html")).toEqual(
"components.molecules.import.courses.options.ctlTools.infoText"
expect(infoText.text()).toEqual(
"components.molecules.shareImport.options.ctlTools.infoText.unavailable"
);
});
it("should not show course file info", () => {
it("should also show course file info", () => {
const { wrapper } = setup({ getCtlToolsTabEnabled: true });

const dialog = wrapper.findComponent({ name: "v-custom-dialog" });
Expand All @@ -136,7 +136,7 @@ describe("@components/share/ImportModal", () => {
`[data-testid="import-modal-coursefiles-info"]`
);

expect(infoText.exists()).toBe(false);
expect(infoText.exists()).toBe(true);
});
});
describe("show ctl tool info is disabled", () => {
Expand Down Expand Up @@ -176,7 +176,7 @@ describe("@components/share/ImportModal", () => {
);

expect(infoText.element.innerHTML).toEqual(
"components.molecules.import.courses.options.infoText"
"components.molecules.shareImport.options.restrictions.infoText.courseFiles"
);
});
});
Expand Down
90 changes: 73 additions & 17 deletions src/components/share/ImportModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
confirm-btn-title-key="common.actions.import"
@dialog-confirmed="onConfirm"
@dialog-canceled="onCancel"
data-testid="import-modal"
>
<template #title>
<div ref="textTitle" class="text-h4 my-2">
Expand All @@ -21,39 +22,91 @@
<div class="mx-2">
<v-icon color="info" :icon="mdiInformation" />
</div>
<RenderHTML
data-testid="import-modal-external-tools-info"
v-if="ctlToolsEnabled && parentType === 'courses'"
:html="
t(
`components.molecules.import.${parentType}.options.ctlTools.infoText`
)
"
/>
<div v-else data-testid="import-modal-coursefiles-info">
{{
t(`components.molecules.import.${parentType}.options.infoText`)
}}
<div>
GordonNicholasCap marked this conversation as resolved.
Show resolved Hide resolved
<div data-testid="import-options-table-header">
{{
t(
"components.molecules.shareImport.options.tableHeader.InfoText"
)
}}
<ul class="ml-6">
<li data-testid="import-options-personal-data-text">
{{
t(
"components.molecules.shareImport.options.restrictions.infoText.personalData"
)
}}
</li>
<li
v-if="showCtlToolsInfo"
data-testid="import-modal-external-tools-info"
>
{{
t(
"components.molecules.shareImport.options.ctlTools.infoText.unavailable"
)
}}
</li>
<li v-if="showCtlToolsInfo">
{{
t(
"components.molecules.shareImport.options.ctlTools.infoText.protected"
)
}}
</li>
<li data-testid="import-modal-coursefiles-info">
{{
t(
"components.molecules.shareImport.options.restrictions.infoText.courseFiles"
)
}}
</li>
<li>
{{
t(
"components.molecules.shareImport.options.restrictions.infoText.etherpad"
)
}}
</li>
<li>
{{
t(
"components.molecules.shareImport.options.restrictions.infoText.geogebra"
)
}}
</li>
<li>
{{
t(
"components.molecules.shareImport.options.restrictions.infoText.courseGroups"
)
}}
</li>
</ul>
</div>
</div>
</div>
<div class="mb-4">
{{ t(`components.molecules.import.${parentType}.rename`) }}
</div>
<v-text-field
ref="nameInputText"
v-model="newName"
:label="t(`components.molecules.import.${parentType}.label`)"
:rules="[rules.required]"
data-testid="import-modal-name-input"
/>
</div>
</template>
</v-custom-dialog>
</template>

<script setup>
import vCustomDialog from "@/components/organisms/vCustomDialog.vue";
import VCustomDialog from "@/components/organisms/vCustomDialog.vue";
import { ENV_CONFIG_MODULE_KEY, injectStrict } from "@/utils/inject";
import { mdiInformation } from "@icons/material";
import { computed, reactive, ref } from "vue";
import { useI18n } from "vue-i18n";
import { RenderHTML } from "@feature-render-html";

const emit = defineEmits(["import", "cancel"]);
const props = defineProps({
Expand Down Expand Up @@ -82,7 +135,10 @@ const onConfirm = () => {
};
const onCancel = () => emit("cancel");

const ctlToolsEnabled = computed(() => {
return envConfigModule.getCtlToolsTabEnabled;
const showCtlToolsInfo = computed(() => {
return (
envConfigModule.getCtlToolsTabEnabled &&
(props.parentType === "courses" || props.parentType === "columnBoard")
);
});
</script>
17 changes: 8 additions & 9 deletions src/components/share/ShareModal.unit.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import ShareModule from "@/store/share";
import { createModuleMocks } from "@@/tests/test-utils/mock-store-module";
import { mount } from "@vue/test-utils";
import ShareModal from "./ShareModal.vue";
import vCustomDialog from "@/components/organisms/vCustomDialog.vue";
import ShareModalOptionsForm from "@/components/share/ShareModalOptionsForm.vue";
import ShareModalResult from "@/components/share/ShareModalResult.vue";
import { ShareTokenBodyParamsParentTypeEnum } from "@/serverApi/v3";
import EnvConfigModule from "@/store/env-config";
import NotifierModule from "@/store/notifier";
import ShareModule from "@/store/share";
import {
ENV_CONFIG_MODULE_KEY,
NOTIFIER_MODULE_KEY,
SHARE_MODULE_KEY,
} from "@/utils/inject";
import NotifierModule from "@/store/notifier";
import EnvConfigModule from "@/store/env-config";
import { createModuleMocks } from "@@/tests/test-utils/mock-store-module";
import {
createTestingI18n,
createTestingVuetify,
} from "@@/tests/test-utils/setup";
import { mount } from "@vue/test-utils";
import ShareModal from "./ShareModal.vue";

describe("@/components/share/ShareModal", () => {
let shareModuleMock: ShareModule;
Expand Down Expand Up @@ -137,11 +137,10 @@ describe("@/components/share/ShareModal", () => {
`[data-testid="share-modal-external-tools-info"]`
);

expect(infotext.isVisible()).toBe(true);
expect(infotext.text()).toEqual(
"components.molecules.share.courses.options.ctlTools.infotext"
"components.molecules.shareImport.options.ctlTools.infoText.unavailable"
);

expect(infotext.isVisible()).toBe(true);
});
});

Expand Down
88 changes: 71 additions & 17 deletions src/components/share/ShareModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,73 @@
<!--Fade-out animation ensures that the dialog shows the last visible step while closing-->
<v-fade-transition>
<div v-if="step === 'firstStep' && isOpen">
<div data-testid="share-options-info-text">
{{ t(`components.molecules.share.${type}.options.infoText`) }}
</div>
<div class="d-flex flex-row pa-2 mb-4 rounded bg-blue-lighten-5">
<div class="mx-2">
<v-icon color="info" :icon="mdiInformation" />
</div>
<div>
{{ t(`components.molecules.share.${type}.options.infoText`) }}
<br />
{{ t("components.molecules.copyResult.courseFiles.info") }}
<div
data-testid="share-modal-external-tools-info"
v-if="ctlToolsEnabled"
>
{{
t(
`components.molecules.share.courses.options.ctlTools.infotext`
)
}}
</div>
<div data-testid="share-options-table-header">
{{
t(
"components.molecules.shareImport.options.tableHeader.InfoText"
)
}}
<ul class="ml-6">
<li data-testid="share-options-personal-data-text">
{{
t(
"components.molecules.shareImport.options.restrictions.infoText.personalData"
)
}}
</li>
<li
v-if="showCtlToolsInfo"
data-testid="share-modal-external-tools-info"
>
{{
t(
"components.molecules.shareImport.options.ctlTools.infoText.unavailable"
)
}}
</li>
<li v-if="showCtlToolsInfo">
{{
t(
"components.molecules.shareImport.options.ctlTools.infoText.protected"
)
}}
</li>
<li data-testid="share-modal-coursefiles-info">
{{
t(
"components.molecules.shareImport.options.restrictions.infoText.courseFiles"
)
}}
</li>
<li>
{{
t(
"components.molecules.shareImport.options.restrictions.infoText.etherpad"
)
}}
</li>
<li>
{{
t(
"components.molecules.shareImport.options.restrictions.infoText.geogebra"
)
}}
</li>
<li>
{{
t(
"components.molecules.shareImport.options.restrictions.infoText.courseGroups"
)
}}
</li>
</ul>
</div>
</div>
<share-modal-options-form
Expand All @@ -58,7 +107,7 @@
</template>

<script setup lang="ts">
import vCustomDialog from "@/components/organisms/vCustomDialog.vue";
import VCustomDialog from "@/components/organisms/vCustomDialog.vue";
import ShareModalOptionsForm from "@/components/share/ShareModalOptionsForm.vue";
import ShareModalResult from "@/components/share/ShareModalResult.vue";
import { ShareTokenBodyParamsParentTypeEnum } from "@/serverApi/v3/api";
Expand Down Expand Up @@ -97,6 +146,8 @@ const step = computed<ShareModalStep>(() =>
shareModule.getShareUrl === undefined ? "firstStep" : "secondStep"
);

const isCourse = computed(() => props.type === "courses");
GordonNicholasCap marked this conversation as resolved.
Show resolved Hide resolved
IgorCapCoder marked this conversation as resolved.
Show resolved Hide resolved

const modalOptions: Record<
ShareModalStep,
{ title: string; actionButtons: string[] }
Expand Down Expand Up @@ -141,7 +192,10 @@ const onCopy = () => {
});
};

const ctlToolsEnabled = computed(() => {
return envConfigModule.getCtlToolsTabEnabled;
const showCtlToolsInfo = computed(() => {
return (
envConfigModule.getCtlToolsTabEnabled &&
(props.type === "courses" || props.type === "columnBoard")
);
});
</script>
1 change: 1 addition & 0 deletions src/components/share/ShareModalResult.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
:model-value="shareUrl"
readonly
:label="`${t(`components.molecules.share.${type}.result.linkLabel`)}`"
data-testid="share-course-result-url"
/>
<div class="mb-4">
<div
Expand Down
Loading
Loading