Added init version of sla's.
This commit is contained in:
parent
dcc7ba4535
commit
8436f292c7
7 changed files with 171 additions and 49 deletions
|
@ -418,6 +418,10 @@ class App.ControllerForm extends App.Controller
|
||||||
)
|
)
|
||||||
@delay( a, 180 )
|
@delay( a, 180 )
|
||||||
|
|
||||||
|
# radio
|
||||||
|
else if attribute.tag is 'working_hour'
|
||||||
|
item = $( App.view('generic/working_hour')( attribute: attribute ) )
|
||||||
|
|
||||||
# ticket attribute selection
|
# ticket attribute selection
|
||||||
else if attribute.tag is 'ticket_attribute_selection'
|
else if attribute.tag is 'ticket_attribute_selection'
|
||||||
|
|
||||||
|
@ -494,7 +498,7 @@ class App.ControllerForm extends App.Controller
|
||||||
} )
|
} )
|
||||||
all.unshift( {
|
all.unshift( {
|
||||||
id: 1
|
id: 1
|
||||||
name: '*** nobody ***'
|
name: '*** not set ***'
|
||||||
} )
|
} )
|
||||||
all.unshift( {
|
all.unshift( {
|
||||||
id: 'current_user.id'
|
id: 'current_user.id'
|
||||||
|
@ -594,18 +598,18 @@ class App.ControllerForm extends App.Controller
|
||||||
selected: false
|
selected: false
|
||||||
disable: true
|
disable: true
|
||||||
},
|
},
|
||||||
{
|
# {
|
||||||
value: 'number'
|
# value: 'number'
|
||||||
name: 'Number'
|
# name: 'Number'
|
||||||
selected: true
|
# selected: true
|
||||||
disable: false
|
# disable: false
|
||||||
},
|
# },
|
||||||
{
|
# {
|
||||||
value: 'title'
|
# value: 'title'
|
||||||
name: 'Title'
|
# name: 'Title'
|
||||||
selected: true
|
# selected: true
|
||||||
disable: false
|
# disable: false
|
||||||
},
|
# },
|
||||||
{
|
{
|
||||||
value: 'group_id'
|
value: 'group_id'
|
||||||
name: 'Group'
|
name: 'Group'
|
||||||
|
@ -685,42 +689,42 @@ class App.ControllerForm extends App.Controller
|
||||||
# selected: true
|
# selected: true
|
||||||
# disable: false
|
# disable: false
|
||||||
# },
|
# },
|
||||||
{
|
# {
|
||||||
value: '-a'
|
# value: '-a'
|
||||||
name: '-- ' + App.i18n.translateInline('Article') + ' --'
|
# name: '-- ' + App.i18n.translateInline('Article') + ' --'
|
||||||
selected: false
|
# selected: false
|
||||||
disable: true
|
# disable: true
|
||||||
},
|
# },
|
||||||
{
|
# {
|
||||||
value: 'from'
|
# value: 'from'
|
||||||
name: 'From'
|
# name: 'From'
|
||||||
selected: true
|
# selected: true
|
||||||
disable: false
|
# disable: false
|
||||||
},
|
# },
|
||||||
{
|
# {
|
||||||
value: 'to'
|
# value: 'to'
|
||||||
name: 'To'
|
# name: 'To'
|
||||||
selected: true
|
# selected: true
|
||||||
disable: false
|
# disable: false
|
||||||
},
|
# },
|
||||||
{
|
# {
|
||||||
value: 'cc'
|
# value: 'cc'
|
||||||
name: 'Cc'
|
# name: 'Cc'
|
||||||
selected: true
|
# selected: true
|
||||||
disable: false
|
# disable: false
|
||||||
},
|
# },
|
||||||
{
|
# {
|
||||||
value: 'subject'
|
# value: 'subject'
|
||||||
name: 'Subject'
|
# name: 'Subject'
|
||||||
selected: true
|
# selected: true
|
||||||
disable: false
|
# disable: false
|
||||||
},
|
# },
|
||||||
{
|
# {
|
||||||
value: 'body'
|
# value: 'body'
|
||||||
name: 'Text'
|
# name: 'Text'
|
||||||
selected: true
|
# selected: true
|
||||||
disable: false
|
# disable: false
|
||||||
},
|
# },
|
||||||
# {
|
# {
|
||||||
# value: '-c'
|
# value: '-c'
|
||||||
# name: '-- ' + App.i18n.translateInline('Customer') + ' --'
|
# name: '-- ' + App.i18n.translateInline('Customer') + ' --'
|
||||||
|
|
31
app/assets/javascripts/app/controllers/sla.js.coffee
Normal file
31
app/assets/javascripts/app/controllers/sla.js.coffee
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
$ = jQuery.sub()
|
||||||
|
|
||||||
|
class Index extends App.Controller
|
||||||
|
constructor: ->
|
||||||
|
super
|
||||||
|
|
||||||
|
# check authentication
|
||||||
|
return if !@authenticate()
|
||||||
|
|
||||||
|
new App.ControllerGenericIndex(
|
||||||
|
el: @el,
|
||||||
|
id: @id,
|
||||||
|
genericObject: 'Sla',
|
||||||
|
pageData: {
|
||||||
|
title: 'SLA',
|
||||||
|
home: 'slas',
|
||||||
|
object: 'SLA',
|
||||||
|
objects: 'SLAs',
|
||||||
|
navupdate: '#slas',
|
||||||
|
notes: [
|
||||||
|
# 'SLA are ...'
|
||||||
|
],
|
||||||
|
buttons: [
|
||||||
|
{ name: 'New SLA', 'data-type': 'new', class: 'primary' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
App.Config.set( 'slas', Index, 'Routes' )
|
||||||
|
App.Config.set( 'Sla', { prio: 2900, parent: '#admin', name: 'SLAs', target: '#slas', role: ['Admin'] }, 'NavBar' )
|
||||||
|
|
33
app/assets/javascripts/app/models/sla.js.coffee
Normal file
33
app/assets/javascripts/app/models/sla.js.coffee
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
class App.Sla extends Spine.Model
|
||||||
|
@configure 'Sla', 'name', 'condition', 'data', 'active'
|
||||||
|
@extend Spine.Model.Ajax
|
||||||
|
@url: 'api/slas'
|
||||||
|
@configure_attributes = [
|
||||||
|
{ name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, null: false, 'class': 'span4' },
|
||||||
|
{ name: 'first_response_time', display: 'First Resposne Time', tag: 'input', type: 'text', limit: 100, null: true, 'class': 'span4' },
|
||||||
|
{ name: 'update_time', display: 'Update Time', tag: 'input', type: 'text', limit: 100, null: true, 'class': 'span4' },
|
||||||
|
{ name: 'solution_time', display: 'Solution Time', tag: 'input', type: 'text', limit: 100, null: true, 'class': 'span4' },
|
||||||
|
{ name: 'condition', display: 'Conditions where SLA is used', tag: 'ticket_attribute_selection', null: true, class: 'span4' },
|
||||||
|
{
|
||||||
|
name: 'working_hour'
|
||||||
|
display: 'Working Hours'
|
||||||
|
tag: 'working_hour'
|
||||||
|
default: ''
|
||||||
|
null: true
|
||||||
|
nulloption: true
|
||||||
|
translate: true
|
||||||
|
options:
|
||||||
|
customer: 'Customer'
|
||||||
|
ticket_state: 'State'
|
||||||
|
ticket_priority: 'Priority'
|
||||||
|
group: 'Group'
|
||||||
|
owner: 'Owner'
|
||||||
|
class: 'span4'
|
||||||
|
},
|
||||||
|
{ name: 'updated_at', display: 'Updated', type: 'time', readonly: 1 },
|
||||||
|
{ name: 'active', display: 'Active', tag: 'boolean', note: 'boolean', 'default': true, 'null': false, 'class': 'span4' },
|
||||||
|
]
|
||||||
|
@configure_delete = true
|
||||||
|
@configure_overview = [
|
||||||
|
'name',
|
||||||
|
]
|
|
@ -0,0 +1,19 @@
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<% for hour in [ 0 .. 23 ]: %>
|
||||||
|
<th><%- hour %></th>
|
||||||
|
<% end %>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% for day in ['Mon', '', 'Wed', '', 'Fri', 'Sat', 'Sun']: %>
|
||||||
|
<tr>
|
||||||
|
<td><%- @T(day) %></td>
|
||||||
|
<% for hour in [ 0 .. 23 ]: %>
|
||||||
|
<td><input type="checkbox" value="1" name="<%- day %>-<%- hour %>"></td>
|
||||||
|
<% end %>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
5
app/models/sla.rb
Normal file
5
app/models/sla.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class Sla < ApplicationModel
|
||||||
|
store :condition
|
||||||
|
store :data
|
||||||
|
validates :name, :presence => true
|
||||||
|
end
|
13
config/routes/sla.rb
Normal file
13
config/routes/sla.rb
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
module ExtraRoutes
|
||||||
|
def add(map)
|
||||||
|
|
||||||
|
# slas
|
||||||
|
map.match '/api/slas', :to => 'slas#index', :via => :get
|
||||||
|
map.match '/api/slas/:id', :to => 'slas#show', :via => :get
|
||||||
|
map.match '/api/slas', :to => 'slas#create', :via => :post
|
||||||
|
map.match '/api/slas/:id', :to => 'slas#update', :via => :put
|
||||||
|
map.match '/api/slas/:id', :to => 'slas#destroy', :via => :delete
|
||||||
|
|
||||||
|
end
|
||||||
|
module_function :add
|
||||||
|
end
|
17
db/migrate/20130201071513_create_sla.rb
Normal file
17
db/migrate/20130201071513_create_sla.rb
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
class CreateSla < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
create_table :slas do |t|
|
||||||
|
t.column :name, :string, :limit => 150, :null => true
|
||||||
|
t.column :condition, :string, :limit => 5000, :null => true
|
||||||
|
t.column :data, :string, :limit => 5000, :null => true
|
||||||
|
t.column :active, :boolean, :null => false, :default => true
|
||||||
|
t.column :updated_by_id, :integer, :null => false
|
||||||
|
t.column :created_by_id, :integer, :null => false
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
add_index :slas, [:name], :unique => true
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue