Skip to content

Commit

Permalink
Changes in Combo2 configs to suite new scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
SilverFire committed May 1, 2015
1 parent 94dd965 commit 66d2a2b
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 22 deletions.
23 changes: 14 additions & 9 deletions assets/combo2/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,35 @@
class Account extends Combo2Config
{
/** @inheritdoc */
public $type = 'account';
public $type = 'hosting/account';

/** @inheritdoc */
public $_primaryFilter = 'login_like';
public $name = 'login';

/** @inheritdoc */
public $url = '/hosting/account/search';

/** @inheritdoc */
public $_return = ['id', 'client', 'client_id', 'device', 'device_id'];

/** @inheritdoc */
public $_rename = ['text' => 'login'];

/** @inheritdoc */
public $_filter = [
'client' => 'client',
'server' => 'server'
'client' => 'client/client',
'server' => 'server/server',
];

/** @inheritdoc */
function getConfig ($config = []) {
function getConfig($config = [])
{
$config = ArrayHelper::merge([
'clearWhen' => ['client', 'server'],
'affects' => [
'client' => 'client',
'server' => 'device'
'clearWhen' => ['client/client', 'server/server'],
'affects' => [
'client/seller' => 'seller',
'client/client' => 'client',
'server/server' => 'device',
]
], $config);

Expand Down
5 changes: 3 additions & 2 deletions assets/combo2/DbService.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
/**
* Class DbService
*/
class DbService extends Service {
class DbService extends Service
{
/** @inheritdoc */
public $type = 'dbService';
public $type = 'hosting/service/db';

/** @inheritdoc */
public $softType = 'db';
Expand Down
29 changes: 18 additions & 11 deletions assets/combo2/Service.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

namespace hipanel\modules\hosting\assets\combo2;

use hipanel\widgets\Combo2Config;
use yii\helpers\ArrayHelper;

Expand All @@ -11,10 +12,10 @@
class Service extends Combo2Config
{
/** @inheritdoc */
public $type = 'service';
public $type = 'hosting/service';

/** @inheritdoc */
public $_primaryFilter = 'name_like';
public $name = 'name';

/** @inheritdoc */
public $url = '/hosting/service/search';
Expand All @@ -27,30 +28,36 @@ class Service extends Combo2Config

/** @inheritdoc */
public $_filter = [
'client' => 'client',
'server' => 'server'
'client' => 'client/client',
'server' => 'server/server',
];

/**
* @var string the soft type, used by [[getFilter]] to filter by the soft type
* @see getFilter()
*/
public $softType;

/** @inheritdoc */
function getConfig ($config = []) {
function getConfig($config = [])
{
$config = ArrayHelper::merge([
'affects' => [
'seller' => 'seller',
'client' => 'client',
'server' => 'device'
'affects' => [
'client/seller' => 'seller',
'client/client' => 'client',
'server/server' => 'device',
],
'activeWhen' => [
'server'
'server/server',
]
], $config);

return parent::getConfig($config);
}

/** @inheritdoc */
public function getFilter () {
public function getFilter()
{
return ArrayHelper::merge(parent::getFilter(), [
'soft_type' => ['format' => $this->softType]
]);
Expand Down

0 comments on commit 66d2a2b

Please sign in to comment.