Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Package registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
HUB Terra
SMS
Frontend
Commits
903dd68c
Commit
903dd68c
authored
4 years ago
by
Marc Hanisch
Browse files
Options
Downloads
Patches
Plain Diff
reworked page for creating a new device
parent
97a3596c
No related branches found
No related tags found
2 merge requests
!90
Draft: restructure frontend properties 2
,
!82
Restructure frontend
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pages/devices/new.vue
+49
-60
49 additions, 60 deletions
pages/devices/new.vue
with
49 additions
and
60 deletions
pages/devices/new.vue
+
49
−
60
View file @
903dd68c
...
...
@@ -29,19 +29,34 @@ implied. See the Licence for the specific language governing
permissions and limitations under the Licence.
-->
<
template
>
<div>
<v-card
outlined
>
<v-tabs-items
v-model=
"activeTab"
<v-card
flat
>
<v-card-actions>
<v-spacer
/>
<v-btn
v-if=
"isLoggedIn"
small
text
nuxt
to=
"/search/devices"
>
<v-tab-item
:eager=
"true"
>
<DeviceBasicDataForm
v-model=
"device"
/>
</v-tab-item>
</v-tabs-items>
</v-card>
</div>
cancel
</v-btn>
<v-btn
v-if=
"isLoggedIn"
color=
"green"
small
@
click=
"onSaveButtonClicked"
>
create
</v-btn>
</v-card-actions>
<DeviceBasicDataForm
ref=
"basicForm"
v-model=
"device"
/>
</v-card>
</
template
>
<
style
lang=
"scss"
>
...
...
@@ -55,10 +70,6 @@ import { Rules } from '@/mixins/Rules'
import
{
Device
}
from
'
@/models/Device
'
import
AttachmentList
from
'
@/components/AttachmentList.vue
'
import
ContactSelect
from
'
@/components/ContactSelect.vue
'
import
CustomFieldCards
from
'
@/components/CustomFieldCards.vue
'
import
DevicePropertyExpansionPanels
from
'
@/components/DevicePropertyExpansionPanels.vue
'
import
DeviceBasicDataForm
from
'
@/components/DeviceBasicDataForm.vue
'
@
Component
({
...
...
@@ -72,57 +83,23 @@ export default class DeviceNewPage extends mixins(Rules) {
private
device
:
Device
=
new
Device
()
created
()
{
this
.
initializeAppBar
()
this
.
registerButtonActions
()
}
mounted
()
{
this
.
$store
.
commit
(
'
a
pp
b
ar
/setTitle
'
,
'
Add Device
'
)
this
.
initializeA
pp
B
ar
(
)
}
beforeDestroy
()
{
this
.
unregisterButtonActions
()
this
.
$store
.
dispatch
(
'
appbar/setDefaults
'
)
}
registerButtonActions
()
{
this
.
$nuxt
.
$on
(
'
AppBarEditModeContent:save-btn-click
'
,
()
=>
{
this
.
save
()
})
this
.
$nuxt
.
$on
(
'
AppBarEditModeContent:cancel-btn-click
'
,
()
=>
{
this
.
cancel
()
})
}
unregisterButtonActions
()
{
this
.
$nuxt
.
$off
(
'
AppBarEditModeContent:save-btn-click
'
)
this
.
$nuxt
.
$off
(
'
AppBarEditModeContent:cancel-btn-click
'
)
}
initializeAppBar
()
{
this
.
$store
.
dispatch
(
'
appbar/init
'
,
{
tabs
:
[
'
Basic Data
'
],
title
:
'
Add Device
'
,
saveBtnHidden
:
false
,
cancelBtnHidden
:
false
})
}
get
activeTab
():
number
|
null
{
return
this
.
$store
.
state
.
appbar
.
activeTab
}
set
activeTab
(
tab
:
number
|
null
)
{
this
.
$store
.
commit
(
'
appbar/setActiveTab
'
,
tab
)
}
save
():
void
{
onSaveButtonClicked
():
void
{
if
(
!
(
this
.
$refs
.
basicForm
as
Vue
&
{
validateForm
:
()
=>
boolean
}).
validateForm
())
{
this
.
$store
.
commit
(
'
snackbar/setError
'
,
'
Please correct your input
'
)
return
}
this
.
$api
.
devices
.
save
(
this
.
device
).
then
((
savedDevice
)
=>
{
if
(
this
.
isLoggedIn
)
{
this
.
$router
.
push
(
'
/devices/show/
'
+
savedDevice
.
id
+
''
)
this
.
$store
.
commit
(
'
snackbar/setSuccess
'
,
'
Device created
'
)
this
.
$router
.
push
(
'
/devices/
'
+
savedDevice
.
id
+
''
)
}
else
{
throw
new
Error
(
'
You need to be logged in to save the device
'
)
}
...
...
@@ -131,8 +108,20 @@ export default class DeviceNewPage extends mixins(Rules) {
})
}
cancel
()
{
this
.
$router
.
push
(
'
/search/devices
'
)
initializeAppBar
()
{
this
.
$store
.
dispatch
(
'
appbar/init
'
,
{
tabs
:
[
{
to
:
'
/devices/new
'
,
name
:
'
Basic Data
'
},
{
name
:
'
Contacts
'
,
disabled
:
true
}
],
title
:
'
Add Device
'
})
}
get
isLoggedIn
()
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment