New overview seeds.

This commit is contained in:
Martin Edenhofer 2015-10-12 23:12:44 +02:00
parent d7cd5b57cc
commit e5ac9519e7
2 changed files with 320 additions and 34 deletions

View file

@ -0,0 +1,283 @@
class UpdateOverview4 < ActiveRecord::Migration
def up
# return if it's a new setup
return if !Setting.find_by(name: 'system_init_done')
UserInfo.current_user_id = 1
overview_role = Role.where( name: 'Agent' ).first
Overview.create_or_update(
name: 'My assigned Tickets',
link: 'my_assigned',
prio: 1000,
role_id: overview_role.id,
condition: {
'ticket.state_id' => {
operator: 'is',
value: [ 1, 2, 3, 7 ],
},
'ticket.owner_id' => {
operator: 'is',
value: 'current_user.id',
},
},
order: {
by: 'created_at',
direction: 'ASC',
},
view: {
d: %w(title customer group created_at),
s: %w(title customer group created_at),
m: %w(number title customer group created_at),
view_mode_default: 's',
},
)
Overview.create_or_update(
name: 'My pending reached Tickets',
link: 'my_pending_reached',
prio: 1010,
role_id: overview_role.id,
condition: {
'ticket.state_id' => {
operator: 'is',
value: 3,
},
'ticket.owner_id' => {
operator: 'is',
value: 'current_user.id',
},
'ticket.pending_time' => {
operator: 'within next (relative)',
value: 0,
range: 'minute',
},
},
order: {
by: 'created_at',
direction: 'ASC',
},
view: {
d: %w(title customer group created_at),
s: %w(title customer group created_at),
m: %w(number title customer group created_at),
view_mode_default: 's',
},
)
Overview.create_or_update(
name: 'Unassigned & Open Tickets',
link: 'all_unassigned',
prio: 1020,
role_id: overview_role.id,
condition: {
'ticket.state_id' => {
operator: 'is',
value: [1, 2, 3],
},
'ticket.owner_id' => {
operator: 'is',
value: 1,
},
},
order: {
by: 'created_at',
direction: 'ASC',
},
view: {
d: %w(title customer group created_at),
s: %w(title customer group created_at),
m: %w(number title customer group created_at),
view_mode_default: 's',
},
)
Overview.create_or_update(
name: 'All Open Tickets',
link: 'all_open',
prio: 1030,
role_id: overview_role.id,
condition: {
'ticket.state_id' => {
operator: 'is',
value: [1, 2, 3],
},
},
order: {
by: 'created_at',
direction: 'ASC',
},
view: {
d: %w(title customer group state owner created_at),
s: %w(title customer group state owner created_at),
m: %w(number title customer group state owner created_at),
view_mode_default: 's',
},
)
Overview.create_or_update(
name: 'All pending reached Tickets',
link: 'all_pending_reached',
prio: 1035,
role_id: overview_role.id,
condition: {
'ticket.state_id' => {
operator: 'is',
value: [3],
},
'ticket.pending_time' => {
operator: 'within next (relative)',
value: 0,
range: 'minute',
},
},
order: {
by: 'created_at',
direction: 'ASC',
},
view: {
d: %w(title customer group owner created_at),
s: %w(title customer group owner created_at),
m: %w(number title customer group owner created_at),
view_mode_default: 's',
},
)
Overview.create_or_update(
name: 'Escalated Tickets',
link: 'all_escalated',
prio: 1040,
role_id: overview_role.id,
condition: {
'ticket.escalation_time' => {
operator: 'within next (relative)',
value: '10',
range: 'minute',
},
},
order: {
by: 'escalation_time',
direction: 'ASC',
},
view: {
d: %w(title customer group owner escalation_time),
s: %w(title customer group owner escalation_time),
m: %w(number title customer group owner escalation_time),
view_mode_default: 's',
},
)
overview_role = Role.where( name: 'Customer' ).first
Overview.create_or_update(
name: 'My Tickets',
link: 'my_tickets',
prio: 1000,
role_id: overview_role.id,
condition: {
'ticket.state_id' => {
operator: 'is',
value: [ 1, 2, 3, 4, 6, 7 ],
},
'ticket.customer_id' => {
operator: 'is',
value: 'current_user.id',
},
},
order: {
by: 'created_at',
direction: 'DESC',
},
view: {
d: %w(title customer state created_at),
s: %w(number title state created_at),
m: %w(number title state created_at),
view_mode_default: 's',
},
)
Overview.create_or_update(
name: 'My Organization Tickets',
link: 'my_organization_tickets',
prio: 1100,
role_id: overview_role.id,
organization_shared: true,
condition: {
'ticket.state_id' => {
operator: 'is',
value: [ 1, 2, 3, 4, 6, 7 ],
},
'ticket.organization_id' => {
operator: 'is',
value: 'current_user.organization_id',
},
},
order: {
by: 'created_at',
direction: 'DESC',
},
view: {
d: %w(title customer state created_at),
s: %w(number title customer state created_at),
m: %w(number title customer state created_at),
view_mode_default: 's',
},
)
ObjectManager::Attribute.add(
object: 'Ticket',
name: 'title',
display: 'Title',
data_type: 'input',
data_option: {
type: 'text',
maxlength: 200,
null: false,
translate: false,
},
editable: false,
active: true,
screens: {
create_top: {
'-all-' => {
null: false,
},
},
edit: {},
},
pending_migration: false,
position: 15,
)
ObjectManager::Attribute.add(
object: 'Ticket',
name: 'group_id',
display: 'Group',
data_type: 'select',
data_option: {
relation: 'Group',
relation_condition: { access: 'rw' },
nulloption: true,
multiple: false,
null: false,
translate: false,
},
editable: false,
active: true,
screens: {
create_middle: {
'-all-' => {
null: false,
item_class: 'column',
},
},
edit: {
Agent: {
null: false,
},
},
},
pending_migration: false,
position: 25,
)
end
end

View file

@ -1645,8 +1645,9 @@ Overview.create_if_not_exists(
value: 'current_user.id',
},
'ticket.pending_time' => {
operator: 'after (relative)',
value: '1',
operator: 'within next (relative)',
value: 0,
range: 'minute',
},
},
order: {
@ -1722,8 +1723,9 @@ Overview.create_if_not_exists(
value: [3],
},
'ticket.pending_time' => {
operator: 'after (relative)',
value: 1,
operator: 'within next (relative)',
value: 0,
range: 'minute',
},
},
order: {
@ -1745,8 +1747,9 @@ Overview.create_if_not_exists(
role_id: overview_role.id,
condition: {
'ticket.escalation_time' => {
operator: 'before (relative)',
value: 5,
operator: 'within next (relative)',
value: '10',
range: 'minute',
},
},
order: {
@ -1770,7 +1773,7 @@ Overview.create_if_not_exists(
condition: {
'ticket.state_id' => {
operator: 'is',
value: [ 1, 2, 3, 4, 6 ],
value: [ 1, 2, 3, 4, 6, 7 ],
},
'ticket.customer_id' => {
operator: 'is',
@ -1797,7 +1800,7 @@ Overview.create_if_not_exists(
condition: {
'ticket.state_id' => {
operator: 'is',
value: [ 1, 2, 3, 4, 6 ],
value: [ 1, 2, 3, 4, 6, 7 ],
},
'ticket.organization_id' => {
operator: 'is',
@ -1946,6 +1949,31 @@ Network::Item::Comment.create(
body: 'Some comment....',
)
ObjectManager::Attribute.add(
object: 'Ticket',
name: 'title',
display: 'Title',
data_type: 'input',
data_option: {
type: 'text',
maxlength: 200,
null: false,
translate: false,
},
editable: false,
active: true,
screens: {
create_top: {
'-all-' => {
null: false,
},
},
edit: {},
},
pending_migration: false,
position: 15,
)
ObjectManager::Attribute.add(
object: 'Ticket',
name: 'customer_id',
@ -2038,7 +2066,7 @@ ObjectManager::Attribute.add(
},
},
pending_migration: false,
position: 20,
position: 25,
)
ObjectManager::Attribute.add(
object: 'Ticket',
@ -2211,31 +2239,6 @@ ObjectManager::Attribute.add(
position: 900,
)
ObjectManager::Attribute.add(
object: 'Ticket',
name: 'title',
display: 'Title',
data_type: 'input',
data_option: {
type: 'text',
maxlength: 200,
null: false,
translate: false,
},
editable: false,
active: true,
screens: {
create_top: {
'-all-' => {
null: false,
},
},
edit: {},
},
pending_migration: false,
position: 15,
)
ObjectManager::Attribute.add(
object: 'TicketArticle',
name: 'type_id',