Files
baserow/web-frontend/stories/SegmentControl.stories.js
Przemyslaw Kukulski 58a9449209 feat: create a user template and list it in "Your templates" (#6421)
* feat(jobs): Opt-in lock so a job type can refuse a cancel after its commit

* feat(create-user-template): Create a user template and list it in "Your templates"

* fix(create-user-template): Address review feedback

- Only the owner can open a user template; the slug endpoint returns 404
  otherwise and includes `type`.
- List templates through `/api/templates/?view=flat` instead of `/own/`.
- Rename the job's copy to `template_workspace`, renumber the migration to
  0132 after develop's core migrations, guard it like 0128, and move
  revision fields and metadata to the update PR.
- Clear references outside the selection instead of failing the import,
  lock the owner row against a concurrent delete, and keep leftovers
  tracked until they're deleted.
- Load workspace permissions only for the wizard, handle instances without
  categories, restore a running job before a failed one, and open the
  default template again in the template modal.
- Reuse existing export, cancel and serializer code, keep one icon list,
  remove overlapping tests, and give template fixtures a unique slug.
2026-10-22 12:05:04 +02:00

64 lines
1.3 KiB
JavaScript

import SegmentControl from '@baserow/modules/core/components/SegmentControl'
export default {
title: 'Baserow/Form Elements/SegmentControl',
component: SegmentControl,
tags: ['autodocs'],
argTypes: {
segments: {
control: 'object',
description: 'Array of objects with a label and an optional icon',
},
initialActiveIndex: {
control: 'number',
},
type: {
control: {
type: 'select',
options: ['regular', 'rounded', 'pills'],
},
},
size: {
control: {
type: 'select',
options: ['regular', 'small', 'large'],
},
},
transparent: {
control: 'boolean',
},
iconsOnly: {
control: 'boolean',
},
},
args: {
segments: [{ label: 'Daily' }, { label: 'Weekly' }, { label: 'Monthly' }],
initialActiveIndex: 0,
type: 'regular',
size: 'regular',
transparent: false,
iconsOnly: false,
},
}
const render = (args) => ({
components: { SegmentControl },
setup() {
return { args }
},
template: '<SegmentControl v-bind="args" />',
})
export const Default = { render }
export const Pills = {
render,
args: {
type: 'pills',
segments: [
{ label: 'Official templates', icon: 'baserow-icon-templates' },
{ label: 'Your templates', icon: 'iconoir-box' },
],
},
}