Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
72 changes: 67 additions & 5 deletions src/components/pages/ProductionSchedule.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@
:options="modeOptions"
@update:model-value="onModeChanged"
/>

<combobox
class="flexrow-item ml1"
v-if="availableEntityTypes.length > 1"
:label="$t('schedule.entities')"
v-model="entityTypeFilter"
:options="entityFilterOptions"
@update:model-value="onEntityFilterChanged"
/>
<div class="flexrow-item ml1" v-if="mode === 'prev'">
<label class="label">
{{ $t('schedule.version') }}
Expand Down Expand Up @@ -65,6 +74,7 @@
/>
</div>
</div>

<div class="filler"></div>
<div class="flexrow" style="margin-top: 23px">
<button-simple
Expand Down Expand Up @@ -105,7 +115,7 @@
ref="schedule"
:start-date="startDate"
:end-date="endDate"
:hierarchy="scheduleItems"
:hierarchy="filteredScheduleItems"
:zoom-level="zoomLevel"
:is-loading="loading.schedule"
:is-error="errors.schedule"
Expand Down Expand Up @@ -580,7 +590,7 @@ export default {
daysOffByPerson: {},
draggedEntities: [],
endDate: moment().add(6, 'months').endOf('day'),
isSidePanelOpen: false,
entityTypeFilter: 'ALL',
scheduleItems: [],
startDate: moment().startOf('day'),
selectedStartDate: null,
Expand Down Expand Up @@ -740,7 +750,38 @@ export default {
}

return [referenceVersion, ...options]
}
},

availableEntityTypes() {
const types = new Set()
this.scheduleItems.forEach(item => {
const taskType = this.taskTypeMap.get(item.task_type_id)
if (taskType && taskType.for_entity) {
types.add(taskType.for_entity)
}
})
return Array.from(types).sort()
},

entityFilterOptions() {
const options = [
{ label: this.$t('schedule.all_entities'), value: 'ALL' }
]
this.availableEntityTypes.forEach(type => {
options.push({ label: type, value: type })
})
return options
},

filteredScheduleItems() {
if (this.entityTypeFilter === 'ALL') {
return this.scheduleItems
}
return this.scheduleItems.filter(item => {
const taskType = this.taskTypeMap.get(item.task_type_id)
return taskType && taskType.for_entity === this.entityTypeFilter
})
},
},

methods: {
Expand Down Expand Up @@ -769,7 +810,7 @@ export default {
'updateTask'
]),

updateRoute({ mode, version, zoom }) {
updateRoute({ mode, version, zoom, entityTypes }) {
const query = { ...this.$route.query }

if (mode !== undefined) {
Expand All @@ -781,6 +822,9 @@ export default {
if (zoom !== undefined) {
query.zoom = String(zoom)
}
if (entityTypes !== undefined) {
query.entityTypes = entityTypes || undefined
}

if (JSON.stringify(query) !== JSON.stringify(this.$route.query)) {
this.$router.push({ query })
Expand Down Expand Up @@ -888,6 +932,13 @@ export default {
this.zoomLevel = this.zoomOptions.map(o => o.value).includes(zoom)
? zoom
: DEFAULT_ZOOM

const entityType = this.$route.query.entityType
if (entityType) {
this.entityTypeFilter = entityType
} else {
this.entityTypeFilter = 'ALL'
}
},

convertScheduleItems(taskTypeElement, scheduleItems) {
Expand Down Expand Up @@ -965,7 +1016,9 @@ export default {
: this.loadSequenceScheduleItems
: taskTypeElement.for_entity === 'Shot'
? this.loadSequenceScheduleItems
: this.loadAssetTypeScheduleItems
: taskTypeElement.for_entity === 'Sequence'
? this.loadSequenceScheduleItems
: this.loadAssetTypeScheduleItems
const parameters = {
production: this.currentProduction,
taskType: this.taskTypeMap.get(taskTypeElement.task_type_id)
Expand Down Expand Up @@ -1851,6 +1904,13 @@ export default {
this.refreshSchedule()
},

onEntityFilterChanged() {
const entityType = this.entityTypeFilter !== 'ALL'
? this.entityTypeFilter
: undefined
this.updateRoute({ entityType })
},

refreshSchedule() {
this.scheduleItems.forEach(item => {
if (!item.expanded) {
Expand Down Expand Up @@ -2427,5 +2487,7 @@ export default {
width: 90px;
}
}

// Entity filter styling to match navigation menu
}
</style>
5 changes: 4 additions & 1 deletion src/locales/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -1584,7 +1584,10 @@ export default {
new: 'new schedule',
name: 'version name',
locked: 'locked version'
}
},
entities: 'Entities',
all_entities: 'All',
selected: 'selected'
},

team_schedule: {
Expand Down