Skip to content

Commit

Permalink
Merge pull request #1564 from NicoPennec/fix/various
Browse files Browse the repository at this point in the history
Various fixes
  • Loading branch information
NicoPennec authored Oct 28, 2024
2 parents 1231991 + 176e9b3 commit ee77c47
Show file tree
Hide file tree
Showing 13 changed files with 116 additions and 128 deletions.
6 changes: 4 additions & 2 deletions src/components/mixins/entities.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,14 @@ export const entitiesMixin = {
this.$store.commit('SET_EDIT_LIST_SCROLL_POSITION', scrollPosition)
},

onSearchChange() {
onSearchChange(clearSelection = true) {
if (!this.searchField) return
this.isSearchActive = false
const searchQuery = this.searchField.getValue() || ''
this.applySearch(searchQuery)
this.clearSelection()
if (clearSelection) {
this.clearSelection()
}
},

onChangeSortClicked(sortInfo) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/modals/EditPlaylistModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ export default {
this.forClient = this.playlistToEdit.for_client ? 'true' : 'false'
this.resetForm()
setTimeout(() => {
this.$refs.nameField.focus()
this.$refs.nameField?.focus()
}, 100)
}
}
Expand Down
19 changes: 10 additions & 9 deletions src/components/pages/AssetLibrary.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<page-layout>
<page-layout :side="isCurrentUserManager">
<template #main>
<div class="asset-library">
<header class="flexrow">
Expand Down Expand Up @@ -55,11 +55,12 @@
<li
class="item flexcolumn"
:class="{
'selectable-item': isCurrentUserManager,
'selected-item': isSelected(entity)
}"
:key="entity.id"
v-for="entity in group"
@click="toggleEntity(entity)"
@click="isCurrentUserManager && toggleEntity(entity)"
>
<div class="card" :title="entity.full_name">
<entity-preview
Expand Down Expand Up @@ -156,6 +157,7 @@ export default {
...mapGetters([
'displayedSharedAssets',
'displayedSharedAssetsByType',
'isCurrentUserManager',
'openProductions',
'productionMap',
'selectedAssets'
Expand Down Expand Up @@ -188,10 +190,6 @@ export default {
}
return type.sort(firstBy(nameFilter).thenBy(productionFilter))
})
},
hasSelectedAssets() {
return this.selectedAssets.size > 0
}
},
Expand Down Expand Up @@ -280,10 +278,13 @@ export default {
border: 5px solid transparent;
border-radius: 1em;
transition: border-color 0.2s ease-in-out;
cursor: pointer;
&:hover {
border-color: var(--background-selectable);
&.selectable-item {
cursor: pointer;
&:hover {
border-color: var(--background-selectable);
}
}
&.selected-item {
Expand Down
28 changes: 16 additions & 12 deletions src/components/pages/Assets.vue
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ export default {
this.onSearchChange()
this.$refs['asset-list'].setScrollPosition(this.assetListScrollPosition)
this.$nextTick(() => {
this.$refs['asset-list'].selectTaskFromQuery()
this.$refs['asset-list']?.selectTaskFromQuery()
})
}
}
Expand Down Expand Up @@ -629,7 +629,7 @@ export default {
.then(form => {
this.loading.edit = false
this.modals.isNewDisplayed = false
this.onSearchChange()
this.onSearchChange(false)
})
.catch(err => {
console.error(err)
Expand Down Expand Up @@ -837,7 +837,7 @@ export default {
this.showImportModal()
},
onSearchChange() {
onSearchChange(clearSelection = true) {
const searchQuery = this.searchField.getValue() || ''
if (
searchQuery.length !== 1 &&
Expand All @@ -847,7 +847,9 @@ export default {
this.setAssetSearch(searchQuery)
this.setSearchInUrl()
}
this.clearSelection()
if (clearSelection) {
this.clearSelection()
}
},
saveSearchQuery(searchQuery) {
Expand Down Expand Up @@ -988,26 +990,28 @@ export default {
},
async onFieldChanged({ entry, fieldName, value }) {
const data = { id: entry.id }
data[fieldName] = value
const data = {
id: entry.id,
[fieldName]: value
}
await this.editAsset(data)
this.onSearchChange()
this.onSearchChange(false)
},
async onMetadataChanged({ entry, descriptor, value }) {
const metadata = {}
metadata[descriptor.field_name] = value
const data = {
id: entry.id,
data: metadata
data: {
[descriptor.field_name]: value
}
}
await this.editAsset(data)
this.onSearchChange()
this.onSearchChange(false)
},
async onAssetChanged(asset) {
await this.editAsset(asset)
this.onSearchChange()
this.onSearchChange(false)
},
reset() {
Expand Down
22 changes: 12 additions & 10 deletions src/components/pages/Edits.vue
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ export default {
.then(form => {
this.loading.edit = false
this.modals.isNewDisplayed = false
this.onSearchChange()
this.onSearchChange(false)
})
.catch(err => {
console.error(err)
Expand Down Expand Up @@ -828,7 +828,7 @@ export default {
this.modals.isDeleteAllTasksDisplayed = true
},
onSearchChange() {
onSearchChange(clearSelection = true) {
if (!this.searchField) return
this.isSearchActive = false
const searchQuery = this.searchField.getValue() || ''
Expand All @@ -838,7 +838,9 @@ export default {
if (searchQuery.length === 0 && this.isLongEditList) {
this.applySearch('')
}
this.clearSelection()
if (clearSelection) {
this.clearSelection()
}
},
saveScrollPosition(scrollPosition) {
Expand Down Expand Up @@ -941,22 +943,22 @@ export default {
async onFieldChanged({ entry, fieldName, value }) {
const data = {
id: entry.id,
description: entry.description
description: entry.description,
[fieldName]: value
}
data[fieldName] = value
await this.editEdit(data)
this.onSearchChange()
this.onSearchChange(false)
},
async onMetadataChanged({ entry, descriptor, value }) {
const metadata = {}
metadata[descriptor.field_name] = value
const data = {
id: entry.id,
data: metadata
data: {
[descriptor.field_name]: value
}
}
await this.editEdit(data)
this.onSearchChange()
this.onSearchChange(false)
}
},
Expand Down
18 changes: 9 additions & 9 deletions src/components/pages/Episodes.vue
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ export default {
this.episodeListScrollPosition
)
this.$nextTick(() => {
this.$refs['episode-list'].selectTaskFromQuery()
this.$refs['episode-list']?.selectTaskFromQuery()
})
}
}
Expand Down Expand Up @@ -559,22 +559,22 @@ export default {
async onFieldChanged({ entry, fieldName, value }) {
const data = {
id: entry.id,
description: entry.description
description: entry.description,
[fieldName]: value
}
data[fieldName] = value
await this.editEpisode(data)
this.onSearchChange()
this.onSearchChange(false)
},
async onMetadataChanged({ entry, descriptor, value }) {
const metadata = {}
metadata[descriptor.field_name] = value
const data = {
id: entry.id,
data: metadata
data: {
[descriptor.field_name]: value
}
}
await this.editEpisode(data)
this.onSearchChange()
this.onSearchChange(false)
},
onEditClicked(episode) {
Expand All @@ -596,7 +596,7 @@ export default {
.then(() => {
this.loading.edit = false
this.modals.isNewDisplayed = false
this.onSearchChange()
this.onSearchChange(false)
})
.catch(err => {
console.error(err)
Expand Down
2 changes: 1 addition & 1 deletion src/components/pages/MyChecks.vue
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ export default {
const isName = this.currentSort === 'entity_name'
const isPriority = this.currentSort === 'priority'
const isDueDate = this.currentSort === 'due_date'
const tasks = this.filteredTasks
const tasks = [...this.filteredTasks]
if (isName) {
return tasks.sort(
firstBy('project_name')
Expand Down
16 changes: 8 additions & 8 deletions src/components/pages/Sequences.vue
Original file line number Diff line number Diff line change
Expand Up @@ -559,22 +559,22 @@ export default {
async onFieldChanged({ entry, fieldName, value }) {
const data = {
id: entry.id,
description: entry.description
description: entry.description,
[fieldName]: value
}
data[fieldName] = value
await this.editSequence(data)
this.onSearchChange()
this.onSearchChange(false)
},
async onMetadataChanged({ entry, descriptor, value }) {
const metadata = {}
metadata[descriptor.field_name] = value
const data = {
id: entry.id,
data: metadata
data: {
[descriptor.field_name]: value
}
}
await this.editSequence(data)
this.onSearchChange()
this.onSearchChange(false)
},
onEditClicked(sequence) {
Expand All @@ -595,7 +595,7 @@ export default {
.then(() => {
this.loading.edit = false
this.modals.isNewDisplayed = false
this.onSearchChange()
this.onSearchChange(false)
})
.catch(err => {
console.error(err)
Expand Down
22 changes: 12 additions & 10 deletions src/components/pages/Shots.vue
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ export default {
// Needed to be sure the shots are loaded
this.onSearchChange()
this.$nextTick(() => {
this.$refs['shot-list'].selectTaskFromQuery()
this.$refs['shot-list']?.selectTaskFromQuery()
})
})
})
Expand Down Expand Up @@ -487,7 +487,7 @@ export default {
this.onSearchChange()
this.$refs['shot-list'].setScrollPosition(this.shotListScrollPosition)
this.$nextTick(() => {
this.$refs['shot-list'].selectTaskFromQuery()
this.$refs['shot-list']?.selectTaskFromQuery()
})
}
},
Expand Down Expand Up @@ -705,7 +705,7 @@ export default {
.then(() => {
this.loading.edit = false
this.modals.isNewDisplayed = false
this.onSearchChange()
this.onSearchChange(false)
})
.catch(err => {
console.error(err)
Expand Down Expand Up @@ -935,7 +935,7 @@ export default {
this.onSearchChange()
},
onSearchChange() {
onSearchChange(clearSelection = true) {
if (!this.searchField) return
this.isSearchActive = false
const searchQuery = this.searchField.getValue() || ''
Expand All @@ -945,7 +945,9 @@ export default {
if (searchQuery.length === 0 && this.isLongShotList) {
this.applySearch('')
}
this.clearSelection()
if (clearSelection) {
this.clearSelection()
}
},
saveScrollPosition(scrollPosition) {
Expand Down Expand Up @@ -1080,15 +1082,15 @@ export default {
}
data[fieldName] = value
await this.editShot(data)
this.onSearchChange()
this.onSearchChange(false)
},
async onMetadataChanged({ entry, descriptor, value }) {
const metadata = {}
metadata[descriptor.field_name] = value
const data = {
id: entry.id,
data: metadata
data: {
[descriptor.field_name]: value
}
}
const shot = this.shotMap.get(entry.id)
if (
Expand All @@ -1106,7 +1108,7 @@ export default {
data.nb_frames = parseInt(value) - parseInt(shot.data.frame_in) + 1
}
await this.editShot(data)
this.onSearchChange()
this.onSearchChange(false)
},
showEDLImportModal() {
Expand Down
Loading

0 comments on commit ee77c47

Please sign in to comment.