►
Description
In this session, we resurrect an old MR to introduce a reusable Vue component that encapsualtes some common logic about form fields.
MR: https://gitlab.com/gitlab-org/gitlab-ui/-/merge_requests/2586
A
A
Having
this
form
component
that
is
doing
apollo,
stuff
and
rendering
feels
dynamically,
and
it's
really
useful
but
is
doing
a
lot,
and
so
we
tried
to
this
was
already
an
iteration
towards
a
further
goal,
so
we're
trying
to
now
iterate,
maybe
over
this
component
and
clean
up
the
maybe
the
responsibilities
and
to
reusable
beds,
because
what
if
we
were
in?
How
could
we
reuse
this
if
we
weren't
using
apollo-
and
maybe
things
like
that?
A
So
the
idea
here
is
this-
is
the
presentation,
responsibility
component
of
presenting
these
lists
of
form
fields
and
managing
the
the
interactions
there.
So
looking
at
this
component
that
it's
inspired
from
some
of
the
props
are
fields,
there's
a
handful
of
props
about
the
query
that
will
actually
submit
when
this
thing
gets
submitted.
A
That's
not
going
to
be
relevant
to
our
presentation,
only
component
be
kind
of
relevant,
but
not
what
we're
going
to
be
using
there's
the
model,
which
is,
I
guess
these
are
the
value
of
the
fields.
Is
that
that's
right
lee?
Does
that
sound
familiar.
B
Yeah,
so
existing
model
was
that
sorry
paul
yep
yep
yeah.
So
that
was
the
idea
again.
We
might
decide.
We
need
more
abstraction,
but
the
idea
is,
you
can
use
this
for
create,
in
which
case
I
guess
you
don't
pass
an
existing
model
or
you
can
use
it
as
an
update
form,
in
which
case
yeah
you
would
pass
it
a
model.
A
Okay,
so
what
we
found,
what
I
found
to
be
helpful
was
a
component
that
took
in.
A
Let
me
go
to
here
component
that
took
in
fields
model
and
looks
like
we
need
to
figure
out
whether
we
should
show
the
validate
validations
or
not,
and
fields
had
their
own,
like
validation,
logic
it
sounded
like,
and
that
was
it
so
really
excited
about
this
component,
because
we
do
forms
all
the
time.
A
Maybe
now
we
can
be
way
more
data-driven
with
it
to
be
really
cool,
so
some
stories
of
it
do.
I
have
interesting
stories
of
this.
Maybe,
but
let
me
show
you
the
screenshot
of
this
oh
yeah.
A
Oh
yeah,
so
there's
the
fields,
there's
three
fields
and
I've
specified
the
types
of
the
fields
which
isn't
being
included
in
the
props
and
that
value
is
getting
emitted
as
the
model
is
changing
for
these
fields
and
so
yeah.
This
does
not
include
like
the
submit
button,
but
that
validation
state
would
get
passed
down
of
like
if
we
need
to
show
field
level
validation
like
if
I
hit
submit
and
then
I
can
show
the
field,
level,
validation
or
something
like
that.
A
So
yeah,
it
seems
helpful
and
I
think
we
have
already
places
where
this
could
encapsulate
a
lot
of
boilerplate
with
creating
forms
and
that's
the
goal.
Does
that
make
sense?
Does
anyone
have
any
questions
about
the
scope
of
this
component.
A
A
Oh,
oh,
we
have
to
update
these.
That's
not
a
big
deal.
So,
let's
I
guess
the
first
thing
you
do
because
this
is
old,
is
to
rebase
it
right,
yeah,
yeah!
Let's
do
that.
I
have
a
couple
of
commits.
I
think
I'm
going
to
squash
them
first
and
then
I'll
rebase
sounds
good.
So
let's
do
that.
B
C
A
Be
so
bad,
it
would
go
badly
all
right.
I've
checked
this
out,
but
we
are
behind.
Let's
squash
our
commits,
so
I'm
gonna
rebase
off
of
this
one.
That's
before
I
don't
auto
squash
isn't
gonna
do
anything.
I
mean.
A
All
right,
I'm
going
to
actually
give
this
the
good
commit
message.
We
are
adding
gl
form
fields
component.
This
component
encapsulates
presentation
null
responsibility
for
presenting
a
list
of
fields
which
can
be
validated
and
managing
the
value.
A
A
E
A
A
D
B
A
All
right
all
right,
I'm
I'm
really
finding
the
urge
to
create
an
mri
to
remove
this.
What
do
you
think
should
we
just
remove
it?
We
should
just
remove
that
empty
file.
B
A
This
whole
file
must
be
not
a
thing
anymore.
This
components,
documentation.
A
A
Cool
so,
but
I
should
add
to
the
a
real
index.
B
Is
the
the
kind
of
what
do
we
call
it
that
are
the
conventional
commit
sign
tax
for
this
burrito?
It's
a
little
bit
different
right
I'll!
Do
something
like
chore
in
brackets,
removing
redundant
file
or.
A
Yes,
yes,
we
can
read
the
docs.
The
conventional
comments
are
going
to
be
in
the
contributing
docs.
The
conventional
commits
commit
message,
conventions
and
rules.
A
Yep
yep,
all
right,
we
got
this,
we're
exporting
it.
Oh
yeah!
Look
these
don't
need
to
be
in
sources
anymore.
That's
cool,
great.
A
Whoa
I
was
like,
let's
continue
with
the
rebase
man
that
took
a
while,
that
was
frustrating
all
right
push.
I'm
gonna
have
to
move
our
heads.
B
No,
no
don't
be
silly
like
you
know
it's
it's
something
that
I
think
everyone
will
benefit
from
when
we
do
get
round
to
it,
but.
B
For
seasoned
experts,
like
you
paul,
maybe
not
so
much,
but
I
think
they're
life
savers,
because
there's
nothing
worse
than
pushing
up
on
the
main
gitlab
project,
and
then
you
get
a
failure
on
like
prettier
or
eslin
or
ruby
cop,
or
something
like
that,
and
it's
like
okay,
I've
just
wasted
three
hours
of
pipeline
minutes.
This.
A
A
Yep,
no,
no,
I
mean
that's,
that's
that's
all
good.
Just
it
does
throw
me
off
my
grooves
like
get
in
a
groove
yeah.
B
B
C
Else,
I
don't
know
if
I
swing.
A
The
multitasking
is
a
double-edged
sword
for
me,
because
I
will
I
will
just
keep
jumping
tasks
and
just
so
forget
about
the
original
task.
I
was
doing
until
it's
too
late.
A
A
Run
this
thing,
we're
looking
at
form,
fields,
look
at
form,
fields,
look
at
those
form
fields,
so
here's
the
array
of
I'm
not
good
at
naming
things,
my
even
number
field
is
named.
Events
should
be
named,
even
sorry.
A
D
A
B
Power-
I
think
I
don't
know
if
that's
the
right
term,
but
the
yeah,
just
the.
A
A
B
A
A
You
know
so
this
is
a
custom
thing.
A
A
Great
great
great
yeah,
look
at
that.
That's
so
great
okay,.
A
B
So
the
thing
that
it's
probably
not
answering
the
question
that
you've
asked,
but
the
the
thing
that
I've
got
in
the
back
of
my
head-
that
I
can't
see
just
from
this
is,
I
don't
know
when
well,
I
do
know
when
we
write
this
in
january,
but
when
how
the
form
component
has
subsequently
evolved.
So
now
we've
got
gl
inputs,
we've
got
jill
drop,
I'm
not
sure
if
it's
drop
drop
down,
but
a
drop
down
and
we've
got
check
box.
So
that's
one
of
the
things
that
would
be
really
nice.
B
If
we
could
work
on
this
so
that,
yes,
you
can
provide
a
template,
a
slot,
a
name
slot
because
sometimes
we'll
want
a
color
picker.
Sometimes
we'll
want.
You
know
some
weird
and
wonderful
stuff
yeah,
but
that's
one
of
the
things
that
would
be
nice
to
either
today
or
in
the
future
iteration
or
at
some
point
ensure
that
we
can
handle
some
of
that
stuff.
B
The
other
thing
is
I've,
never
written
a
render
function,
and
I
might
say
that
it
would
take
me
longer
to
interpret
understand
and
potentially,
if
I
was
to
raise
an
mr
to
add
more
functionality
to
this
component
in
the
future.
That
being
said,
I
think
when
we
sat
together
and
worked
for
it,
it
kind
of
made
sense
and
I'm
sure
that
you
know
yeah
yeah.
A
No,
it's
not
yeah.
That
is
a
little.
That
is
a
little
concerning.
I'm
not
sure
why
I
made
it
a
render
function.
Let's
try
to
make
it
not
a
render
function.
Do
you
think
that's
a
good
task
for
us
to
do
right
now,
as
let's
try
to
not.
I.
B
Why
bring
up
the
yeah
that
you
you
might
come
face
to
face
with
that's
why
we
did
it.
A
A
There
is
oh
and
the
exact
same,
I'm
not
yeah.
Here's
the.
C
A
A
So
key
is
going
to
be
field
name
label.
We're
passing,
is
going
to
be
field
label
or
field
name.
A
All
right,
I
want
to
create
a
computed
for
this
so
like
we
try
not
to.
A
I
think
we're
gonna
want
to
compute
it
for
fields.
That's
gonna,
be
like
I
can't.
This
is
word
that
eludes
me,
processed
fields
or
fields
to
render.
Let's
call
it
fields
to
render
I'd
like
that.
Okay,
I
can't
think
of
a
better
thing
computed.
A
A
A
Name
and
then
I'm
gonna
call
oh
yeah,
and
then
we
can
just
do
this
thing
that
we
were
doing
here.
We
can
do
that
here.
A
A
Great
yeah
just
just
chill
out:
okay.
B
We
don't
need
a
render
function
to
be
able
to
do
this.
Do
we.
A
A
Yeah,
this
dot
get
scope
slot
for
input
field
great.
So
now,
inside
of
here
I
can
do
if
that
has
scope
slot.
A
A
C
A
C
D
A
Oh
yeah
yeah
yeah
yeah.
No,
this
is
because
why
did
I
do
a
render
function?
Is
this
you
know
like
how
the
template
works
where
you
can
just
do
v
bind
and
it
will
go
to
attributes
props.
It
doesn't
matter
it'll
just
go
there
like
that's
great
well,
with
render
functions
you
have
to
know,
is
it
going
to
props
or
attributes?
B
A
Where
was
that
vpn
thing?
Yes,
so
that's
all!
That's
all
I'm
trying
to
do
it's
so
gosh.
This
is
so
this
is
so
embarrassing.
It
is
just
me
trying
to
deal
with
render
functions
this
so.
A
All
right,
so
that's
great
that
works
we'll
put
in
the
value,
but
it
looks
like
we
somehow
do
this
calculation
to
get
the
value.
A
A
No
get
value,
get
ready,
yeah
field,
okay,
so
then
so
then
I
can
bind
all
those
things
I
can
pass
in.
Field.Value.
D
A
C
A
Was
wow,
it
smells
so
much
smaller
now,
all
right!
So
now
we
can
get
the
scope
slot
for
the
input
and
then
we
pass
these
things
into
it.
This
value
input
and
blur
thing.
A
D
A
And
then
I
don't
know
if
you
all
like
this.
A
Sculpt
slot
attributes,
if
we
do
not
have
a
scope
slot.
This
is
null
else.
Something
like
this.
I
don't
know
if
we
like
that.
Maybe
we
don't.
E
A
B
A
But
I
think
it's
a
good
idea,
though:
let's
yeah,
let
me
do
this.
A
A
A
C
C
A
Is
all
right
so
then,
if
oh
gosh
daddy,
that's
something
up!
No,
I
do.
I
don't
need
to
cast
it
to
bullying,
but
if
not
as
scope
return.
E
A
I
don't
need
to
cast
a
boolean,
that's
not
needed
at
all.
I
think
that's
how
it
works.
A
A
A
I
don't
need
this
one
hooray,
oh
so
much
somewhere,
so
much
okay.
What
is
final
value
is
not
used.
Is
it
oh,
it
is
used.
B
A
A
A
Why
in
the
world,
oh
my
gosh,
that's
gonna,
be
so
much
easier
to
test.
Like
I
mean
it's,
the
same
thing
it's,
but
for
some
reason
having
this
template
is
really
nice
at
knowing
like
what
you
need
to
test
like.
I
usually
just
look
at
the
template
to
know.
This
is
what
I
need
to
test
when
you
have
a
render
function.
It's
like
whoa.
A
I
guess
I
gotta
test
everything
cool
so
yeah.
Now
we
gotta
now
we'll
write
the
tests
for
this.
Let
me
see
what
is
happening
with
on
the
when
the
field
inputs
yeah.
So
here's
the
other
here's,
the
other
dealio.
B
A
D
E
B
B
Black
sheep,
no
you'll
get
geek
bot
will
tell
you
off
for
that
paul.
A
There's
a
really
cool
rap
group
called
black
sheep.
They
did
flavor
of
the
month
it's
one
of
their
more
popular
songs
back
in
the
back
in
the
day.
So
we'll
call
it.
B
I
mean
you
could
call
the
previous
one
required
in
this
one
uppercase
or
upper,
or
something
to
oh
gosh.
No,
that
did
not
help.
A
B
C
C
I,
like
the
uppercase,
so
it's
uppercase
for
the
user
as
well
like
exactly,
I
think,
I'm
thinking
about
not
so
much
of
design
perspectives,
but
what
are
ux
if
the
interface
you're
working
with
will
transformation
uppercase.
I
think
it
feels
it's
just
the
right
thing
to
show
this.
So
if
you're
dealing
with
some
case
issues,
at
least
there
will
be
an
indicator
that
just
automatically.
B
A
Because
yeah,
that's
where
I
would
say
that
is
not
the
responsibilities
component.
This
component
is
responsible
for
presentation,
yeah
yeah,
it's!
This
is
all
about,
probably
transforming
what
we
present
and
what
we
transform
we're
going
to
present.
So
we
have
something
we
want
to
do
behind
the
scenes.
Yeah,
do
you
make
sense
to
happen
somewhere
else?
Yeah,
absolutely.
B
A
B
A
That
was
just
hey.
I
just
added
this.
I
just
added
this
field.
Here's
here
we
go
this.
Is
it
that's
kind
of
really
nice
and.
A
When
I
start
validating
you
know
this,
this
doesn't
have
any
validation,
but
that
does
oh,
that's
pretty
nice,
so
those
ux
needs
that
we
have
out
of
the
box
of
needing
revalidation
and
stuff
like
that
is
all
way
more
data
driven
which,
which
is
exciting,
so
cool.
I
guess
I
will
commit
this
push
it
up
and.
B
The
what
were
the
failures
we
were
seeing
before
we
started
working
on
there.
A
A
So
we'll
update
it
to
do
that,
I
just
amended
it
without
adding
the
changes
that
happens.
A
lot.
A
Cool
all
right
come
on.
Oh
man,
see,
do
you
see
how
committing's
taken
so
long?
That's
because
of
these
hooks
man
just
stop
stop
with
the
software.
I
don't
need
more.
A
Why
isn't
it
it's
supposed
to
be
doing
this
on.
B
B
Yeah,
I've
had
a
lot
of
a
lot
of
pain
with
that
recently,
actually
working
on
different
projects
and
unsafe
yeah
yeah,
even
to
a
point
actually
where
at
the
moment,
when
I
save
a
javascript
or
view
file
in
the
gitlab
project,
it's
I
think
it's
using
a
completely
different
formatter
to
prettier.
So
it
then
I
need
to
prettier
right
to
fix
it.
So
I
need
to
figure
out,
what's
going
on
there,
yeah.
A
All
right
this
is
it
cool?
Well,
thank
you
all
for
your
help.
Thanks
I'm.
I
think
this
will
be
much
easier
thanks
for
pushing
it
forward.
Paul
appreciate
it
well,
I
think
it'll
be
much
easier
to
push
forward
now
that
it's
not
so
complex,
so
wow,
that's
a
lot
easier
to
push
forward.
We'll
see
the
one
thing
to
be
thinking
about
I'd,
love,
to
hear
your
async
thoughts
on
this
yannick
and
lee
and
I'll
ping.
A
C
I'm,
I
would
argue,
no
because
I
can't
think
of
of
any
other
option
to
validate
anything
other
than
a
function.
B
A
B
A
B
I
think
we
iterate
right,
so
we
don't
try
and
do
drop
downs
and
check
boxes
and
stuff
yet,
but
we
had
that
fairly
imminently
afterwards,
but.