
- Renames kimchi references to wok. - Rename kimchi_log to wok_log - It now uses wok.min.js for server JS API. Signed-off-by: Lucio Correia <luciojhc@linux.vnet.ibm.com> Signed-off-by: Gustavo Y. Ribeiro <gyr@linux.vnet.ibm.com> --- plugins/kimchi/disks.py | 8 +- plugins/kimchi/distroloader.py | 6 +- plugins/kimchi/imageinfo.py | 4 +- plugins/kimchi/isoinfo.py | 4 +- plugins/kimchi/mockmodel.py | 6 +- plugins/kimchi/model/config.py | 8 +- plugins/kimchi/model/cpuinfo.py | 6 +- plugins/kimchi/model/debugreports.py | 18 +- plugins/kimchi/model/diskutils.py | 6 +- plugins/kimchi/model/featuretests.py | 8 +- plugins/kimchi/model/host.py | 8 +- plugins/kimchi/model/hostdev.py | 8 +- plugins/kimchi/model/libvirtconnection.py | 8 +- plugins/kimchi/model/libvirtstoragepool.py | 4 +- plugins/kimchi/model/networks.py | 16 +- plugins/kimchi/model/peers.py | 14 +- plugins/kimchi/model/storagepools.py | 32 ++-- plugins/kimchi/model/storagetargets.py | 6 +- plugins/kimchi/model/storagevolumes.py | 6 +- plugins/kimchi/model/vmhostdevs.py | 6 +- plugins/kimchi/model/vms.py | 22 +- plugins/kimchi/model/vmstorages.py | 8 +- plugins/kimchi/scan.py | 4 +- plugins/kimchi/screenshot.py | 6 +- plugins/kimchi/swupdate.py | 8 +- plugins/kimchi/tests/utils.py | 6 +- plugins/kimchi/ui/js/src/kimchi.api.js | 234 ++++++++++---------- plugins/kimchi/ui/js/src/kimchi.grid.js | 2 +- plugins/kimchi/ui/js/src/kimchi.guest_add_main.js | 14 +- plugins/kimchi/ui/js/src/kimchi.guest_edit_main.js | 56 +++--- plugins/kimchi/ui/js/src/kimchi.guest_main.js | 36 ++-- .../kimchi/ui/js/src/kimchi.guest_media_main.js | 8 +- .../ui/js/src/kimchi.guest_storage_add.main.js | 10 +- plugins/kimchi/ui/js/src/kimchi.host.js | 76 ++++---- plugins/kimchi/ui/js/src/kimchi.line-chart.js | 4 +- plugins/kimchi/ui/js/src/kimchi.network.js | 36 ++-- plugins/kimchi/ui/js/src/kimchi.report_add_main.js | 10 +- .../kimchi/ui/js/src/kimchi.report_rename_main.js | 10 +- .../kimchi/ui/js/src/kimchi.repository_add_main.js | 6 +- .../ui/js/src/kimchi.repository_edit_main.js | 10 +- plugins/kimchi/ui/js/src/kimchi.storage_main.js | 66 +++--- .../ui/js/src/kimchi.storagepool_add_main.js | 26 +- .../js/src/kimchi.storagepool_add_volume_main.js | 18 +- .../kimchi/ui/js/src/kimchi.template_add_main.js | 38 ++-- .../kimchi/ui/js/src/kimchi.template_edit_main.js | 12 +- plugins/kimchi/ui/js/src/kimchi.template_main.js | 16 +- .../kimchi/ui/spice-html5/pages/spice_auto.html | 2 +- plugins/sample/API.json | 2 +- plugins/sample/__init__.py | 2 +- plugins/sample/sample.conf.in | 10 +- plugins/sample/ui/js/util.js | 4 +- .../sample/ui/pages/help/en_US/sample-tab1.html | 2 +- .../sample/ui/pages/help/en_US/sample-tab2.html | 2 +- src/nginx/wok.conf.in | 8 +- src/wok.conf.in | 14 +- src/wok/auth.py | 10 +- src/wok/config.py.in | 40 ++-- src/wok/control/base.py | 8 +- src/wok/exception.py | 22 +- src/wok/objectstore.py | 4 +- src/wok/proxy.py | 18 +- src/wok/server.py | 14 +- src/wok/template.py | 4 +- src/wok/utils.py | 22 +- src/wok/vnc.py | 6 +- src/wokd.in | 6 +- ui/js/src/wok.cookie.js | 2 +- ui/js/src/wok.lang.js | 6 +- ui/js/src/wok.login.js | 14 +- ui/js/src/wok.main.js | 84 ++++---- ui/js/src/wok.message.js | 20 +- ui/js/src/wok.popable.js | 4 +- ui/js/src/wok.substitute.js | 2 +- ui/js/src/wok.topic.js | 8 +- ui/js/src/wok.user.js | 6 +- ui/js/src/wok.utils.js | 18 +- ui/js/src/wok.window.js | 4 +- ui/js/widgets/button-dropDown.js | 2 +- ui/js/widgets/combobox.js | 2 +- ui/js/widgets/filter-select.js | 2 +- ui/js/widgets/select-menu.js | 2 +- ui/pages/error.html.tmpl | 4 +- ui/pages/login.html.tmpl | 4 +- ui/pages/websockify/console.html | 12 +- ui/pages/wok-ui.html.tmpl | 10 +- 85 files changed, 665 insertions(+), 665 deletions(-) diff --git a/plugins/kimchi/disks.py b/plugins/kimchi/disks.py index 59e52f9..88a69f4 100644 --- a/plugins/kimchi/disks.py +++ b/plugins/kimchi/disks.py @@ -25,7 +25,7 @@ from parted import Device as PDevice from parted import Disk as PDisk from wok.exception import OperationFailed -from wok.utils import kimchi_log +from wok.utils import wok_log def _get_dev_node_path(maj_min): @@ -82,7 +82,7 @@ def _is_dev_leaf(devNodePath): except OperationFailed as e: # lsblk is known to fail on multipath devices # Assume these devices contain children - kimchi_log.error( + wok_log.error( "Error getting device info for %s: %s", devNodePath, e) return False @@ -97,7 +97,7 @@ def _is_dev_extended_partition(devType, devNodePath): try: extended_part = PDisk(device).getExtendedPartition() except NotImplementedError as e: - kimchi_log.warning( + wok_log.warning( "Error getting extended partition info for dev %s type %s: %s", devNodePath, devType, e.message) # Treate disk with unsupported partiton table as if it does not @@ -180,7 +180,7 @@ def get_partition_details(name): try: dev = _get_lsblk_devs(keys, [dev_path])[0] except OperationFailed as e: - kimchi_log.error( + wok_log.error( "Error getting partition info for %s: %s", name, e) return {} diff --git a/plugins/kimchi/distroloader.py b/plugins/kimchi/distroloader.py index 8ad34d2..a593246 100644 --- a/plugins/kimchi/distroloader.py +++ b/plugins/kimchi/distroloader.py @@ -25,7 +25,7 @@ import os import config from wok.exception import NotFoundError, OperationFailed -from wok.utils import kimchi_log +from wok.utils import wok_log ARCHS = {'x86_64': ['x86_64', 'amd64', 'i686', 'x86', 'i386'], @@ -43,7 +43,7 @@ class DistroLoader(object): msg_args = {'filename': fname} if not os.path.isfile(fname): msg = "DistroLoader: failed to find distro file: %s" % fname - kimchi_log.error(msg) + wok_log.error(msg) raise NotFoundError("KCHDL0001E", msg_args) try: with open(fname) as f: @@ -51,7 +51,7 @@ class DistroLoader(object): return data except ValueError: msg = "DistroLoader: failed to parse distro file: %s" % fname - kimchi_log.error(msg) + wok_log.error(msg) raise OperationFailed("KCHDL0002E", msg_args) def get(self): diff --git a/plugins/kimchi/imageinfo.py b/plugins/kimchi/imageinfo.py index fbd1396..7d92f54 100644 --- a/plugins/kimchi/imageinfo.py +++ b/plugins/kimchi/imageinfo.py @@ -23,7 +23,7 @@ import sys import guestfs from wok.exception import ImageFormatError, InvalidParameter, TimeoutExpired -from wok.utils import run_command, kimchi_log +from wok.utils import run_command, wok_log def probe_img_info(path): @@ -32,7 +32,7 @@ def probe_img_info(path): try: out = run_command(cmd, 10)[0] except TimeoutExpired: - kimchi_log.warning("Cannot decide format of base img %s", path) + wok_log.warning("Cannot decide format of base img %s", path) return None info = json.loads(out) diff --git a/plugins/kimchi/isoinfo.py b/plugins/kimchi/isoinfo.py index de9c359..cec20b1 100644 --- a/plugins/kimchi/isoinfo.py +++ b/plugins/kimchi/isoinfo.py @@ -29,7 +29,7 @@ import urllib2 from wok.exception import IsoFormatError -from wok.utils import check_url_path, kimchi_log +from wok.utils import check_url_path, wok_log iso_dir = [ @@ -178,7 +178,7 @@ class IsoImage(object): return (distro, version) msg = "probe_iso: Unable to identify ISO %s with Volume ID: %s" - kimchi_log.debug(msg, self.path, self.volume_id) + wok_log.debug(msg, self.path, self.volume_id) return ('unknown', 'unknown') diff --git a/plugins/kimchi/mockmodel.py b/plugins/kimchi/mockmodel.py index 384ce9b..88eb033 100644 --- a/plugins/kimchi/mockmodel.py +++ b/plugins/kimchi/mockmodel.py @@ -43,7 +43,7 @@ from model.templates import LibvirtVMTemplate from model.users import PAMUsersModel from model.groups import PAMGroupsModel from wok.objectstore import ObjectStore -from wok.utils import add_task, get_next_clone_name, kimchi_log +from wok.utils import add_task, get_next_clone_name, wok_log from vmtemplate import VMTemplate from wok.xmlutils.utils import xml_item_update @@ -276,10 +276,10 @@ class MockModel(Model): conn.storagePoolDefineXML(ET.tostring(root), 0) def _mock_host_shutdown(self, *name): - kimchi_log.info("The host system will be shutted down") + wok_log.info("The host system will be shutted down") def _mock_host_reboot(self, *name): - kimchi_log.info("The host system will be rebooted") + wok_log.info("The host system will be rebooted") def _mock_storagevolumes_create(self, pool, params): vol_source = ['url', 'capacity'] diff --git a/plugins/kimchi/model/config.py b/plugins/kimchi/model/config.py index 6f593e3..d0799fe 100644 --- a/plugins/kimchi/model/config.py +++ b/plugins/kimchi/model/config.py @@ -33,7 +33,7 @@ from featuretests import FEATURETEST_VM_NAME from ..repositories import Repositories from ..screenshot import VMScreenshot from ..swupdate import SoftwareUpdate -from wok.utils import check_url_path, kimchi_log, run_command +from wok.utils import check_url_path, wok_log, run_command class ConfigModel(object): @@ -86,7 +86,7 @@ class CapabilitiesModel(object): FeatureTests.enable_libvirt_error_logging() def _set_capabilities(self): - kimchi_log.info("*** Running feature tests ***") + wok_log.info("*** Running feature tests ***") conn = self.conn.get() self.qemu_stream = FeatureTests.qemu_supports_iso_stream() self.nfs_target_probe = FeatureTests.libvirt_support_nfs_probe(conn) @@ -100,14 +100,14 @@ class CapabilitiesModel(object): if FeatureTests.libvirt_supports_iso_stream(conn, p): self.libvirt_stream_protocols.append(p) - kimchi_log.info("*** Feature tests completed ***") + wok_log.info("*** Feature tests completed ***") _set_capabilities.priority = 90 def _qemu_support_spice(self): qemu_path = find_qemu_binary(find_emulator=True) out, err, rc = run_command(['ldd', qemu_path]) if rc != 0: - kimchi_log.error('Failed to find qemu binary dependencies: %s', + wok_log.error('Failed to find qemu binary dependencies: %s', err) return False for line in out.split('\n'): diff --git a/plugins/kimchi/model/cpuinfo.py b/plugins/kimchi/model/cpuinfo.py index 54d6eaa..61d1ec6 100644 --- a/plugins/kimchi/model/cpuinfo.py +++ b/plugins/kimchi/model/cpuinfo.py @@ -22,7 +22,7 @@ import platform from xml.etree import ElementTree as ET from wok.exception import InvalidParameter, InvalidOperation -from wok.utils import kimchi_log, run_command +from wok.utils import wok_log, run_command ARCH = 'power' if platform.machine().startswith('ppc') else 'x86' @@ -59,11 +59,11 @@ class CPUInfoModel(object): connect = self.conn.get() libvirt_topology = get_topo_capabilities(connect) except Exception as e: - kimchi_log.info("Unable to get CPU topology capabilities: %s" + wok_log.info("Unable to get CPU topology capabilities: %s" % e.message) return if libvirt_topology is None: - kimchi_log.info("cpu_info topology not supported.") + wok_log.info("cpu_info topology not supported.") return if ARCH == 'power': diff --git a/plugins/kimchi/model/debugreports.py b/plugins/kimchi/model/debugreports.py index 6cc8819..ea5853d 100644 --- a/plugins/kimchi/model/debugreports.py +++ b/plugins/kimchi/model/debugreports.py @@ -26,10 +26,10 @@ import subprocess import time from .. import config -from wok.exception import InvalidParameter, KimchiException, NotFoundError +from wok.exception import InvalidParameter, WokException, NotFoundError from wok.exception import OperationFailed from tasks import TaskModel -from wok.utils import add_task, kimchi_log +from wok.utils import add_task, wok_log from wok.utils import run_command @@ -95,7 +95,7 @@ class DebugReportsModel(object): break # Some error in sosreport happened if reportFile is None: - kimchi_log.error('Debug report file not found. See sosreport ' + wok_log.error('Debug report file not found. See sosreport ' 'output for detail:\n%s', output) fname = (patterns[0] % name).split('/')[-1] raise OperationFailed('KCHDR0004E', {'name': fname}) @@ -107,19 +107,19 @@ class DebugReportsModel(object): # Moving report msg = 'Moving debug report file "%s" to "%s"' % (reportFile, target) - kimchi_log.info(msg) + wok_log.info(msg) shutil.move(reportFile, target) # Deleting md5 msg = 'Deleting report md5 file: "%s"' % (md5_report_file) - kimchi_log.info(msg) + wok_log.info(msg) with open(md5_report_file) as f: md5 = f.read().strip() - kimchi_log.info('Md5 file content: "%s"', md5) + wok_log.info('Md5 file content: "%s"', md5) os.remove(md5_report_file) cb('OK', True) return - except KimchiException as e: + except WokException as e: log_error(e) raise @@ -151,7 +151,7 @@ class DebugReportsModel(object): if retcode == 0: return helper_tool['fn'] except Exception, e: - kimchi_log.info('Exception running command: %s', e) + wok_log.info('Exception running command: %s', e) return None @@ -189,7 +189,7 @@ class DebugReportModel(object): raise InvalidParameter('KCHDR0008E', {'name': params['name']}) shutil.move(file_source, file_target) - kimchi_log.info('%s renamed to %s' % (file_source, file_target)) + wok_log.info('%s renamed to %s' % (file_source, file_target)) return params['name'] def delete(self, name): diff --git a/plugins/kimchi/model/diskutils.py b/plugins/kimchi/model/diskutils.py index 041a135..49bf17d 100644 --- a/plugins/kimchi/model/diskutils.py +++ b/plugins/kimchi/model/diskutils.py @@ -20,7 +20,7 @@ from wok.exception import OperationFailed, NotFoundError from vms import VMModel, VMsModel -from wok.utils import kimchi_log +from wok.utils import wok_log from ..xmlutils.disk import get_vm_disk_info, get_vm_disks """ @@ -35,7 +35,7 @@ def get_disk_used_by(objstore, conn, path): try: used_by = session.get('storagevolume', path)['used_by'] except (KeyError, NotFoundError): - kimchi_log.info('Volume %s not found in obj store.' % path) + wok_log.info('Volume %s not found in obj store.' % path) used_by = [] # try to find this volume in existing vm vms_list = VMsModel.get_vms(conn) @@ -54,7 +54,7 @@ def get_disk_used_by(objstore, conn, path): # used_by to be out of sync, data corruption could # occour if a disk is added to two guests # unknowingly. - kimchi_log.error('Unable to store storage volume id in' + wok_log.error('Unable to store storage volume id in' ' objectstore due error: %s', e.message) raise OperationFailed('KCHVOL0017E', diff --git a/plugins/kimchi/model/featuretests.py b/plugins/kimchi/model/featuretests.py index 16fd25e..eb41edb 100644 --- a/plugins/kimchi/model/featuretests.py +++ b/plugins/kimchi/model/featuretests.py @@ -26,7 +26,7 @@ import subprocess from lxml.builder import E from wok.rollbackcontext import RollbackContext -from wok.utils import kimchi_log, run_command, servermethod +from wok.utils import wok_log, run_command, servermethod FEATURETEST_VM_NAME = "FEATURETEST_VM" FEATURETEST_POOL_NAME = "FEATURETEST_POOL" @@ -132,7 +132,7 @@ class FeatureTests(object): dom.undefine() return True except libvirt.libvirtError, e: - kimchi_log.error(e.message) + wok_log.error(e.message) return False finally: FeatureTests.enable_libvirt_error_logging() @@ -147,7 +147,7 @@ class FeatureTests(object): FeatureTests.disable_libvirt_error_logging() conn.findStoragePoolSources('netfs', _get_xml(), 0) except libvirt.libvirtError as e: - kimchi_log.error(e.message) + wok_log.error(e.message) if e.get_error_code() == 38: # if libvirt cannot find showmount, # it returns 38--general system call failure @@ -213,7 +213,7 @@ class FeatureTests(object): def kernel_support_vfio(): out, err, rc = run_command(['modprobe', 'vfio-pci']) if rc != 0: - kimchi_log.warning("Unable to load Kernal module vfio-pci.") + wok_log.warning("Unable to load Kernal module vfio-pci.") return False return True diff --git a/plugins/kimchi/model/host.py b/plugins/kimchi/model/host.py index f1f0b83..2a78a88 100644 --- a/plugins/kimchi/model/host.py +++ b/plugins/kimchi/model/host.py @@ -37,7 +37,7 @@ from tasks import TaskModel from vms import DOM_STATE_MAP from ..repositories import Repositories from ..swupdate import SoftwareUpdate -from wok.utils import add_task, kimchi_log +from wok.utils import add_task, wok_log from wok.xmlutils.utils import xpath_get_text @@ -131,7 +131,7 @@ class HostModel(object): if pkgs == 0: raise OperationFailed('KCHPKGUPD0001E') - kimchi_log.debug('Host is going to be updated.') + wok_log.debug('Host is going to be updated.') taskid = add_task('/host/swupdate', swupdate.doUpdate, self.objstore, None) return self.task.lookup(taskid) @@ -142,7 +142,7 @@ class HostModel(object): if len(running_vms) > 0: raise OperationFailed("KCHHOST0001E") - kimchi_log.info('Host is going to shutdown.') + wok_log.info('Host is going to shutdown.') os.system('shutdown -h now') def reboot(self, args=None): @@ -151,7 +151,7 @@ class HostModel(object): if len(running_vms) > 0: raise OperationFailed("KCHHOST0002E") - kimchi_log.info('Host is going to reboot.') + wok_log.info('Host is going to reboot.') os.system('reboot') def _get_vms_list_by_state(self, state): diff --git a/plugins/kimchi/model/hostdev.py b/plugins/kimchi/model/hostdev.py index 34a8e1b..9ebc3c3 100644 --- a/plugins/kimchi/model/hostdev.py +++ b/plugins/kimchi/model/hostdev.py @@ -22,7 +22,7 @@ from pprint import pformat from pprint import pprint from libvirtconnection import LibvirtConnection -from wok.utils import kimchi_log +from wok.utils import wok_log from wok.xmlutils.utils import dictize @@ -42,7 +42,7 @@ def _get_dev_info_tree(dev_infos): try: parent = devs[dev_info['parent']] except KeyError: - kimchi_log.error('Parent %s of device %s does not exist.', + wok_log.error('Parent %s of device %s does not exist.', dev_info['parent'], dev_info['name']) continue @@ -97,7 +97,7 @@ def _get_same_iommugroup_devices(dev_infos, device_info): try: parent_info = dev_dict[parent] except KeyError: - kimchi_log.error("Parent %s of device %s does not exist", + wok_log.error("Parent %s of device %s does not exist", parent, dev_info['name']) break @@ -184,7 +184,7 @@ def get_dev_info(node_dev): if dev_type in ('net', 'pci', 'scsi_host', 'storage', 'usb_device'): return globals()['_get_%s_dev_info' % dev_type](info) - kimchi_log.error("Unknown device type: %s", dev_type) + wok_log.error("Unknown device type: %s", dev_type) return info diff --git a/plugins/kimchi/model/libvirtconnection.py b/plugins/kimchi/model/libvirtconnection.py index 4a4eee4..d2ce031 100644 --- a/plugins/kimchi/model/libvirtconnection.py +++ b/plugins/kimchi/model/libvirtconnection.py @@ -23,7 +23,7 @@ import time import cherrypy import libvirt -from wok.utils import kimchi_log +from wok.utils import wok_log class LibvirtConnection(object): @@ -75,7 +75,7 @@ class LibvirtConnection(object): libvirt.VIR_ERR_NO_CONNECT, libvirt.VIR_ERR_INVALID_CONN) if edom in EDOMAINS and ecode in ECODES: - kimchi_log.error('Connection to libvirt broken. ' + wok_log.error('Connection to libvirt broken. ' 'Recycling. ecode: %d edom: %d' % (ecode, edom)) with LibvirtConnection._connectionLock: @@ -95,9 +95,9 @@ class LibvirtConnection(object): conn = libvirt.open(self.uri) break except libvirt.libvirtError: - kimchi_log.error('Unable to connect to libvirt.') + wok_log.error('Unable to connect to libvirt.') if not retries: - kimchi_log.error("Unable to establish connection " + wok_log.error("Unable to establish connection " "with libvirt. Please check " "your libvirt URI which is often " "defined in " diff --git a/plugins/kimchi/model/libvirtstoragepool.py b/plugins/kimchi/model/libvirtstoragepool.py index b7a8291..6c1f031 100644 --- a/plugins/kimchi/model/libvirtstoragepool.py +++ b/plugins/kimchi/model/libvirtstoragepool.py @@ -27,7 +27,7 @@ import libvirt from wok.exception import InvalidParameter, OperationFailed, TimeoutExpired from ..iscsi import TargetClient from wok.rollbackcontext import RollbackContext -from wok.utils import kimchi_log, parse_cmd_output, run_command +from wok.utils import wok_log, parse_cmd_output, run_command class StoragePoolDef(object): @@ -165,7 +165,7 @@ class ScsiPoolDef(StoragePoolDef): msg = "Libvirt version <= 1.0.5. Setting SCSI host name as '%s'; "\ "setting SCSI adapter type as 'scsi_host'; "\ "ignoring wwnn and wwpn." % tmp_name - kimchi_log.info(msg) + wok_log.info(msg) # Path for Fibre Channel scsi hosts self.poolArgs['path'] = '/dev/disk/by-path' if not self.poolArgs['source']['adapter']['type']: diff --git a/plugins/kimchi/model/networks.py b/plugins/kimchi/model/networks.py index 7a3dfc8..594bfca 100644 --- a/plugins/kimchi/model/networks.py +++ b/plugins/kimchi/model/networks.py @@ -32,7 +32,7 @@ from wok.exception import InvalidOperation, InvalidParameter from wok.exception import MissingParameter, NotFoundError, OperationFailed from ..osinfo import defaults as tmpl_defaults from wok.rollbackcontext import RollbackContext -from wok.utils import kimchi_log, run_command +from wok.utils import wok_log, run_command from ..xmlutils.network import create_vlan_tagged_bridge_xml from ..xmlutils.network import to_network_xml from wok.xmlutils.utils import xpath_get_text @@ -59,9 +59,9 @@ class NetworksModel(object): net = conn.networkLookupByName(net_name) except libvirt.libvirtError, e: msg = "Fatal: Unable to find network %s." - kimchi_log.error(msg, net_name) - kimchi_log.error(error_msg) - kimchi_log.error("Details: %s", e.message) + wok_log.error(msg, net_name) + wok_log.error(error_msg) + wok_log.error("Details: %s", e.message) sys.exit(1) if net.isActive() == 0: @@ -69,9 +69,9 @@ class NetworksModel(object): net.create() except libvirt.libvirtError as e: msg = "Fatal: Unable to activate network %s." - kimchi_log.error(msg, net_name) - kimchi_log.error(error_msg) - kimchi_log.error("Details: %s", e.message) + wok_log.error(msg, net_name) + wok_log.error(error_msg) + wok_log.error("Details: %s", e.message) sys.exit(1) def create(self, params): @@ -211,7 +211,7 @@ class NetworksModel(object): try: bridges.append(net.bridgeName()) except libvirt.libvirtError, e: - kimchi_log.error(e.message) + wok_log.error(e.message) if br_name in bridges: raise InvalidOperation("KCHNET0010E", {'iface': br_name}) diff --git a/plugins/kimchi/model/peers.py b/plugins/kimchi/model/peers.py index ef70b1e..a9cf3b7 100644 --- a/plugins/kimchi/model/peers.py +++ b/plugins/kimchi/model/peers.py @@ -22,7 +22,7 @@ import re import socket from wok.config import config -from wok.utils import kimchi_log, run_command +from wok.utils import wok_log, run_command class PeersModel(object): @@ -37,19 +37,19 @@ class PeersModel(object): self.url = hostname + ":" + port cmd = ["slptool", "register", - "service:kimchid://%s" % self.url] + "service:wokd://%s" % self.url] out, error, ret = run_command(cmd) if out and len(out) != 0: - kimchi_log.error("Unable to register server on openSLP." + wok_log.error("Unable to register server on openSLP." " Details: %s" % out) cherrypy.engine.subscribe('exit', self._peer_deregister) def _peer_deregister(self): cmd = ["slptool", "deregister", - "service:kimchid://%s" % self.url] + "service:wokd://%s" % self.url] out, error, ret = run_command(cmd) if out and len(out) != 0: - kimchi_log.error("Unable to deregister server on openSLP." + wok_log.error("Unable to deregister server on openSLP." " Details: %s" % out) def get_list(self): @@ -57,14 +57,14 @@ class PeersModel(object): if config.get("server", "federation") == "off": return [] - cmd = ["slptool", "findsrvs", "service:kimchid"] + cmd = ["slptool", "findsrvs", "service:wokd"] out, error, ret = run_command(cmd) if ret != 0: return [] peers = [] for server in out.strip().split("\n"): - match = re.match("service:kimchid://(.*?),.*", server) + match = re.match("service:wokd://(.*?),.*", server) peer = match.group(1) if peer != self.url: peers.append("https://" + peer) diff --git a/plugins/kimchi/model/storagepools.py b/plugins/kimchi/model/storagepools.py index 6d9c8cf..2514ce4 100644 --- a/plugins/kimchi/model/storagepools.py +++ b/plugins/kimchi/model/storagepools.py @@ -31,7 +31,7 @@ from config import CapabilitiesModel from host import DeviceModel from libvirtstoragepool import StoragePoolDef from ..osinfo import defaults as tmpl_defaults -from wok.utils import add_task, kimchi_log, run_command +from wok.utils import add_task, wok_log, run_command from ..utils import pool_name_from_uri from wok.xmlutils.utils import xpath_get_text @@ -92,8 +92,8 @@ class StoragePoolsModel(object): pool_path = pools[pool_name].get('path') if pool_path is None: msg = "Fatal: Unable to find storage pool %s. " + error_msg - kimchi_log.error(msg % pool_name) - kimchi_log.error("Details: %s", e.message) + wok_log.error(msg % pool_name) + wok_log.error("Details: %s", e.message) sys.exit(1) # Try to create the pool @@ -108,8 +108,8 @@ class StoragePoolsModel(object): except libvirt.libvirtError, e: msg = "Fatal: Unable to create storage pool %s. " msg += error_msg - kimchi_log.error(msg % pool_name) - kimchi_log.error("Details: %s", e.message) + wok_log.error(msg % pool_name) + wok_log.error("Details: %s", e.message) sys.exit(1) if pool.isActive() == 0: @@ -118,8 +118,8 @@ class StoragePoolsModel(object): except libvirt.libvirtError, e: msg = "Fatal: Unable to craete storage pool %s. " msg += error_msg - kimchi_log.error(msg % pool_name) - kimchi_log.error("Details: %s", e.message) + wok_log.error(msg % pool_name) + wok_log.error("Details: %s", e.message) sys.exit(1) def get_list(self): @@ -192,14 +192,14 @@ class StoragePoolsModel(object): # disable autostart for others pool.setAutostart(0) except libvirt.libvirtError as e: - kimchi_log.error("Problem creating Storage Pool: %s", e) + wok_log.error("Problem creating Storage Pool: %s", e) raise OperationFailed("KCHPOOL0007E", {'name': name, 'err': e.get_error_message()}) if params['type'] == 'netfs': output, error, returncode = run_command(['setsebool', '-P', 'virt_use_nfs=1']) if error or returncode: - kimchi_log.error("Unable to set virt_use_nfs=1. If you use " + wok_log.error("Unable to set virt_use_nfs=1. If you use " "SELinux, this may prevent NFS pools from " "being used.") return name @@ -213,7 +213,7 @@ class StoragePoolsModel(object): session.delete('scanning', pool_name) except Exception, e: err = "Exception %s occured when cleaning scan result" - kimchi_log.debug(err % e.message) + wok_log.debug(err % e.message) def _do_deep_scan(self, params): scan_params = dict(ignore_list=[]) @@ -228,7 +228,7 @@ class StoragePoolsModel(object): scan_params['ignore_list'].append(res['path']) except Exception, e: err = "Exception %s occured when get ignore path" - kimchi_log.debug(err % e.message) + wok_log.debug(err % e.message) params['path'] = self.scanner.scan_dir_prepare(params['name']) scan_params['pool_path'] = params['path'] @@ -270,9 +270,9 @@ class StoragePoolModel(object): # If something (say a busy pool) prevents the refresh, # throwing an Exception here would prevent all pools from # displaying information -- so return None for busy - kimchi_log.error("ERROR: Storage Pool get vol count: %s " + wok_log.error("ERROR: Storage Pool get vol count: %s " % e.get_error_message()) - kimchi_log.error("ERROR: Storage Pool get vol count error no: %s " + wok_log.error("ERROR: Storage Pool get vol count error no: %s " % e.get_error_code()) return 0 except Exception as e: @@ -325,7 +325,7 @@ class StoragePoolModel(object): # FIXME: nfs workaround - prevent any libvirt operation # for a nfs if the corresponding NFS server is down. if pool_type == 'netfs' and not self._nfs_status_online(pool): - kimchi_log.debug("NFS pool %s is offline, reason: NFS " + wok_log.debug("NFS pool %s is offline, reason: NFS " "server %s is unreachable.", name, source['addr']) # Mark state as '4' => inaccessible. @@ -364,7 +364,7 @@ class StoragePoolModel(object): lsblk_cmd = ['lsblk', disk] output, error, returncode = run_command(lsblk_cmd) if returncode != 0: - kimchi_log.error('%s is not a valid disk/partition. Could not ' + wok_log.error('%s is not a valid disk/partition. Could not ' 'add it to the pool %s.', disk, pool_name) raise OperationFailed('KCHPOOL0027E', {'disk': disk, 'pool': pool_name}) @@ -374,7 +374,7 @@ class StoragePoolModel(object): output, error, returncode = run_command(vgextend_cmd) if returncode != 0: msg = "Could not add disks to pool %s, error: %s" - kimchi_log.error(msg, pool_name, error) + wok_log.error(msg, pool_name, error) raise OperationFailed('KCHPOOL0028E', {'pool': pool_name, 'err': error}) # refreshing pool state diff --git a/plugins/kimchi/model/storagetargets.py b/plugins/kimchi/model/storagetargets.py index dd88fec..bbcfb0d 100644 --- a/plugins/kimchi/model/storagetargets.py +++ b/plugins/kimchi/model/storagetargets.py @@ -24,7 +24,7 @@ from lxml.builder import E from config import CapabilitiesModel from storageservers import STORAGE_SERVERS -from wok.utils import kimchi_log, patch_find_nfs_target +from wok.utils import wok_log, patch_find_nfs_target class StorageTargetsModel(object): @@ -51,7 +51,7 @@ class StorageTargetsModel(object): ret = conn.findStoragePoolSources(target_type, xml, 0) except libvirt.libvirtError as e: err = "Query storage pool source fails because of %s" - kimchi_log.warning(err, e.get_error_message()) + wok_log.warning(err, e.get_error_message()) continue targets = self._parse_target_source_result(target_type, ret) @@ -78,7 +78,7 @@ class StorageTargetsModel(object): except libvirt.libvirtError as e: err = "Query storage pool source fails because of %s" - kimchi_log.warning(err, e.get_error_message()) + wok_log.warning(err, e.get_error_message()) # Filter target_list to not not show the used paths target_list = [elem for elem in target_list diff --git a/plugins/kimchi/model/storagevolumes.py b/plugins/kimchi/model/storagevolumes.py index 92e1c7c..908fbc4 100644 --- a/plugins/kimchi/model/storagevolumes.py +++ b/plugins/kimchi/model/storagevolumes.py @@ -36,7 +36,7 @@ from diskutils import get_disk_used_by, set_disk_used_by from storagepools import StoragePoolModel from tasks import TaskModel from wok.utils import add_task, get_next_clone_name, get_unique_file_name -from wok.utils import kimchi_log +from wok.utils import wok_log from wok.xmlutils.utils import xpath_get_text @@ -233,7 +233,7 @@ class StorageVolumesModel(object): if virt_vol: virt_vol.delete(0) except libvirt.libvirtError, virt_e: - kimchi_log.error(virt_e.message) + wok_log.error(virt_e.message) finally: raise OperationFailed('KCHVOL0007E', {'name': name, 'pool': pool_name, @@ -528,7 +528,7 @@ class IsoVolumesModel(object): volumes = pool.listVolumes() except Exception, e: # Skip inactive pools - kimchi_log.debug("Shallow scan: skipping pool %s because of " + wok_log.debug("Shallow scan: skipping pool %s because of " "error: %s", (pool_name, e.message)) continue diff --git a/plugins/kimchi/model/vmhostdevs.py b/plugins/kimchi/model/vmhostdevs.py index f8c87dd..18f4e1f 100644 --- a/plugins/kimchi/model/vmhostdevs.py +++ b/plugins/kimchi/model/vmhostdevs.py @@ -31,7 +31,7 @@ from host import DeviceModel, DevicesModel from utils import get_vm_config_flag from vms import DOM_STATE_MAP, VMModel from wok.rollbackcontext import RollbackContext -from wok.utils import kimchi_log, run_command +from wok.utils import wok_log, run_command import platform @@ -169,7 +169,7 @@ class VMHostDevsModel(object): out, err, rc = run_command(['setsebool', '-P', 'virt_use_sysfs=on']) if rc != 0: - kimchi_log.warning("Unable to turn on sebool virt_use_sysfs") + wok_log.warning("Unable to turn on sebool virt_use_sysfs") def _attach_pci_device(self, vmid, dev_info): self._validate_pci_passthrough_env() @@ -205,7 +205,7 @@ class VMHostDevsModel(object): try: dom.attachDeviceFlags(xmlstr, device_flags) except libvirt.libvirtError: - kimchi_log.error( + wok_log.error( 'Failed to attach host device %s to VM %s: \n%s', pci_info['name'], vmid, xmlstr) raise diff --git a/plugins/kimchi/model/vms.py b/plugins/kimchi/model/vms.py index a874ca1..2e9721d 100644 --- a/plugins/kimchi/model/vms.py +++ b/plugins/kimchi/model/vms.py @@ -45,7 +45,7 @@ from utils import set_metadata_node from wok.rollbackcontext import RollbackContext from ..screenshot import VMScreenshot from wok.utils import add_task, convert_data_size, get_next_clone_name -from wok.utils import import_class, kimchi_log, run_setfacl_set_attr +from wok.utils import import_class, wok_log, run_setfacl_set_attr from ..utils import template_name_from_uri from ..xmlutils.cpu import get_cpu_xml, get_numa_xml from wok.xmlutils.utils import xpath_get_text, xml_item_update @@ -134,7 +134,7 @@ class VMsModel(object): except Exception as e: # It is possible to continue Kimchi executions without store # vm icon info - kimchi_log.error('Error trying to update database with guest ' + wok_log.error('Error trying to update database with guest ' 'icon information due error: %s', e.message) # If storagepool is SCSI, volumes will be LUNs and must be passed by @@ -396,7 +396,7 @@ class VMModel(object): # a new volume with the same size, the pool 'default' should # be used if orig_vol['capacity'] > orig_pool['available']: - kimchi_log.warning('storage pool \'%s\' doesn\'t have ' + wok_log.warning('storage pool \'%s\' doesn\'t have ' 'enough free space to store image ' '\'%s\'; falling back to \'default\'', orig_pool_name, path) @@ -412,7 +412,7 @@ class VMModel(object): elif orig_pool['type'] in ['scsi', 'iscsi']: # SCSI and iSCSI always fall back to the storage pool 'default' - kimchi_log.warning('cannot create new volume for clone in ' + wok_log.warning('cannot create new volume for clone in ' 'storage pool \'%s\'; falling back to ' '\'default\'', orig_pool_name) new_pool_name = u'default' @@ -866,7 +866,7 @@ class VMModel(object): except Exception as e: # VM might be deleted just after we get the list. # This is OK, just skip. - kimchi_log.debug('Error processing VM stats: %s', e.message) + wok_log.debug('Error processing VM stats: %s', e.message) def _get_percentage_cpu_usage(self, vm_uuid, info, seconds): prevCpuTime = self.stats[vm_uuid].get('cputime', 0) @@ -1042,7 +1042,7 @@ class VMModel(object): try: snapshot_names = self.vmsnapshots.get_list(name) except OperationFailed, e: - kimchi_log.error('cannot list snapshots: %s; ' + wok_log.error('cannot list snapshots: %s; ' 'skipping snapshot deleting...' % e.message) else: for s in snapshot_names: @@ -1067,7 +1067,7 @@ class VMModel(object): session.delete('storagevolume', path, ignore_missing=True) except libvirt.libvirtError as e: - kimchi_log.error('Unable to get storage volume by path: %s' % + wok_log.error('Unable to get storage volume by path: %s' % e.message) except Exception as e: raise OperationFailed('KCHVOL0017E', {'err': e.message}) @@ -1087,7 +1087,7 @@ class VMModel(object): session.delete('vm', dom.UUIDString(), ignore_missing=True) except Exception as e: # It is possible to delete vm without delete its database info - kimchi_log.error('Error deleting vm information from database: ' + wok_log.error('Error deleting vm information from database: ' '%s', e.message) vnc.remove_proxy_token(name) @@ -1183,7 +1183,7 @@ class VMModel(object): except Exception as e: # It is possible to continue Kimchi executions without delete # screenshots - kimchi_log.error('Error trying to delete vm screenshot from ' + wok_log.error('Error trying to delete vm screenshot from ' 'database due error: %s', e.message) def suspend(self, name): @@ -1249,7 +1249,7 @@ class VMScreenshotModel(object): except Exception as e: # It is possible to continue Kimchi executions without store # screenshots - kimchi_log.error('Error trying to update database with guest ' + wok_log.error('Error trying to update database with guest ' 'screenshot information due error: %s', e.message) return img_path @@ -1267,7 +1267,7 @@ class VMScreenshotModel(object): # exception from '__exit__' when calling 'session.store' # It is possible to continue Kimchi vm executions without # screenshots - kimchi_log.error('Error trying to update database with guest ' + wok_log.error('Error trying to update database with guest ' 'screenshot information due error: %s', e.message) return LibvirtVMScreenshot(params, conn) diff --git a/plugins/kimchi/model/vmstorages.py b/plugins/kimchi/model/vmstorages.py index 29f8f30..f7cef52 100644 --- a/plugins/kimchi/model/vmstorages.py +++ b/plugins/kimchi/model/vmstorages.py @@ -29,7 +29,7 @@ from storagevolumes import StorageVolumeModel from utils import get_vm_config_flag from ..osinfo import lookup from diskutils import get_disk_used_by, set_disk_used_by -from wok.utils import kimchi_log +from wok.utils import wok_log from ..xmlutils.disk import get_device_node, get_disk_xml from ..xmlutils.disk import get_vm_disk_info, get_vm_disks @@ -191,7 +191,7 @@ class VMStorageModel(object): if path is not None: used_by = get_disk_used_by(self.objstore, self.conn, path) else: - kimchi_log.error("Unable to decrement volume used_by on" + wok_log.error("Unable to decrement volume used_by on" " delete because no path could be found.") dom.detachDeviceFlags(etree.tostring(disk), get_vm_config_flag(dom, 'all')) @@ -202,7 +202,7 @@ class VMStorageModel(object): used_by.remove(vm_name) set_disk_used_by(self.objstore, path, used_by) else: - kimchi_log.error("Unable to update %s:%s used_by on delete." + wok_log.error("Unable to update %s:%s used_by on delete." % (vm_name, dev_name)) def update(self, vm_name, dev_name, params): @@ -246,6 +246,6 @@ class VMStorageModel(object): set_disk_used_by(self.objstore, new_disk_path, new_disk_used_by) except Exception as e: - kimchi_log.error("Unable to update dev used_by on update due to" + wok_log.error("Unable to update dev used_by on update due to" " %s:" % e.message) return dev diff --git a/plugins/kimchi/scan.py b/plugins/kimchi/scan.py index 8e42fbc..663b838 100644 --- a/plugins/kimchi/scan.py +++ b/plugins/kimchi/scan.py @@ -27,7 +27,7 @@ import time from isoinfo import IsoImage, probe_iso -from wok.utils import kimchi_log +from wok.utils import wok_log SCAN_IGNORE = ['/tmp/kimchi-scan-*'] @@ -58,7 +58,7 @@ class Scanner(object): self.clean_cb(transient_pool) except OSError as e: msg = "Exception %s occured when cleaning stale pool, ignore" - kimchi_log.debug(msg % e.message) + wok_log.debug(msg % e.message) def scan_dir_prepare(self, name): # clean stale scan storage pools diff --git a/plugins/kimchi/screenshot.py b/plugins/kimchi/screenshot.py index 765e1a6..05701dd 100644 --- a/plugins/kimchi/screenshot.py +++ b/plugins/kimchi/screenshot.py @@ -33,7 +33,7 @@ except ImportError: import config -from wok.utils import kimchi_log +from wok.utils import wok_log (fd, pipe) = tempfile.mkstemp() @@ -164,7 +164,7 @@ class VMScreenshot(object): try: self._generate_scratch(thumbnail) except: - kimchi_log.error("screenshot_creation: Unable to create " + wok_log.error("screenshot_creation: Unable to create " "screenshot image %s." % thumbnail) else: self._create_black_image(thumbnail) @@ -178,7 +178,7 @@ class VMScreenshot(object): # work around pic truncate validation in thumbnail generation im.thumbnail(self.THUMBNAIL_SIZE) except Exception as e: - kimchi_log.warning("Image load with warning: %s." % e) + wok_log.warning("Image load with warning: %s." % e) im.save(thumbnail, "PNG") self.info['thumbnail'] = thumbnail diff --git a/plugins/kimchi/swupdate.py b/plugins/kimchi/swupdate.py index 592fb84..cd56707 100644 --- a/plugins/kimchi/swupdate.py +++ b/plugins/kimchi/swupdate.py @@ -23,7 +23,7 @@ import time from wok.basemodel import Singleton from config import kimchiLock from wok.exception import NotFoundError, OperationFailed -from wok.utils import kimchi_log, run_command +from wok.utils import wok_log, run_command from yumparser import get_yum_packages_list_update @@ -49,18 +49,18 @@ class SoftwareUpdate(object): # correct package management system try: __import__('yum') - kimchi_log.info("Loading YumUpdate features.") + wok_log.info("Loading YumUpdate features.") self._pkg_mnger = YumUpdate() except ImportError: try: __import__('apt') - kimchi_log.info("Loading AptUpdate features.") + wok_log.info("Loading AptUpdate features.") self._pkg_mnger = AptUpdate() except ImportError: zypper_help = ["zypper", "--help"] (stdout, stderr, returncode) = run_command(zypper_help) if returncode == 0: - kimchi_log.info("Loading ZypperUpdate features.") + wok_log.info("Loading ZypperUpdate features.") self._pkg_mnger = ZypperUpdate() else: raise Exception("There is no compatible package manager " diff --git a/plugins/kimchi/tests/utils.py b/plugins/kimchi/tests/utils.py index 6144dc7..e22bffa 100644 --- a/plugins/kimchi/tests/utils.py +++ b/plugins/kimchi/tests/utils.py @@ -41,7 +41,7 @@ import wok.server from wok.config import config, paths from wok.auth import User, USER_NAME, USER_GROUPS, USER_ROLES, tabs from wok.exception import NotFoundError, OperationFailed -from wok.utils import kimchi_log +from wok.utils import wok_log _ports = {} @@ -227,12 +227,12 @@ def wait_task(task_lookup, taskid, timeout=10): for i in range(0, timeout): task_info = task_lookup(taskid) if task_info['status'] == "running": - kimchi_log.info("Waiting task %s, message: %s", + wok_log.info("Waiting task %s, message: %s", taskid, task_info['message']) time.sleep(1) else: return - kimchi_log.error("Timeout while process long-run task, " + wok_log.error("Timeout while process long-run task, " "try to increase timeout value.") diff --git a/plugins/kimchi/ui/js/src/kimchi.api.js b/plugins/kimchi/ui/js/src/kimchi.api.js index a7c3b2d..81e44fd 100644 --- a/plugins/kimchi/ui/js/src/kimchi.api.js +++ b/plugins/kimchi/ui/js/src/kimchi.api.js @@ -53,7 +53,7 @@ var kimchi = { */ getCapabilities : function(suc, err, done) { done = typeof done !== 'undefined' ? done: function(){}; - kimchi.requestJSON({ + wok.requestJSON({ url : "config/capabilities", type : "GET", contentType : "application/json", @@ -68,7 +68,7 @@ var kimchi = { * Get the i18 strings. */ getI18n: function(suc, err, url, sync) { - kimchi.requestJSON({ + wok.requestJSON({ url : url ? url : 'i18n.json', type : 'GET', resend: true, @@ -83,7 +83,7 @@ var kimchi = { * Get the host static information. */ getHost: function(suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'host', type : 'GET', resend: true, @@ -98,11 +98,11 @@ var kimchi = { * Get the dynamic host stats (usually used for monitoring). */ getHostStats : function(suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'host/stats', type : 'GET', contentType : 'application/json', - headers: {'Kimchi-Robot': 'kimchi-robot'}, + headers: {'Wok-Robot': 'wok-robot'}, dataType : 'json', success : suc, error: err @@ -113,12 +113,12 @@ var kimchi = { * Get the historic host stats. */ getHostStatsHistory : function(suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'host/stats/history', type : 'GET', resend: true, contentType : 'application/json', - headers: {'Kimchi-Robot': 'kimchi-robot'}, + headers: {'Wok-Robot': 'wok-robot'}, dataType : 'json', success : suc, error: err @@ -137,7 +137,7 @@ var kimchi = { * suc: callback if succeed err: callback if failed */ createVM : function(settings, suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : "vms", type : "POST", contentType : "application/json", @@ -153,7 +153,7 @@ var kimchi = { * if failed */ createTemplate : function(settings, suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : "templates", type : "POST", contentType : "application/json", @@ -165,7 +165,7 @@ var kimchi = { }, deleteTemplate : function(tem, suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'templates/' + encodeURIComponent(tem), type : 'DELETE', contentType : 'application/json', @@ -176,7 +176,7 @@ var kimchi = { }, cloneTemplate : function(tem, suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'templates/' + encodeURIComponent(tem) + "/clone", type : 'POST', contentType : 'application/json', @@ -187,7 +187,7 @@ var kimchi = { }, listTemplates : function(suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'templates', type : 'GET', contentType : 'application/json', @@ -201,7 +201,7 @@ var kimchi = { * Retrieve the information of a template by the given name. */ retrieveTemplate : function(templateName, suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : "templates/" + encodeURIComponent(templateName), type : 'GET', contentType : 'application/json', @@ -231,7 +231,7 @@ var kimchi = { * The unit is MBytes suc: callback if succeed err: callback if failed */ createStoragePool : function(settings, suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'storagepools', type : 'POST', contentType : 'application/json', @@ -248,12 +248,12 @@ var kimchi = { dataType : 'json', data : JSON.stringify(content) }).done(suc).fail(err ? err : function(data) { - kimchi.message.error(data.responseJSON.reason); + wok.message.error(data.responseJSON.reason); }); }, startVM : function(vm, suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'vms/' + encodeURIComponent(vm) + '/start', type : 'POST', contentType : 'application/json', @@ -264,7 +264,7 @@ var kimchi = { }, poweroffVM : function(vm, suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'vms/' + encodeURIComponent(vm) + '/poweroff', type : 'POST', contentType : 'application/json', @@ -275,7 +275,7 @@ var kimchi = { }, shutdownVM : function(vm, suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'vms/' + encodeURIComponent(vm) + '/shutdown', type : 'POST', contentType : 'application/json', @@ -286,7 +286,7 @@ var kimchi = { }, resetVM : function(vm, suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'vms/' + encodeURIComponent(vm) + '/reset', type : 'POST', contentType : 'application/json', @@ -297,7 +297,7 @@ var kimchi = { }, suspendVM : function(vm, suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'vms/' + encodeURIComponent(vm) + '/suspend', type : 'POST', contentType : 'application/json', @@ -308,7 +308,7 @@ var kimchi = { }, resumeVM : function(vm, suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'vms/' + encodeURIComponent(vm) + '/resume', type : 'POST', contentType : 'application/json', @@ -352,7 +352,7 @@ var kimchi = { }, deleteVM : function(vm, suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'vms/' + encodeURIComponent(vm), type : 'DELETE', contentType : 'application/json', @@ -363,13 +363,13 @@ var kimchi = { }, vncToVM : function(vm) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'config', type : 'GET', dataType : 'json' }).done(function(data, textStatus, xhr) { proxy_port = data['display_proxy_port']; - kimchi.requestJSON({ + wok.requestJSON({ url : "vms/" + encodeURIComponent(vm) + "/connect", type : "POST", dataType : "json" @@ -384,24 +384,24 @@ var kimchi = { * contain = which is not safe in a URL query component. * So remove it when needed as base64 can work well without it. * */ - url += "&path=?token=" + kimchi.urlSafeB64Encode(vm).replace(/=*$/g, ""); - url += "&kimchi=" + location.port; + url += "&path=?token=" + wok.urlSafeB64Encode(vm).replace(/=*$/g, ""); + url += "&wok=" + location.port; url += '&encrypt=1'; window.open(url); }); }).error(function() { - kimchi.message.error.code('KCHAPI6002E'); + wok.message.error.code('KCHAPI6002E'); }); }, spiceToVM : function(vm) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'config', type : 'GET', dataType : 'json' }).done(function(data, textStatus, xhr) { proxy_port = data['display_proxy_port']; - kimchi.requestJSON({ + wok.requestJSON({ url : "vms/" + encodeURIComponent(vm) + "/connect", type : "POST", dataType : "json" @@ -416,22 +416,22 @@ var kimchi = { * contain = which is not safe in a URL query component. * So remove it when needed as base64 can work well without it. * */ - url += "&token=" + kimchi.urlSafeB64Encode(vm).replace(/=*$/g, ""); - url += "&kimchi=" + location.port; + url += "&token=" + wok.urlSafeB64Encode(vm).replace(/=*$/g, ""); + url += "&wok=" + location.port; url += '&encrypt=1'; window.open(url); }); }).error(function() { - kimchi.message.error.code('KCHAPI6002E'); + wok.message.error.code('KCHAPI6002E'); }); }, listVMs : function(suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'vms', type : 'GET', contentType : 'application/json', - headers: {'Kimchi-Robot': 'kimchi-robot'}, + headers: {'Wok-Robot': 'wok-robot'}, dataType : 'json', resend: true, success : suc, @@ -440,7 +440,7 @@ var kimchi = { }, listTemplates : function(suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'templates', type : 'GET', contentType : 'application/json', @@ -452,7 +452,7 @@ var kimchi = { }, listStoragePools : function(suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'storagepools', type : 'GET', contentType : 'application/json', @@ -475,7 +475,7 @@ var kimchi = { }, listIsos : function(suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'storagepools/kimchi_isos/storagevolumes', type : 'GET', contentType : 'application/json', @@ -486,7 +486,7 @@ var kimchi = { }, listDistros : function(suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'config/distros', type : 'GET', contentType : 'application/json', @@ -548,7 +548,7 @@ var kimchi = { }, getTask : function(taskId, suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'tasks/' + encodeURIComponent(taskId), type : 'GET', contentType : 'application/json', @@ -559,7 +559,7 @@ var kimchi = { }, getTasksByFilter : function(filter, suc, err, sync) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'tasks?' + filter, type : 'GET', contentType : 'application/json', @@ -626,7 +626,7 @@ var kimchi = { }, listNetworks : function(suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'networks', type : 'GET', contentType : 'application/json', @@ -634,27 +634,27 @@ var kimchi = { resend : true, success : suc, error : err ? err : function(data) { - kimchi.message.error(data.responseJSON.reason); + wok.message.error(data.responseJSON.reason); } }); }, toggleNetwork : function(name, on, suc, err) { var action = on ? "activate" : "deactivate"; - kimchi.requestJSON({ + wok.requestJSON({ url : 'networks/' + encodeURIComponent(name) + '/' + action, type : 'POST', contentType : 'application/json', dataType : 'json', success : suc, error : err ? err : function(data) { - kimchi.message.error(data.responseJSON.reason); + wok.message.error(data.responseJSON.reason); } }); }, createNetwork : function(network, suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'networks', type : 'POST', contentType : 'application/json', @@ -662,13 +662,13 @@ var kimchi = { data : JSON.stringify(network), success : suc, error : err ? err : function(data) { - kimchi.message.error(data.responseJSON.reason); + wok.message.error(data.responseJSON.reason); } }); }, getInterfaces : function(suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'interfaces', type : 'GET', contentType : 'application/json', @@ -676,26 +676,26 @@ var kimchi = { resend : true, success : suc, error : err ? err : function(data) { - kimchi.message.error(data.responseJSON.reason); + wok.message.error(data.responseJSON.reason); } }); }, deleteNetwork : function(name, suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'networks/' + encodeURIComponent(name), type : 'DELETE', contentType : 'application/json', dataType : 'json', success : suc, error : err ? err : function(data) { - kimchi.message.error(data.responseJSON.reason); + wok.message.error(data.responseJSON.reason); } }); }, listReports : function(suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'debugreports', type : 'GET', contentType : 'application/json', @@ -738,7 +738,7 @@ var kimchi = { kimchi.trackTask(taskID, suc, err, progress); }; - kimchi.requestJSON({ + wok.requestJSON({ url : 'debugreports', type : "POST", contentType : "application/json", @@ -763,7 +763,7 @@ var kimchi = { deleteReport: function(settings, suc, err) { var reportName = encodeURIComponent(settings['name']); - kimchi.requestJSON({ + wok.requestJSON({ url : 'debugreports/' + reportName, type : 'DELETE', contentType : 'application/json', @@ -780,7 +780,7 @@ var kimchi = { shutdown: function(settings, suc, err) { var reboot = settings && settings['reboot'] === true; var url = 'host/' + (reboot ? 'reboot' : 'shutdown'); - kimchi.requestJSON({ + wok.requestJSON({ url : url, type : 'POST', contentType : 'application/json', @@ -791,7 +791,7 @@ var kimchi = { }, listHostPartitions : function(suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'host/partitions', type : 'GET', contentType : 'application/json', @@ -803,21 +803,21 @@ var kimchi = { getStorageServers: function(type, suc, err) { var url = 'storageservers?_target_type=' + type; - kimchi.requestJSON({ + wok.requestJSON({ url : url, type : 'GET', contentType : 'application/json', dataType : 'json', success : suc, error : err ? err : function(data) { - kimchi.message.error(data.responseJSON.reason); + wok.message.error(data.responseJSON.reason); } }); }, getStorageTargets: function(server,type, suc, err) { var url = 'storageservers/' + server + '/storagetargets?_target_type=' + type; - kimchi.requestJSON({ + wok.requestJSON({ url : url, type : 'GET', contentType : 'application/json', @@ -830,7 +830,7 @@ var kimchi = { getStoragePool: function(poolName, suc, err) { var url = kimchi.url + 'storagepools/' + encodeURIComponent(poolName); - kimchi.requestJSON({ + wok.requestJSON({ url : url, type : 'GET', contentType : 'application/json', @@ -843,7 +843,7 @@ var kimchi = { getStoragePoolVolume: function(poolName, volumeName, suc, err) { var url = 'storagepools/' + encodeURIComponent(poolName) + '/storagevolumes/' + encodeURIComponent(volumeName); - kimchi.requestJSON({ + wok.requestJSON({ url : url, type : 'GET', contentType : 'application/json', @@ -857,7 +857,7 @@ var kimchi = { addVMStorage : function(settings, suc, err) { var vm = encodeURIComponent(settings['vm']); delete settings['vm']; - kimchi.requestJSON({ + wok.requestJSON({ url : 'vms/' + vm + '/storages', type : 'POST', contentType : 'application/json', @@ -871,7 +871,7 @@ var kimchi = { retrieveVMStorage : function(settings, suc, err) { var vm = encodeURIComponent(settings['vm']); var dev = encodeURIComponent(settings['dev']); - kimchi.requestJSON({ + wok.requestJSON({ url : "vms/" + vm + '/storages/' + dev, type : 'GET', contentType : 'application/json', @@ -884,7 +884,7 @@ var kimchi = { replaceVMStorage : function(settings, suc, err) { var vm = encodeURIComponent(settings['vm']); var dev = encodeURIComponent(settings['dev']); - kimchi.requestJSON({ + wok.requestJSON({ url : 'vms/' + vm + '/storages/' + dev, type : 'PUT', contentType : 'application/json', @@ -900,7 +900,7 @@ var kimchi = { deleteVMStorage : function(settings, suc, err) { var vm = settings['vm']; var dev = settings['dev']; - kimchi.requestJSON({ + wok.requestJSON({ url : 'vms/' + encodeURIComponent(vm) + '/storages/' + encodeURIComponent(dev), type : 'DELETE', @@ -918,7 +918,7 @@ var kimchi = { if(type) { url += '?type=' + type; } - kimchi.requestJSON({ + wok.requestJSON({ url : url, type : 'GET', contentType : 'application/json', @@ -929,7 +929,7 @@ var kimchi = { }, listSoftwareUpdates : function(suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'host/packagesupdate', type : 'GET', contentType : 'application/json', @@ -969,7 +969,7 @@ var kimchi = { } }; - kimchi.requestJSON({ + wok.requestJSON({ url : 'host/swupdate', type : "POST", contentType : "application/json", @@ -980,7 +980,7 @@ var kimchi = { }, createRepository : function(settings, suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : "host/repositories", type : "POST", contentType : "application/json", @@ -993,7 +993,7 @@ var kimchi = { retrieveRepository : function(repository, suc, err) { var reposID = encodeURIComponent(repository); - kimchi.requestJSON({ + wok.requestJSON({ url : "host/repositories/" + reposID, type : 'GET', contentType : 'application/json', @@ -1031,7 +1031,7 @@ var kimchi = { deleteRepository : function(repository, suc, err) { var reposID = encodeURIComponent(repository); - kimchi.requestJSON({ + wok.requestJSON({ url : 'host/repositories/' + reposID, type : 'DELETE', contentType : 'application/json', @@ -1042,7 +1042,7 @@ var kimchi = { }, listRepositories : function(suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'host/repositories', type : 'GET', contentType : 'application/json', @@ -1055,34 +1055,34 @@ var kimchi = { getHostFCDevices: function(suc, err) { var url = 'host/devices?_cap=fc_host'; - kimchi.requestJSON({ + wok.requestJSON({ url : url, type : 'GET', contentType : 'application/json', dataType : 'json', success : suc, error : err ? err : function(data) { - kimchi.message.error(data.responseJSON.reason); + wok.message.error(data.responseJSON.reason); } }); }, getGuestInterfaces: function(name, suc, err) { var url = 'vms/'+encodeURIComponent(name)+'/ifaces'; - kimchi.requestJSON({ + wok.requestJSON({ url : url, type : 'GET', contentType : 'application/json', dataType : 'json', success : suc, error : err || function(data) { - kimchi.message.error(data.responseJSON.reason); + wok.message.error(data.responseJSON.reason); } }); }, createGuestInterface : function(name, interface, suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'vms/'+encodeURIComponent(name)+'/ifaces', type : 'POST', contentType : 'application/json', @@ -1090,20 +1090,20 @@ var kimchi = { data : JSON.stringify(interface), success : suc, error : err || function(data) { - kimchi.message.error(data.responseJSON.reason); + wok.message.error(data.responseJSON.reason); } }); }, deleteGuestInterface : function(vm, mac, suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'vms/'+encodeURIComponent(vm)+'/ifaces/'+encodeURIComponent(mac), type : 'DELETE', contentType : 'application/json', dataType : 'json', success : suc, error : err ? err : function(data) { - kimchi.message.error(data.responseJSON.reason); + wok.message.error(data.responseJSON.reason); } }); }, @@ -1117,13 +1117,13 @@ var kimchi = { dataType : 'json', success: suc, error: err ? err : function(data) { - kimchi.message.error(data.responseJSON.reason); + wok.message.error(data.responseJSON.reason); } }); }, getUserById : function(data, suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'users?_user_id=' + data.user_id, type : 'GET', contentType : 'application/json', @@ -1132,13 +1132,13 @@ var kimchi = { async : false, success : suc && suc(data), error : err ? err : function(data) { - kimchi.message.error(data.responseJSON.reason); + wok.message.error(data.responseJSON.reason); } }); }, getUsers : function(suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'users', type : 'GET', contentType : 'application/json', @@ -1146,13 +1146,13 @@ var kimchi = { resend : true, success : suc, error : err ? err : function(data) { - kimchi.message.error(data.responseJSON.reason); + wok.message.error(data.responseJSON.reason); } }); }, getGroups : function(suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'groups', type : 'GET', contentType : 'application/json', @@ -1160,13 +1160,13 @@ var kimchi = { resend : true, success : suc, error : err ? err : function(data) { - kimchi.message.error(data.responseJSON.reason); + wok.message.error(data.responseJSON.reason); } }); }, getHostPCIDevices : function(suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'host/devices?_passthrough=true&_cap=pci', type : 'GET', contentType : 'application/json', @@ -1174,13 +1174,13 @@ var kimchi = { resend : true, success : suc, error : err ? err : function(data) { - kimchi.message.error(data.responseJSON.reason); + wok.message.error(data.responseJSON.reason); } }); }, getPCIDeviceCompanions : function(pcidev, suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'host/devices?_passthrough_affected_by=' + pcidev, type : 'GET', contentType : 'application/json', @@ -1188,7 +1188,7 @@ var kimchi = { resend : true, success : suc, error : err ? err : function(data) { - kimchi.message.error(data.responseJSON.reason); + wok.message.error(data.responseJSON.reason); } }); }, @@ -1196,7 +1196,7 @@ var kimchi = { getISCSITargets : function(server, port, suc, err) { server = encodeURIComponent(server); port = port ? '&_server_port='+encodeURIComponent(port) : ''; - kimchi.requestJSON({ + wok.requestJSON({ url : 'storageservers/'+server+'/storagetargets?_target_type=iscsi'+port, type : 'GET', contentType : 'application/json', @@ -1204,13 +1204,13 @@ var kimchi = { resend : true, success : suc, error : err ? err : function(data) { - kimchi.message.error(data.responseJSON.reason); + wok.message.error(data.responseJSON.reason); } }); }, getPeers : function(suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'peers', type : 'GET', contentType : 'application/json', @@ -1218,13 +1218,13 @@ var kimchi = { resend : true, success : suc, error : err ? err : function(data) { - kimchi.message.error(data.responseJSON.reason); + wok.message.error(data.responseJSON.reason); } }); }, getVMPCIDevices : function(id, suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'vms/'+encodeURIComponent(id)+'/hostdevs', type : 'GET', contentType : 'application/json', @@ -1232,13 +1232,13 @@ var kimchi = { resend : true, success : suc, error : err ? err : function(data) { - kimchi.message.error(data.responseJSON.reason); + wok.message.error(data.responseJSON.reason); } }); }, addVMPCIDevice : function(vm, device, suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'vms/'+ encodeURIComponent(vm) +'/hostdevs', type : 'POST', contentType : 'application/json', @@ -1246,20 +1246,20 @@ var kimchi = { data : JSON.stringify(device), success : suc, error : err ? err : function(data) { - kimchi.message.error(data.responseJSON.reason); + wok.message.error(data.responseJSON.reason); } }); }, removeVMPCIDevice : function(vm, device, suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'vms/'+ encodeURIComponent(vm) +'/hostdevs/' + encodeURIComponent(device), type : 'DELETE', contentType : 'application/json', dataType : 'json', success : suc, error : err ? err : function(data) { - kimchi.message.error(data.responseJSON.reason); + wok.message.error(data.responseJSON.reason); } }); }, @@ -1268,7 +1268,7 @@ var kimchi = { * Create a new volume with capacity */ createVolumeWithCapacity: function(poolName, settings, suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'storagepools/' + encodeURIComponent(poolName) + '/storagevolumes', type : 'POST', contentType : "application/json", @@ -1285,7 +1285,7 @@ var kimchi = { uploadVolumeToSP: function(poolName, volumeName, settings, suc, err) { var url = 'storagepools/' + encodeURIComponent(poolName) + '/storagevolumes/' + encodeURIComponent(volumeName); var fd = settings['formData']; - kimchi.requestJSON({ + wok.requestJSON({ url : url, type : 'PUT', data : fd, @@ -1303,7 +1303,7 @@ var kimchi = { downloadVolumeToSP: function(settings, suc, err) { var sp = encodeURIComponent(settings['sp']); delete settings['sp']; - kimchi.requestJSON({ + wok.requestJSON({ url : 'storagepools/' + sp + '/storagevolumes', type : 'POST', data : JSON.stringify(settings), @@ -1315,20 +1315,20 @@ var kimchi = { }, cloneGuest: function(vm, suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'vms/'+encodeURIComponent(vm)+"/clone", type : 'POST', contentType : 'application/json', dataType : 'json', success : suc, error : err ? err : function(data) { - kimchi.message.error(data.responseJSON.reason); + wok.message.error(data.responseJSON.reason); } }); }, listSnapshots : function(vm, suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'vms/'+encodeURIComponent(vm)+'/snapshots', type : 'GET', contentType : 'application/json', @@ -1336,13 +1336,13 @@ var kimchi = { resend : true, success : suc, error : err ? err : function(data) { - kimchi.message.error(data.responseJSON.reason); + wok.message.error(data.responseJSON.reason); } }); }, getCurrentSnapshot : function(vm, suc, err, sync) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'vms/'+encodeURIComponent(vm)+'/snapshots/current', type : 'GET', contentType : 'application/json', @@ -1351,52 +1351,52 @@ var kimchi = { resend : true, success : suc, error : err ? err : function(data) { - kimchi.message.error(data.responseJSON.reason); + wok.message.error(data.responseJSON.reason); } }); }, revertSnapshot : function(vm, snapshot, suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'vms/'+encodeURIComponent(vm)+'/snapshots/'+encodeURIComponent(snapshot)+'/revert', type : 'POST', contentType : 'application/json', dataType : 'json', success : suc, error : err ? err : function(data) { - kimchi.message.error(data.responseJSON.reason); + wok.message.error(data.responseJSON.reason); } }); }, createSnapshot : function(vm, suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'vms/'+encodeURIComponent(vm)+'/snapshots', type : 'POST', contentType : 'application/json', dataType : 'json', success : suc, error : err ? err : function(data) { - kimchi.message.error(data.responseJSON.reason); + wok.message.error(data.responseJSON.reason); } }); }, deleteSnapshot : function(vm, snapshot, suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'vms/'+encodeURIComponent(vm)+'/snapshots/'+encodeURIComponent(snapshot), type : 'DELETE', contentType : 'application/json', dataType : 'json', success : suc, error : err ? err : function(data) { - kimchi.message.error(data.responseJSON.reason); + wok.message.error(data.responseJSON.reason); } }); }, getCPUInfo : function(suc, err) { - kimchi.requestJSON({ + wok.requestJSON({ url : 'host/cpuinfo', type : 'GET', contentType : 'application/json', @@ -1404,7 +1404,7 @@ var kimchi = { resend : true, success : suc, error : err ? err : function(data) { - kimchi.message.error(data.responseJSON.reason); + wok.message.error(data.responseJSON.reason); } }); } diff --git a/plugins/kimchi/ui/js/src/kimchi.grid.js b/plugins/kimchi/ui/js/src/kimchi.grid.js index 6fed753..fcd9096 100644 --- a/plugins/kimchi/ui/js/src/kimchi.grid.js +++ b/plugins/kimchi/ui/js/src/kimchi.grid.js @@ -376,7 +376,7 @@ kimchi.widget.Grid.prototype = (function() { var container = $('#' + containerID); var gridID = this['opts']['id']; var rowSelection = this['opts']['rowSelection'] || 'single'; - var domNode = $(kimchi.substitute(htmlStr, { + var domNode = $(wok.substitute(htmlStr, { id: gridID, loading: i18n['KCHGRD6001M'], message: i18n['KCHGRD6002M'], diff --git a/plugins/kimchi/ui/js/src/kimchi.guest_add_main.js b/plugins/kimchi/ui/js/src/kimchi.guest_add_main.js index df76975..1008d85 100644 --- a/plugins/kimchi/ui/js/src/kimchi.guest_add_main.js +++ b/plugins/kimchi/ui/js/src/kimchi.guest_add_main.js @@ -17,7 +17,7 @@ */ kimchi.guest_add_main = function() { var showTemplates = function() { - kimchi.topic('templateCreated').unsubscribe(showTemplates); + wok.topic('templateCreated').unsubscribe(showTemplates); kimchi.listTemplates(function(result) { if (result && result.length) { $('#prompt-create-template').addClass('hidden'); @@ -25,16 +25,16 @@ kimchi.guest_add_main = function() { var html = ''; var tmpl = $('#tmpl-template').html(); $.each(result, function(index, value) { - html += kimchi.substitute(tmpl, value); + html += wok.substitute(tmpl, value); }); $('#templateTile').html(html); return; } $('#btn-create-template').on('click', function(event) { - kimchi.topic('templateCreated').subscribe(showTemplates); + wok.topic('templateCreated').subscribe(showTemplates); - kimchi.window.open('template-add.html'); + wok.window.open('template-add.html'); event.preventDefault(); }); @@ -42,7 +42,7 @@ kimchi.guest_add_main = function() { $('#prompt-choose-template').addClass('hidden'); $('#prompt-create-template').removeClass('hidden'); }, function(err) { - kimchi.message.error(err.responseJSON.reason); + wok.message.error(err.responseJSON.reason); }); }; @@ -66,14 +66,14 @@ kimchi.guest_add_main = function() { var formData = $('#form-vm-add').serializeObject(); kimchi.createVM(formData, function() { kimchi.listVmsAuto(); - kimchi.window.close(); + wok.window.close(); }, function(jqXHR, textStatus, errorThrown) { $('#vm-doAdd').attr('style', 'display'); $('#vm-doAdding').attr('style', 'display:none'); var reason = jqXHR && jqXHR['responseJSON'] && jqXHR['responseJSON']['reason']; - kimchi.message.error(reason); + wok.message.error(reason); }); return false; diff --git a/plugins/kimchi/ui/js/src/kimchi.guest_edit_main.js b/plugins/kimchi/ui/js/src/kimchi.guest_edit_main.js index 7671e43..28c2163 100644 --- a/plugins/kimchi/ui/js/src/kimchi.guest_edit_main.js +++ b/plugins/kimchi/ui/js/src/kimchi.guest_edit_main.js @@ -46,7 +46,7 @@ kimchi.guest_edit_main = function() { $.each(storages, function(index, storage) { storage['vm'] = kimchi.selectedGuest; rowHTML = $('#' + storage['type'] + '-row-tmpl').html(); - var templated = kimchi.substitute(rowHTML, storage); + var templated = wok.substitute(rowHTML, storage); container.append(templated); }); @@ -120,12 +120,12 @@ kimchi.guest_edit_main = function() { settings['content'] = i18n['KCHVMCD6009M']; var dev = $(this).data('dev'); - kimchi.confirm(settings, function() { + wok.confirm(settings, function() { kimchi.deleteVMStorage({ vm: kimchi.selectedGuest, dev: dev }, function() { - kimchi.topic('kimchi/vmCDROMDetached').publish(); + wok.topic('kimchi/vmCDROMDetached').publish(); }); }); }); @@ -140,13 +140,13 @@ kimchi.guest_edit_main = function() { }; kimchi.replaceVMStorage(settings, function(result) { - kimchi.topic('kimchi/vmCDROMReplaced').publish({ + wok.topic('kimchi/vmCDROMReplaced').publish({ result: result }); }, function(result) { var errText = result['reason'] || result['responseJSON']['reason']; - kimchi.message.error(errText); + wok.message.error(errText); }); }); @@ -183,7 +183,7 @@ kimchi.guest_edit_main = function() { if (data.id == -1) { data.id = $('#form-guest-edit-interface > .body').children().size() } - var itemNode = $.parseHTML(kimchi.substitute($('#interface-tmpl').html(),data)); + var itemNode = $.parseHTML(wok.substitute($('#interface-tmpl').html(),data)); $(".body", "#form-guest-edit-interface").append(itemNode); $("select", itemNode).append(networkOptions); if(data.network!==""){ @@ -283,7 +283,7 @@ kimchi.guest_edit_main = function() { }); }); var addItem = function(data) { - var itemNode = $.parseHTML(kimchi.substitute($('#ldap-user-tmpl').html(),data)); + var itemNode = $.parseHTML(wok.substitute($('#ldap-user-tmpl').html(),data)); $(".body", "#form-guest-edit-permission .ldap").append(itemNode); $(".delete", itemNode).button({ icons: { primary: "ui-icon-trash" }, @@ -314,7 +314,7 @@ kimchi.guest_edit_main = function() { }; //set up for PAM var userNodes = {}, groupNodes = {}; - authType = kimchi.capabilities['auth'] + authType = wok.capabilities['auth'] if (authType == 'pam') { $("#form-guest-edit-permission .ldap").hide(); kimchi.retrieveVM(kimchi.selectedGuest, function(vm){ @@ -367,7 +367,7 @@ kimchi.guest_edit_main = function() { var init = function(availUsers, availGroups, selUsers, selGroups){ var initNode = function(key, isUserNode){ var nodeGroups = isUserNode ? userNodes : groupNodes; - nodeGroups[key] = $.parseHTML(kimchi.substitute($('#permission-item-pam').html(), { + nodeGroups[key] = $.parseHTML(wok.substitute($('#permission-item-pam').html(), { val: key, class: isUserNode? "user-icon" : "group-icon" })); @@ -432,9 +432,9 @@ kimchi.guest_edit_main = function() { var setupPCIDevice = function(){ kimchi.getHostPCIDevices(function(hostPCIs){ kimchi.getVMPCIDevices(kimchi.selectedGuest, function(vmPCIs){ - var pciEnabled = kimchi.capabilities.kernel_vfio; + var pciEnabled = wok.capabilities.kernel_vfio; for(var i=0; i<hostPCIs.length; i++){ - var itemNode = $.parseHTML(kimchi.substitute($('#pci-tmpl').html(),{ + var itemNode = $.parseHTML(wok.substitute($('#pci-tmpl').html(),{ name: hostPCIs[i].name, product: hostPCIs[i].product.description, vendor: hostPCIs[i].vendor.description @@ -545,7 +545,7 @@ kimchi.guest_edit_main = function() { } }; var addItem = function(data, container) { - var itemNode = $.parseHTML(kimchi.substitute($('#snapshot-tmpl').html(),data)); + var itemNode = $.parseHTML(wok.substitute($('#snapshot-tmpl').html(),data)); $("."+container, "#form-guest-edit-snapshot").append(itemNode); $(".delete", itemNode).button({ icons: { primary: "ui-icon-trash" }, @@ -559,7 +559,7 @@ kimchi.guest_edit_main = function() { setCurrentSnapshot(); $("button", "#form-guest-edit-snapshot").button("enable"); }, function(data){ - kimchi.message.error(data.responseJSON.reason); + wok.message.error(data.responseJSON.reason); $("button", "#form-guest-edit-snapshot").button("enable"); }); }); @@ -577,9 +577,9 @@ kimchi.guest_edit_main = function() { $("button", "#form-guest-edit-snapshot").button("enable"); setCurrentSnapshot(item.prop("id")); kimchi.listVmsAuto(); - kimchi.window.close(); + wok.window.close(); }, function(data){ - kimchi.message.error(data.responseJSON.reason); + wok.message.error(data.responseJSON.reason); $(".icon", item).addClass("hide"); $("button", "#form-guest-edit-snapshot").button("enable"); }); @@ -598,7 +598,7 @@ kimchi.guest_edit_main = function() { listGeneratingSnapshots(); $("button", "#form-guest-edit-snapshot").button("enable"); }, function(err){ - kimchi.message.error(err.message); + wok.message.error(err.message); listGeneratingSnapshots(); $("button", "#form-guest-edit-snapshot").button("enable"); }); @@ -650,7 +650,7 @@ kimchi.guest_edit_main = function() { text: false }).click(function(event) { event.preventDefault(); - kimchi.window.open("guest-storage-add.html"); + wok.window.open("guest-storage-add.html"); }); if(kimchi.thisVMState === "running") { $("#form-guest-edit-general input").prop("disabled", true); @@ -674,14 +674,14 @@ kimchi.guest_edit_main = function() { setupPCIDevice(); setupSnapshot(); - kimchi.topic('kimchi/vmCDROMAttached').subscribe(onAttached); - kimchi.topic('kimchi/vmCDROMReplaced').subscribe(onReplaced); - kimchi.topic('kimchi/vmCDROMDetached').subscribe(onDetached); + wok.topic('kimchi/vmCDROMAttached').subscribe(onAttached); + wok.topic('kimchi/vmCDROMReplaced').subscribe(onReplaced); + wok.topic('kimchi/vmCDROMDetached').subscribe(onDetached); kimchi.clearGuestEdit = function() { - kimchi.topic('kimchi/vmCDROMAttached').unsubscribe(onAttached); - kimchi.topic('kimchi/vmCDROMReplaced').unsubscribe(onReplaced); - kimchi.topic('kimchi/vmCDROMDetached').unsubscribe(onDetached); + wok.topic('kimchi/vmCDROMAttached').unsubscribe(onAttached); + wok.topic('kimchi/vmCDROMReplaced').unsubscribe(onReplaced); + wok.topic('kimchi/vmCDROMDetached').unsubscribe(onDetached); }; }; @@ -699,16 +699,16 @@ kimchi.guest_edit_main = function() { kimchi.updateVM(kimchi.selectedGuest, data, function() { kimchi.listVmsAuto(); - kimchi.window.close(); + wok.window.close(); }, function(err) { - kimchi.message.error(err.responseJSON.reason); + wok.message.error(err.responseJSON.reason); $(saveButton).prop('disabled', false); }); } var permissionSubmit = function(event) { var content = { users: [], groups: [] }; - authType = kimchi.capabilities['auth'] + authType = wok.capabilities['auth'] if (authType == 'pam') { $("#permission-sel-users").children().each(function(){ content.users.push($("label", this).text()); @@ -717,7 +717,7 @@ kimchi.guest_edit_main = function() { content.groups.push($("label", this).text()); }); kimchi.updateVM(kimchi.selectedGuest, content, function(){ - kimchi.window.close(); + wok.window.close(); }); } else if (authType == 'ldap') { $(saveButton).prop('disabled', true); @@ -737,7 +737,7 @@ kimchi.guest_edit_main = function() { }); if (errors == 0) { kimchi.updateVM(kimchi.selectedGuest, content, function(){ - kimchi.window.close(); + wok.window.close(); }); } else { $(saveButton).prop('disabled', false); diff --git a/plugins/kimchi/ui/js/src/kimchi.guest_main.js b/plugins/kimchi/ui/js/src/kimchi.guest_main.js index 7e25b68..a0f927b 100644 --- a/plugins/kimchi/ui/js/src/kimchi.guest_main.js +++ b/plugins/kimchi/ui/js/src/kimchi.guest_main.js @@ -55,7 +55,7 @@ kimchi.vmstart = function(event) { kimchi.listVmsAuto(); }, function(err) { button.removeClass('loading'); - kimchi.message.error(err.responseJSON.reason); + wok.message.error(err.responseJSON.reason); } ); } else { @@ -76,7 +76,7 @@ kimchi.vmsuspend = function(event) { kimchi.listVmsAuto(); }, function(err) { button.removeClass('pause-gray'); - kimchi.message.error(err.responseJSON.reason); + wok.message.error(err.responseJSON.reason); } ); } else { @@ -97,7 +97,7 @@ kimchi.vmresume = function(event) { kimchi.listVmsAuto(); }, function(err) { button.removeClass('resume-gray'); - kimchi.message.error(err.responseJSON.reason); + wok.message.error(err.responseJSON.reason); } ); } else { @@ -123,12 +123,12 @@ kimchi.vmpoweroff = function(event) { confirm : i18n['KCHAPI6002M'], cancel : i18n['KCHAPI6003M'] }; - kimchi.confirm(settings, function() { + wok.confirm(settings, function() { kimchi.poweroffVM(vm_id, function(result) { button.removeClass('loading'); kimchi.listVmsAuto(); }, function(err) { - kimchi.message.error(err.responseJSON.reason); + wok.message.error(err.responseJSON.reason); }); }, function() { }); @@ -147,11 +147,11 @@ kimchi.vmshutdown = function(event){ confirm : i18n['KCHAPI6002M'], cancel : i18n['KCHAPI6003M'] }; - kimchi.confirm(settings, function() { + wok.confirm(settings, function() { kimchi.shutdownVM(vm_id, function(result) { kimchi.listVmsAuto(); }, function(err) { - kimchi.message.error(err.responseJSON.reason); + wok.message.error(err.responseJSON.reason); } ); }, function() { @@ -167,11 +167,11 @@ kimchi.vmreset = function(event){ confirm : i18n['KCHAPI6002M'], cancel : i18n['KCHAPI6003M'] }; - kimchi.confirm(settings, function() { + wok.confirm(settings, function() { kimchi.resetVM(vm_id, function(result) { kimchi.listVmsAuto(); }, function(err) { - kimchi.message.error(err.responseJSON.reason); + wok.message.error(err.responseJSON.reason); } ); }, function() { @@ -187,11 +187,11 @@ kimchi.vmdelete = function(event) { confirm : i18n['KCHAPI6002M'], cancel : i18n['KCHAPI6003M'] }; - kimchi.confirm(settings, function() { + wok.confirm(settings, function() { kimchi.deleteVM(vm_id, function(result) { kimchi.listVmsAuto(); }, function(err) { - kimchi.message.error(err.responseJSON.reason); + wok.message.error(err.responseJSON.reason); }); }, function() { }); @@ -201,7 +201,7 @@ kimchi.vmedit = function(event) { var vm = $(this).closest('li[name=guest]'); var vm_id=vm.attr("id"); kimchi.selectedGuest = vm_id; - kimchi.window.open({ + wok.window.open({ url: 'guest-edit.html', close: function() { kimchi.clearGuestEdit(); @@ -252,7 +252,7 @@ kimchi.listVmsAuto = function() { guests.push($.extend({}, kimchi.sampleGuestObject, {name: guestName, isCreating: true})); if(kimchi.trackingTasks.indexOf(tasks[i].id)==-1) kimchi.trackTask(tasks[i].id, null, function(err){ - kimchi.message.error(err.message); + wok.message.error(err.message); }, null); } }, null, true); @@ -267,7 +267,7 @@ kimchi.listVmsAuto = function() { guests.push($.extend({}, kimchi.sampleGuestObject, {name: guestName, isCloning: true})); if(kimchi.trackingTasks.indexOf(tasks[i].id)==-1) kimchi.trackTask(tasks[i].id, null, function(err){ - kimchi.message.error(err.message); + wok.message.error(err.message); }, null); } }, null, true); @@ -299,7 +299,7 @@ kimchi.listVmsAuto = function() { kimchi.vmTimeout = window.setTimeout("kimchi.listVmsAuto();", 5000); }, function(errorResponse, textStatus, errorThrown) { if(errorResponse.responseJSON && errorResponse.responseJSON.reason) { - kimchi.message.error(errorResponse.responseJSON.reason); + wok.message.error(errorResponse.responseJSON.reason); } kimchi.vmTimeout = window.setTimeout("kimchi.listVmsAuto();", 5000); }); @@ -439,7 +439,7 @@ kimchi.createGuestLi = function(vmObject, prevScreenImage, openMenu) { guestActions.find("[name=vm-delete]").on({click : kimchi.vmdelete}); guestActions.find("[name=vm-clone]").click(function(){ var guest = $(this).closest('li[name=guest]').attr("id"); - kimchi.confirm({ + wok.confirm({ title : i18n['KCHAPI6006M'], content : i18n['KCHVM6010M'], confirm : i18n['KCHAPI6002M'], @@ -489,10 +489,10 @@ kimchi.guestSetRequestHeader = function(xhr) { }; kimchi.guest_main = function() { - if(kimchi.tabMode['guests'] === 'admin') { + if(wok.tabMode['guests'] === 'admin') { $('.tools').attr('style','display'); $("#vm-add").on("click", function(event) { - kimchi.window.open('guest-add.html'); + wok.window.open('guest-add.html'); }); } kimchi.guestTemplate = $('#guest-tmpl').html(); diff --git a/plugins/kimchi/ui/js/src/kimchi.guest_media_main.js b/plugins/kimchi/ui/js/src/kimchi.guest_media_main.js index 82bceb4..2e4e7e8 100644 --- a/plugins/kimchi/ui/js/src/kimchi.guest_media_main.js +++ b/plugins/kimchi/ui/js/src/kimchi.guest_media_main.js @@ -28,14 +28,14 @@ kimchi.guest_media_main = function() { $.each(storages, function(index, storage) { storage['vm'] = kimchi.selectedGuest; - var templated = kimchi.substitute(rowHTML, storage); + var templated = wok.substitute(rowHTML, storage); container.append(templated); }); var replaceCDROM = function(event) { event.preventDefault(); kimchi.selectedGuestStorage = $(this).data('dev'); - kimchi.window.open("guest-cdrom-edit.html"); + wok.window.open("guest-cdrom-edit.html"); }; $('input[type="text"][name="cdrom"]', container).on('click', replaceCDROM); @@ -48,9 +48,9 @@ kimchi.guest_media_main = function() { var onReplaced = function(params) { refreshCDROMs(); }; - kimchi.topic('kimchi/vmCDROMReplaced').subscribe(onReplaced); + wok.topic('kimchi/vmCDROMReplaced').subscribe(onReplaced); kimchi.clearGuestMedia = function() { - kimchi.topic('kimchi/vmCDROMReplaced').unsubscribe(onReplaced); + wok.topic('kimchi/vmCDROMReplaced').unsubscribe(onReplaced); }; }; diff --git a/plugins/kimchi/ui/js/src/kimchi.guest_storage_add.main.js b/plugins/kimchi/ui/js/src/kimchi.guest_storage_add.main.js index 3581c34..6723b1a 100644 --- a/plugins/kimchi/ui/js/src/kimchi.guest_storage_add.main.js +++ b/plugins/kimchi/ui/js/src/kimchi.guest_storage_add.main.js @@ -123,7 +123,7 @@ kimchi.guest_storage_add_main = function() { if (/^((https|http|ftp|ftps|tftp|\/).*)+$/.test(settings['path'])) return true; else { - kimchi.message.error.code('KCHVMSTOR0001E'); + wok.message.error.code('KCHVMSTOR0001E'); return false; } } @@ -132,7 +132,7 @@ kimchi.guest_storage_add_main = function() { if (settings['pool'] && settings['vol']) return true; else { - kimchi.message.error.code('KCHVMSTOR0002E'); + wok.message.error.code('KCHVMSTOR0002E'); return false; } } @@ -169,14 +169,14 @@ kimchi.guest_storage_add_main = function() { $(submitButton).addClass('loading').text(i18n['KCHVMCD6003M']); kimchi.addVMStorage(settings, function(result) { - kimchi.window.close(); - kimchi.topic('kimchi/vmCDROMAttached').publish({ + wok.window.close(); + wok.topic('kimchi/vmCDROMAttached').publish({ result: result }); }, function(result) { var errText = result['reason'] || result['responseJSON']['reason']; - kimchi.message.error(errText); + wok.message.error(errText); $.each([submitButton, pathTextbox, poolTextbox, volTextbox], function(i, c) { $(c).prop('disabled', false); diff --git a/plugins/kimchi/ui/js/src/kimchi.host.js b/plugins/kimchi/ui/js/src/kimchi.host.js index b75b9e4..7834024 100644 --- a/plugins/kimchi/ui/js/src/kimchi.host.js +++ b/plugins/kimchi/ui/js/src/kimchi.host.js @@ -86,7 +86,7 @@ kimchi.host_main = function() { id: 'repositories-grid-add-button', label: i18n['KCHREPO6012M'], onClick: function(event) { - kimchi.window.open({url:'repository-add.html', class: repo_type}); + wok.window.open({url:'repository-add.html', class: repo_type}); } }, { id: 'repositories-grid-enable-button', @@ -101,7 +101,7 @@ kimchi.host_main = function() { var enable = !repository['enabled']; $(this).prop('disabled', true); kimchi.enableRepository(name, enable, function() { - kimchi.topic('kimchi/repositoryUpdated').publish(); + wok.topic('kimchi/repositoryUpdated').publish(); }); } }, { @@ -114,7 +114,7 @@ kimchi.host_main = function() { return; } kimchi.selectedRepository = repository['repo_id']; - kimchi.window.open({url:'repository-edit.html', class: repo_type}); + wok.window.open({url:'repository-edit.html', class: repo_type}); } }, { id: 'repositories-grid-remove-button', @@ -133,11 +133,11 @@ kimchi.host_main = function() { cancel : i18n['KCHAPI6003M'] }; - kimchi.confirm(settings, function() { + wok.confirm(settings, function() { kimchi.deleteRepository( repository['repo_id'], function(result) { - kimchi.topic('kimchi/repositoryDeleted').publish(result); + wok.topic('kimchi/repositoryDeleted').publish(result); }, function(error) { } ); @@ -217,19 +217,19 @@ kimchi.host_main = function() { var progressArea = $('#' + progressAreaID)[0]; $('#software-updates-progress-container').removeClass('hidden'); $(progressArea).text(''); - !kimchi.isElementInViewport(progressArea) && + !wok.isElementInViewport(progressArea) && progressArea.scrollIntoView(); $(updateButton).text(i18n['KCHUPD6007M']).prop('disabled', true); kimchi.updateSoftware(function(result) { reloadProgressArea(result); $(updateButton).text(i18n['KCHUPD6006M']).prop('disabled', false); - kimchi.topic('kimchi/softwareUpdated').publish({ + wok.topic('kimchi/softwareUpdated').publish({ result: result }); }, function(error) { var message = error && error['responseJSON'] && error['responseJSON']['reason']; - kimchi.message.error(message || i18n['KCHUPD6009M']); + wok.message.error(message || i18n['KCHUPD6009M']); $(updateButton).text(i18n['KCHUPD6006M']).prop('disabled', false); }, reloadProgressArea); } @@ -287,7 +287,7 @@ kimchi.host_main = function() { var enableReportButtons = function(toEnable) { var buttonID = '#{grid}-{btn}-button'; $.each(['rename', 'remove', 'download'], function(i, n) { - $(kimchi.substitute(buttonID, { + $(wok.substitute(buttonID, { grid: reportGridID, btn: n })).prop('disabled', !toEnable); @@ -302,7 +302,7 @@ kimchi.host_main = function() { id: reportGridID + '-generate-button', label: i18n['KCHDR6006M'], onClick: function(event) { - kimchi.window.open('report-add.html'); + wok.window.open('report-add.html'); } }, { id: reportGridID + '-rename-button', @@ -315,7 +315,7 @@ kimchi.host_main = function() { } kimchi.selectedReport = report['name']; - kimchi.window.open('report-rename.html'); + wok.window.open('report-rename.html'); } }, { id: reportGridID + '-remove-button', @@ -334,13 +334,13 @@ kimchi.host_main = function() { cancel : i18n['KCHAPI6003M'] }; - kimchi.confirm(settings, function() { + wok.confirm(settings, function() { kimchi.deleteReport({ name: report['name'] }, function(result) { listDebugReports(); }, function(error) { - kimchi.message.error(error.responseJSON.reason); + wok.message.error(error.responseJSON.reason); }); }); } @@ -401,7 +401,7 @@ kimchi.host_main = function() { } kimchi.trackTask(tasks[i].id, function(result) { - kimchi.topic('kimchi/debugReportAdded').publish(); + wok.topic('kimchi/debugReportAdded').publish(); }, function(result) { // Error message from Async Task status if (result['message']) { @@ -411,8 +411,8 @@ kimchi.host_main = function() { else { var errText = result['responseJSON']['reason']; } - result && kimchi.message.error(errText); - kimchi.topic('kimchi/debugReportAdded').publish(); + result && wok.message.error(errText); + wok.topic('kimchi/debugReportAdded').publish(); }, null); } }, null, true); @@ -462,7 +462,7 @@ kimchi.host_main = function() { cancel : i18n['KCHAPI6003M'] }; - kimchi.confirm(settings, function() { + wok.confirm(settings, function() { kimchi.shutdown(params); $(shutdownButtonID).prop('disabled', true); $(restartButtonID).prop('disabled', true); @@ -470,7 +470,7 @@ kimchi.host_main = function() { kimchi.listVMs(function(vms) { for(var i = 0; i < vms.length; i++) { if(vms[i]['state'] === 'running') { - kimchi.message.error.code('KCHHOST6001E'); + wok.message.error.code('KCHHOST6001E'); $(shutdownButtonID).prop('disabled', false); $(restartButtonID).prop('disabled', false); return; @@ -505,37 +505,37 @@ kimchi.host_main = function() { }); var setupUI = function() { - if (kimchi.capabilities == undefined) { + if (wok.capabilities == undefined) { setTimeout(setupUI, 2000); return; } - if((kimchi.capabilities['repo_mngt_tool']) && (kimchi.capabilities['repo_mngt_tool']!="None")) { - initRepositoriesGrid(kimchi.capabilities['repo_mngt_tool']); - $('#repositories-section').switchClass('hidden', kimchi.capabilities['repo_mngt_tool']); - kimchi.topic('kimchi/repositoryAdded') + if((wok.capabilities['repo_mngt_tool']) && (wok.capabilities['repo_mngt_tool']!="None")) { + initRepositoriesGrid(wok.capabilities['repo_mngt_tool']); + $('#repositories-section').switchClass('hidden', wok.capabilities['repo_mngt_tool']); + wok.topic('kimchi/repositoryAdded') .subscribe(listRepositories); - kimchi.topic('kimchi/repositoryUpdated') + wok.topic('kimchi/repositoryUpdated') .subscribe(listRepositories); - kimchi.topic('kimchi/repositoryDeleted') + wok.topic('kimchi/repositoryDeleted') .subscribe(listRepositories); } - if(kimchi.capabilities['update_tool']) { + if(wok.capabilities['update_tool']) { $('#software-update-section').removeClass('hidden'); initSoftwareUpdatesGrid(); - kimchi.topic('kimchi/softwareUpdated') + wok.topic('kimchi/softwareUpdated') .subscribe(listSoftwareUpdates); $('#software-updates-progress-container').accordion({ collapsible: true }); } - if(kimchi.capabilities['system_report_tool']) { + if(wok.capabilities['system_report_tool']) { listDebugReports(); - kimchi.topic('kimchi/debugReportAdded') + wok.topic('kimchi/debugReportAdded') .subscribe(listDebugReports); - kimchi.topic('kimchi/debugReportRenamed') + wok.topic('kimchi/debugReportRenamed') .subscribe(listDebugReports); } }; @@ -545,10 +545,10 @@ kimchi.host_main = function() { kimchi.getHost(function(data) { var htmlTmpl = $('#host-tmpl').html(); data['logo'] = data['logo'] || ''; - data['memory'] = kimchi.formatMeasurement(data['memory'], { + data['memory'] = wok.formatMeasurement(data['memory'], { fixed: 2 }); - var templated = kimchi.substitute(htmlTmpl, data); + var templated = wok.substitute(htmlTmpl, data); $('#host-content-container').html(templated); initPage(); @@ -839,18 +839,18 @@ kimchi.host_main = function() { } repositoriesGrid && repositoriesGrid.destroy(); - kimchi.topic('kimchi/repositoryAdded') + wok.topic('kimchi/repositoryAdded') .unsubscribe(listRepositories); - kimchi.topic('kimchi/repositoryUpdated') + wok.topic('kimchi/repositoryUpdated') .unsubscribe(listRepositories); - kimchi.topic('kimchi/repositoryDeleted') + wok.topic('kimchi/repositoryDeleted') .unsubscribe(listRepositories); softwareUpdatesGrid && softwareUpdatesGrid.destroy(); - kimchi.topic('kimchi/softwareUpdated').unsubscribe(listSoftwareUpdates); + wok.topic('kimchi/softwareUpdated').unsubscribe(listSoftwareUpdates); reportGrid && reportGrid.destroy(); - kimchi.topic('kimchi/debugReportAdded').unsubscribe(listDebugReports); - kimchi.topic('kimchi/debugReportRenamed').unsubscribe(listDebugReports); + wok.topic('kimchi/debugReportAdded').unsubscribe(listDebugReports); + wok.topic('kimchi/debugReportRenamed').unsubscribe(listDebugReports); }); }; diff --git a/plugins/kimchi/ui/js/src/kimchi.line-chart.js b/plugins/kimchi/ui/js/src/kimchi.line-chart.js index d2f40db..46c9833 100644 --- a/plugins/kimchi/ui/js/src/kimchi.line-chart.js +++ b/plugins/kimchi/ui/js/src/kimchi.line-chart.js @@ -109,7 +109,7 @@ kimchi.widget.LineChart = function(params) { var maxValueLabel = i18n['KCHHOST6001M'] + ' ' + (type === 'value' - ? kimchi.formatMeasurement(maxValue, formatSettings) + ? wok.formatMeasurement(maxValue, formatSettings) : '100%'); if(!chartVAxis) { chartVAxis = $('<div class="chart-vaxis-container">' + @@ -182,7 +182,7 @@ kimchi.widget.LineChart = function(params) { var latestPoint = data[i]['points'].slice(-1).pop(); var latestValue = latestPoint['y']; if(type === 'value') { - latestValue = kimchi.formatMeasurement( + latestValue = wok.formatMeasurement( latestValue, formatSettings ); diff --git a/plugins/kimchi/ui/js/src/kimchi.network.js b/plugins/kimchi/ui/js/src/kimchi.network.js index c84bcb0..214e18b 100644 --- a/plugins/kimchi/ui/js/src/kimchi.network.js +++ b/plugins/kimchi/ui/js/src/kimchi.network.js @@ -19,7 +19,7 @@ kimchi.NETWORK_TYPE_BRIDGE = "bridged"; kimchi.initNetwork = function() { - if(kimchi.tabMode['network'] === 'admin') { + if(wok.tabMode['network'] === 'admin') { $('.tools').attr('style','display'); $('#network-content .header span:last-child').attr('style','display'); kimchi.initNetworkCreation(); @@ -52,7 +52,7 @@ kimchi.initNetworkListView = function() { kimchi.addNetworkItem = function(network) { $("#networkBody").append(kimchi.getNetworkItemHtml(network)); - if(kimchi.tabMode["network"] === "admin") { + if(wok.tabMode["network"] === "admin") { $(".column-action").attr("style","display"); } else { $(".column-space").addClass('column-space-no-border-right'); @@ -72,7 +72,7 @@ kimchi.getNetworkItemHtml = function(network) { } var disable_in_use = network.in_use ? "ui-state-disabled" : ""; - var networkItem = kimchi.substitute($('#networkItem').html(), { + var networkItem = wok.substitute($('#networkItem').html(), { name : network.name, state : network.state, type : network.type, @@ -88,7 +88,7 @@ kimchi.getNetworkItemHtml = function(network) { }; kimchi.stopNetwork = function(network,menu) { - $(".network-state", $("#" + kimchi.escapeStr(network.name))).switchClass("up", "nw-loading"); + $(".network-state", $("#" + wok.escapeStr(network.name))).switchClass("up", "nw-loading"); $("[nwAct='stop']", menu).addClass("ui-state-disabled"); kimchi.toggleNetwork(network.name, false, function() { $("[nwAct='start']", menu).removeClass("hide-action-item"); @@ -98,23 +98,23 @@ kimchi.stopNetwork = function(network,menu) { $("[nwAct='delete']", menu).removeClass("ui-state-disabled"); $(":first-child", $("[nwAct='delete']", menu)).removeAttr("disabled"); } - $(".network-state", $("#" + kimchi.escapeStr(network.name))).switchClass("nw-loading", "down"); + $(".network-state", $("#" + wok.escapeStr(network.name))).switchClass("nw-loading", "down"); }, function(err) { - $(".network-state", $("#" + kimchi.escapeStr(network.name))).switchClass("nw-loading", "up"); + $(".network-state", $("#" + wok.escapeStr(network.name))).switchClass("nw-loading", "up"); if (!network.in_use) { $("[nwAct='stop']", menu).removeClass("ui-state-disabled"); } - kimchi.message.error(err.responseJSON.reason); + wok.message.error(err.responseJSON.reason); }); } kimchi.addNetworkActions = function(network) { - $(".menu-container", "#" + kimchi.escapeStr(network.name)).menu(); + $(".menu-container", "#" + wok.escapeStr(network.name)).menu(); - $('#' + kimchi.escapeStr(network.name)).on('click', '.menu-container li', function(evt) { + $('#' + wok.escapeStr(network.name)).on('click', '.menu-container li', function(evt) { var menu = $(evt.currentTarget).parent(); if ($(evt.currentTarget).attr("nwAct") === "start") { - $(".network-state", $("#" + kimchi.escapeStr(network.name))).switchClass("down", "nw-loading"); + $(".network-state", $("#" + wok.escapeStr(network.name))).switchClass("down", "nw-loading"); $("[nwAct='start']", menu).addClass("ui-state-disabled"); $("[nwAct='delete']", menu).addClass("ui-state-disabled"); $(":first-child", $("[nwAct='delete']", menu)).attr("disabled", true); @@ -126,15 +126,15 @@ kimchi.addNetworkActions = function(network) { if (network.in_use) { $("[nwAct='stop']", menu).addClass("ui-state-disabled"); } - $(".network-state", $("#" + kimchi.escapeStr(network.name))).switchClass("nw-loading", "up"); + $(".network-state", $("#" + wok.escapeStr(network.name))).switchClass("nw-loading", "up"); }, function(err) { - $(".network-state", $("#" + kimchi.escapeStr(network.name))).switchClass("nw-loading","down"); + $(".network-state", $("#" + wok.escapeStr(network.name))).switchClass("nw-loading","down"); $("[nwAct='start']", menu).removeClass("ui-state-disabled"); if (!network.in_use) { $("[nwAct='delete']", menu).removeClass("ui-state-disabled"); } $(":first-child", $("[nwAct='delete']", menu)).removeAttr("disabled"); - kimchi.message.error(err.responseJSON.reason); + wok.message.error(err.responseJSON.reason); }); } else if ($(evt.currentTarget).attr("nwAct") === "stop") { if (network.in_use) { @@ -147,7 +147,7 @@ kimchi.addNetworkActions = function(network) { confirm : i18n['KCHAPI6002M'], cancel : i18n['KCHAPI6003M'] }; - kimchi.confirm(settings, function() { + wok.confirm(settings, function() { kimchi.stopNetwork(network, menu); $(evt.currentTarget).parents(".item").remove(); }, null); @@ -160,7 +160,7 @@ kimchi.addNetworkActions = function(network) { if (network.state === "up" || network.in_use) { return false; } - kimchi.confirm({ + wok.confirm({ title : i18n['KCHAPI6006M'], content : i18n['KCHNET6002M'], confirm : i18n['KCHAPI6002M'], @@ -200,7 +200,7 @@ kimchi.initNetworkCreation = function() { if ($("#enableVlan").prop("checked")) { data.vlan_id = network.vlan_id; if (!(data.vlan_id >=1 && data.vlan_id <= 4094)) { - kimchi.message.error.code('KCHNET6001E'); + wok.message.error.code('KCHNET6001E'); errorCallback(); return; } @@ -214,7 +214,7 @@ kimchi.initNetworkCreation = function() { kimchi.addNetworkItem(network); $("#networkConfig").dialog("close"); }, function(data) { - kimchi.message.error(data.responseJSON.reason); + wok.message.error(data.responseJSON.reason); errorCallback(); }); }); @@ -324,7 +324,7 @@ kimchi.setDefaultNetworkType = function(isInterfaceAvail) { $("#networkBriDisabledLabel").show(); } else { if (kimchi.capabilities && kimchi.capabilities.nm_running) { - kimchi.message.warn(i18n['KCHNET6001W']); + wok.message.warn(i18n['KCHNET6001W']); } $("#bridgeOptions").slideDown(100); $("#networkVlanID").toggle(false); diff --git a/plugins/kimchi/ui/js/src/kimchi.report_add_main.js b/plugins/kimchi/ui/js/src/kimchi.report_add_main.js index 9a7df2c..5f098d3 100644 --- a/plugins/kimchi/ui/js/src/kimchi.report_add_main.js +++ b/plugins/kimchi/ui/js/src/kimchi.report_add_main.js @@ -29,7 +29,7 @@ kimchi.report_add_main = function() { var reportName = nameTextbox.val(); var validator = RegExp("^[_A-Za-z0-9-]*$"); if (!validator.test(reportName)) { - kimchi.message.error.code('KCHDR6011M'); + wok.message.error.code('KCHDR6011M'); return false; } var formData = addReportForm.serializeObject(); @@ -39,13 +39,13 @@ kimchi.report_add_main = function() { return; } taskAccepted = true; - kimchi.window.close(); - kimchi.topic('kimchi/debugReportAdded').publish(); + wok.window.close(); + wok.topic('kimchi/debugReportAdded').publish(); }; kimchi.createReport(formData, function(result) { onTaskAccepted(); - kimchi.topic('kimchi/debugReportAdded').publish(); + wok.topic('kimchi/debugReportAdded').publish(); }, function(result) { // Error message from Async Task status if (result['message']) { @@ -55,7 +55,7 @@ kimchi.report_add_main = function() { else { var errText = result['responseJSON']['reason']; } - result && kimchi.message.error(errText); + result && wok.message.error(errText); taskAccepted && $('.grid-body-view table tr:first-child', diff --git a/plugins/kimchi/ui/js/src/kimchi.report_rename_main.js b/plugins/kimchi/ui/js/src/kimchi.report_rename_main.js index 6ee56d9..1bdb8d9 100644 --- a/plugins/kimchi/ui/js/src/kimchi.report_rename_main.js +++ b/plugins/kimchi/ui/js/src/kimchi.report_rename_main.js @@ -28,13 +28,13 @@ kimchi.report_rename_main = function() { // if the user hasn't changed the report's name, // nothing should be done. if (reportName == kimchi.selectedReport) { - kimchi.message.error.code('KCHDR6013M'); + wok.message.error.code('KCHDR6013M'); return false; } var validator = RegExp("^[A-Za-z0-9-]*$"); if (!validator.test(reportName)) { - kimchi.message.error.code('KCHDR6011M'); + wok.message.error.code('KCHDR6011M'); return false; } var formData = renameReportForm.serializeObject(); @@ -43,15 +43,15 @@ kimchi.report_rename_main = function() { kimchi.renameReport(kimchi.selectedReport, formData, function(result) { submitButton.prop('disabled', false); nameTextbox.prop('disabled', false); - kimchi.window.close(); - kimchi.topic('kimchi/debugReportRenamed').publish({ + wok.window.close(); + wok.topic('kimchi/debugReportRenamed').publish({ result: result }); }, function(result) { var errText = result && result['responseJSON'] && result['responseJSON']['reason']; - kimchi.message.error(errText); + wok.message.error(errText); submitButton.prop('disabled', false); nameTextbox.prop('disabled', false).focus(); }); diff --git a/plugins/kimchi/ui/js/src/kimchi.repository_add_main.js b/plugins/kimchi/ui/js/src/kimchi.repository_add_main.js index 2a277fd..656306b 100644 --- a/plugins/kimchi/ui/js/src/kimchi.repository_add_main.js +++ b/plugins/kimchi/ui/js/src/kimchi.repository_add_main.js @@ -81,13 +81,13 @@ kimchi.repository_add_main = function() { } kimchi.createRepository(formData, function() { - kimchi.topic('kimchi/repositoryAdded').publish(); - kimchi.window.close(); + wok.topic('kimchi/repositoryAdded').publish(); + wok.window.close(); }, function(jqXHR, textStatus, errorThrown) { var reason = jqXHR && jqXHR['responseJSON'] && jqXHR['responseJSON']['reason']; - kimchi.message.error(reason); + wok.message.error(reason); }); return false; }; diff --git a/plugins/kimchi/ui/js/src/kimchi.repository_edit_main.js b/plugins/kimchi/ui/js/src/kimchi.repository_edit_main.js index a9a0ca6..85e24d4 100644 --- a/plugins/kimchi/ui/js/src/kimchi.repository_edit_main.js +++ b/plugins/kimchi/ui/js/src/kimchi.repository_edit_main.js @@ -21,10 +21,10 @@ kimchi.repository_edit_main = function() { var saveButton = $('#repository-edit-button-save'); - if(kimchi.capabilities['repo_mngt_tool']=="yum") { + if(wok.capabilities['repo_mngt_tool']=="yum") { editForm.find('input.deb').prop('disabled', true); } - else if(kimchi.capabilities['repo_mngt_tool']=="deb") { + else if(wok.capabilities['repo_mngt_tool']=="deb") { editForm.find('input.yum').prop('disabled', true); } @@ -57,13 +57,13 @@ kimchi.repository_edit_main = function() { } kimchi.updateRepository(kimchi.selectedRepository, formData, function() { - kimchi.topic('kimchi/repositoryUpdated').publish(); - kimchi.window.close(); + wok.topic('kimchi/repositoryUpdated').publish(); + wok.window.close(); }, function(jqXHR, textStatus, errorThrown) { var reason = jqXHR && jqXHR['responseJSON'] && jqXHR['responseJSON']['reason']; - kimchi.message.error(reason); + wok.message.error(reason); }); return false; diff --git a/plugins/kimchi/ui/js/src/kimchi.storage_main.js b/plugins/kimchi/ui/js/src/kimchi.storage_main.js index 963bc10..1238c5f 100644 --- a/plugins/kimchi/ui/js/src/kimchi.storage_main.js +++ b/plugins/kimchi/ui/js/src/kimchi.storage_main.js @@ -22,15 +22,15 @@ kimchi.doListStoragePools = function() { var listHtml = ''; $.each(result, function(index, value) { value.usage = Math.round(value.allocated / value.capacity * 100) || 0; - value.capacity = kimchi.changetoProperUnit(value.capacity,1); - value.allocated = kimchi.changetoProperUnit(value.allocated,1); + value.capacity = wok.changetoProperUnit(value.capacity,1); + value.allocated = wok.changetoProperUnit(value.allocated,1); value.enableExt = value.type==="logical" ? "" : "hide-content"; if ('kimchi-iso' !== value.type) { - listHtml += kimchi.substitute(storageHtml, value); + listHtml += wok.substitute(storageHtml, value); } }); $('#storagepoolsList').html(listHtml); - if(kimchi.tabMode['storage'] === 'admin') { + if(wok.tabMode['storage'] === 'admin') { $('.storage-button').attr('style','display'); } else { $('.storage-allocate').addClass('storage-allocate-padding-user'); @@ -40,7 +40,7 @@ kimchi.doListStoragePools = function() { $('#storagepoolsList').html(''); } }, function(err) { - kimchi.message.error(err.responseJSON.reason); + wok.message.error(err.responseJSON.reason); }); } @@ -91,7 +91,7 @@ kimchi.storageBindClick = function() { } }); - if(kimchi.tabMode['storage'] === 'admin') { + if(wok.tabMode['storage'] === 'admin') { $('.pool-delete').on('click', function(event) { var $pool = $(this); var settings = { @@ -100,12 +100,12 @@ kimchi.storageBindClick = function() { confirm : i18n['KCHAPI6002M'], cancel : i18n['KCHAPI6003M'] }; - kimchi.confirm(settings, function() { + wok.confirm(settings, function() { var poolName = $pool.data('name'); kimchi.deleteStoragePool(poolName, function() { kimchi.doListStoragePools(); }, function(err) { - kimchi.message.error(err.responseJSON.reason); + wok.message.error(err.responseJSON.reason); }); }); }); @@ -115,7 +115,7 @@ kimchi.storageBindClick = function() { kimchi.changePoolState(poolName, 'activate', function() { kimchi.doListStoragePools(); }, function(err) { - kimchi.message.error(err.responseJSON.reason); + wok.message.error(err.responseJSON.reason); }); }); @@ -128,11 +128,11 @@ kimchi.storageBindClick = function() { cancel : i18n['KCHAPI6003M'] }; if (!$(this).data('persistent')) { - kimchi.confirm(settings, function() { + wok.confirm(settings, function() { kimchi.changePoolState(poolName, 'deactivate', function() { kimchi.doListStoragePools(); }, function(err) { - kimchi.message.error(err.responseJSON.reason); + wok.message.error(err.responseJSON.reason); }); }, function() { return false; @@ -142,7 +142,7 @@ kimchi.storageBindClick = function() { kimchi.changePoolState(poolName, 'deactivate', function() { kimchi.doListStoragePools(); }, function(err) { - kimchi.message.error(err.responseJSON.reason); + wok.message.error(err.responseJSON.reason); }); } }); @@ -150,7 +150,7 @@ kimchi.storageBindClick = function() { $('.pool-add-volume').on('click', function(event) { var poolName = $(this).data('name'); kimchi.selectedSP = poolName; - kimchi.window.open('storagepool-add-volume.html'); + wok.window.open('storagepool-add-volume.html'); }); $('.storage-action').on('click', function() { @@ -192,9 +192,9 @@ kimchi._generateVolumeHTML = function(volume) { return ''; } var volumeHtml = $('#volumeTmpl').html(); - volume.capacity = kimchi.changetoProperUnit(volume.capacity,1); - volume.allocation = kimchi.changetoProperUnit(volume.allocation,1); - return kimchi.substitute(volumeHtml, volume); + volume.capacity = wok.changetoProperUnit(volume.capacity,1); + volume.allocation = wok.changetoProperUnit(volume.allocation,1); + return wok.substitute(volumeHtml, volume); }; kimchi.doListVolumes = function(poolObj) { @@ -213,11 +213,11 @@ kimchi.doListVolumes = function(poolObj) { } kimchi.trackTask(tasks[i].id, function(result) { - kimchi.topic('kimchi/volumeTransferFinished').publish(result); + wok.topic('kimchi/volumeTransferFinished').publish(result); }, function(result) { - kimchi.topic('kimchi/volumeTransferError').publish(result); + wok.topic('kimchi/volumeTransferError').publish(result); }, function(result) { - kimchi.topic('kimchi/volumeTransferProgress').publish(result); + wok.topic('kimchi/volumeTransferProgress').publish(result); }); } }, null, true); @@ -265,14 +265,14 @@ kimchi.doListVolumes = function(poolObj) { } $.each(ongoingVolumesMap, function(volumeName, task) { - kimchi.topic('kimchi/volumeTransferProgress').publish(task); + wok.topic('kimchi/volumeTransferProgress').publish(task); }); poolObj.removeClass('in'); kimchi.changeArrow(handleArrow); slide.slideDown('slow'); }, function(err) { - kimchi.message.error(err.responseJSON.reason); + wok.message.error(err.responseJSON.reason); }); } @@ -291,7 +291,7 @@ kimchi.initLogicalPoolExtend = function() { if (data.length > 0) { for(var i=0;i<data.length;i++){ if (data[i].type === 'part' || data[i].type === 'disk') { - $('.host-partition', '#logicalPoolExtend').append(kimchi.substitute($('#logicalPoolExtendTmpl').html(), data[i])); + $('.host-partition', '#logicalPoolExtend').append(wok.substitute($('#logicalPoolExtendTmpl').html(), data[i])); } } } else { @@ -316,8 +316,8 @@ kimchi.initLogicalPoolExtend = function() { kimchi.updateStoragePool($("#logicalPoolExtend").dialog("option", "poolName"),{disks: devicePaths},function(data){ var item = $("#"+$("#logicalPoolExtend").dialog("option", "poolName")); $(".usage", $(".storage-name", item)).text((Math.round(data.allocated/data.capacity*100)||0)+"%"); - $(".storage-text", $(".storage-capacity", item)).text(kimchi.changetoProperUnit(data.capacity,1)); - $(".storage-text", $(".storage-allocate", item)).text(kimchi.changetoProperUnit(data.allocated,1)); + $(".storage-text", $(".storage-capacity", item)).text(wok.changetoProperUnit(data.capacity,1)); + $(".storage-text", $(".storage-allocate", item)).text(wok.changetoProperUnit(data.allocated,1)); }); $(this).dialog("close"); } @@ -326,23 +326,23 @@ kimchi.initLogicalPoolExtend = function() { } kimchi.storage_main = function() { - if(kimchi.tabMode['storage'] === 'admin') { + if(wok.tabMode['storage'] === 'admin') { $('.tools').attr('style','display'); $('#storage-pool-add').on('click', function() { - kimchi.window.open('storagepool-add.html'); + wok.window.open('storagepool-add.html'); }); $('.list-title .title-actions').attr('style','display'); } kimchi.doListStoragePools(); kimchi.initLogicalPoolExtend(); - kimchi.topic('kimchi/storageVolumeAdded').subscribe(function() { + wok.topic('kimchi/storageVolumeAdded').subscribe(function() { pool = kimchi.selectedSP; var poolNode = $('.storage-li[data-name="' + pool + '"]'); kimchi.doListVolumes(poolNode); }); - kimchi.topic('kimchi/volumeTransferProgress').subscribe(function(result) { + wok.topic('kimchi/volumeTransferProgress').subscribe(function(result) { var extractProgressData = function(data) { var sizeArray = /(\d+)\/(\d+)/g.exec(data) || [0, 0, 0]; var downloaded = sizeArray[1]; @@ -353,7 +353,7 @@ kimchi.storage_main = function() { percent = downloaded / total * 100; } } - var formatted = kimchi.formatMeasurement(downloaded); + var formatted = wok.formatMeasurement(downloaded); var size = (1.0 * formatted['v']).toFixed(1) + formatted['s']; return { size: size, @@ -377,7 +377,7 @@ kimchi.storage_main = function() { $('.progress-status', volumeBox).text(i18n['KCHPOOL6014M']); }); - kimchi.topic('kimchi/volumeTransferFinished').subscribe(function(result) { + wok.topic('kimchi/volumeTransferFinished').subscribe(function(result) { var uriElements = result.target_uri.split('/'); var poolName = uriElements[2]; var volumeName = uriElements.pop(); @@ -387,11 +387,11 @@ kimchi.storage_main = function() { var html = kimchi._generateVolumeHTML(volume); $(volumeBox).replaceWith(html); }, function(err) { - kimchi.message.error(err.responseJSON.reason); + wok.message.error(err.responseJSON.reason); }); }); - kimchi.topic('kimchi/volumeTransferError').subscribe(function(result) { + wok.topic('kimchi/volumeTransferError').subscribe(function(result) { // Error message from Async Task status if (result['message']) { var errText = result['message']; @@ -400,7 +400,7 @@ kimchi.storage_main = function() { else { var errText = result['responseJSON']['reason']; } - result && kimchi.message.error(errText); + result && wok.message.error(errText); var uriElements = result.target_uri.split('/'); var poolName = uriElements[2]; diff --git a/plugins/kimchi/ui/js/src/kimchi.storagepool_add_main.js b/plugins/kimchi/ui/js/src/kimchi.storagepool_add_main.js index e33a299..91026ca 100644 --- a/plugins/kimchi/ui/js/src/kimchi.storagepool_add_main.js +++ b/plugins/kimchi/ui/js/src/kimchi.storagepool_add_main.js @@ -80,7 +80,7 @@ kimchi.setupISCSI = function(){ }, function(data){ $('input', "#iSCSITarget").attr("placeholder", i18n['KCHPOOL6008M']); callback(); - kimchi.message.error(data.responseJSON.reason); + wok.message.error(data.responseJSON.reason); }); }; var triggerLoadTarget = function(){ @@ -129,7 +129,7 @@ kimchi.initStorageAddPage = function() { valid_types = ['part', 'disk', 'mpath']; $.each(data, function(index, value) { if (valid_types.indexOf(value.type) != -1) { - listHtml += kimchi.substitute(deviceHtml, value); + listHtml += wok.substitute(deviceHtml, value); } }); $('.host-partition', '#form-pool-add').html(listHtml); @@ -199,7 +199,7 @@ kimchi.initStorageAddPage = function() { } }); $('#nfsserverId').on("change keyup",function() { - if ($(this).val() !== '' && kimchi.isServer($(this).val())) { + if ($(this).val() !== '' && wok.isServer($(this).val())) { $('#nfspathId').prop('disabled',false); $(this).removeClass("invalid-field"); } else { @@ -248,9 +248,9 @@ kimchi.initStorageAddPage = function() { $(this).toggleClass("invalid-field",!/^[0-9]*$/.test($(this).val())); }); $('#iscsiserverId').keyup(function(event) { - $(this).toggleClass("invalid-field",!kimchi.isServer($(this).val().trim())); + $(this).toggleClass("invalid-field",!wok.isServer($(this).val().trim())); }).change(function(event) { - $(this).toggleClass("invalid-field",!kimchi.isServer($(this).val().trim())); + $(this).toggleClass("invalid-field",!wok.isServer($(this).val().trim())); }); kimchi.setupISCSI(); }; @@ -299,7 +299,7 @@ kimchi.validateForm = function() { kimchi.validateDirForm = function () { var path = $('#pathId').val(); if (!/(^\/.*)$/.test(path)) { - kimchi.message.error.code('KCHAPI6003E'); + wok.message.error.code('KCHAPI6003E'); return false; } return true; @@ -312,7 +312,7 @@ kimchi.validateNfsForm = function () { return false; } if (!/((\/([0-9a-zA-Z-_\.]+)))$/.test(nfspath)) { - kimchi.message.error.code('KCHPOOL6005E'); + wok.message.error.code('KCHPOOL6005E'); return false; } $('#nfs-mount-loading').removeClass('hidden'); @@ -329,8 +329,8 @@ kimchi.validateIscsiForm = function() { }; kimchi.validateServer = function(serverField) { - if(!kimchi.isServer(serverField)) { - kimchi.message.error.code('KCHPOOL6009E'); + if(!wok.isServer(serverField)) { + wok.message.error.code('KCHPOOL6009E'); return false; } return true; @@ -338,7 +338,7 @@ kimchi.validateServer = function(serverField) { kimchi.validateLogicalForm = function () { if ($("input[name=devices]:checked").length === 0) { - kimchi.message.error.code('KCHPOOL6006E'); + wok.message.error.code('KCHPOOL6006E'); return false; } else { return true; @@ -389,9 +389,9 @@ kimchi.addPool = function(event) { $('#pool-loading').show(); kimchi.createStoragePool(formData, function() { kimchi.doListStoragePools(); - kimchi.window.close(); + wok.window.close(); }, function(err) { - kimchi.message.error(err.responseJSON.reason); + wok.message.error(err.responseJSON.reason); $('input', '#form-pool-add').removeAttr('disabled'); $('#pool-loading').hide(); $('#pool-doAdd').show(); @@ -404,7 +404,7 @@ kimchi.addPool = function(event) { confirm : i18n['KCHAPI6002M'], cancel : i18n['KCHAPI6003M'] }; - kimchi.confirm(settings, function() { + wok.confirm(settings, function() { storagePoolAddingFunc(); }, function() { }); diff --git a/plugins/kimchi/ui/js/src/kimchi.storagepool_add_volume_main.js b/plugins/kimchi/ui/js/src/kimchi.storagepool_add_volume_main.js index c56f68c..8479ab2 100644 --- a/plugins/kimchi/ui/js/src/kimchi.storagepool_add_volume_main.js +++ b/plugins/kimchi/ui/js/src/kimchi.storagepool_add_volume_main.js @@ -63,7 +63,7 @@ kimchi.sp_add_volume_main = function() { var msg = result['message'] || ( result['responseJSON'] && result['responseJSON']['reason'] ); - kimchi.message.error(msg); + wok.message.error(msg); }; var fetchRemoteFile = function() { @@ -73,8 +73,8 @@ kimchi.sp_add_volume_main = function() { sp: kimchi.selectedSP, url: volumeURL }, function(result) { - kimchi.window.close(); - kimchi.topic('kimchi/storageVolumeAdded').publish(); + wok.window.close(); + wok.topic('kimchi/storageVolumeAdded').publish(); }, onError); }; @@ -91,7 +91,7 @@ kimchi.sp_add_volume_main = function() { capacity: blobFile.size, upload: true }, function(result) { - kimchi.window.close(); + wok.window.close(); trackVolCreation(result.id); }, onError); }; @@ -117,14 +117,14 @@ kimchi.sp_add_volume_main = function() { var reader = new FileReader(); reader.onloadend = function(e) { if (e.loaded == 0) - kimchi.message.error.code('KCHAPI6008E'); + wok.message.error.code('KCHAPI6008E'); else createUploadVol(); }; reader.readAsBinaryString(blob); } catch (err) { - kimchi.message.error.code('KCHAPI6008E'); + wok.message.error.code('KCHAPI6008E'); return; } @@ -134,14 +134,14 @@ kimchi.sp_add_volume_main = function() { var reader = new FileReader(); reader.onloadend = function(e) { if (e.loaded == 0) - kimchi.message.error.code('KCHAPI6009E'); + wok.message.error.code('KCHAPI6009E'); else uploadRequest(blob); }; reader.readAsBinaryString(blob); } catch (err) { - kimchi.message.error.code('KCHAPI6009E'); + wok.message.error.code('KCHAPI6009E'); return; } } @@ -156,7 +156,7 @@ kimchi.sp_add_volume_main = function() { trackVolCreation(taskid); }, 2000); } else { - kimchi.topic('kimchi/storageVolumeAdded').publish(); + wok.topic('kimchi/storageVolumeAdded').publish(); doUpload(); } } diff --git a/plugins/kimchi/ui/js/src/kimchi.template_add_main.js b/plugins/kimchi/ui/js/src/kimchi.template_add_main.js index e449212..5528eb2 100644 --- a/plugins/kimchi/ui/js/src/kimchi.template_add_main.js +++ b/plugins/kimchi/ui/js/src/kimchi.template_add_main.js @@ -56,7 +56,7 @@ kimchi.template_add_main = function() { $('#iso-search').show(); } }, function(err) { - kimchi.message.error(err.responseJSON.reason); + wok.message.error(err.responseJSON.reason); }); }); @@ -71,7 +71,7 @@ kimchi.template_add_main = function() { var settings = { content : i18n['KCHTMPL6002M'] }; - kimchi.confirm(settings, function() { + wok.confirm(settings, function() { $('#iso-search').hide(); $('#iso-search-loading').show(); deepScan('#iso-search'); @@ -82,7 +82,7 @@ kimchi.template_add_main = function() { var settings = { content : i18n['KCHTMPL6002M'] }; - kimchi.confirm(settings, function() { + wok.confirm(settings, function() { $('#iso-more').hide(); $('#iso-more-loading').show(); deepScan('#iso-more'); @@ -116,7 +116,7 @@ kimchi.template_add_main = function() { showLocalIsoField(isos); } else { if (isFinished) { - kimchi.message.warn(i18n['KCHTMPL6001W']); + wok.message.warn(i18n['KCHTMPL6001W']); } } if (isFinished) { @@ -124,7 +124,7 @@ kimchi.template_add_main = function() { $(button).show(); } }, function(err) { - kimchi.message.error(err.responseJSON.reason); + wok.message.error(err.responseJSON.reason); $(button + '-loading').hide(); $(button).show(); }); @@ -150,9 +150,9 @@ kimchi.template_add_main = function() { var isoId = volume.os_distro + '*' + volume.name + '*' + volume.os_version; if (!kimchi.isoInfo[isoId]) { volume.isoId = isoId; - volume.capacity = kimchi.changetoProperUnit(volume.capacity, 1); + volume.capacity = wok.changetoProperUnit(volume.capacity, 1); kimchi.isoInfo[isoId] = volume; - html += kimchi.substitute(template, volume); + html += wok.substitute(template, volume); } }); $('#list-local-iso').append(html); @@ -211,7 +211,7 @@ kimchi.template_add_main = function() { $('#btn-template-file-create').click(function() { var isoFile = $('#iso-file').val(); if (!kimchi.template_check_path(isoFile)) { - kimchi.message.error.code('KCHAPI6003E'); + wok.message.error.code('KCHAPI6003E'); return; } var data = { @@ -224,12 +224,12 @@ kimchi.template_add_main = function() { $('#iso-remote').css('opacity', 0.3).css('cursor', 'not-allowed'); var enabledRemoteIso = function() { - if (kimchi.capabilities == undefined) { + if (wok.capabilities == undefined) { setTimeout(enabledRemoteIso, 2000); return; } - if (kimchi.capabilities.qemu_stream != true) { + if (wok.capabilities.qemu_stream != true) { return; } @@ -269,7 +269,7 @@ kimchi.template_add_main = function() { if (!kimchi.isoInfo[isoId]) { volume.isoId = isoId; kimchi.isoInfo[isoId] = volume; - html += kimchi.substitute(template, volume); + html += wok.substitute(template, volume); } }); $('#list-remote-iso').html(html); @@ -279,7 +279,7 @@ kimchi.template_add_main = function() { } else { $('#load-remote-iso').hide() $('#iso-url-field').show(); - kimchi.message.warn(i18n['KCHTMPL6001W']); + wok.message.warn(i18n['KCHTMPL6001W']); } }; @@ -365,7 +365,7 @@ kimchi.template_add_main = function() { $('#btn-template-url-create').click(function() { var isoUrl = $('#iso-url').val(); if (!kimchi.template_check_url(isoUrl)) { - kimchi.message.error.code('KCHAPI6004E'); + wok.message.error.code('KCHAPI6004E'); return; } var data = { @@ -379,11 +379,11 @@ kimchi.template_add_main = function() { kimchi.createTemplate(data, function() { if(callback) callback(); kimchi.doListTemplates(); - kimchi.window.close(); - kimchi.topic('templateCreated').publish(); + wok.window.close(); + wok.topic('templateCreated').publish(); }, function(err) { if(callback) callback(); - kimchi.message.error(err.responseJSON.reason); + wok.message.error(err.responseJSON.reason); }); }; @@ -403,12 +403,12 @@ kimchi.template_add_main = function() { $('input[value="' + isoInfo.isoId + '"]').prop('checked', false); $('.check-all>input').prop('checked', false); kimchi.doListTemplates(); - kimchi.topic('templateCreated').publish(data); + wok.topic('templateCreated').publish(data); if (successNum === length) { - kimchi.window.close(); + wok.window.close(); } }, function(err) { - kimchi.message.error(err.responseJSON.reason); + wok.message.error(err.responseJSON.reason); }); }; if (formData.iso instanceof Array) { diff --git a/plugins/kimchi/ui/js/src/kimchi.template_edit_main.js b/plugins/kimchi/ui/js/src/kimchi.template_edit_main.js index 21f5575..d336729 100644 --- a/plugins/kimchi/ui/js/src/kimchi.template_edit_main.js +++ b/plugins/kimchi/ui/js/src/kimchi.template_edit_main.js @@ -49,11 +49,11 @@ kimchi.template_edit_main = function() { $('#template-edit-graphics').append('<option>Spice</option>'); kimchi.select('template-edit-graphics-list', vncOpt); var enableSpice = function() { - if (kimchi.capabilities == undefined) { + if (wok.capabilities == undefined) { setTimeout(enableSpice, 2000); return; } - if (kimchi.capabilities.qemu_spice == true) { + if (wok.capabilities.qemu_spice == true) { spiceOpt = [{label: 'Spice', value: 'spice'}] kimchi.select('template-edit-graphics-list', spiceOpt); } @@ -63,7 +63,7 @@ kimchi.template_edit_main = function() { var scsipools = {}; var addStorageItem = function(storageData) { var thisName = storageData.storageName; - var nodeStorage = $.parseHTML(kimchi.substitute($('#template-storage-pool-tmpl').html(), storageData)); + var nodeStorage = $.parseHTML(wok.substitute($('#template-storage-pool-tmpl').html(), storageData)); $('.template-tab-body', '#form-template-storage').append(nodeStorage); var storageOptions = ''; var scsiOptions = ''; @@ -185,7 +185,7 @@ kimchi.template_edit_main = function() { var networkItemNum = 0; var addInterfaceItem = function(networkData) { var networkName = networkData.networkV; - var nodeInterface = $.parseHTML(kimchi.substitute($('#template-interface-tmpl').html(), networkData)); + var nodeInterface = $.parseHTML(wok.substitute($('#template-interface-tmpl').html(), networkData)); $('.template-tab-body', '#form-template-interface').append(nodeInterface); $('.delete', '#form-template-interface').button({ icons : {primary : 'ui-icon-trash'}, @@ -335,9 +335,9 @@ kimchi.template_edit_main = function() { kimchi.updateTemplate($('#template-name').val(), data, function() { kimchi.doListTemplates(); - kimchi.window.close(); + wok.window.close(); }, function(err) { - kimchi.message.error(err.responseJSON.reason); + wok.message.error(err.responseJSON.reason); }); }); }; diff --git a/plugins/kimchi/ui/js/src/kimchi.template_main.js b/plugins/kimchi/ui/js/src/kimchi.template_main.js index 775cb0b..5d474bd 100644 --- a/plugins/kimchi/ui/js/src/kimchi.template_main.js +++ b/plugins/kimchi/ui/js/src/kimchi.template_main.js @@ -38,7 +38,7 @@ kimchi.doListTemplates = function() { }else{ value.location = "images/theme-default/icon-remote.png"; } - listHtml += kimchi.substitute(templateHtml, value); + listHtml += wok.substitute(templateHtml, value); }); $('#templateList').html(listHtml); kimchi.templateBindClick(); @@ -48,7 +48,7 @@ kimchi.doListTemplates = function() { } $('html').removeClass('processing'); }, function(err) { - kimchi.message.error(err.responseJSON.reason); + wok.message.error(err.responseJSON.reason); $('html').removeClass('processing'); }); }; @@ -57,7 +57,7 @@ kimchi.templateBindClick = function() { $('.template-edit').on('click', function(event) { var templateName = $(this).data('template'); kimchi.selectedTemplate = templateName; - kimchi.window.open("template-edit.html"); + wok.window.open("template-edit.html"); }); $('.template-clone').on('click', function(event) { kimchi.selectedTemplate = $(this).data('template'); @@ -65,7 +65,7 @@ kimchi.templateBindClick = function() { kimchi.cloneTemplate(kimchi.selectedTemplate, function() { kimchi.doListTemplates(); }, function(err) { - kimchi.message.error(err.responseJSON.reason); + wok.message.error(err.responseJSON.reason); kimchi.doListTemplates(); }); }); @@ -77,12 +77,12 @@ kimchi.templateBindClick = function() { confirm : i18n['KCHAPI6002M'], cancel : i18n['KCHAPI6003M'] }; - kimchi.confirm(settings, function() { + wok.confirm(settings, function() { var templateName = $template.data('template'); kimchi.deleteTemplate(templateName, function() { kimchi.doListTemplates(); }, function(err) { - kimchi.message.error(err.responseJSON.reason); + wok.message.error(err.responseJSON.reason); }); }, function() { }); @@ -93,10 +93,10 @@ kimchi.hideTitle = function() { }; kimchi.template_main = function() { - if(kimchi.tabMode['templates'] === 'admin') { + if(wok.tabMode['templates'] === 'admin') { $('.tools').attr('style','display'); $("#template-add").on("click", function(event) { - kimchi.window.open({ + wok.window.open({ url: 'template-add.html', close: function() { if (kimchi.deepScanHandler) { diff --git a/plugins/kimchi/ui/spice-html5/pages/spice_auto.html b/plugins/kimchi/ui/spice-html5/pages/spice_auto.html index 40afea4..c87f5c2 100644 --- a/plugins/kimchi/ui/spice-html5/pages/spice_auto.html +++ b/plugins/kimchi/ui/spice-html5/pages/spice_auto.html @@ -140,7 +140,7 @@ * * 'uri = scheme + host + ":" + port;' * - * to point Kimchi user to a specific console represented by + * to point wok.user to a specific console represented by * token value. */ uri = scheme + host + ":" + port + "/?token=" + token; diff --git a/plugins/sample/API.json b/plugins/sample/API.json index ebc596b..6ee7d91 100644 --- a/plugins/sample/API.json +++ b/plugins/sample/API.json @@ -1,7 +1,7 @@ { "$schema": "http://json-schema.org/draft-03/schema#", "title": "Plugin Sample API", - "description": "Json schema for Kimchi's Sample Plugin API", + "description": "Json schema for Wok's Sample Plugin API", "type": "object", "error": "SPAPI0001E", "properties": { diff --git a/plugins/sample/__init__.py b/plugins/sample/__init__.py index d741ddb..786832f 100644 --- a/plugins/sample/__init__.py +++ b/plugins/sample/__init__.py @@ -48,7 +48,7 @@ class Drawings(Root): @expose def index(self): - return 'This is a sample plugin for Kimchi' + return 'This is a sample plugin for Wok' class Description(Resource): diff --git a/plugins/sample/sample.conf.in b/plugins/sample/sample.conf.in index 28ae891..9da33e1 100644 --- a/plugins/sample/sample.conf.in +++ b/plugins/sample/sample.conf.in @@ -1,4 +1,4 @@ -[kimchi] +[wok] enable = @ENABLE_SAMPLE@ plugin_class = "Drawings" uri = "/plugins/sample" @@ -7,19 +7,19 @@ uri = "/plugins/sample" tools.nocache.on = True tools.trailing_slash.on = False tools.sessions.on = True -tools.sessions.name = 'kimchi' +tools.sessions.name = 'wok' tools.sessions.httponly = True tools.sessions.locking = 'explicit' tools.sessions.storage_type = 'ram' [/description] -tools.kimchiauth.on = True +tools.wokauth.on = True [/rectangles] -tools.kimchiauth.on = True +tools.wokauth.on = True [/circles] -tools.kimchiauth.on = True +tools.wokauth.on = True [/help] tools.staticdir.on = True diff --git a/plugins/sample/ui/js/util.js b/plugins/sample/ui/js/util.js index 157ddde..1e6c4df 100644 --- a/plugins/sample/ui/js/util.js +++ b/plugins/sample/ui/js/util.js @@ -19,7 +19,7 @@ sample = {}; sample.description = function(suc, err){ - kimchi.requestJSON({ + wok.requestJSON({ url : kimchi.url + 'plugins/sample/description', type : 'GET', contentType : 'application/json', @@ -27,7 +27,7 @@ sample.description = function(suc, err){ resend : true, success : suc, error : err || function(data) { - kimchi.message.error(data.responseJSON.reason); + wok.message.error(data.responseJSON.reason); } }); }; diff --git a/plugins/sample/ui/pages/help/en_US/sample-tab1.html b/plugins/sample/ui/pages/help/en_US/sample-tab1.html index 70aa1c0..7122124 100644 --- a/plugins/sample/ui/pages/help/en_US/sample-tab1.html +++ b/plugins/sample/ui/pages/help/en_US/sample-tab1.html @@ -1 +1 @@ -Help page for TAB 1 of Kimchi's Sample plugin. +Help page for TAB 1 of Wok's Sample plugin. diff --git a/plugins/sample/ui/pages/help/en_US/sample-tab2.html b/plugins/sample/ui/pages/help/en_US/sample-tab2.html index 367318f..1bfe448 100644 --- a/plugins/sample/ui/pages/help/en_US/sample-tab2.html +++ b/plugins/sample/ui/pages/help/en_US/sample-tab2.html @@ -1 +1 @@ -Help page for TAB 2 of Kimchi's Sample plugin. +Help page for TAB 2 of Wok's Sample plugin. diff --git a/src/nginx/wok.conf.in b/src/nginx/wok.conf.in index b0faea3..ce99115 100644 --- a/src/nginx/wok.conf.in +++ b/src/nginx/wok.conf.in @@ -18,7 +18,7 @@ # 02110-1301 USA # This is a template file to be used to generate a nginx -# proxy config file at kimchid script. +# proxy config file at wokd script. user ${user}; worker_processes 1; @@ -41,7 +41,7 @@ http { client_max_body_size ${max_body_size}k; # Timeout set to 10 minutes to avoid the 504 Gateway Timeout - # when Kimchi is processing a request. + # when Wok is processing a request. proxy_connect_timeout 600; proxy_send_timeout 600; proxy_read_timeout 600; @@ -63,11 +63,11 @@ http { add_header X-XSS-Protection "1; mode=block"; location / { - proxy_pass http://127.0.0.1:${kimchid_port}; + proxy_pass http://127.0.0.1:${wokd_port}; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_redirect http://127.0.0.1:${kimchid_port}/ https://$host:${proxy_ssl_port}/; + proxy_redirect http://127.0.0.1:${wokd_port}/ https://$host:${proxy_ssl_port}/; } } diff --git a/src/wok.conf.in b/src/wok.conf.in index cd141f5..60d826f 100644 --- a/src/wok.conf.in +++ b/src/wok.conf.in @@ -1,5 +1,5 @@ # -# Configuration file for Kimchi Web Server +# Configuration file for Wok Web Server # [server] @@ -16,17 +16,17 @@ #cherrypy_port = 8010 # The full path to an SSL Certificate in PEM format. If left unspecified, -# Kimchi will generate a self-signed certificate automatically. +# Wok will generate a self-signed certificate automatically. #ssl_cert = # The corresponding private key in PEM format for the SSL Certificate supplied -# above. If left blank, Kimchi will generate a self-signed certificate. +# above. If left blank, Wok will generate a self-signed certificate. #ssl_key = # Running environment of the server #environment = production -# Federation feature: register Kimchi server on openSLP and discover peers +# Federation feature: register Wok server on openSLP and discover peers # in the same network. Check README-federation for more details. #federation = off @@ -38,7 +38,7 @@ [logging] # Log directory -#log_dir = @localstatedir@/log/kimchi +#log_dir = @localstatedir@/log/wok # Logging level: debug, info, warning, error or critical #log_level = debug @@ -56,10 +56,10 @@ # ldap_server = "localhost" # Search tree base in ldap -# ldap_search_base = "ou=People, dc=kimchi, dc=org" +# ldap_search_base = "ou=People, dc=wok, dc=org" # User id filter # ldap_search_filter = "uid=%(username)s" -# User IDs regarded as kimchi admin +# User IDs regarded as Wok admin # ldap_admin_id = "foo@foo.com, bar@bar.com" diff --git a/src/wok/auth.py b/src/wok/auth.py index 6bd1566..cc470b6 100644 --- a/src/wok/auth.py +++ b/src/wok/auth.py @@ -259,8 +259,8 @@ def check_auth_session(): cherrypy.session.release_lock() if session is not None: debug("Session authenticated for user %s" % session) - kimchiRobot = cherrypy.request.headers.get('Kimchi-Robot') - if kimchiRobot == "kimchi-robot": + wokRobot = cherrypy.request.headers.get('Wok-Robot') + if wokRobot == "wok-robot": if (time.time() - cherrypy.session[REFRESH] > cherrypy.session.timeout * 60): cherrypy.session[USER_NAME] = None @@ -327,8 +327,8 @@ def logout(): cherrypy.lib.sessions.close() -def kimchiauth(): - debug("Entering kimchiauth...") +def wokauth(): + debug("Entering wokauth...") session_missing = cherrypy.session.missing if check_auth_session(): return @@ -346,7 +346,7 @@ def kimchiauth(): raise cherrypy.HTTPError(401, "sessionTimeout") if not from_browser(): - cherrypy.response.headers['WWW-Authenticate'] = 'Basic realm=kimchi' + cherrypy.response.headers['WWW-Authenticate'] = 'Basic realm=wok' e = InvalidOperation('KCHAUTH0002E') raise cherrypy.HTTPError(401, e.message.encode('utf-8')) diff --git a/src/wok/config.py.in b/src/wok/config.py.in index 019f42f..4c97840 100644 --- a/src/wok/config.py.in +++ b/src/wok/config.py.in @@ -29,8 +29,8 @@ from ConfigParser import SafeConfigParser from kimchi.xmlutils.utils import xpath_get_text -__version__ = "@kimchiversion@" -__release__ = "@kimchirelease@" +__version__ = "@wokversion@" +__release__ = "@wokrelease@" __with_spice__ = "@withspice@" DEFAULT_LOG_LEVEL = "debug" @@ -113,11 +113,11 @@ class Paths(object): if self.installed: self.nginx_conf_dir = '@sysconfdir@/nginx/conf.d' - self.state_dir = '@localstatedir@/lib/kimchi' - self.log_dir = '@localstatedir@/log/kimchi' - self.conf_dir = '@sysconfdir@/kimchi' - self.src_dir = '@kimchidir@' - self.plugins_dir = '@kimchidir@/plugins' + self.state_dir = '@localstatedir@/lib/wok' + self.log_dir = '@localstatedir@/log/wok' + self.conf_dir = '@sysconfdir@/wok' + self.src_dir = '@wokdir@' + self.plugins_dir = '@wokdir@/plugins' self.mo_dir = '@prefix@/share/locale' self.spice_css_file = os.path.join(self.spice_dir, 'spice.css') else: @@ -125,7 +125,7 @@ class Paths(object): self.state_dir = self.add_prefix('data') self.log_dir = self.add_prefix('log') self.conf_dir = self.add_prefix('src') - self.src_dir = self.add_prefix('src/kimchi') + self.src_dir = self.add_prefix('src/wok') self.plugins_dir = self.add_prefix('plugins') self.mo_dir = self.add_prefix('mo') self.spice_css_file = os.path.join(self.spice_dir, 'css/spice.css') @@ -158,8 +158,8 @@ class PluginPaths(Paths): self.plugin_dir = os.path.join('plugins', name) if self.installed: - self.conf_dir = '@sysconfdir@/kimchi/plugins.d' - self.src_dir = os.path.join('@kimchidir@', self.plugin_dir) + self.conf_dir = '@sysconfdir@/wok/plugins.d' + self.src_dir = os.path.join('@wokdir@', self.plugin_dir) else: self.conf_dir = self.add_prefix(self.plugin_dir) self.src_dir = self.add_prefix(self.plugin_dir) @@ -188,30 +188,30 @@ class UIConfig(dict): self.update(ui_configs) -class KimchiConfig(dict): +class WokConfig(dict): # session time out is 10 minutes SESSIONSTIMEOUT = 10 - kimchi_config = { + wok_config = { '/': { 'tools.trailing_slash.on': False, 'request.methods_with_bodies': ('POST', 'PUT'), 'tools.nocache.on': True, 'tools.proxy.on': True, 'tools.sessions.on': True, - 'tools.sessions.name': 'kimchi', + 'tools.sessions.name': 'wok', 'tools.sessions.secure': True, 'tools.sessions.httponly': True, 'tools.sessions.locking': 'explicit', 'tools.sessions.storage_type': 'ram', 'tools.sessions.timeout': SESSIONSTIMEOUT, - 'tools.kimchiauth.on': False + 'tools.wokauth.on': False }, '/novnc': { 'tools.staticdir.on': True, 'tools.staticdir.dir': paths.novnc_dir, 'tools.nocache.on': True, - 'tools.kimchiauth.on': True + 'tools.wokauth.on': True }, '/spice_auto.html': { 'tools.staticfile.on': True, @@ -229,8 +229,8 @@ class KimchiConfig(dict): 'tools.staticfile.filename': paths.spice_css_file, 'tools.nocache.on': True, }, - '/kimchi-ui.html': { - 'tools.kimchiauth.on': True + '/wok-ui.html': { + 'tools.wokauth.on': True }, '/data/screenshots': { 'tools.staticdir.on': True, @@ -267,8 +267,8 @@ class KimchiConfig(dict): } def __init__(self): - super(KimchiConfig, self).__init__(self) - self.update(self.kimchi_config) + super(WokConfig, self).__init__(self) + self.update(self.wok_config) self.update(UIConfig(paths)) @@ -311,7 +311,7 @@ def _get_config(): config.add_section("display") config.set("display", "display_proxy_port", "64667") - config_file = os.path.join(paths.conf_dir, 'kimchi.conf') + config_file = os.path.join(paths.conf_dir, 'wok.conf') if os.path.exists(config_file): config.read(config_file) return config diff --git a/src/wok/control/base.py b/src/wok/control/base.py index d926a63..8cfa51c 100644 --- a/src/wok/control/base.py +++ b/src/wok/control/base.py @@ -28,7 +28,7 @@ from wok.control.utils import get_class_name, internal_redirect, model_fn from wok.control.utils import parse_request, validate_method from wok.control.utils import validate_params from wok.exception import InvalidOperation, InvalidParameter -from wok.exception import KimchiException, MissingParameter, NotFoundError +from wok.exception import WokException, MissingParameter, NotFoundError from wok.exception import OperationFailed, UnauthorizedError @@ -127,7 +127,7 @@ class Resource(object): raise cherrypy.HTTPError(404, e.message) except OperationFailed, e: raise cherrypy.HTTPError(500, e.message) - except KimchiException, e: + except WokException, e: raise cherrypy.HTTPError(500, e.message) wrapper.__name__ = action_name @@ -178,7 +178,7 @@ class Resource(object): raise cherrypy.HTTPError(404, e.message) except OperationFailed, e: raise cherrypy.HTTPError(500, e.message) - except KimchiException, e: + except WokException, e: raise cherrypy.HTTPError(500, e.message) def is_authorized(self): @@ -338,7 +338,7 @@ class Collection(object): raise cherrypy.HTTPError(404, e.message) except OperationFailed, e: raise cherrypy.HTTPError(500, e.message) - except KimchiException, e: + except WokException, e: raise cherrypy.HTTPError(500, e.message) diff --git a/src/wok/exception.py b/src/wok/exception.py index f41028b..6f5e9d9 100644 --- a/src/wok/exception.py +++ b/src/wok/exception.py @@ -25,7 +25,7 @@ from wok.i18n import messages as _messages from wok.template import get_lang, validate_language -class KimchiException(Exception): +class WokException(Exception): def __init__(self, code='', args={}): self.code = code @@ -38,7 +38,7 @@ class KimchiException(Exception): # In case the value formats itself to an ascii string. args[key] = unicode(str(value), 'utf-8') except UnicodeEncodeError: - # In case the value is a KimchiException or it formats + # In case the value is a WokException or it formats # itself to a unicode string. args[key] = unicode(value) @@ -66,37 +66,37 @@ class KimchiException(Exception): return translation.gettext(text) -class NotFoundError(KimchiException): +class NotFoundError(WokException): pass -class OperationFailed(KimchiException): +class OperationFailed(WokException): pass -class MissingParameter(KimchiException): +class MissingParameter(WokException): pass -class InvalidParameter(KimchiException): +class InvalidParameter(WokException): pass -class InvalidOperation(KimchiException): +class InvalidOperation(WokException): pass -class IsoFormatError(KimchiException): +class IsoFormatError(WokException): pass -class ImageFormatError(KimchiException): +class ImageFormatError(WokException): pass -class TimeoutExpired(KimchiException): +class TimeoutExpired(WokException): pass -class UnauthorizedError(KimchiException): +class UnauthorizedError(WokException): pass diff --git a/src/wok/objectstore.py b/src/wok/objectstore.py index 7c2a5cc..87a30d1 100644 --- a/src/wok/objectstore.py +++ b/src/wok/objectstore.py @@ -30,7 +30,7 @@ except ImportError: from wok import config from wok.exception import NotFoundError -from wok.utils import kimchi_log +from wok.utils import wok_log class ObjectStoreSession(object): @@ -129,5 +129,5 @@ class ObjectStore(object): if type is not None and issubclass(type, sqlite3.DatabaseError): # Logs the error and return False, which makes __exit__ raise # exception again - kimchi_log.error(traceback.format_exc()) + wok_log.error(traceback.format_exc()) return False diff --git a/src/wok/proxy.py b/src/wok/proxy.py index 1c46c11..961f8a7 100644 --- a/src/wok/proxy.py +++ b/src/wok/proxy.py @@ -34,13 +34,13 @@ from wok.config import paths def _create_proxy_config(options): """Create nginx configuration file based on current ports config - To allow flexibility in which port kimchi runs, we need the same + To allow flexibility in which port wok runs, we need the same flexibility with the nginx proxy. This method creates the config file dynamically by using 'nginx.conf.in' as a template, creating - the file 'kimchi.conf' which will be used to launch the proxy. + the file 'wok.conf' which will be used to launch the proxy. Arguments: - options - OptionParser object with Kimchi config options + options - OptionParser object with Wok config options """ # User that will run the worker process of the proxy. Fedora, # RHEL and Suse creates an user called 'nginx' when installing @@ -58,8 +58,8 @@ def _create_proxy_config(options): # No certificates specified by the user if not cert or not key: - cert = '%s/kimchi-cert.pem' % config_dir - key = '%s/kimchi-key.pem' % config_dir + cert = '%s/wok-cert.pem' % config_dir + key = '%s/wok-key.pem' % config_dir # create cert files if they don't exist if not os.path.exists(cert) or not os.path.exists(key): ssl_gen = sslcert.SSLCert() @@ -73,19 +73,19 @@ def _create_proxy_config(options): # Read template file and create a new config file # with the specified parameters. - with open(os.path.join(nginx_config_dir, "kimchi.conf.in")) as template: + with open(os.path.join(nginx_config_dir, "wok.conf.in")) as template: data = template.read() data = Template(data) data = data.safe_substitute(user=user_proxy, proxy_port=options.port, - kimchid_port=options.cherrypy_port, + wokd_port=options.cherrypy_port, proxy_ssl_port=options.ssl_port, cert_pem=cert, cert_key=key, max_body_size=eval(options.max_body_size), dhparams_pem=dhparams_pem) # Write file to be used for nginx. - config_file = open(os.path.join(nginx_config_dir, "kimchi.conf"), "w") + config_file = open(os.path.join(nginx_config_dir, "wok.conf"), "w") config_file.write(data) config_file.close() @@ -94,7 +94,7 @@ def start_proxy(options): """Start nginx reverse proxy.""" _create_proxy_config(options) nginx_config_dir = paths.nginx_conf_dir - config_file = "%s/kimchi.conf" % nginx_config_dir + config_file = "%s/wok.conf" % nginx_config_dir cmd = ['nginx', '-c', config_file] subprocess.call(cmd) diff --git a/src/wok/server.py b/src/wok/server.py index 5394d24..0f99663 100644 --- a/src/wok/server.py +++ b/src/wok/server.py @@ -80,9 +80,9 @@ class Server(object): # thus it is safe to unsubscribe. cherrypy.engine.timeout_monitor.unsubscribe() cherrypy.tools.nocache = cherrypy.Tool('on_end_resource', set_no_cache) - cherrypy.tools.kimchiauth = cherrypy.Tool('before_handler', - auth.kimchiauth) - # Setting host to 127.0.0.1. This makes kimchi runs + cherrypy.tools.wokauth = cherrypy.Tool('before_handler', + auth.wokauth) + # Setting host to 127.0.0.1. This makes wok run # as a localhost app, inaccessible to the outside # directly. You must go through the proxy. cherrypy.server.socket_host = '127.0.0.1' @@ -139,7 +139,7 @@ class Server(object): if node.url_auth: cfg = self.configObj ident = "/%s" % ident - cfg[ident] = {'tools.kimchiauth.on': True} + cfg[ident] = {'tools.wokauth.on': True} self.app = cherrypy.tree.mount(KimchiRoot(model_instance, dev_env), config=self.configObj) @@ -155,9 +155,9 @@ class Server(object): try: plugin_class = ('plugins.%s.%s' % (plugin_name, - plugin_config['kimchi']['plugin_class'])) - script_name = plugin_config['kimchi']['uri'] - del plugin_config['kimchi'] + plugin_config['wok']['plugin_class'])) + script_name = plugin_config['wok']['uri'] + del plugin_config['wok'] plugin_config.update(PluginConfig(plugin_name)) except KeyError: diff --git a/src/wok/template.py b/src/wok/template.py index 46c0f3c..e192ca4 100644 --- a/src/wok/template.py +++ b/src/wok/template.py @@ -29,8 +29,8 @@ from glob import iglob def get_lang(): cookie = cherrypy.request.cookie - if "kimchiLang" in cookie.keys(): - return [cookie["kimchiLang"].value] + if "wokLang" in cookie.keys(): + return [cookie["wokLang"].value] lang = cherrypy.request.headers.get("Accept-Language", "en_US") diff --git a/src/wok/utils.py b/src/wok/utils.py index d8ad25f..f5058d5 100644 --- a/src/wok/utils.py +++ b/src/wok/utils.py @@ -40,7 +40,7 @@ from wok.config import paths, PluginPaths from wok.exception import InvalidParameter, TimeoutExpired -kimchi_log = cherrypy.log.error_log +wok_log = cherrypy.log.error_log task_id = 0 @@ -106,7 +106,7 @@ def get_enabled_plugins(): if os.path.isdir(os.path.join(plugin_dir, name)): plugin_config = _load_plugin_conf(name) try: - if plugin_config['kimchi']['enable']: + if plugin_config['wok']['enable']: yield (name, plugin_config) except (TypeError, KeyError): continue @@ -200,22 +200,22 @@ def run_command(cmd, timeout=None): timer.start() out, error = proc.communicate() - kimchi_log.debug("Run command: '%s'", " ".join(cmd)) + wok_log.debug("Run command: '%s'", " ".join(cmd)) if out: - kimchi_log.debug("out:\n%s", out) + wok_log.debug("out:\n%s", out) if proc.returncode != 0: - kimchi_log.error("rc: %s error: %s returned from cmd: %s", + wok_log.error("rc: %s error: %s returned from cmd: %s", proc.returncode, error, ' '.join(cmd)) elif error: - kimchi_log.debug("error: %s returned from cmd: %s", + wok_log.debug("error: %s returned from cmd: %s", error, ' '.join(cmd)) if timeout_flag[0]: msg = ("subprocess is killed by signal.SIGKILL for " "timeout %s seconds" % timeout) - kimchi_log.error(msg) + wok_log.error(msg) msg_args = {'cmd': " ".join(cmd), 'seconds': str(timeout)} raise TimeoutExpired("KCHUTILS0002E", msg_args) @@ -225,13 +225,13 @@ def run_command(cmd, timeout=None): raise except OSError as e: msg = "Impossible to execute '%s'" % ' '.join(cmd) - kimchi_log.debug("%s", msg) + wok_log.debug("%s", msg) return None, "%s %s" % (msg, e), -1 except Exception as e: msg = "Failed to run command: %s." % " ".join(cmd) msg = msg if proc is None else msg + "\n error code: %s." - kimchi_log.error("%s %s", msg, e) + wok_log.error("%s %s", msg, e) if proc: return out, error, proc.returncode @@ -255,7 +255,7 @@ def patch_find_nfs_target(nfs_server): try: out = run_command(cmd, 10)[0] except TimeoutExpired: - kimchi_log.warning("server %s query timeout, may not have any path " + wok_log.warning("server %s query timeout, may not have any path " "exported", nfs_server) return list() @@ -293,7 +293,7 @@ def probe_file_permission_as_user(file, user): with open(file): q.put((True, None)) except Exception as e: - kimchi_log.debug(traceback.format_exc()) + wok_log.debug(traceback.format_exc()) q.put((False, e)) queue = Queue() diff --git a/src/wok/vnc.py b/src/wok/vnc.py index e50e9f2..3b6a80b 100644 --- a/src/wok/vnc.py +++ b/src/wok/vnc.py @@ -28,7 +28,7 @@ from websockify import WebSocketProxy from wok.config import config, paths -WS_TOKENS_DIR = '/var/lib/kimchi/vnc-tokens' +WS_TOKENS_DIR = '/var/lib/wok/vnc-tokens' def new_ws_proxy(): @@ -41,8 +41,8 @@ def new_ws_proxy(): cert = config.get('server', 'ssl_cert') key = config.get('server', 'ssl_key') if not (cert and key): - cert = '%s/kimchi-cert.pem' % paths.conf_dir - key = '%s/kimchi-key.pem' % paths.conf_dir + cert = '%s/wok-cert.pem' % paths.conf_dir + key = '%s/wok-key.pem' % paths.conf_dir params = {'web': os.path.join(paths.ui_dir, 'pages/websockify'), 'listen_port': config.get('display', 'display_proxy_port'), diff --git a/src/wokd.in b/src/wokd.in index 62a8504..f225361 100644 --- a/src/wokd.in +++ b/src/wokd.in @@ -32,8 +32,8 @@ import wok.config as config if not config.paths.installed: sys.path.append(config.paths.prefix) -ACCESS_LOG = "kimchi-access.log" -ERROR_LOG = "kimchi-error.log" +ACCESS_LOG = "wok-access.log" +ERROR_LOG = "wok-error.log" def main(options): @@ -69,7 +69,7 @@ def main(options): default=os.path.join(logDir, ERROR_LOG), help="Error log file") parser.add_option('--environment', default=runningEnv, - help="Running environment of kimchi server") + help="Running environment of wok server") parser.add_option('--federation', default=federation, help="Register and discover Kimchi peers in the same " "network using openSLP. Check README-federation for" diff --git a/ui/js/src/wok.cookie.js b/ui/js/src/wok.cookie.js index f1b52db..bc0a06d 100644 --- a/ui/js/src/wok.cookie.js +++ b/ui/js/src/wok.cookie.js @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -kimchi.cookie = { +wok.cookie = { set: function(key, value, expireDays) { value = encodeURIComponent(value); value += '; secure' diff --git a/ui/js/src/wok.lang.js b/ui/js/src/wok.lang.js index 1d2de4e..ef8e923 100644 --- a/ui/js/src/wok.lang.js +++ b/ui/js/src/wok.lang.js @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -kimchi.lang = { +wok.lang = { all: function() { return { 'en_US': 'English (US)', @@ -39,12 +39,12 @@ kimchi.lang = { * 3) DEFAULT (en_US). */ get: function() { - return kimchi.cookie.get('kimchiLang') || + return wok.cookie.get('wokLang') || $('html').prop('lang') || 'en_US'; }, set: function(lang) { - kimchi.cookie.set('kimchiLang', lang, 365); + wok.cookie.set('wokLang', lang, 365); } }; diff --git a/ui/js/src/wok.login.js b/ui/js/src/wok.login.js index c737d26..926d80c 100644 --- a/ui/js/src/wok.login.js +++ b/ui/js/src/wok.login.js @@ -15,13 +15,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -kimchi.login_main = function() { +wok.login_main = function() { - var selectedLanguage = kimchi.lang.get(); + var selectedLanguage = wok.lang.get(); $('#userLang').val(selectedLanguage); $('#userLang').on('change', function() { - kimchi.lang.set($(this).val()); + wok.lang.set($(this).val()); location.reload(); }); @@ -40,23 +40,23 @@ kimchi.login_main = function() { $("#logging").show(); var userName = userNameBox.val(); - userName && kimchi.user.setUserName(userName); + userName && wok.user.setUserName(userName); var settings = { username: userName, password: passwordBox.val() }; - kimchi.login(settings, function(data) { + wok.login(settings, function(data) { var query = window.location.search; var next = /.*next=(.*?)(&|$)/g.exec(query); if (next) { var next_url = decodeURIComponent(next[1]); } else { - var lastPage = kimchi.cookie.get('lastPage'); + var lastPage = wok.cookie.get('lastPage'); var next_url = lastPage ? lastPage.replace(/\"/g,'') : "/"; } - kimchi.cookie.set('roles',JSON.stringify(data.roles)); + wok.cookie.set('roles',JSON.stringify(data.roles)); window.location.replace(window.location.pathname.replace(/\/+login.html/, '') + next_url) }, function() { $("#messUserPass").show(); diff --git a/ui/js/src/wok.main.js b/ui/js/src/wok.main.js index 0d4ad43..089b523 100644 --- a/ui/js/src/wok.main.js +++ b/ui/js/src/wok.main.js @@ -15,21 +15,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -kimchi.tabMode = {}; +wok.tabMode = {}; -kimchi.capabilities = undefined; -kimchi.getCapabilities(function(result) { - kimchi.capabilities = result; +wok.capabilities = undefined; +wok.getCapabilities(function(result) { + wok.capabilities = result; - if(kimchi.capabilities.federation=="on") + if(wok.capabilities.federation=="on") $('#peers').removeClass('hide-content'); }, function() { - kimchi.capabilities = {}; + wok.capabilities = {}; }); -kimchi.main = function() { - kimchi.isLoggingOut = false; - kimchi.popable(); +wok.main = function() { + wok.isLoggingOut = false; + wok.popable(); var genTabs = function(tabs) { var tabsHtml = []; @@ -38,7 +38,7 @@ kimchi.main = function() { var path = tab['path']; var mode = tab['mode']; if (mode != 'none') { - var helpPath = kimchi.checkHelpFile(path); + var helpPath = wok.checkHelpFile(path); var disableHelp = (helpPath.length == 0 ? "disableHelp" : helpPath); tabsHtml.push( '<li>', @@ -60,11 +60,11 @@ kimchi.main = function() { var titleKey = $tab.find('title').text(); var title = i18n[titleKey] ? i18n[titleKey] : titleKey; var path = $tab.find('path').text(); - var roles = kimchi.cookie.get('roles'); + var roles = wok.cookie.get('roles'); if (roles) { var role = JSON.parse(roles)[titleKey.toLowerCase()]; var mode = $tab.find('[role="' + role + '"]').attr('mode'); - kimchi.tabMode[titleKey.toLowerCase()] = mode; + wok.tabMode[titleKey.toLowerCase()] = mode; tabs.push({ title: title, path: path, @@ -96,15 +96,15 @@ kimchi.main = function() { var DEFAULT_HASH; var buildTabs = function(callback) { var tabs = retrieveTabs(tabConfigUrl); - kimchi.listPlugins(function(plugins) { + wok.listPlugins(function(plugins) { $(plugins).each(function(i, p) { - var url = kimchi.substitute(pluginConfigUrl, { + var url = wok.substitute(pluginConfigUrl, { plugin: p }); - var i18nUrl = kimchi.substitute(pluginI18nUrl, { + var i18nUrl = wok.substitute(pluginI18nUrl, { plugin: p }); - kimchi.getI18n(function(i18nObj){ $.extend(i18n, i18nObj)}, + wok.getI18n(function(i18nObj){ $.extend(i18n, i18nObj)}, function(i18nObj){ //i18n is not define by plugin }, i18nUrl, true); tabs.push.apply(tabs, retrieveTabs(url)); @@ -121,12 +121,12 @@ kimchi.main = function() { callback && callback(); }, function(data) { - kimchi.message.error(data.responseJSON.reason); + wok.message.error(data.responseJSON.reason); }, true); }; var onLanguageChanged = function(lang) { - kimchi.lang.set(lang); + wok.lang.set(lang); location.reload(); }; @@ -140,7 +140,7 @@ kimchi.main = function() { * Move the page tab indicator to the right position; * Load the page content via Ajax. */ - var onKimchiRedirect = function(url) { + var onWokRedirect = function(url) { /* * Find the corresponding tab node and animate the arrow indicator to * point to the tab. If nothing found, inform user the URL is invalid @@ -170,7 +170,7 @@ kimchi.main = function() { } else { $('#btn-help').css('cursor', "pointer"); - $('#btn-help').on("click", kimchi.openHelp); + $('#btn-help').on("click", wok.openHelp); } // Load page content. loadPage(url); @@ -209,13 +209,13 @@ kimchi.main = function() { location.hash = DEFAULT_HASH; } else { - kimchi.topic('redirect').publish(hashString + '.html'); + wok.topic('redirect').publish(hashString + '.html'); } }; /** * Register listeners including: - * 1) Kimchi redirect event + * 1) wok redirect event * 2) hashchange event * 3) Tab list click event * 4) Log-out button click event @@ -225,8 +225,8 @@ kimchi.main = function() { */ var searchingPeers = false; var initListeners = function() { - kimchi.topic('languageChanged').subscribe(onLanguageChanged); - kimchi.topic('redirect').subscribe(onKimchiRedirect); + wok.topic('languageChanged').subscribe(onLanguageChanged); + wok.topic('redirect').subscribe(onWokRedirect); /* * If hash value is changed, then we know the user is intended to load @@ -246,7 +246,7 @@ kimchi.main = function() { * We use the HTML file name for hash, like: guests for guests.html * and templates for templates.html. * Retrieve hash value from the given URL and update location's - * hash part. It has 2 effects: one is to publish Kimchi "redirect" + * hash part. It has 2 effects: one is to publish Wok "redirect" * event to trigger listener, the other is to put an entry into the * browser's address history to make pages be bookmark-able. */ @@ -256,22 +256,22 @@ kimchi.main = function() { // Perform logging out via Ajax request. $('#btn-logout').on('click', function() { - kimchi.logout(function() { - kimchi.isLoggingOut = true; + wok.logout(function() { + wok.isLoggingOut = true; document.location.href = "login.html"; }, function(err) { - kimchi.message.error(err.responseJSON.reason); + wok.message.error(err.responseJSON.reason); }); }); // Set handler for about button $('#btn-about').on('click', function(event) { - kimchi.window.open({"content": $('#about-tmpl').html()}); + wok.window.open({"content": $('#about-tmpl').html()}); event.preventDefault(); }); // Set handler for help button - $('#btn-help').on('click', kimchi.openHelp); + $('#btn-help').on('click', wok.openHelp); // Set handler to peers drop down $('#peers').on('click', function() { @@ -301,46 +301,46 @@ kimchi.main = function() { var initUI = function() { $(document).bind('ajaxError', function(event, jqXHR, ajaxSettings, errorThrown) { - if (!ajaxSettings['kimchi']) { + if (!ajaxSettings['wok']) { return; } if (jqXHR['status'] === 401) { var isSessionTimeout = jqXHR['responseText'].indexOf("sessionTimeout")!=-1; - kimchi.user.showUser(false); - kimchi.previousAjax = ajaxSettings; + wok.user.showUser(false); + wok.previousAjax = ajaxSettings; $(".empty-when-logged-off").empty(); $(".remove-when-logged-off").remove(); document.location.href= isSessionTimeout ? 'login.html?error=sessionTimeout' : 'login.html'; return; } - else if((jqXHR['status'] == 0) && ("error"==jqXHR.statusText) && !kimchi.isLoggingOut) { - kimchi.message.error(i18n['KCHAPI6007E'].replace("%1", jqXHR.state())); + else if((jqXHR['status'] == 0) && ("error"==jqXHR.statusText) && !wok.isLoggingOut) { + wok.message.error(i18n['KCHAPI6007E'].replace("%1", jqXHR.state())); } if(ajaxSettings['originalError']) { ajaxSettings['originalError'](jqXHR, jqXHR.statusText, errorThrown); } }); - kimchi.user.showUser(true); + wok.user.showUser(true); initListeners(); updatePage(); }; // Load i18n translation strings first and then render the page. - kimchi.getI18n( + wok.getI18n( function(i18nStrings){ //success i18n = i18nStrings; buildTabs(initUI); }, function(data){ //error - kimchi.message.error(data.responseJSON.reason); + wok.message.error(data.responseJSON.reason); }); }; -kimchi.checkHelpFile = function(path) { - var lang = kimchi.lang.get(); +wok.checkHelpFile = function(path) { + var lang = wok.lang.get(); var url = "" // Find help page path according to tab name if (/^tabs/.test(path)) @@ -358,9 +358,9 @@ kimchi.checkHelpFile = function(path) { }; -kimchi.openHelp = function(e) { +wok.openHelp = function(e) { var tab = $('#nav-menu a.current'); var url = $(tab).parent().find("input[name='helpPath']").val(); - window.open(url, "Kimchi Help"); + window.open(url, "Wok Help"); e.preventDefault(); }; diff --git a/ui/js/src/wok.message.js b/ui/js/src/wok.message.js index 241626f..db1dc36 100644 --- a/ui/js/src/wok.message.js +++ b/ui/js/src/wok.message.js @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -kimchi.message = function(msg, level, node) { +wok.message = function(msg, level, node) { var container = node || $('#messageField'); if ($(container).size() < 1) { container = $('<div id="messageField"/>').appendTo(document.body); @@ -61,7 +61,7 @@ kimchi.message = function(msg, level, node) { * @param cancelCallback * The callback function of click the cancel and X button. */ -kimchi.confirm = function(settings, confirmCallback, cancelCallback) { +wok.confirm = function(settings, confirmCallback, cancelCallback) { if ($('#confirmbox-container ').size() < 1) { $(document.body).append('<div id="confirmbox-container" class="bgmask"></div>'); } @@ -101,16 +101,16 @@ kimchi.confirm = function(settings, confirmCallback, cancelCallback) { }); }; -kimchi.message.warn = function(msg, node) { - kimchi.message(msg, 'warn', node); +wok.message.warn = function(msg, node) { + wok.message(msg, 'warn', node); }; -kimchi.message.error = function(msg, node) { - kimchi.message(msg, 'error', node); +wok.message.error = function(msg, node) { + wok.message(msg, 'error', node); }; -kimchi.message.error.code = function(code) { +wok.message.error.code = function(code) { msg = code + ": " + i18n[code] - kimchi.message(msg, 'error'); + wok.message(msg, 'error'); }; -kimchi.message.success = function(msg, node) { - kimchi.message(msg, 'success', node); +wok.message.success = function(msg, node) { + wok.message(msg, 'success', node); }; diff --git a/ui/js/src/wok.popable.js b/ui/js/src/wok.popable.js index fb57010..7c01a0e 100644 --- a/ui/js/src/wok.popable.js +++ b/ui/js/src/wok.popable.js @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -kimchi.popable = function() { +wok.popable = function() { $(document).click(function(e) { $('.popable').each(function(i, n) { n === e.target || $.contains(n, e.target) || @@ -28,7 +28,7 @@ kimchi.popable = function() { // Scroll the popup menu into viewport if invisible. !$(popup).is(':visible') || - kimchi.isElementInViewport(popup) || + wok.isElementInViewport(popup) || popup.scrollIntoView(); }); }; diff --git a/ui/js/src/wok.substitute.js b/ui/js/src/wok.substitute.js index 434d9d3..225f967 100644 --- a/ui/js/src/wok.substitute.js +++ b/ui/js/src/wok.substitute.js @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -kimchi.substitute = function(templateStr, data, tag) { +wok.substitute = function(templateStr, data, tag) { tag = tag || /\{([^\}]+)\}/g; var escapeHtml = function(html) { diff --git a/ui/js/src/wok.topic.js b/ui/js/src/wok.topic.js index fd62ffe..0b8b148 100644 --- a/ui/js/src/wok.topic.js +++ b/ui/js/src/wok.topic.js @@ -19,11 +19,11 @@ /** * pub/sub * Usage: - * Publish - kimchi.topic('eventname').publish(params); - * Subscribe - kimchi.topic('eventname').subscribe(listener); - * Unsubscribe - kimchi.topic('eventname').unsubscribe(listener); + * Publish - wok.topic('eventname').publish(params); + * Subscribe - wok.topic('eventname').subscribe(listener); + * Unsubscribe - wok.topic('eventname').unsubscribe(listener); */ -kimchi.topic = (function() { +wok.topic = (function() { var topics = {}; diff --git a/ui/js/src/wok.user.js b/ui/js/src/wok.user.js index c036155..e642801 100644 --- a/ui/js/src/wok.user.js +++ b/ui/js/src/wok.user.js @@ -15,13 +15,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -kimchi.user = (function() { +wok.user = (function() { var getUserName = function() { - return kimchi.cookie.get('username'); + return wok.cookie.get('username'); }; var setUserName = function(userName) { - kimchi.cookie.set('username', userName, 365); + wok.cookie.set('username', userName, 365); }; var showUser = function(toShow) { diff --git a/ui/js/src/wok.utils.js b/ui/js/src/wok.utils.js index f26a560..23aa30c 100644 --- a/ui/js/src/wok.utils.js +++ b/ui/js/src/wok.utils.js @@ -26,7 +26,7 @@ * false if the node is not entirely visible, or * undefined if the given parameter is invalid. */ -kimchi.isElementInViewport = function(el) { +wok.isElementInViewport = function(el) { if (!el || !el.getBoundingClientRect) { return undefined; } @@ -47,7 +47,7 @@ kimchi.isElementInViewport = function(el) { * @param digits after the decimal point. * @returns str with unit. */ -kimchi.changetoProperUnit = function(numOrg, digits, base) { +wok.changetoProperUnit = function(numOrg, digits, base) { if (numOrg === undefined) { return ""; } @@ -65,7 +65,7 @@ kimchi.changetoProperUnit = function(numOrg, digits, base) { }; /** - * kimchi.formatMeasurement util. + * wok.formatMeasurement util. * * Refer to "Units of information" ( * http://en.wikipedia.org/wiki/Units_of_information @@ -158,15 +158,15 @@ kimchi.changetoProperUnit = function(numOrg, digits, base) { return new Formatted(fixed ? number.toFixed(fixed) : number, unit); }; - kimchi.formatMeasurement = format; + wok.formatMeasurement = format; })(); -kimchi.isUnsignedNumeric = function(number) { +wok.isUnsignedNumeric = function(number) { var reg = /^d+(.d+)?$/ return reg.test(number); } -kimchi.isServer = function(server) { +wok.isServer = function(server) { var domain = "([0-9a-z_!~*'()-]+\.)*([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\.[a-z]{2,6}"; var ip = "(\\d{1,3}\.){3}\\d{1,3}"; regex = new RegExp('^' + domain + '|' + ip + '$'); @@ -177,17 +177,17 @@ kimchi.isServer = function(server) { } }; -kimchi.escapeStr = function(str) { +wok.escapeStr = function(str) { if (str) return str.replace(/([ #;?%&,.+*~\\':"!^$[\]()<=>`{|}\/@])/g,'\\$&'); return str; }; -kimchi.urlSafeB64Decode = function(str) { +wok.urlSafeB64Decode = function(str) { return atob(str.replace(/-/g, '+').replace(/_/g, '/')); } -kimchi.urlSafeB64Encode = function(str) { +wok.urlSafeB64Encode = function(str) { return btoa(str).replace(/\+/g, '-').replace(/\//g, '_'); } diff --git a/ui/js/src/wok.window.js b/ui/js/src/wok.window.js index 3ac8699..5542270 100644 --- a/ui/js/src/wok.window.js +++ b/ui/js/src/wok.window.js @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -kimchi.window = (function() { +wok.window = (function() { var _windows = []; var _listeners = {}; var open = function(settings) { @@ -39,7 +39,7 @@ kimchi.window = (function() { $(windowNode).css(settings['style'] || ''); $(windowNode).appendTo('body').on('click', '.window .close', function() { - kimchi.window.close(); + wok.window.close(); }); if (settings['url']) { diff --git a/ui/js/widgets/button-dropDown.js b/ui/js/widgets/button-dropDown.js index 9157dde..ec6bd2a 100644 --- a/ui/js/widgets/button-dropDown.js +++ b/ui/js/widgets/button-dropDown.js @@ -16,7 +16,7 @@ * limitations under the License. */ (function($) { - $.widget('kimchi.dropdownButton', { + $.widget('wok.dropdownButton', { _create : function() { this.actionDiv = this.element; diff --git a/ui/js/widgets/combobox.js b/ui/js/widgets/combobox.js index b0edd88..92244a2 100644 --- a/ui/js/widgets/combobox.js +++ b/ui/js/widgets/combobox.js @@ -16,7 +16,7 @@ * limitations under the License. */ (function($) { - $.widget('kimchi.combobox', { + $.widget('wok.combobox', { _create : function() { this.selectDiv = this.element; this.listControl = this.selectDiv.find('ul').first(); diff --git a/ui/js/widgets/filter-select.js b/ui/js/widgets/filter-select.js index 020c567..db6b4b0 100644 --- a/ui/js/widgets/filter-select.js +++ b/ui/js/widgets/filter-select.js @@ -16,7 +16,7 @@ * limitations under the License. */ (function($) { - $.widget('kimchi.filterselect', { + $.widget('wok.filterselect', { _create : function() { this.selectDiv = this.element; this.listControl = this.selectDiv.find('ul').first(); diff --git a/ui/js/widgets/select-menu.js b/ui/js/widgets/select-menu.js index 4a79605..bd7a207 100644 --- a/ui/js/widgets/select-menu.js +++ b/ui/js/widgets/select-menu.js @@ -16,7 +16,7 @@ * limitations under the License. */ (function($) { - $.widget('kimchi.selectMenu', { + $.widget('wok.selectMenu', { _create : function() { this.selectDiv = this.element; diff --git a/ui/pages/error.html.tmpl b/ui/pages/error.html.tmpl index 068f2a6..dfe7ce3 100644 --- a/ui/pages/error.html.tmpl +++ b/ui/pages/error.html.tmpl @@ -27,7 +27,7 @@ <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> - <title>Kimchi</title> + <title>Wok</title> <link rel="stylesheet" href="$href("/css/theme-default.min.css")"> </head> @@ -35,7 +35,7 @@ <body> <div class="error-background"> <h1 id="logo"> - <img src="/images/theme-default/logo-white.png" alt="Kimchi"> + <img src="/images/theme-default/logo-white.png" alt="Wok"> </h1> </div> <div class="error-msg error-icon"> diff --git a/ui/pages/login.html.tmpl b/ui/pages/login.html.tmpl index e13e03d..92af4e0 100644 --- a/ui/pages/login.html.tmpl +++ b/ui/pages/login.html.tmpl @@ -35,7 +35,7 @@ <script src="$href('libs/jquery-1.10.0.min.js')"></script> <script src="$href('libs/jquery-ui.min.js')"></script> <script src="$href('libs/jquery-ui-i18n.min.js')"></script> -<script src="$href('js/kimchi.min.js')"></script> +<script src="$href('js/wok.min.js')"></script> <style type="text/css"> .topbar select { float: right; @@ -57,7 +57,7 @@ } </style> </head> -<body onload="kimchi.login_main()"> +<body onload="wok.login_main()"> <div class="container topbar"> <span id="logo"><img alt="Project Kimchi" src="images/theme-default/logo-white.png"></span> <select id="userLang"> diff --git a/ui/pages/websockify/console.html b/ui/pages/websockify/console.html index 3be317f..e0a3cd4 100644 --- a/ui/pages/websockify/console.html +++ b/ui/pages/websockify/console.html @@ -2,18 +2,18 @@ <html> <head> <script type="text/javascript"> - redirectToKimchi = function() { + redirectToWok = function() { var query = window.location.search; var path = /.*url=(.*?)(&|$)/g.exec(query)[1]; query = query.replace("url=" + path + "&", "") query = query.replace("url=" + path, "") - var kimchi_port = /.*kimchi=(.*?)(&|$)/g.exec(query)[1]; - query = query.replace("kimchi=" + kimchi_port + "&", "") - query = query.replace("kimchi=" + kimchi_port, "") + var wok_port = /.*wok=(.*?)(&|$)/g.exec(query)[1]; + query = query.replace("wok=" + wok_port + "&", "") + query = query.replace("wok=" + wok_port, "") - var url = "https://" + location.hostname + ":" + kimchi_port + "/"; + var url = "https://" + location.hostname + ":" + wok_port + "/"; url += decodeURIComponent(path) + query window.location.replace(url) @@ -21,5 +21,5 @@ </script> </head> - <body onload="redirectToKimchi()"/> + <body onload="redirectToWok()"/> </html> diff --git a/ui/pages/wok-ui.html.tmpl b/ui/pages/wok-ui.html.tmpl index 23e6875..9a0f258 100644 --- a/ui/pages/wok-ui.html.tmpl +++ b/ui/pages/wok-ui.html.tmpl @@ -36,7 +36,7 @@ <script src="$href('libs/jquery-1.10.0.min.js')"></script> <script src="$href('libs/jquery-ui.min.js')"></script> <script src="$href('libs/jquery-ui-i18n.min.js')"></script> -<script src="$href('js/kimchi.min.js')"></script> +<script src="$href('js/wok.min.js')"></script> <!-- This is used for detecting if the UI needs to be built --> <style type="text/css"> @@ -64,7 +64,7 @@ } </style> </head> -<body onload="kimchi.main()"> +<body onload="wok.main()"> <div class="container"> <header class="topbar"> <h1 id="logo"><img alt="Project Kimchi" src="images/theme-default/logo-white.png"></h1> @@ -110,12 +110,12 @@ <div id="buildme"> <div><p>Oops! It looks like I am running from a source tree and you forgot to build! - Please run the following command from the kimchi directory and reload this page:</p> + Please run the following command from the wok and kimchi directories and reload this page:</p> <p><code>make</code></p> </div> </div> -<script id="about-tmpl" type="kimchi/template"> +<script id="about-tmpl" type="wok/template"> <div class="window about-window"> <header> <h1 class="title"><img alt="Kimchi logo" src="images/logo.ico"/> $_("About")</h1> @@ -129,7 +129,7 @@ <img src="images/theme-default/logo-plain.gif"/> <br/> <br/> - <h2>Kimchi</h2> + <h2>Wok</h2> <p>$_("Version:") $get_version()</p> </div> </center> -- 1.7.1