Revision b440d082

View differences:

src/sunstone/etc/sunstone-views/admin.yaml
769 769
            Support.create_dialog: true
770 770
    settings-tab:
771 771
        panel_tabs:
772
            user_info_tab: true
773
            user_config_tab: false
774
            user_quotas_tab: true
775
            group_quotas_tab: true
776
            user_accounting_tab: true
777
            user_showback_tab: true
772
            settings_info_tab: true
773
            settings_config_tab: false
774
            settings_quotas_tab: true
775
            settings_group_quotas_tab: true
776
            settings_accounting_tab: true
777
            settings_showback_tab: true
778 778
        actions:
779
            # The buttons inside the settings-tab panel user_info_tab are
780
            # configured with users-tab/actions; User.update_password and
781
            # User.login_token
782
            #
783
            # Buttons for user_config_tab
779
            # Buttons for settings_info_tab
780
            User.update_password: true
781
            User.login_token: true
782
            # Buttons for settings_config_tab
784 783
            Settings.change_language: true
785 784
            Settings.change_password: true
786 785
            Settings.change_view: true
787 786
            Settings.ssh_key: true
788 787
            Settings.login_token: true
789
            # Edit button in user_quotas_tab
788
            # Edit button in settings_quotas_tab
790 789
            User.quotas_dialog: false
791 790
    upgrade-top-tab:
792 791
        panel_tabs:
src/sunstone/etc/sunstone-views/admin_vcenter.yaml
767 767
            Support.create_dialog: true
768 768
    settings-tab:
769 769
        panel_tabs:
770
            user_info_tab: true
771
            user_config_tab: false
772
            user_quotas_tab: true
773
            group_quotas_tab: true
774
            user_accounting_tab: true
775
            user_showback_tab: true
770
            settings_info_tab: true
771
            settings_config_tab: false
772
            settings_quotas_tab: true
773
            settings_group_quotas_tab: true
774
            settings_accounting_tab: true
775
            settings_showback_tab: true
776 776
        actions:
777
            # The buttons inside the settings-tab panel user_info_tab are
778
            # configured with users-tab/actions; User.update_password and
779
            # User.login_token
780
            #
781
            # Buttons for user_config_tab
777
            # Buttons for settings_info_tab
778
            User.update_password: true
779
            User.login_token: true
780
            # Buttons for settings_config_tab
782 781
            Settings.change_language: true
783 782
            Settings.change_password: true
784 783
            Settings.change_view: true
785 784
            Settings.ssh_key: true
786 785
            Settings.login_token: true
787
            # Edit button in user_quotas_tab
786
            # Edit button in settings_quotas_tab
788 787
            User.quotas_dialog: false
789 788
    upgrade-top-tab:
790 789
        panel_tabs:
src/sunstone/etc/sunstone-views/cloud.yaml
79 79
            disk_resize: true
80 80
    settings-tab:
81 81
        panel_tabs:
82
            user_info_tab: false
83
            user_config_tab: true
84
            user_quotas_tab: true
85
            user_accounting_tab: true
86
            user_showback_tab: true
82
            settings_info_tab: false
83
            settings_config_tab: true
84
            settings_quotas_tab: true
85
            settings_accounting_tab: true
86
            settings_showback_tab: true
87 87
        actions:
88
            # The buttons inside the settings-tab panel user_info_tab are
89
            # configured with users-tab/actions; User.update_password and
90
            # User.login_token
91
            #
92
            # Buttons for user_config_tab
88
            # Buttons for settings_info_tab
89
            User.update_password: true
90
            User.login_token: true
91
            # Buttons for settings_config_tab
93 92
            Settings.change_language: true
94 93
            Settings.change_password: true
95 94
            Settings.change_view: true
96 95
            Settings.ssh_key: true
97 96
            Settings.login_token: true
98
            # Edit button in user_quotas_tab
97
            # Edit button in settings_quotas_tab
99 98
            User.quotas_dialog: false
100
    users-tab:
101
        actions:
102
            User.update_password: true
103
            User.login_token: true
104 99
    vms-tab:
105 100
        actions: *provisionactions
106 101
    images-tab:
src/sunstone/etc/sunstone-views/cloud_vcenter.yaml
79 79
            disk_resize: false
80 80
    settings-tab:
81 81
        panel_tabs:
82
            user_info_tab: false
83
            user_config_tab: true
84
            user_quotas_tab: true
85
            user_accounting_tab: true
86
            user_showback_tab: true
82
            settings_info_tab: false
83
            settings_config_tab: true
84
            settings_quotas_tab: true
85
            settings_accounting_tab: true
86
            settings_showback_tab: true
87 87
        actions:
88
            # The buttons inside the settings-tab panel user_info_tab are
88
            # The buttons inside the settings-tab panel settings_info_tab are
89 89
            # configured with users-tab/actions; User.update_password and
90 90
            # User.login_token
91 91
            #
92
            # Buttons for user_config_tab
92
            # Buttons for settings_config_tab
93 93
            Settings.change_language: true
94 94
            Settings.change_password: true
95 95
            Settings.change_view: true
96 96
            Settings.ssh_key: true
97 97
            Settings.login_token: true
98
            # Edit button in user_quotas_tab
98
            # Edit button in settings_quotas_tab
99 99
            User.quotas_dialog: false
100 100
    users-tab:
101 101
        actions:
src/sunstone/etc/sunstone-views/groupadmin.yaml
768 768
            Support.create_dialog: true
769 769
    settings-tab:
770 770
        panel_tabs:
771
            user_info_tab: true
772
            user_config_tab: false
773
            user_quotas_tab: true
774
            group_quotas_tab: true
775
            user_accounting_tab: true
776
            user_showback_tab: true
771
            settings_info_tab: true
772
            settings_config_tab: false
773
            settings_quotas_tab: true
774
            settings_group_quotas_tab: true
775
            settings_accounting_tab: true
776
            settings_showback_tab: true
777 777
        actions:
778
            # The buttons inside the settings-tab panel user_info_tab are
779
            # configured with users-tab/actions; User.update_password and
780
            # User.login_token
781
            #
782
            # Buttons for user_config_tab
778
            # Buttons for settings_info_tab
779
            User.update_password: true
780
            User.login_token: true
781
            # Buttons for settings_config_tab
783 782
            Settings.change_language: true
784 783
            Settings.change_password: true
785 784
            Settings.change_view: true
786 785
            Settings.ssh_key: true
787 786
            Settings.login_token: true
788
            # Edit button in user_quotas_tab
787
            # Edit button in settings_quotas_tab
789 788
            User.quotas_dialog: false
790 789
    upgrade-top-tab:
791 790
        panel_tabs:
src/sunstone/etc/sunstone-views/groupadmin_vcenter.yaml
768 768
            Support.create_dialog: true
769 769
    settings-tab:
770 770
        panel_tabs:
771
            user_info_tab: true
772
            user_config_tab: false
773
            user_quotas_tab: true
774
            group_quotas_tab: true
775
            user_accounting_tab: true
776
            user_showback_tab: true
771
            settings_info_tab: true
772
            settings_config_tab: false
773
            settings_quotas_tab: true
774
            settings_group_quotas_tab: true
775
            settings_accounting_tab: true
776
            settings_showback_tab: true
777 777
        actions:
778
            # The buttons inside the settings-tab panel user_info_tab are
779
            # configured with users-tab/actions; User.update_password and
780
            # User.login_token
781
            #
782
            # Buttons for user_config_tab
778
            # Buttons for settings_info_tab
779
            User.update_password: true
780
            User.login_token: true
781
            # Buttons for settings_config_tab
783 782
            Settings.change_language: true
784 783
            Settings.change_password: true
785 784
            Settings.change_view: true
786 785
            Settings.ssh_key: true
787 786
            Settings.login_token: true
788
            # Edit button in user_quotas_tab
787
            # Edit button in settings_quotas_tab
789 788
            User.quotas_dialog: false
790 789
    upgrade-top-tab:
791 790
        panel_tabs:
src/sunstone/etc/sunstone-views/user.yaml
767 767
            Support.create_dialog: true
768 768
    settings-tab:
769 769
        panel_tabs:
770
            user_info_tab: true
771
            user_config_tab: false
772
            user_quotas_tab: true
773
            group_quotas_tab: true
774
            user_accounting_tab: true
775
            user_showback_tab: true
770
            settings_info_tab: true
771
            settings_config_tab: false
772
            settings_quotas_tab: true
773
            settings_group_quotas_tab: true
774
            settings_accounting_tab: true
775
            settings_showback_tab: true
776 776
        actions:
777
            # The buttons inside the settings-tab panel user_info_tab are
778
            # configured with users-tab/actions; User.update_password and
779
            # User.login_token
780
            #
781
            # Buttons for user_config_tab
777
            # Buttons for settings_info_tab
778
            User.update_password: true
779
            User.login_token: true
780
            # Buttons for settings_config_tab
782 781
            Settings.change_language: true
783 782
            Settings.change_password: true
784 783
            Settings.change_view: true
785 784
            Settings.ssh_key: true
786 785
            Settings.login_token: true
787
            # Edit button in user_quotas_tab
786
            # Edit button in settings_quotas_tab
788 787
            User.quotas_dialog: false
789 788
    upgrade-top-tab:
790 789
        panel_tabs:
src/sunstone/public/app/tabs/settings-tab.js
21 21
  var _actions = require('./users-tab/actions');
22 22

  
23 23
  var TAB_ID = require('./settings-tab/tabId');
24
  var USERS_TAB_ID = require('tabs/users-tab/tabId');
25 24

  
26 25
  _actions["Settings.refresh"] = {
27 26
    type: "custom",
......
34 33
  ];
35 34

  
36 35
  var _panels = [
37
    require('tabs/users-tab/panels/info'),
36
    require('tabs/settings-tab/panels/info'),
38 37
    require('tabs/settings-tab/panels/user-config'),
39
    require('tabs/users-tab/panels/quotas'),
38
    require('tabs/settings-tab/panels/quotas'),
40 39
    require('tabs/settings-tab/panels/group-quotas'),
41
    require('tabs/users-tab/panels/accounting'),
42
    require('tabs/users-tab/panels/showback')
40
    require('tabs/settings-tab/panels/accounting'),
41
    require('tabs/settings-tab/panels/showback')
43 42
  ];
44 43

  
45 44
  var _formPanels = [
src/sunstone/public/app/tabs/settings-tab/panels/accounting.js
1
/* -------------------------------------------------------------------------- */
2
/* Copyright 2002-2016, OpenNebula Project, OpenNebula Systems                */
3
/*                                                                            */
4
/* Licensed under the Apache License, Version 2.0 (the "License"); you may    */
5
/* not use this file except in compliance with the License. You may obtain    */
6
/* a copy of the License at                                                   */
7
/*                                                                            */
8
/* http://www.apache.org/licenses/LICENSE-2.0                                 */
9
/*                                                                            */
10
/* Unless required by applicable law or agreed to in writing, software        */
11
/* distributed under the License is distributed on an "AS IS" BASIS,          */
12
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   */
13
/* See the License for the specific language governing permissions and        */
14
/* limitations under the License.                                             */
15
/* -------------------------------------------------------------------------- */
16

  
17
define(function(require) {
18
  /*
19
    DEPENDENCIES
20
   */
21

  
22
  var BasePanel = require('tabs/users-tab/panels/accounting-common');
23

  
24
  /*
25
    CONSTANTS
26
   */
27

  
28
  var TAB_ID = require('../tabId');
29
  var PANEL_ID = require('./accounting/panelId');
30

  
31
  /*
32
    CONSTRUCTOR
33
   */
34

  
35
  function Panel(info) {
36
    this.tabId = TAB_ID;
37

  
38
    return BasePanel.call(this, info);
39
  };
40

  
41
  Panel.PANEL_ID = PANEL_ID;
42
  Panel.prototype = Object.create(BasePanel.prototype);
43
  Panel.prototype.constructor = Panel;
44

  
45
  return Panel;
46
});
src/sunstone/public/app/tabs/settings-tab/panels/accounting/panelId.js
1
/* -------------------------------------------------------------------------- */
2
/* Copyright 2002-2016, OpenNebula Project, OpenNebula Systems                */
3
/*                                                                            */
4
/* Licensed under the Apache License, Version 2.0 (the "License"); you may    */
5
/* not use this file except in compliance with the License. You may obtain    */
6
/* a copy of the License at                                                   */
7
/*                                                                            */
8
/* http://www.apache.org/licenses/LICENSE-2.0                                 */
9
/*                                                                            */
10
/* Unless required by applicable law or agreed to in writing, software        */
11
/* distributed under the License is distributed on an "AS IS" BASIS,          */
12
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   */
13
/* See the License for the specific language governing permissions and        */
14
/* limitations under the License.                                             */
15
/* -------------------------------------------------------------------------- */
16

  
17
define(function(require){
18
  return 'settings_accounting_tab';
19
})
src/sunstone/public/app/tabs/settings-tab/panels/group-quotas/panelId.js
15 15
/* -------------------------------------------------------------------------- */
16 16

  
17 17
define(function(require){
18
  return 'group_quotas_tab';
18
  return 'settings_group_quotas_tab';
19 19
});
src/sunstone/public/app/tabs/settings-tab/panels/info.js
1
/* -------------------------------------------------------------------------- */
2
/* Copyright 2002-2016, OpenNebula Project, OpenNebula Systems                */
3
/*                                                                            */
4
/* Licensed under the Apache License, Version 2.0 (the "License"); you may    */
5
/* not use this file except in compliance with the License. You may obtain    */
6
/* a copy of the License at                                                   */
7
/*                                                                            */
8
/* http://www.apache.org/licenses/LICENSE-2.0                                 */
9
/*                                                                            */
10
/* Unless required by applicable law or agreed to in writing, software        */
11
/* distributed under the License is distributed on an "AS IS" BASIS,          */
12
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   */
13
/* See the License for the specific language governing permissions and        */
14
/* limitations under the License.                                             */
15
/* -------------------------------------------------------------------------- */
16

  
17
define(function(require) {
18
  /*
19
    DEPENDENCIES
20
   */
21

  
22
  var BasePanel = require('tabs/users-tab/panels/info-common');
23

  
24
  /*
25
    CONSTANTS
26
   */
27

  
28
  var TAB_ID = require('../tabId');
29
  var PANEL_ID = require('./info/panelId');
30

  
31
  /*
32
    CONSTRUCTOR
33
   */
34

  
35
  function Panel(info) {
36
    this.tabId = TAB_ID;
37

  
38
    return BasePanel.call(this, info);
39
  };
40

  
41
  Panel.PANEL_ID = PANEL_ID;
42
  Panel.prototype = Object.create(BasePanel.prototype);
43
  Panel.prototype.constructor = Panel;
44

  
45
  return Panel;
46
});
src/sunstone/public/app/tabs/settings-tab/panels/info/panelId.js
1
/* -------------------------------------------------------------------------- */
2
/* Copyright 2002-2016, OpenNebula Project, OpenNebula Systems                */
3
/*                                                                            */
4
/* Licensed under the Apache License, Version 2.0 (the "License"); you may    */
5
/* not use this file except in compliance with the License. You may obtain    */
6
/* a copy of the License at                                                   */
7
/*                                                                            */
8
/* http://www.apache.org/licenses/LICENSE-2.0                                 */
9
/*                                                                            */
10
/* Unless required by applicable law or agreed to in writing, software        */
11
/* distributed under the License is distributed on an "AS IS" BASIS,          */
12
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   */
13
/* See the License for the specific language governing permissions and        */
14
/* limitations under the License.                                             */
15
/* -------------------------------------------------------------------------- */
16

  
17
define(function(require){
18
  return 'settings_info_tab';
19
})
src/sunstone/public/app/tabs/settings-tab/panels/quotas.js
1
/* -------------------------------------------------------------------------- */
2
/* Copyright 2002-2016, OpenNebula Project, OpenNebula Systems                */
3
/*                                                                            */
4
/* Licensed under the Apache License, Version 2.0 (the "License"); you may    */
5
/* not use this file except in compliance with the License. You may obtain    */
6
/* a copy of the License at                                                   */
7
/*                                                                            */
8
/* http://www.apache.org/licenses/LICENSE-2.0                                 */
9
/*                                                                            */
10
/* Unless required by applicable law or agreed to in writing, software        */
11
/* distributed under the License is distributed on an "AS IS" BASIS,          */
12
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   */
13
/* See the License for the specific language governing permissions and        */
14
/* limitations under the License.                                             */
15
/* -------------------------------------------------------------------------- */
16

  
17
define(function(require) {
18
  /*
19
    DEPENDENCIES
20
   */
21

  
22
  var BasePanel = require('tabs/users-tab/panels/quotas-common');
23

  
24
  /*
25
    CONSTANTS
26
   */
27

  
28
  var TAB_ID = require('../tabId');
29
  var PANEL_ID = require('./quotas/panelId');
30

  
31
  /*
32
    CONSTRUCTOR
33
   */
34

  
35
  function Panel(info) {
36
    this.tabId = TAB_ID;
37

  
38
    return BasePanel.call(this, info);
39
  };
40

  
41
  Panel.PANEL_ID = PANEL_ID;
42
  Panel.prototype = Object.create(BasePanel.prototype);
43
  Panel.prototype.constructor = Panel;
44

  
45
  return Panel;
46
});
src/sunstone/public/app/tabs/settings-tab/panels/quotas/panelId.js
1
/* -------------------------------------------------------------------------- */
2
/* Copyright 2002-2016, OpenNebula Project, OpenNebula Systems                */
3
/*                                                                            */
4
/* Licensed under the Apache License, Version 2.0 (the "License"); you may    */
5
/* not use this file except in compliance with the License. You may obtain    */
6
/* a copy of the License at                                                   */
7
/*                                                                            */
8
/* http://www.apache.org/licenses/LICENSE-2.0                                 */
9
/*                                                                            */
10
/* Unless required by applicable law or agreed to in writing, software        */
11
/* distributed under the License is distributed on an "AS IS" BASIS,          */
12
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   */
13
/* See the License for the specific language governing permissions and        */
14
/* limitations under the License.                                             */
15
/* -------------------------------------------------------------------------- */
16

  
17
define(function(require){
18
  return 'settings_quotas_tab';
19
})
src/sunstone/public/app/tabs/settings-tab/panels/showback.js
1
/* -------------------------------------------------------------------------- */
2
/* Copyright 2002-2016, OpenNebula Project, OpenNebula Systems                */
3
/*                                                                            */
4
/* Licensed under the Apache License, Version 2.0 (the "License"); you may    */
5
/* not use this file except in compliance with the License. You may obtain    */
6
/* a copy of the License at                                                   */
7
/*                                                                            */
8
/* http://www.apache.org/licenses/LICENSE-2.0                                 */
9
/*                                                                            */
10
/* Unless required by applicable law or agreed to in writing, software        */
11
/* distributed under the License is distributed on an "AS IS" BASIS,          */
12
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   */
13
/* See the License for the specific language governing permissions and        */
14
/* limitations under the License.                                             */
15
/* -------------------------------------------------------------------------- */
16

  
17
define(function(require) {
18
  /*
19
    DEPENDENCIES
20
   */
21

  
22
  var BasePanel = require('tabs/users-tab/panels/showback-common');
23

  
24
  /*
25
    CONSTANTS
26
   */
27

  
28
  var TAB_ID = require('../tabId');
29
  var PANEL_ID = require('./showback/panelId');
30

  
31
  /*
32
    CONSTRUCTOR
33
   */
34

  
35
  function Panel(info) {
36
    this.tabId = TAB_ID;
37

  
38
    return BasePanel.call(this, info);
39
  };
40

  
41
  Panel.PANEL_ID = PANEL_ID;
42
  Panel.prototype = Object.create(BasePanel.prototype);
43
  Panel.prototype.constructor = Panel;
44

  
45
  return Panel;
46
});
src/sunstone/public/app/tabs/settings-tab/panels/showback/panelId.js
1
/* -------------------------------------------------------------------------- */
2
/* Copyright 2002-2016, OpenNebula Project, OpenNebula Systems                */
3
/*                                                                            */
4
/* Licensed under the Apache License, Version 2.0 (the "License"); you may    */
5
/* not use this file except in compliance with the License. You may obtain    */
6
/* a copy of the License at                                                   */
7
/*                                                                            */
8
/* http://www.apache.org/licenses/LICENSE-2.0                                 */
9
/*                                                                            */
10
/* Unless required by applicable law or agreed to in writing, software        */
11
/* distributed under the License is distributed on an "AS IS" BASIS,          */
12
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   */
13
/* See the License for the specific language governing permissions and        */
14
/* limitations under the License.                                             */
15
/* -------------------------------------------------------------------------- */
16

  
17
define(function(require){
18
  return 'settings_showback_tab';
19
})
src/sunstone/public/app/tabs/settings-tab/panels/user-config/panelId.js
15 15
/* -------------------------------------------------------------------------- */
16 16

  
17 17
define(function(require) {
18
  return 'user_config_tab';
18
  return 'settings_config_tab';
19 19
});
src/sunstone/public/app/tabs/users-tab/panels/accounting-common.js
1
/* -------------------------------------------------------------------------- */
2
/* Copyright 2002-2016, OpenNebula Project, OpenNebula Systems                */
3
/*                                                                            */
4
/* Licensed under the Apache License, Version 2.0 (the "License"); you may    */
5
/* not use this file except in compliance with the License. You may obtain    */
6
/* a copy of the License at                                                   */
7
/*                                                                            */
8
/* http://www.apache.org/licenses/LICENSE-2.0                                 */
9
/*                                                                            */
10
/* Unless required by applicable law or agreed to in writing, software        */
11
/* distributed under the License is distributed on an "AS IS" BASIS,          */
12
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   */
13
/* See the License for the specific language governing permissions and        */
14
/* limitations under the License.                                             */
15
/* -------------------------------------------------------------------------- */
16

  
17
define(function(require) {
18
  /*
19
    DEPENDENCIES
20
   */
21

  
22
  var Locale = require('utils/locale');
23
  var Accounting = require('utils/accounting');
24

  
25
  /*
26
    CONSTANTS
27
   */
28

  
29
  var RESOURCE = "User";
30
  var XML_ROOT = "USER";
31

  
32
  /*
33
    CONSTRUCTOR
34
   */
35

  
36
  function Panel(info) {
37
    this.title = Locale.tr("Accounting");
38
    this.icon = "fa-bar-chart-o";
39

  
40
    this.element = info[XML_ROOT];
41

  
42
    return this;
43
  }
44

  
45
  Panel.prototype.html = _html;
46
  Panel.prototype.setup = _setup;
47

  
48
  return Panel;
49

  
50
  /*
51
    FUNCTION DEFINITIONS
52
   */
53

  
54
  function _html() {
55
    return Accounting.html();
56
  }
57

  
58
  function _setup(context) {
59
    Accounting.setup(
60
      context,
61
      { fixed_user: this.element.ID,
62
        init_group_by: "vm"
63
      });
64
  }
65
});
src/sunstone/public/app/tabs/users-tab/panels/accounting.js
19 19
    DEPENDENCIES
20 20
   */
21 21

  
22
  var Locale = require('utils/locale');
23
  var Accounting = require('utils/accounting');
22
  var BasePanel = require('tabs/users-tab/panels/accounting-common');
24 23

  
25 24
  /*
26 25
    CONSTANTS
......
28 27

  
29 28
  var TAB_ID = require('../tabId');
30 29
  var PANEL_ID = require('./accounting/panelId');
31
  var RESOURCE = "User";
32
  var XML_ROOT = "USER";
33 30

  
34 31
  /*
35 32
    CONSTRUCTOR
36 33
   */
37 34

  
38 35
  function Panel(info) {
39
    this.title = Locale.tr("Accounting");
40
    this.icon = "fa-bar-chart-o";
36
    this.tabId = TAB_ID;
41 37

  
42
    this.element = info[XML_ROOT];
43

  
44
    return this;
45
  }
38
    return BasePanel.call(this, info);
39
  };
46 40

  
47 41
  Panel.PANEL_ID = PANEL_ID;
48
  Panel.prototype.html = _html;
49
  Panel.prototype.setup = _setup;
42
  Panel.prototype = Object.create(BasePanel.prototype);
43
  Panel.prototype.constructor = Panel;
50 44

  
51 45
  return Panel;
52

  
53
  /*
54
    FUNCTION DEFINITIONS
55
   */
56

  
57
  function _html() {
58
    return Accounting.html();
59
  }
60

  
61
  function _setup(context) {
62
    Accounting.setup(
63
      context,
64
      { fixed_user: this.element.ID,
65
        init_group_by: "vm"
66
      });
67
  }
68 46
});
src/sunstone/public/app/tabs/users-tab/panels/info-common.js
1
/* -------------------------------------------------------------------------- */
2
/* Copyright 2002-2016, OpenNebula Project, OpenNebula Systems                */
3
/*                                                                            */
4
/* Licensed under the Apache License, Version 2.0 (the "License"); you may    */
5
/* not use this file except in compliance with the License. You may obtain    */
6
/* a copy of the License at                                                   */
7
/*                                                                            */
8
/* http://www.apache.org/licenses/LICENSE-2.0                                 */
9
/*                                                                            */
10
/* Unless required by applicable law or agreed to in writing, software        */
11
/* distributed under the License is distributed on an "AS IS" BASIS,          */
12
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   */
13
/* See the License for the specific language governing permissions and        */
14
/* limitations under the License.                                             */
15
/* -------------------------------------------------------------------------- */
16

  
17
define(function(require) {
18
  /*
19
    DEPENDENCIES
20
   */
21

  
22
  var TemplateInfo = require('hbs!./info/html');
23
  var TemplateChgrpTr = require('hbs!./info/chgrp-tr');
24
  var ResourceSelect = require('utils/resource-select');
25
  var TemplateUtils = require('utils/template-utils');
26
  var Locale = require('utils/locale');
27
  var OpenNebulaUser = require('opennebula/user');
28
  var Sunstone = require('sunstone');
29

  
30
  /*
31
    TEMPLATES
32
   */
33

  
34
  var TemplateTable = require('utils/panel/template-table');
35

  
36
  /*
37
    CONSTANTS
38
   */
39

  
40
  var RESOURCE = "User";
41
  var XML_ROOT = "USER";
42
  var PASSWORD_DIALOG_ID = require('tabs/users-tab/dialogs/password/dialogId');
43
  var LOGIN_TOKEN_DIALOG_ID = require('tabs/users-tab/dialogs/login-token/dialogId');
44
  var CONFIRM_DIALOG_ID = require('utils/dialogs/generic-confirm/dialogId');
45

  
46
  /*
47
    CONSTRUCTOR
48
   */
49

  
50
  function Panel(info) {
51
    this.title = Locale.tr("Info");
52
    this.icon = "fa-info-circle";
53

  
54
    this.element = info[XML_ROOT];
55

  
56
    return this;
57
  }
58

  
59
  Panel.prototype.html = _html;
60
  Panel.prototype.setup = _setup;
61

  
62
  return Panel;
63

  
64
  /*
65
    FUNCTION DEFINITIONS
66
   */
67

  
68
  function _html() {
69
    var groupTrHTML = TemplateChgrpTr({'element': this.element});
70

  
71
    // TODO: simplify interface?
72
    var strippedTemplate = $.extend({}, this.element.TEMPLATE);
73
    delete strippedTemplate["SSH_PUBLIC_KEY"];
74
    delete strippedTemplate["SUNSTONE"];
75

  
76
    var templateTableHTML = TemplateTable.html(strippedTemplate, RESOURCE,
77
                                              Locale.tr("Attributes"));
78
    //====
79

  
80
    return TemplateInfo({
81
      'element': this.element,
82
      'sunstone_template': this.element.TEMPLATE.SUNSTONE||{},
83
      'groupTrHTML': groupTrHTML,
84
      'templateTableHTML': templateTableHTML,
85
      'tabId': this.tabId
86
    });
87
  }
88

  
89
  function _setup(context) {
90
    var that = this;
91

  
92
    // Template update
93
    // TODO: simplify interface?
94
    var strippedTemplate = $.extend({}, this.element.TEMPLATE);
95
    delete strippedTemplate["SSH_PUBLIC_KEY"];
96
    delete strippedTemplate["SUNSTONE"];
97

  
98
    var hiddenValues = {};
99

  
100
    if (this.element.TEMPLATE.SSH_PUBLIC_KEY != undefined) {
101
      hiddenValues.SSH_PUBLIC_KEY = this.element.TEMPLATE.SSH_PUBLIC_KEY;
102
    }
103
    if (this.element.TEMPLATE.SUNSTONE != undefined) {
104
      hiddenValues.SUNSTONE = this.element.TEMPLATE.SUNSTONE;
105
    }
106

  
107
    TemplateTable.setup(strippedTemplate, RESOURCE, this.element.ID, context, hiddenValues);
108
    //===
109

  
110
    // Chgrp
111
    context.off("click", "#div_edit_chg_group_link");
112
    context.on("click", "#div_edit_chg_group_link", function() {
113
      ResourceSelect.insert({
114
        context: $('#value_td_group', context),
115
        resourceName: 'Group',
116
        initValue: that.element.GID
117
      });
118
    });
119

  
120
    context.off("change", "#value_td_group .resource_list_select");
121
    context.on("change", "#value_td_group .resource_list_select", function() {
122
      var newGroupId = $(this).val();
123
      if (newGroupId != "") {
124
        Sunstone.runAction(RESOURCE + ".chgrp", [that.element.ID], newGroupId);
125
      }
126
    });
127

  
128
    // View password button
129
    context.off("click", "#view_password");
130
    context.on("click", "#view_password", function(){
131
      Sunstone.getDialog(CONFIRM_DIALOG_ID).setParams({
132
        header : Locale.tr("Password"),
133
        headerTabId: that.tabId,
134
        body: '<label>' + Locale.tr("Current password") + '</label>' +
135
              '<pre>'+that.element.PASSWORD+'</pre>',
136
        question : '',
137
        buttons : [
138
          Locale.tr("Close"),
139
        ],
140
        submit : [
141
          function(){
142
            return false;
143
          }
144
        ]
145
      });
146

  
147
      Sunstone.getDialog(CONFIRM_DIALOG_ID).reset();
148
      Sunstone.getDialog(CONFIRM_DIALOG_ID).show();
149
    });
150

  
151
    // Edit password button
152
    context.off("click", "#update_password");
153
    context.on("click", "#update_password", function(){
154
      Sunstone.getDialog(PASSWORD_DIALOG_ID).setParams(
155
        {selectedElements: [that.element.ID]});
156
      Sunstone.getDialog(PASSWORD_DIALOG_ID).reset();
157
      Sunstone.getDialog(PASSWORD_DIALOG_ID).show();
158
    });
159

  
160
    // Login token button
161
    context.off("click", "#login_token");
162
    context.on("click", "#login_token", function(){
163
      Sunstone.getDialog(LOGIN_TOKEN_DIALOG_ID).setParams({element: that.element});
164
      Sunstone.getDialog(LOGIN_TOKEN_DIALOG_ID).reset();
165
      Sunstone.getDialog(LOGIN_TOKEN_DIALOG_ID).show();
166
    });
167

  
168
    // SSH input
169

  
170
    context.off("click", ".user_ssh_public_key_edit");
171
    context.on("click", ".user_ssh_public_key_edit", function() {
172
      $("#user_ssh_public_key_text", context).hide();
173
      $("#user_ssh_public_key_textarea", context).show().focus();
174
    });
175

  
176
    context.off("change", "#user_ssh_public_key_textarea");
177
    context.on("change", "#user_ssh_public_key_textarea", function() {
178
      var template_str = 'SSH_PUBLIC_KEY = "'+TemplateUtils.escapeDoubleQuotes($(this).val())+'"';
179

  
180
      Sunstone.runAction("User.append_template", that.element.ID, template_str);
181
    });
182

  
183
    context.off("focusout", "#user_ssh_public_key_textarea");
184
    context.on("focusout", "#user_ssh_public_key_textarea", function() {
185
      $("#user_ssh_public_key_text", context).show();
186
      $("#user_ssh_public_key_textarea", context).hide();
187
    });
188

  
189
    $("#user_ssh_public_key_text", context).show();
190
    $("#user_ssh_public_key_textarea", context).hide();
191
      
192
    // Change table Order
193
    context.off("click", "#div_edit_table_order")
194
    context.on("click", "#div_edit_table_order", function() {
195
      $(".value_td_table_order", context).html('<select id="table_order_select">' +
196
         '<option value="asc">' + Locale.tr("ascending") + '</option>' +
197
         '<option value="desc">' + Locale.tr("descending") + '</option>' +
198
       '</select>');
199

  
200
      if (that.element.TEMPLATE.SUNSTONE && that.element.TEMPLATE.SUNSTONE.TABLE_ORDER) {
201
        $('#table_order_select', context).val(that.element.TEMPLATE.SUNSTONE.TABLE_ORDER);
202
      }
203
    });
204

  
205
    context.off("change", "#table_order_select")
206
    context.on("change", "#table_order_select", function() {
207
      var sunstone_setting = {TABLE_ORDER : $(this).val()};
208
      Sunstone.runAction("User.append_sunstone_setting_refresh", that.element.ID, sunstone_setting);
209
    });
210

  
211
    // Change language
212
    context.off("click", "#div_edit_language")
213
    context.on("click", "#div_edit_language", function() {
214
      $(".value_td_language", context).html('<select id="language_select">' +
215
         Locale.language_options +
216
       '</select>');
217

  
218
      if (that.element.TEMPLATE.SUNSTONE && that.element.TEMPLATE.SUNSTONE.LANG) {
219
        $('#language_select', context).val(that.element.TEMPLATE.SUNSTONE.LANG);
220
      }
221
    });
222

  
223
    context.off("change", "#language_select")
224
    context.on("change", "#language_select", function() {
225
      var sunstone_setting = {LANG : $(this).val()};
226
      Sunstone.runAction("User.append_sunstone_setting_refresh", that.element.ID, sunstone_setting);
227
    });
228

  
229
    // Change view
230
    context.off("click", "#div_edit_view")
231
    context.on("click", "#div_edit_view", function() {
232
      var options = '';
233
      $.each( config['available_views'], function(id, view) {
234
        options += '<option value="'+view+'">'+view+'</option>';
235
      });
236

  
237
      $(".value_td_view", context).html('<select id="view_select">' +
238
         options +
239
       '</select>');
240

  
241
      if (that.element.TEMPLATE.SUNSTONE && that.element.TEMPLATE.SUNSTONE.DEFAULT_VIEW) {
242
        $('#view_select', context).val(that.element.TEMPLATE.SUNSTONE.DEFAULT_VIEW);
243
      }
244
    });
245

  
246
    context.off("change", "#view_select")
247
    context.on("change", "#view_select", function() {
248
      var sunstone_setting = {DEFAULT_VIEW : $(this).val()};
249
      Sunstone.runAction("User.append_sunstone_setting_refresh", that.element.ID, sunstone_setting);
250
    });
251

  
252
    return false;
253
  }
254
});
src/sunstone/public/app/tabs/users-tab/panels/info.js
19 19
    DEPENDENCIES
20 20
   */
21 21

  
22
  var TemplateInfo = require('hbs!./info/html');
23
  var TemplateChgrpTr = require('hbs!./info/chgrp-tr');
24
  var ResourceSelect = require('utils/resource-select');
25
  var TemplateUtils = require('utils/template-utils');
26
  var Locale = require('utils/locale');
27
  var OpenNebulaUser = require('opennebula/user');
28
  var Sunstone = require('sunstone');
29

  
30
  /*
31
    TEMPLATES
32
   */
33

  
34
  var TemplateTable = require('utils/panel/template-table');
22
  var BasePanel = require('tabs/users-tab/panels/info-common');
35 23

  
36 24
  /*
37 25
    CONSTANTS
......
39 27

  
40 28
  var TAB_ID = require('../tabId');
41 29
  var PANEL_ID = require('./info/panelId');
42
  var RESOURCE = "User";
43
  var XML_ROOT = "USER";
44
  var PASSWORD_DIALOG_ID = require('tabs/users-tab/dialogs/password/dialogId');
45
  var LOGIN_TOKEN_DIALOG_ID = require('tabs/users-tab/dialogs/login-token/dialogId');
46
  var CONFIRM_DIALOG_ID = require('utils/dialogs/generic-confirm/dialogId');
47 30

  
48 31
  /*
49 32
    CONSTRUCTOR
50 33
   */
51 34

  
52 35
  function Panel(info) {
53
    this.title = Locale.tr("Info");
54
    this.icon = "fa-info-circle";
55

  
56
    this.element = info[XML_ROOT];
36
    this.tabId = TAB_ID;
57 37

  
58
    return this;
59
  }
38
    return BasePanel.call(this, info);
39
  };
60 40

  
61 41
  Panel.PANEL_ID = PANEL_ID;
62
  Panel.prototype.html = _html;
63
  Panel.prototype.setup = _setup;
42
  Panel.prototype = Object.create(BasePanel.prototype);
43
  Panel.prototype.constructor = Panel;
64 44

  
65 45
  return Panel;
66

  
67
  /*
68
    FUNCTION DEFINITIONS
69
   */
70

  
71
  function _html() {
72
    var groupTrHTML = TemplateChgrpTr({'element': this.element});
73

  
74
    // TODO: simplify interface?
75
    var strippedTemplate = $.extend({}, this.element.TEMPLATE);
76
    delete strippedTemplate["SSH_PUBLIC_KEY"];
77
    delete strippedTemplate["SUNSTONE"];
78

  
79
    var templateTableHTML = TemplateTable.html(strippedTemplate, RESOURCE,
80
                                              Locale.tr("Attributes"));
81
    //====
82

  
83
    return TemplateInfo({
84
      'element': this.element,
85
      'sunstone_template': this.element.TEMPLATE.SUNSTONE||{},
86
      'groupTrHTML': groupTrHTML,
87
      'templateTableHTML': templateTableHTML
88
    });
89
  }
90

  
91
  function _setup(context) {
92
    var that = this;
93

  
94
    // Template update
95
    // TODO: simplify interface?
96
    var strippedTemplate = $.extend({}, this.element.TEMPLATE);
97
    delete strippedTemplate["SSH_PUBLIC_KEY"];
98
    delete strippedTemplate["SUNSTONE"];
99

  
100
    var hiddenValues = {};
101

  
102
    if (this.element.TEMPLATE.SSH_PUBLIC_KEY != undefined) {
103
      hiddenValues.SSH_PUBLIC_KEY = this.element.TEMPLATE.SSH_PUBLIC_KEY;
104
    }
105
    if (this.element.TEMPLATE.SUNSTONE != undefined) {
106
      hiddenValues.SUNSTONE = this.element.TEMPLATE.SUNSTONE;
107
    }
108

  
109
    TemplateTable.setup(strippedTemplate, RESOURCE, this.element.ID, context, hiddenValues);
110
    //===
111

  
112
    // Chgrp
113
    context.off("click", "#div_edit_chg_group_link");
114
    context.on("click", "#div_edit_chg_group_link", function() {
115
      ResourceSelect.insert({
116
        context: $('#value_td_group', context),
117
        resourceName: 'Group',
118
        initValue: that.element.GID
119
      });
120
    });
121

  
122
    context.off("change", "#value_td_group .resource_list_select");
123
    context.on("change", "#value_td_group .resource_list_select", function() {
124
      var newGroupId = $(this).val();
125
      if (newGroupId != "") {
126
        Sunstone.runAction(RESOURCE + ".chgrp", [that.element.ID], newGroupId);
127
      }
128
    });
129

  
130
    // View password button
131
    context.off("click", "#view_password");
132
    context.on("click", "#view_password", function(){
133
      Sunstone.getDialog(CONFIRM_DIALOG_ID).setParams({
134
        header : Locale.tr("Password"),
135
        headerTabId: TAB_ID,
136
        body: '<label>' + Locale.tr("Current password") + '</label>' +
137
              '<pre>'+that.element.PASSWORD+'</pre>',
138
        question : '',
139
        buttons : [
140
          Locale.tr("Close"),
141
        ],
142
        submit : [
143
          function(){
144
            return false;
145
          }
146
        ]
147
      });
148

  
149
      Sunstone.getDialog(CONFIRM_DIALOG_ID).reset();
150
      Sunstone.getDialog(CONFIRM_DIALOG_ID).show();
151
    });
152

  
153
    // Edit password button
154
    context.off("click", "#update_password");
155
    context.on("click", "#update_password", function(){
156
      Sunstone.getDialog(PASSWORD_DIALOG_ID).setParams(
157
        {selectedElements: [that.element.ID]});
158
      Sunstone.getDialog(PASSWORD_DIALOG_ID).reset();
159
      Sunstone.getDialog(PASSWORD_DIALOG_ID).show();
160
    });
161

  
162
    // Login token button
163
    context.off("click", "#login_token");
164
    context.on("click", "#login_token", function(){
165
      Sunstone.getDialog(LOGIN_TOKEN_DIALOG_ID).setParams({element: that.element});
166
      Sunstone.getDialog(LOGIN_TOKEN_DIALOG_ID).reset();
167
      Sunstone.getDialog(LOGIN_TOKEN_DIALOG_ID).show();
168
    });
169

  
170
    // SSH input
171

  
172
    context.off("click", ".user_ssh_public_key_edit");
173
    context.on("click", ".user_ssh_public_key_edit", function() {
174
      $("#user_ssh_public_key_text", context).hide();
175
      $("#user_ssh_public_key_textarea", context).show().focus();
176
    });
177

  
178
    context.off("change", "#user_ssh_public_key_textarea");
179
    context.on("change", "#user_ssh_public_key_textarea", function() {
180
      var template_str = 'SSH_PUBLIC_KEY = "'+TemplateUtils.escapeDoubleQuotes($(this).val())+'"';
181

  
182
      Sunstone.runAction("User.append_template", that.element.ID, template_str);
183
    });
184

  
185
    context.off("focusout", "#user_ssh_public_key_textarea");
186
    context.on("focusout", "#user_ssh_public_key_textarea", function() {
187
      $("#user_ssh_public_key_text", context).show();
188
      $("#user_ssh_public_key_textarea", context).hide();
189
    });
190

  
191
    $("#user_ssh_public_key_text", context).show();
192
    $("#user_ssh_public_key_textarea", context).hide();
193
      
194
    // Change table Order
195
    context.off("click", "#div_edit_table_order")
196
    context.on("click", "#div_edit_table_order", function() {
197
      $(".value_td_table_order", context).html('<select id="table_order_select">' +
198
         '<option value="asc">' + Locale.tr("ascending") + '</option>' +
199
         '<option value="desc">' + Locale.tr("descending") + '</option>' +
200
       '</select>');
201

  
202
      if (that.element.TEMPLATE.SUNSTONE && that.element.TEMPLATE.SUNSTONE.TABLE_ORDER) {
203
        $('#table_order_select', context).val(that.element.TEMPLATE.SUNSTONE.TABLE_ORDER);
204
      }
205
    });
206

  
207
    context.off("change", "#table_order_select")
208
    context.on("change", "#table_order_select", function() {
209
      var sunstone_setting = {TABLE_ORDER : $(this).val()};
210
      Sunstone.runAction("User.append_sunstone_setting_refresh", that.element.ID, sunstone_setting);
211
    });
212

  
213
    // Change language
214
    context.off("click", "#div_edit_language")
215
    context.on("click", "#div_edit_language", function() {
216
      $(".value_td_language", context).html('<select id="language_select">' +
217
         Locale.language_options +
218
       '</select>');
219

  
220
      if (that.element.TEMPLATE.SUNSTONE && that.element.TEMPLATE.SUNSTONE.LANG) {
221
        $('#language_select', context).val(that.element.TEMPLATE.SUNSTONE.LANG);
222
      }
223
    });
224

  
225
    context.off("change", "#language_select")
226
    context.on("change", "#language_select", function() {
227
      var sunstone_setting = {LANG : $(this).val()};
228
      Sunstone.runAction("User.append_sunstone_setting_refresh", that.element.ID, sunstone_setting);
229
    });
230

  
231
    // Change view
232
    context.off("click", "#div_edit_view")
233
    context.on("click", "#div_edit_view", function() {
234
      var options = '';
235
      $.each( config['available_views'], function(id, view) {
236
        options += '<option value="'+view+'">'+view+'</option>';
237
      });
238

  
239
      $(".value_td_view", context).html('<select id="view_select">' +
240
         options +
241
       '</select>');
242

  
243
      if (that.element.TEMPLATE.SUNSTONE && that.element.TEMPLATE.SUNSTONE.DEFAULT_VIEW) {
244
        $('#view_select', context).val(that.element.TEMPLATE.SUNSTONE.DEFAULT_VIEW);
245
      }
246
    });
247

  
248
    context.off("change", "#view_select")
249
    context.on("change", "#view_select", function() {
250
      var sunstone_setting = {DEFAULT_VIEW : $(this).val()};
251
      Sunstone.runAction("User.append_sunstone_setting_refresh", that.element.ID, sunstone_setting);
252
    });
253

  
254
    return false;
255
  }
256 46
});
src/sunstone/public/app/tabs/users-tab/panels/info/html.hbs
86 86
                </button>
87 87
              </td>
88 88
              <td class="value_td">
89
                {{#isTabActionEnabled "users-tab" "User.update_password"}}
89
                {{#isTabActionEnabled tabId "User.update_password"}}
90 90
                <div>
91 91
                  <a id="update_password" class="edit_e" href="#"> <i class="fa fa-pencil-square-o right"/></a>
92 92
                </div>
93 93
                {{/isTabActionEnabled}}
94 94
              </td>
95 95
            </tr>
96
            {{#isTabActionEnabled "users-tab" "User.login_token"}}
96
            {{#isTabActionEnabled tabId "User.login_token"}}
97 97
            <tr class="login_token">
98 98
              <td class="key_td">{{tr "Login token"}}</td>
99 99
              <td class="value_td">
src/sunstone/public/app/tabs/users-tab/panels/quotas-common.js
1
/* -------------------------------------------------------------------------- */
2
/* Copyright 2002-2016, OpenNebula Project, OpenNebula Systems                */
3
/*                                                                            */
4
/* Licensed under the Apache License, Version 2.0 (the "License"); you may    */
5
/* not use this file except in compliance with the License. You may obtain    */
6
/* a copy of the License at                                                   */
7
/*                                                                            */
8
/* http://www.apache.org/licenses/LICENSE-2.0                                 */
9
/*                                                                            */
10
/* Unless required by applicable law or agreed to in writing, software        */
11
/* distributed under the License is distributed on an "AS IS" BASIS,          */
12
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   */
13
/* See the License for the specific language governing permissions and        */
14
/* limitations under the License.                                             */
15
/* -------------------------------------------------------------------------- */
16

  
17
define(function(require) {
18
  /*
19
    DEPENDENCIES
20
   */
21

  
22
  var Locale = require('utils/locale');
23
  var Config = require('sunstone-config');
24
  var QuotaDefaults = require('utils/quotas/quota-defaults');
25
  var QuotaWidgets = require('utils/quotas/quota-widgets');
26

  
27
  /*
28
    CONSTANTS
29
   */
30

  
31
  var RESOURCE = "User";
32
  var XML_ROOT = "USER";
33

  
34
  /*
35
    CONSTRUCTOR
36
   */
37

  
38
  function Panel(info, tabId) {
39
    this.title = Locale.tr("Quotas");
40
    this.icon = "fa-align-left";
41

  
42
    this.element = info[XML_ROOT];
43

  
44
    return this;
45
  }
46

  
47
  Panel.prototype.html = _html;
48
  Panel.prototype.setup = _setup;
49

  
50
  return Panel;
51

  
52
  /*
53
    FUNCTION DEFINITIONS
54
   */
55

  
56
  function _html() {
57
    return QuotaWidgets.initQuotasPanel(
58
      this.element,
59
      QuotaDefaults.getDefaultQuotas(RESOURCE),
60
      Config.isTabActionEnabled(this.tabId, RESOURCE+".quotas_dialog"));
61
  }
62

  
63
  function _setup(context) {
64
    QuotaWidgets.setupQuotasPanel(
65
      this.element,
66
      context,
67
      Config.isTabActionEnabled(this.tabId, RESOURCE+".quotas_dialog"),
68
      RESOURCE);
69

  
70
    return false;
71
  }
72
});
src/sunstone/public/app/tabs/users-tab/panels/quotas.js
19 19
    DEPENDENCIES
20 20
   */
21 21

  
22
  var Locale = require('utils/locale');
23
  var Config = require('sunstone-config');
24
  var QuotaDefaults = require('utils/quotas/quota-defaults');
25
  var QuotaWidgets = require('utils/quotas/quota-widgets');
22
  var BasePanel = require('tabs/users-tab/panels/quotas-common');
26 23

  
27 24
  /*
28 25
    CONSTANTS
......
30 27

  
31 28
  var TAB_ID = require('../tabId');
32 29
  var PANEL_ID = require('./quotas/panelId');
33
  var RESOURCE = "User";
34
  var XML_ROOT = "USER";
35 30

  
36 31
  /*
37 32
    CONSTRUCTOR
38 33
   */
39 34

  
40
  function Panel(info, tabId) {
41
    this.tabId = tabId || TAB_ID;
42
    this.title = Locale.tr("Quotas");
43
    this.icon = "fa-align-left";
35
  function Panel(info) {
36
    this.tabId = TAB_ID;
44 37

  
45
    this.element = info[XML_ROOT];
46

  
47
    return this;
48
  }
38
    return BasePanel.call(this, info);
39
  };
49 40

  
50 41
  Panel.PANEL_ID = PANEL_ID;
51
  Panel.prototype.html = _html;
52
  Panel.prototype.setup = _setup;
42
  Panel.prototype = Object.create(BasePanel.prototype);
43
  Panel.prototype.constructor = Panel;
53 44

  
54 45
  return Panel;
55

  
56
  /*
57
    FUNCTION DEFINITIONS
58
   */
59

  
60
  function _html() {
61
    return QuotaWidgets.initQuotasPanel(
62
      this.element,
63
      QuotaDefaults.getDefaultQuotas(RESOURCE),
64
      Config.isTabActionEnabled(this.tabId, RESOURCE+".quotas_dialog"));
65
  }
66

  
67
  function _setup(context) {
68
    QuotaWidgets.setupQuotasPanel(
69
      this.element,
70
      context,
71
      Config.isTabActionEnabled(this.tabId, RESOURCE+".quotas_dialog"),
72
      RESOURCE);
73

  
74
    return false;
75
  }
76 46
});
src/sunstone/public/app/tabs/users-tab/panels/showback-common.js
1
/* -------------------------------------------------------------------------- */
2
/* Copyright 2002-2016, OpenNebula Project, OpenNebula Systems                */
3
/*                                                                            */
4
/* Licensed under the Apache License, Version 2.0 (the "License"); you may    */
5
/* not use this file except in compliance with the License. You may obtain    */
6
/* a copy of the License at                                                   */
7
/*                                                                            */
8
/* http://www.apache.org/licenses/LICENSE-2.0                                 */
9
/*                                                                            */
10
/* Unless required by applicable law or agreed to in writing, software        */
11
/* distributed under the License is distributed on an "AS IS" BASIS,          */
12
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   */
13
/* See the License for the specific language governing permissions and        */
14
/* limitations under the License.                                             */
15
/* -------------------------------------------------------------------------- */
16

  
17
define(function(require) {
18
  /*
19
    DEPENDENCIES
20
   */
21

  
22
  var Locale = require('utils/locale');
23
  var Config = require('sunstone-config');
24
  var Showback = require('utils/showback');
25

  
26
  /*
27
    CONSTANTS
28
   */
29
  var RESOURCE = "User";
30
  var XML_ROOT = "USER";
31

  
32
  /*
33
    CONSTRUCTOR
34
   */
35

  
36
  function Panel(info) {
37
    this.title = Locale.tr("Showback");
38
    this.icon = "fa-money";
39

  
40
    this.element = info[XML_ROOT];
41

  
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff