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 )
|
||||
|
||||
# radio
|
||||
else if attribute.tag is 'working_hour'
|
||||
item = $( App.view('generic/working_hour')( attribute: attribute ) )
|
||||
|
||||
# ticket attribute selection
|
||||
else if attribute.tag is 'ticket_attribute_selection'
|
||||
|
||||
|
@ -494,7 +498,7 @@ class App.ControllerForm extends App.Controller
|
|||
} )
|
||||
all.unshift( {
|
||||
id: 1
|
||||
name: '*** nobody ***'
|
||||
name: '*** not set ***'
|
||||
} )
|
||||
all.unshift( {
|
||||
id: 'current_user.id'
|
||||
|
@ -594,18 +598,18 @@ class App.ControllerForm extends App.Controller
|
|||
selected: false
|
||||
disable: true
|
||||
},
|
||||
{
|
||||
value: 'number'
|
||||
name: 'Number'
|
||||
selected: true
|
||||
disable: false
|
||||
},
|
||||
{
|
||||
value: 'title'
|
||||
name: 'Title'
|
||||
selected: true
|
||||
disable: false
|
||||
},
|
||||
# {
|
||||
# value: 'number'
|
||||
# name: 'Number'
|
||||
# selected: true
|
||||
# disable: false
|
||||
# },
|
||||
# {
|
||||
# value: 'title'
|
||||
# name: 'Title'
|
||||
# selected: true
|
||||
# disable: false
|
||||
# },
|
||||
{
|
||||
value: 'group_id'
|
||||
name: 'Group'
|
||||
|
@ -685,42 +689,42 @@ class App.ControllerForm extends App.Controller
|
|||
# selected: true
|
||||
# disable: false
|
||||
# },
|
||||
{
|
||||
value: '-a'
|
||||
name: '-- ' + App.i18n.translateInline('Article') + ' --'
|
||||
selected: false
|
||||
disable: true
|
||||
},
|
||||
{
|
||||
value: 'from'
|
||||
name: 'From'
|
||||
selected: true
|
||||
disable: false
|
||||
},
|
||||
{
|
||||
value: 'to'
|
||||
name: 'To'
|
||||
selected: true
|
||||
disable: false
|
||||
},
|
||||
{
|
||||
value: 'cc'
|
||||
name: 'Cc'
|
||||
selected: true
|
||||
disable: false
|
||||
},
|
||||
{
|
||||
value: 'subject'
|
||||
name: 'Subject'
|
||||
selected: true
|
||||
disable: false
|
||||
},
|
||||
{
|
||||
value: 'body'
|
||||
name: 'Text'
|
||||
selected: true
|
||||
disable: false
|
||||
},
|
||||
# {
|
||||
# value: '-a'
|
||||
# name: '-- ' + App.i18n.translateInline('Article') + ' --'
|
||||
# selected: false
|
||||
# disable: true
|
||||
# },
|
||||
# {
|
||||
# value: 'from'
|
||||
# name: 'From'
|
||||
# selected: true
|
||||
# disable: false
|
||||
# },
|
||||
# {
|
||||
# value: 'to'
|
||||
# name: 'To'
|
||||
# selected: true
|
||||
# disable: false
|
||||
# },
|
||||
# {
|
||||
# value: 'cc'
|
||||
# name: 'Cc'
|
||||
# selected: true
|
||||
# disable: false
|
||||
# },
|
||||
# {
|
||||
# value: 'subject'
|
||||
# name: 'Subject'
|
||||
# selected: true
|
||||
# disable: false
|
||||
# },
|
||||
# {
|
||||
# value: 'body'
|
||||
# name: 'Text'
|
||||
# selected: true
|
||||
# disable: false
|
||||
# },
|
||||
# {
|
||||
# value: '-c'
|
||||
# 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