Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/unstable' into merge-into-sear…
Browse files Browse the repository at this point in the history
…ch-recs
  • Loading branch information
akolson committed Sep 18, 2024
2 parents 812a390 + 45bf94e commit 2df4aae
Show file tree
Hide file tree
Showing 47 changed files with 2,189 additions and 903 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/notify_team_new_comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
uses: slackapi/slack-github-action@v1.26.0
uses: slackapi/slack-github-action@v1.27.0
with:
payload: |
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<Checkbox
ref="checkbox"
class="ma-0 pa-0"
:class="{ selectedIndeterminate: !selected && indeterminate }"
:inputValue="selected"
:indeterminate="indeterminate"
@input="goNextSelectionState"
Expand Down Expand Up @@ -140,4 +141,8 @@
line-height: 1.3 !important;
}
/deep/ .selectedIndeterminate svg {
fill: gray !important;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<Checkbox
ref="checkbox"
class="mt-0 pt-0"
:class="{ selectedIndeterminate: !selected && indeterminate }"
:inputValue="selected"
:indeterminate="indeterminate"
@input="goNextSelectionState"
Expand Down Expand Up @@ -303,4 +304,8 @@
line-height: 1.3 !important;
}
/deep/ .selectedIndeterminate svg {
fill: gray !important;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
</template>

<template #actions-end>
<VListTileAction class="action-icon px-1" @click.stop>
<VListTileAction v-if="canEdit" class="action-icon px-1" @click.stop>
<transition name="fade">
<IconButton
icon="rename"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@

<template>

<KModal
:title="title"
:submitText="$tr('saveAction')"
:submitDisabled="!canSave"
:cancelText="$tr('cancelAction')"
data-test="edit-booleanMap-modal"
@submit="handleSave"
Expand All @@ -11,6 +13,9 @@
<p v-if="resourcesSelectedText.length > 0" data-test="resources-selected-message">
{{ resourcesSelectedText }}
</p>
<p v-if="hasMixedCategories" data-test="mixed-categories-message">
{{ hasMixedCategoriesMessage }}
</p>
<template v-if="isDescendantsUpdatable && isTopicSelected">
<KCheckbox
:checked="updateDescendants"
Expand All @@ -26,9 +31,6 @@
:inputHandler="(value) => { selectedValues = value }"
></slot>

<span v-if="error" class="red--text">
{{ error }}
</span>
</KModal>

</template>
Expand All @@ -45,6 +47,7 @@
import { mapGetters, mapActions } from 'vuex';
import { ContentKindsNames } from 'shared/leUtils/ContentKinds';
import { getInvalidText } from 'shared/utils/validation';
import commonStrings from 'shared/translator';
export default {
name: 'EditBooleanMapModal',
Expand Down Expand Up @@ -91,16 +94,27 @@
*/
selectedValues: {},
changed: false,
hasMixedCategories: false,
};
},
computed: {
...mapGetters('contentNode', ['getContentNodes']),
...mapGetters('contentNode', ['getContentNodes', 'getContentNode']),
nodes() {
return this.getContentNodes(this.nodeIds);
},
isTopicSelected() {
return this.nodes.some(node => node.kind === ContentKindsNames.TOPIC);
},
canSave() {
if (this.hasMixedCategories) {
return Object.values(this.selectedValues).some(value => value.length > 0);
}
return !this.error;
},
hasMixedCategoriesMessage() {
// eslint-disable-next-line kolibri/vue-no-undefined-string-uses
return commonStrings.$tr('addAdditionalCatgoriesDescription');
},
},
watch: {
selectedValues(newValue, oldValue) {
Expand All @@ -121,6 +135,9 @@
});
this.selectedValues = optionsNodes;
this.hasMixedCategories = Object.values(this.selectedValues).some(
value => value.length < this.nodes.length
);
// reset
this.$nextTick(() => {
this.changed = false;
Expand All @@ -147,19 +164,20 @@
}
},
async handleSave() {
this.validate();
if (this.error) {
return;
}
await Promise.all(
this.nodes.map(node => {
this.nodes.map(async node => {
const fieldValue = {};
Object.entries(this.selectedValues).forEach(([key, value]) => {
if (value.includes(node.id)) {
const currentNode = this.getContentNode(node.id);
// If we have mixed categories remain the old ones, and
// just add new categories if there are any
if (this.hasMixedCategories) {
Object.assign(fieldValue, currentNode[this.field] || {});
}
Object.entries(this.selectedValues)
.filter(([value]) => value.length === this.nodeIds.length)
.forEach(([key]) => {
fieldValue[key] = true;
}
});
});
if (this.updateDescendants && node.kind === ContentKindsNames.TOPIC) {
return this.updateContentNodeDescendants({
id: node.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
v-model="selectedLanguage"
:buttonValue="language.id"
:label="languageText(language)"
:labelDir="null"
/>
<p
v-if="!languageOptions.length"
Expand Down Expand Up @@ -178,7 +179,7 @@
'You selected resources in different languages. The language you choose below will be applied to all selected resources.',
updateDescendantsCheckbox:
'Apply the chosen language to all resources, folders, and subfolders contained within the selected folders.',
emptyLanguagesSearch: 'No languages matches the search',
emptyLanguagesSearch: 'No language matches the search',
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<div>
<KModal
v-if="!isAboutLicensesModalOpen"
:title="$tr('editAttribution')"
:submitText="$tr('saveAction')"
:cancelText="$tr('cancelAction')"
Expand Down Expand Up @@ -170,7 +169,6 @@
/* eslint-enable kolibri/vue-no-unused-properties */
},
computed: {
...mapGetters(['isAboutLicensesModalOpen']),
...mapGetters('contentNode', ['getContentNodes']),
...mapFormGettersSetters(sourceKeys),
nodes() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ let generalActions;
const CheckboxValue = {
UNCHECKED: 'UNCHECKED',
CHECKED: 'CHECKED',
INDETERMINATE: 'INDETERMINATE',
};

const { translateMetadataString } = metadataTranslationMixin.methods;
Expand All @@ -31,11 +30,9 @@ const getOptionsValues = wrapper => {
const categories = {};
const checkboxes = wrapper.findAll('[data-test="option-checkbox"]');
checkboxes.wrappers.forEach(checkbox => {
const { label, checked, indeterminate } = checkbox.vm.$props || {};
const { label, checked } = checkbox.vm.$props || {};
let value;
if (indeterminate) {
value = CheckboxValue.INDETERMINATE;
} else if (checked) {
if (checked) {
value = CheckboxValue.CHECKED;
} else {
value = CheckboxValue.UNCHECKED;
Expand Down Expand Up @@ -182,26 +179,6 @@ describe('EditBooleanMapModal', () => {
expect(dailyLifeValue).toBe(CheckboxValue.CHECKED);
expect(foundationsValue).toBe(CheckboxValue.CHECKED);
});

test('checkbox option should be indeterminate if not all nodes have the same options set', () => {
nodes['node1'].categories = {
[Categories.DAILY_LIFE]: true,
[Categories.FOUNDATIONS]: true,
};
nodes['node2'].categories = {
[Categories.DAILY_LIFE]: true,
};

const wrapper = makeWrapper({ nodeIds: ['node1', 'node2'] });

const optionsValues = getOptionsValues(wrapper);
const {
[Categories.DAILY_LIFE]: dailyLifeValue,
[Categories.FOUNDATIONS]: foundationsValue,
} = optionsValues;
expect(dailyLifeValue).toBe(CheckboxValue.CHECKED);
expect(foundationsValue).toBe(CheckboxValue.INDETERMINATE);
});
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ let nodes;
let store;
let contentNodeActions;
let generalActions;
let generalGetters;

const MIXED_VALUE = 'Mixed';

Expand Down Expand Up @@ -64,12 +63,8 @@ describe('EditSourceModal', () => {
generalActions = {
showSnackbarSimple: jest.fn(),
};
generalGetters = {
isAboutLicensesModalOpen: () => false,
};
store = new Vuex.Store({
actions: generalActions,
getters: generalGetters,
modules: {
contentNode: {
namespaced: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,6 @@
</VFlex>
</VLayout>
</BottomBar>
<AboutLicensesModal
v-if="isAboutLicensesModalOpen"
/>
<InheritAncestorMetadataModal
:parent="(createMode && detailNodeIds.length) ? parent : null"
@inherit="inheritMetadata"
Expand Down Expand Up @@ -195,7 +192,6 @@
import { fileSizeMixin, routerMixin } from 'shared/mixins';
import FileStorage from 'shared/views/files/FileStorage';
import MessageDialog from 'shared/views/MessageDialog';
import AboutLicensesModal from 'shared/views/AboutLicensesModal';
import ResizableNavigationDrawer from 'shared/views/ResizableNavigationDrawer';
import Uploader from 'shared/views/files/Uploader';
import LoadingText from 'shared/views/LoadingText';
Expand Down Expand Up @@ -226,7 +222,6 @@
SavingIndicator,
ToolBar,
BottomBar,
AboutLicensesModal,
},
mixins: [fileSizeMixin, routerMixin],
props: {
Expand Down Expand Up @@ -260,7 +255,6 @@
};
},
computed: {
...mapGetters(['isAboutLicensesModalOpen']),
...mapGetters('contentNode', ['getContentNode', 'getContentNodeIsValid']),
...mapGetters('assessmentItem', ['getAssessmentItems']),
...mapGetters('currentChannel', ['currentChannel', 'canEdit']),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@
'All future additions to this folder will have the selected details by default',
language: 'Language: {language}',
categories: 'Categories: {categories}',
learnerNeeds: 'Learner needs: {learnerNeeds}',
learnerNeeds: 'Requirements: {learnerNeeds}',
levels: 'Levels: {levels}',
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ export function isComfortableViewMode(state) {
return viewMode === viewModes.COMFORTABLE;
}

export function isAboutLicensesModalOpen(state) {
return state.aboutLicensesModalOpen;
}

// Convenience function to format strings like "Page Name - Channel Name"
// for tab titles
export function appendChannelName(state, getters) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,3 @@ export function SET_VIEW_MODE(state, viewMode) {
export function SET_VIEW_MODE_OVERRIDES(state, overrides) {
state.viewModeOverrides = overrides;
}

export function SET_SHOW_ABOUT_LICENSES(state, isOpen) {
state.aboutLicensesModalOpen = isOpen;
}
2 changes: 0 additions & 2 deletions contentcuration/contentcuration/frontend/channelEdit/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ export const STORE_CONFIG = {
* to override the current `viewMode`.
*/
viewModeOverrides: [],

aboutLicensesModalOpen: false,
};
},
actions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,7 @@
@deselect="selected = selected.filter(id => id !== $event)"
@scroll="scroll"
@editTitleDescription="showTitleDescriptionModal"
>
<template #pagination>
<slot name="pagination"></slot>
</template>
</NodePanel>
/>
</DraggableRegion>
</VFadeTransition>
<ResourceDrawer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
</span>
<ActionLink
class="mx-2"
:disabled="searchIsNotEmpty || currentSearchSaved"
:disabled="currentSearchSaved"
:text="currentSearchSaved ? $tr('searchSavedSnackbar') : $tr('saveSearchAction')"
@click="handleClickSaveSearch"
/>
Expand Down
Loading

0 comments on commit 2df4aae

Please sign in to comment.