|
66 | 66 | show.sectionHasField(show.layout.sections[0], 'entityList') |
67 | 67 | || show.sectionHasField(show.layout.sections[0], 'dashboard') |
68 | 68 | || show.layout.sections[0].title |
69 | | - || show.sectionCommands(show.layout.sections[0])?.flat().length |
| 69 | + || show.sectionAllowedCommands(show.layout.sections[0])?.flat().length |
70 | 70 | ) |
71 | 71 | || !show.layout.sections.length) { |
72 | 72 | return [ |
|
208 | 208 | </template> |
209 | 209 | <template v-else> |
210 | 210 | <RootCard> |
211 | | - <template v-if="section.title || i == 0 || section.collapsable || show.sectionCommands(section)?.flat().length"> |
| 211 | + <template v-if="section.title || i == 0 || section.collapsable || show.sectionAllowedCommands(section)?.flat().length"> |
212 | 212 | <RootCardHeader class="data-overflowing-viewport:sticky" :collapsed="collapsed"> |
213 | 213 | <div class="flex flex-wrap gap-4"> |
214 | 214 | <div class="flex gap-4"> |
|
226 | 226 | </Button> |
227 | 227 | </template> |
228 | 228 | </div> |
229 | | - <template v-if="show.sectionCommands(section)?.flat().length"> |
230 | | - <div class="ml-auto flex -my-1 justify-end" :class="{ 'invisible': collapsed }" |
231 | | - role="group" |
232 | | - :aria-label="__('sharp::show.section_menu.aria_label', { title: section.title })" |
233 | | - > |
234 | | - <DropdownMenu> |
235 | | - <DropdownMenuTrigger as-child> |
236 | | - <Button class="h-8" size="sm" variant="outline"> |
237 | | - {{ __('sharp::entity_list.commands.instance.label') }} |
238 | | - <DropdownChevronDown /> |
239 | | - </Button> |
240 | | - </DropdownMenuTrigger> |
241 | | - <DropdownMenuContent> |
242 | | - <CommandDropdownItems |
243 | | - :commands="show.sectionCommands(section)" |
244 | | - @select="onCommand" |
245 | | - /> |
246 | | - </DropdownMenuContent> |
247 | | - </DropdownMenu> |
248 | | - </div> |
249 | | - </template> |
250 | 229 | <template v-if="i == 0"> |
251 | 230 | <div class="ml-auto flex flex-wrap -my-1 justify-end gap-2" |
252 | 231 | :class="{ 'invisible': collapsed }" |
|
325 | 304 | </template> |
326 | 305 |
|
327 | 306 | <CommandDropdownItems |
328 | | - :commands="show.allowedInstanceCommands" |
| 307 | + :commands="show.dropdownInstanceCommands" |
329 | 308 | @select="onCommand" |
330 | 309 | /> |
| 310 | + |
331 | 311 | <template v-if="show.authorizations.delete"> |
332 | | - <template v-if="show.allowedInstanceCommands?.flat().length"> |
| 312 | + <template v-if="show.dropdownInstanceCommands?.flat().length"> |
333 | 313 | <DropdownMenuSeparator /> |
334 | 314 | </template> |
335 | 315 | <DropdownMenuItem class="text-destructive" @click="onDelete"> |
|
339 | 319 | </DropdownMenuContent> |
340 | 320 | </DropdownMenu> |
341 | 321 | </template> |
| 322 | + <template v-for="command in show.primaryInstanceCommands"> |
| 323 | + <Button class="h-8" size="sm" @click="onCommand(command)"> |
| 324 | + {{ command.label }} |
| 325 | + </Button> |
| 326 | + </template> |
342 | 327 | <template v-if="show.authorizations.update"> |
343 | 328 | <Button class="h-8 pointer-events-auto" size="sm" :disabled="isReordering" as-child> |
344 | 329 | <Link :as="isReordering ? 'button' : 'a'" :href="show.config.formEditUrl"> |
|
350 | 335 | </template> |
351 | 336 | </div> |
352 | 337 | </template> |
| 338 | + <template v-else> |
| 339 | + <template v-if="show.sectionAllowedCommands(section)?.flat().length"> |
| 340 | + <div class="ml-auto flex -my-1 justify-end gap-2" :class="{ 'invisible': collapsed }" |
| 341 | + role="group" |
| 342 | + :aria-label="__('sharp::show.section_menu.aria_label', { title: section.title })" |
| 343 | + > |
| 344 | + <template v-if="show.sectionDropdownCommands(section)?.flat().length"> |
| 345 | + <DropdownMenu> |
| 346 | + <DropdownMenuTrigger as-child> |
| 347 | + <Button class="h-8" size="sm" variant="outline"> |
| 348 | + {{ __('sharp::entity_list.commands.instance.label') }} |
| 349 | + <DropdownChevronDown /> |
| 350 | + </Button> |
| 351 | + </DropdownMenuTrigger> |
| 352 | + <DropdownMenuContent> |
| 353 | + <CommandDropdownItems |
| 354 | + :commands="show.sectionDropdownCommands(section)" |
| 355 | + @select="onCommand" |
| 356 | + /> |
| 357 | + </DropdownMenuContent> |
| 358 | + </DropdownMenu> |
| 359 | + </template> |
| 360 | + <template v-for="command in show.sectionPrimaryCommands(section)"> |
| 361 | + <Button class="h-8" size="sm" @click="onCommand(command)"> |
| 362 | + {{ command.label }} |
| 363 | + </Button> |
| 364 | + </template> |
| 365 | + </div> |
| 366 | + </template> |
| 367 | + </template> |
353 | 368 | </div> |
354 | 369 | </RootCardHeader> |
355 | 370 | </template> |
|
0 commit comments