Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
David Kempe
Meerkat
Commits
8d70ca6a
Commit
8d70ca6a
authored
Aug 20, 2020
by
Max Reeves
Browse files
tags support
parent
57fbdfd3
Changes
1
Hide whitespace changes
Inline
Side-by-side
frontend/src/editor.jsx
View file @
8d70ca6a
...
...
@@ -19,7 +19,7 @@ const dashboardReducer = (state, action) => {
case
'
setTitle
'
:
console
.
log
(
'
Setting title to
'
+
action
.
title
)
return
{...
state
,
title
:
action
.
title
};
case
'
update
Tags
'
:
case
'
set
Tags
'
:
console
.
log
(
`Setting tags to
${
action
.
tags
}
`
);
return
{...
state
,
tags
:
action
.
tags
};
case
'
setBackground
'
:
...
...
@@ -85,13 +85,6 @@ export function Editor({slug, selectedElementId}) {
element
:
element
});
}
const
updateTags
=
action
=>
{
const
newTags
=
action
.
tags
.
split
(
'
'
);
dashboardDispatch
({
type
:
'
updateTags
'
,
tags
:
newTags
});
}
const
saveDashboard
=
async
e
=>
{
console
.
log
(
dashboard
);
...
...
@@ -117,7 +110,7 @@ export function Editor({slug, selectedElementId}) {
<
hr
/>
<
SidePanelElements
dashboard
=
{
dashboard
}
dashboardDispatch
=
{
dashboardDispatch
}
/>
<
ElementSettings
selectedElement
=
{
selectedElement
}
updateElement
=
{
updateElement
}
updateTags
=
{
updateTags
}
/>
<
ElementSettings
selectedElement
=
{
selectedElement
}
updateElement
=
{
updateElement
}
/>
</
div
>
</
div
>
<
div
class
=
"side-bar-footer lefty-righty"
>
...
...
@@ -274,11 +267,22 @@ function SidePanelSettings({dashboardDispatch, dashboard}) {
}
}
const
updateTags
=
tags
=>
{
dashboardDispatch
({
type
:
'
setTags
'
,
tags
:
tags
.
split
(
'
,
'
).
map
(
v
=>
v
.
trim
())
});
}
return
<
Fragment
>
<
label
for
=
"title"
>
Title
</
label
>
<
input
type
=
"text"
id
=
"title"
placeholder
=
"Network Overview"
value
=
{
dashboard
.
title
}
onInput
=
{
e
=>
dashboardDispatch
({
type
:
'
setTitle
'
,
title
:
e
.
currentTarget
.
value
})
}
/>
<
label
for
=
"tags"
>
Tags
</
label
>
<
input
id
=
"tags"
type
=
"text"
placeholder
=
"Cool Tags"
value
=
{
dashboard
.
tags
.
join
(
'
,
'
)
}
onInput
=
{
e
=>
updateTags
(
e
.
currentTarget
.
value
)
}
/>
<
label
for
=
"background-image"
>
Background Image
</
label
>
<
input
id
=
"background-image"
type
=
"file"
placeholder
=
"Upload a background image"
accept
=
"image/*"
onChange
=
{
handleBackgroundImg
}
/>
...
...
@@ -363,10 +367,6 @@ export function ElementSettings({selectedElement, updateElement, updateTags}) {
<
input
id
=
"name"
type
=
"text"
placeholder
=
"Cool Element"
value
=
{
selectedElement
.
title
}
onInput
=
{
e
=>
updateElement
({...
selectedElement
,
title
:
e
.
currentTarget
.
value
})
}
/>
<
label
for
=
"tags"
>
Tags
</
label
>
<
input
id
=
"tags"
type
=
"text"
placeholder
=
"Cool Tags"
value
=
{
selectedElement
.
tags
}
onInput
=
{
e
=>
updateTags
({
tags
:
e
.
currentTarget
.
value
})
}
/>
<
label
>
Visual Type
</
label
>
<
select
name
=
"item-type"
value
=
{
selectedElement
.
type
}
onInput
=
{
e
=>
updateElement
({...
selectedElement
,
type
:
e
.
currentTarget
.
value
})
}
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment