{"id":13868,"date":"2015-04-28T09:47:54","date_gmt":"2015-04-28T00:47:54","guid":{"rendered":"http:\/\/labs.gree.jp\/blog\/?p=13868"},"modified":"2015-05-08T01:09:30","modified_gmt":"2015-05-07T16:09:30","slug":"openstack-horizon-programming","status":"publish","type":"post","link":"https:\/\/labs.gree.jp\/blog\/2015\/04\/13868\/","title":{"rendered":"OpenStack Horizon Programming"},"content":{"rendered":"<h1>\u306f\u3058\u3081\u306b<\/h1>\n<p>\u3000\u3053\u3093\u306b\u3061\u306f\u3001\u30a4\u30f3\u30d5\u30e9\u672c\u90e8\u306e\u5927\u5c71\u88d5\u6cf0\u3067\u3059\u3002\u4eca\u56de\u306f OpenStack Horizon \u306e\u6a5f\u80fd\u3092\u62e1\u5f35\u3057\u3001\u30aa\u30ea\u30b8\u30ca\u30eb\u306e\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u3092\u4f5c\u6210\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p>\u3000Horizon \u306f OpenStack \u304c\u7ba1\u7406\u3059\u308b\u5404\u7a2e\u30ea\u30bd\u30fc\u30b9 (\u4eee\u60f3\/\u7269\u7406\u30de\u30b7\u30f3\u3001\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u3001\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30b0\u30eb\u30fc\u30d7\u306a\u3069) \u3092\u64cd\u4f5c\u3059\u308b\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u6a5f\u80fd\u3092 WEB UI \u3067\u63d0\u4f9b\u3057\u3066\u3044\u307e\u3059\u3002\u307e\u305f Horizon \u306f OpenStack \u304c\u63d0\u4f9b\u3059\u308b\u30ea\u30bd\u30fc\u30b9\u3060\u3051\u3067\u306f\u306a\u304f\u3001\u30b5\u30fc\u30c9\u30d1\u30fc\u30c6\u30a3\u306e\u30ea\u30bd\u30fc\u30b9\u3082\u7d71\u4e00\u3057\u305f UI \u3067\u6271\u3048\u308b\u6a5f\u80fd\u62e1\u5f35\u306e\u4ed5\u7d44\u307f\u3082\u63d0\u4f9b\u3057\u3066\u3044\u307e\u3059\u3002\u4eca\u56de\u306f\u3053\u306e\u4ed5\u7d44\u307f\u3092\u5229\u7528\u3057\u3066\u3001\u30aa\u30ea\u30b8\u30ca\u30eb\u306e\u30ea\u30bd\u30fc\u30b9\u7ba1\u7406\u30b7\u30b9\u30c6\u30e0\u3092 Horizon \u306b\u8ffd\u52a0\u3059\u308b\u624b\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<h1>\u4f55\u304c\u5b09\u3057\u3044\u304b<\/h1>\n<p>\u3000<a href='http:\/\/developer.openstack.org\/api-ref.html'>OpenStack \u306e\u30ea\u30c3\u30c1\u306a API<\/a> \u306b\u9b45\u305b\u3089\u308c\u3066\u3001\u958b\u767a\u8005\u306f\u3064\u3044\u30d5\u30eb\u30b9\u30af\u30e9\u30c3\u30c1\u3067 OpenStack \u3068\u9023\u643a\u3059\u308b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 (\u4e3b\u306b Web) \u3092\u66f8\u304d\u304c\u3061\u3067\u3059\u3002\u6700\u8fd1\u306f <a href='https:\/\/wiki.openstack.org\/wiki\/SDKs'>OpenStack \u306e SDK<\/a> \u304c\u8c4a\u5bcc\u306a\u3053\u3068\u3082\u3042\u308a\u3001OpenStack \u3068\u9023\u643a\u3057\u305f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u958b\u767a\u3082\u6bd4\u8f03\u7684\u5bb9\u6613\u306b\u5b9f\u65bd\u3067\u304d\u307e\u3059\u3002\u3057\u304b\u3057\u3053\u308c\u3089\u3092\u5229\u7528\u3057\u3066 OpenStack \u9023\u643a\u3059\u308b Web \u30a2\u30d7\u30ea\u3092\u30d5\u30eb\u30b9\u30af\u30e9\u30c3\u30c1\u3067\u66f8\u304f\u5834\u5408\u3001Horizon \u3068\u91cd\u8907\u3057\u305f\u591a\u304f\u306e\u6a5f\u80fd\u306e\u518d\u5b9f\u88c5\u304c\u767a\u751f\u3059\u308b\u53ef\u80fd\u6027\u304c\u591a\u5206\u306b\u3042\u308a\u3001\u305d\u306e\u305f\u3081\u306b\u591a\u5927\u306a\u958b\u767a\u30b3\u30b9\u30c8\u3092\u6295\u3058\u3066 Horizon \u3068\u3088\u304f\u4f3c\u305f\u30e2\u30ce\u304c\u51fa\u6765\u4e0a\u304c\u308a\u3001\u52a0\u3048\u3066\u305d\u308c\u3092\u81ea\u5206\u305f\u3061\u300c\u3060\u3051\u300d\u3067\u30e1\u30f3\u30c6\u3057\u7d9a\u3051\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u304f\u306a\u308a\u307e\u3059\u3002<br \/>\n\u3000\u65e2\u306b\u4f55\u3089\u304b\u306e\u30b7\u30b9\u30c6\u30e0\u30ea\u30bd\u30fc\u30b9\u3092\u7d71\u5408\u3057\u3066\u7ba1\u7406\u3059\u308b\u5805\u7262\u306a\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u304c\u3042\u308c\u3070\u3001\u305d\u3053\u306b API \u3092\u4ecb\u3057\u3066 OpenStack \u3067\u7ba1\u7406\u3059\u308b\u30ea\u30bd\u30fc\u30b9\u3092\u64cd\u4f5c\u3059\u308b\u6a5f\u80fd\u3092\u8ffd\u52a0\u3059\u308b\u306e\u3082\u3044\u3044\u3067\u3059\u304c\u3001\u305d\u3046\u3067\u306a\u3051\u308c\u3070 Horizon \u3092\u62e1\u5f35\u3059\u308b\u624b\u6cd5\u3092\u9078\u629e\u3059\u308b\u306e\u304c\u5408\u7406\u7684\u3067\u3059\u3002Horizon \u306e\u6a5f\u80fd\u62e1\u5f35\u3067\u3042\u308c\u3070\u3001\u8ffd\u52a0\u3067\u7ba1\u7406\u3057\u305f\u3044\u30b7\u30b9\u30c6\u30e0\u30ea\u30bd\u30fc\u30b9\u3092\u7ba1\u7406\u3059\u308b\u30e2\u30c7\u30eb\u3068\u3001\u3069\u3046\u3084\u3063\u3066\u8868\u793a\u3055\u305b\u3001\u3069\u306e\u3088\u3046\u306b\u64cd\u4f5c\u3055\u305b\u308b\u304b\u3068\u3044\u3063\u305f\u3088\u3046\u306a\u3001\u672c\u5f53\u306b\u6b32\u3057\u3044\u6a5f\u80fd\u306e\u51e6\u7406\u3060\u3051\u5b9f\u88c5\u3059\u308b\u3053\u3068\u3067 Horizon \u306b\u5916\u90e8\u306e\u30ea\u30bd\u30fc\u30b9\u7ba1\u7406\u6a5f\u69cb\u3092\u7d71\u5408\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n\u3000\u307e\u305f Horizon \u306f\u3053\u3046\u3057\u305f\u6a5f\u80fd\u62e1\u5f35\u3092\u3059\u308b\u305f\u3081\u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3092\u63d0\u4f9b\u3057\u3066\u304a\u308a\u3001MVC \u30e2\u30c7\u30eb\u306e Web \u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3092\u89e6\u3063\u305f\u3053\u3068\u306e\u3042\u308b\u4eba\u3067\u3042\u308c\u3070\u7c21\u5358\u306b\u62e1\u5f35\u6a5f\u80fd\u306e\u958b\u767a\u3092\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059(\u6b63\u78ba\u306b\u306f Horizon \u81ea\u4f53\u304c\u3053\u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3092\u5229\u7528\u3057\u3066\u958b\u767a\u3055\u308c\u3066\u3044\u307e\u3059)\u3002<\/p>\n<h1>Horizon \u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306e\u5168\u4f53\u69cb\u6210<\/h1>\n<p>\u3000\u5b9f\u969b\u306b\u624b\u3092\u52d5\u304b\u3057\u3066\u4f5c\u308b\u524d\u306b\u3001Horizon \u306e\u5168\u4f53\u50cf\u306b\u3064\u3044\u3066\u7c21\u5358\u306b\u898b\u3066\u884c\u304d\u307e\u3059\u3002Horizon \u306f Django \u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3092\u30d9\u30fc\u30b9\u3068\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u305d\u306e\u4e0a\u306b Horizon \u81ea\u4f53\u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306e\u30ec\u30a4\u30e4\u304c\u5b58\u5728\u3057\u3001Horizon \u306b\u7d71\u5408\u3055\u308c\u3044\u3066\u308b\u5404\u30ea\u30bd\u30fc\u30b9\u306f\u3053\u306e\u4e0a\u306b \"\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9(Dashboard)\" \u3068\u3044\u3046\u5358\u4f4d\u3067\u500b\u5225\u306b\u5b9f\u88c5\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><img src='https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2015\/04\/architecture.png'\/><\/p>\n<p>\u3000\u66f4\u306b\u5404\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u306e\u30da\u30fc\u30b8\u306f\u3001\u4ee5\u4e0b\u306b\u793a\u3059\u968e\u5c64\u69cb\u9020\u306b\u3088\u3063\u3066\u69cb\u9020\u5316\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><img src='https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2015\/04\/construction.png'\/><\/p>\n<p>\u3000\u305d\u308c\u305e\u308c Dashboard > Panel > TabGroup > Tab > Table \u3068\u3044\u3046\u5165\u308c\u5b50\u69cb\u9020\u306b\u306a\u3063\u3066\u304a\u308a\u3001\u4e0a\u4f4d\u304c\u4e0b\u4f4d\u306b\u5bfe\u3057\u30661\u5bfen\u306e\u95a2\u4fc2\uff08\u4e00\u3064\u306e\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u306b\u5bfe\u3057\u3066\u4e00\u3064\u4ee5\u4e0a\u306e Panel \u3092\u6301\u3064\u3053\u3068\u304c\u3067\u304d\u308b\uff09\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002\u307e\u305f Tab \u304c\u4e00\u3064\u3060\u3051\u306e\u5834\u5408\u3001TabGroup \u3084 Tab \u304c\u7701\u7565\u3055\u308c\u308b\u30b1\u30fc\u30b9\u3082\u3042\u308a\u307e\u3059\u3002<br \/>\n\u3000\u4e0a\u8a18\u306e\u69cb\u6210\u8981\u7d20\u3092\u5b9f\u969b\u306e Dashboard \u306e\u8868\u793a\u306b\u5f53\u3066\u306f\u3081\u305f\u3082\u306e\u304c\u4ee5\u4e0b\u306e\u56f3\u306b\u306a\u308a\u307e\u3059\u3002\u4ee5\u4e0b\u3067\u306f\u5404\u69cb\u6210\u8981\u7d20\u3092\u8272\u67a0\u3067\u793a\u3057\u307e\u3057\u305f\u3002<\/p>\n<p><img src='https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2015\/04\/dashboard_components.png'\/><\/p>\n<p>\u3000TableAction \u3068 RowAction \u306b\u3064\u3044\u3066\u306f\u3001\u305d\u308c\u305e\u308c\u30c6\u30fc\u30d6\u30eb\u5168\u4f53\u3078\u306e\u51e6\u7406\u3068\u3001\u30c6\u30fc\u30d6\u30eb\u306e\u5404\u30c7\u30fc\u30bf\u3078\u306e\u51e6\u7406\u3067\u4f7f\u3044\u5206\u3051\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001\u30ab\u30e9\u30e0\u306e\u8ffd\u52a0\u3067\u3042\u3063\u305f\u308a\u3001\u30c6\u30fc\u30d6\u30eb\u306e\u30bd\u30fc\u30c8\u3001\u30c7\u30fc\u30bf\u306e\u30a4\u30f3\u30dd\u30fc\u30c8\/\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u3068\u3044\u3063\u305f\u3088\u3046\u306b\u3001\u30ab\u30e9\u30e0\u5168\u4f53\u306b\u95a2\u308f\u308b\u51e6\u7406\u3092\u884c\u3046\u5834\u5408\u306b\u306f TableAction \u306b\u51e6\u7406\u3092\u8a18\u8ff0\u3057\u307e\u3059\u3002\u9006\u306b\u3001\u30c6\u30fc\u30d6\u30eb\u306e\u7279\u5b9a\u306e\u30ab\u30e9\u30e0\u306e\u66f4\u65b0\u30fb\u524a\u9664\u306a\u3069\u306e\u51e6\u7406\u3092\u5b9f\u65bd\u3059\u308b\u5834\u5408\u306b\u306f RowAction \u306b\u51e6\u7406\u3092\u8a18\u8ff0\u3057\u307e\u3059\u3002<br \/>\n\u3000\u305d\u308c\u3067\u306f Horizon \u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3092\u4f7f\u3063\u3066\u30aa\u30ea\u30b8\u30ca\u30eb\u306e\u30ea\u30bd\u30fc\u30b9\u3092\u7ba1\u7406\u3059\u308b\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u6a5f\u80fd\u3092\u62e1\u5f35\u3059\u308b\u4f8b\u3092\u898b\u3066\u884c\u304d\u307e\u3059\u3002<\/p>\n<h1>\u4f5c\u308a\u65b9<\/h1>\n<p>\u3000\u4ee5\u4e0b\u3067\u306f Horizon \u306e\u62e1\u5f35\u3092\u5b9f\u969b\u306b\u3084\u3063\u3066\u307f\u305f\u3044\u65b9\u5411\u3051\u306b\u3001DevStack \u306b\u3088\u308b OpenStack \u306e\u30c6\u30b9\u30c8\u958b\u767a\u74b0\u5883\u3092\u7528\u3044\u3066\u3001\u30aa\u30ea\u30b8\u30ca\u30eb\u306e\u30ea\u30bd\u30fc\u30b9\u3092\u7ba1\u7406\u3059\u308b\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u6a5f\u80fd\u3092\u8ffd\u52a0\u3059\u308b\u5177\u4f53\u7684\u306a\u65b9\u6cd5\u306b\u3064\u3044\u3066\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<h1>\u30b9\u30b1\u30eb\u30c8\u30f3\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u306e\u4f5c\u6210<\/h1>\n<p>\u3000\u3053\u3053\u3067\u306f\u3001\u4f55\u3082\u306a\u3044\u30b9\u30b1\u30eb\u30c8\u30f3\u306e\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u3092\u4f5c\u308a\u307e\u3059\u3002\u307e\u305a\u306f DevStack \u3067 OpenStack \u306e\u5b9f\u884c\u74b0\u5883\u3092\u69cb\u7bc9\u3057\u307e\u3059\u3002<a href='http:\/\/docs.openstack.org\/developer\/sahara\/devref\/devstack.html#start-vm-and-set-up-os'>DevStack \u304c\u5165\u308b\u74b0\u5883<\/a> \u3092\u3054\u7528\u610f\u3044\u305f\u3060\u304d\u3001\u4ee5\u4e0b\u306a\u611f\u3058\u3067 DevStack \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre>\n$ git clone https:\/\/git.openstack.org\/openstack-dev\/devstack\n$ cd devstack\n$ git checkout stable\/juno\n$ .\/stack.sh\n<\/pre>\n<p>\u3000\u5f8c\u8ff0\u3059\u308b\u30b5\u30f3\u30d7\u30eb\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u6b63\u5e38\u306b\u52d5\u4f5c\u3055\u305b\u308b\u305f\u3081\u306b\u3001\u5ff5\u306e\u305f\u3081 stable\/juno \u30d6\u30e9\u30f3\u30c1\u3067 Devstack \u3092\u69cb\u7bc9\u3057\u3066\u304f\u3060\u3055\u3044\u3002<br \/>\n\u3000\u6b21\u306b\u30b9\u30b1\u30eb\u30c8\u30f3\u306e\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u4ee5\u4e0b\u306a\u611f\u3058\u3067\u30b9\u30b1\u30eb\u30c8\u30f3\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u5c55\u958b\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre>\n$ wget https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2015\/04\/skelton.zip\n$ unzip skelton.zip\n$ cp -r openstack_dashboard \/opt\/stack\/horizon\n$ sudo service apache2 restart\n<\/pre>\n<p>\u3000apache \u306e\u518d\u8d77\u52d5\u5f8c\u3001\u30b5\u30fc\u30d0\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068\u4f55\u3082\u306a\u3044\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9 \"Mydashboard\" \u304c\u8ffd\u52a0\u3055\u308c\u3066\u3044\u308c\u3070\u6210\u529f\u3067\u3059\u3002\u4ee5\u964d\u3067\u306f\u3001\u3053\u3053\u306b\u30aa\u30ea\u30b8\u30ca\u30eb\u306e\u30ea\u30bd\u30fc\u30b9\u7ba1\u7406\u30b7\u30b9\u30c6\u30e0\u3092\u8ffd\u52a0\u3059\u308b\u624b\u6cd5\u3092\u89e3\u8aac\u3057\u3066\u3086\u304d\u307e\u3059\u3002\u5c1a\u3001\u3053\u3053\u307e\u3067\u306e\u64cd\u4f5c\u306e\u88cf\u5074\u306e\u8a73\u7d30\u3092\u77e5\u308a\u305f\u3044\u65b9\u306f OpenStack Horizon \u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306e <a href='http:\/\/docs.openstack.org\/developer\/horizon\/topics\/tutorial.html'>\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb<\/a> \u3092\u53c2\u7167\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h1>\u30aa\u30ea\u30b8\u30ca\u30eb\u6a5f\u80fd\u306e\u8ffd\u52a0<\/h1>\n<p>\u3000\u3055\u3066\u3001\u3053\u3053\u304b\u3089\u304c\u672c\u7de8\u306e\u672c\u984c\u306b\u306a\u308a\u307e\u3059\u3002Horizon \u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u306b\u306f\u3001\u4e0a\u8a18\u306e\u30b9\u30b1\u30eb\u30c8\u30f3\u30da\u30fc\u30b8\u3092\u8868\u793a\u3059\u308b\u3068\u3053\u308d\u307e\u3067\u306e\u89e3\u8aac\u306f\u66f8\u3044\u3066\u3042\u308a\u307e\u3059\u304c\u3001\u305d\u308c\u4ee5\u4e0a\u306e\u5185\u5bb9\u306b\u3064\u3044\u3066\u8a00\u53ca\u3055\u308c\u305f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306f\u7686\u7121\u306a\u305f\u3081\u3001\u5b9f\u969b\u306b Horizon \u306e\u30b3\u30fc\u30c9\u3092\u8aad\u3093\u3067\u52d5\u4f5c\u3092\u7406\u89e3\u3059\u308b\u5fc5\u8981\u304c\u3067\u3066\u304d\u307e\u3059\u3002\u4eca\u56de\u306f\u3001\u30aa\u30ea\u30b8\u30ca\u30eb\u306e\u62e1\u5f35\u6a5f\u80fd\u3092\u5b9f\u88c5\u3059\u308b\u4e0a\u3067\u7279\u306b\u3088\u304f\u4f7f\u308f\u308c\u308b\u624b\u6cd5\u306b\u3064\u3044\u3066\u7d39\u4ecb\u3057\u3066\u884c\u304d\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h2>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h2>\n<p>\u3000Horizon \u306e\u6a5f\u80fd\u62e1\u5f35\u306e\u624b\u6cd5\u306b\u3064\u3044\u3066\u8aac\u660e\u3059\u308b\u4e0a\u3067\u3001\u3053\u3061\u3089\u3067\u4f5c\u6210\u3057\u307e\u3057\u305f (\u30c0\u30df\u30fc\u306e) \u30b9\u30c8\u30ec\u30fc\u30b8\u7ba1\u7406\u30b7\u30b9\u30c6\u30e0\u3092\u7528\u3044\u307e\u3059\u3002\u3053\u306e\u30b7\u30b9\u30c6\u30e0\u306f\u3001\u30e6\u30fc\u30b6\u304c (\u30c0\u30df\u30fc) \u306e\u30dc\u30ea\u30e5\u30fc\u30e0\u3092\u4f5c\u6210\u30fb\u524a\u9664\u3067\u304d\u308b\u6a5f\u80fd\u3092\u63d0\u4f9b\u3057\u3066\u304a\u308a\u3001\u3053\u308c\u3089\u306e\u6a5f\u80fd\u3092\u62e1\u5f35\u3057\u305f Horizon \u306e\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u4e0a\u304b\u3089\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u884c\u3048\u307e\u3059\u3002<\/p>\n<p><img src='https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2015\/04\/dummy_manager.png' \/><\/p>\n<p>\u3000\u3053\u3061\u3089\u306e\u74b0\u5883\u3082 skelton \u540c\u69d8\u3001\u4ee5\u4e0b\u306e\u624b\u9806\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre>\n$ wget https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2015\/04\/dummy_manager.zip\n$ unzip dummy_manager.zip\n$ cp -r openstack_dashboard \/opt\/stack\/horizon\n$ sudo service apache2 restart\n<\/pre>\n<p>\u3000Apache \u518d\u8d77\u52d5\u5f8c\u306b Horizon \u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068\u3001Mydashboard \u306b Dummy_Manager \u304c\u8ffd\u52a0\u3055\u308c\u3066\u3044\u308b\u3068\u601d\u3044\u307e\u3059\u3002\u53f3\u4e0a\u306e Create Data \u30dc\u30bf\u30f3\u304b\u3089\u30b9\u30c8\u30ec\u30fc\u30b8\u540d\u3068\u30b9\u30c8\u30ec\u30fc\u30b8\u30b5\u30a4\u30ba\u3092\u6307\u5b9a\u3057 \"\u4f5c\u6210\" \u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u30c6\u30fc\u30d6\u30eb\u306b\u30c7\u30fc\u30bf\u304c\u8ffd\u52a0\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><img src='https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2015\/04\/create_data.png'\/><\/p>\n<p>\u3000\u307e\u305f\u3001\u8ffd\u52a0\u3055\u308c\u305f\u30c6\u30fc\u30d6\u30eb\u306e\u53f3\u8107\u306e\u30dc\u30bf\u30f3 \"Remove Data\" \u3092\u62bc\u3059\u3068\u3001\u30c7\u30fc\u30bf\u304c\u524a\u9664\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><img src='https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2015\/04\/remove_data.png'\/><\/p>\n<p>\u3000\u4ee5\u4e0b\u3067\u306f\u3001\u3053\u3053\u3067\u4f5c\u6210\u3057\u305f Horizon \u62e1\u5f35 \"Dummy_Manager\" \u3067\u5229\u7528\u3057\u3066\u3044\u308b Horizon \u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306e\u69d8\u3005\u306a\u624b\u6cd5\u306b\u3064\u3044\u3066\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<h2>\u30c6\u30fc\u30d6\u30eb\u306e\u30c7\u30fc\u30bf\u306e\u8a2d\u5b9a<\/h2>\n<p>\u3000\u307e\u305a\u306f\u30c6\u30fc\u30d6\u30eb\u306b\u30aa\u30ea\u30b8\u30ca\u30eb\u306e\u30c7\u30fc\u30bf\u3092\u8868\u793a\u3055\u305b\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<br \/>\n\u3000Dummy_Manager \u3067\u306f\u3001\u30e6\u30fc\u30b6\u304c\u4f5c\u6210\u3057\u305f (\u30c0\u30df\u30fc\u306e) \u30c7\u30fc\u30bf\u30e2\u30c7\u30eb\u3092\u53d6\u5f97\u3057\u3001\u305d\u308c\u3092 Horizon \u306e\u30c7\u30fc\u30bf\u30c6\u30fc\u30d6\u30eb\u306b\u683c\u7d0d\u3057\u8868\u793a\u3055\u305b\u3066\u3044\u307e\u3059\u3002\u5177\u4f53\u7684\u306b\u306f dummy_manager\/test_service.py \u306e TestService \u3092\u901a\u3057\u3066 DummyData \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u53d6\u5f97\u3057\u3001\u5f53\u8a72\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3092 Horizon \u306e DataTable \u306b\u683c\u7d0d\u3057\u3066\u3086\u304d\u307e\u3059\u3002<br \/>\n\u3000\u305d\u308c\u3067\u306f\u3001\u3069\u306e\u3088\u3046\u306b\u3057\u3066\u3053\u3046\u3057\u305f\u51e6\u7406\u3092\u5b9f\u65bd\u3057\u3066\u3044\u308b\u304b\u306e\u5b9f\u88c5\u3092\u307f\u3066\u3086\u304d\u307e\u3059\u3002\u307e\u305a Mydashboard \u306b Dummy_Manager \u3092\u8ffd\u52a0\u3057\u305f\u51e6\u7406\u3067\u3059\u304c\u3001mydashboard \u4ee5\u4e0b\u306e dashboard.py \u3067\u5b9a\u7fa9\u3057\u3066\u3044\u308b horizon.Dashboard \u3092\u7d99\u627f\u3057\u305f\u30af\u30e9\u30b9\u306e\u30af\u30e9\u30b9\u5909\u6570 panels \u306b\u8ffd\u52a0\u3057\u305f\u30d1\u30cd\u30eb\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002default_panel \u30d1\u30e9\u30e1\u30fc\u30bf\u3067\u306f \"Mydashborad\" \u30dc\u30bf\u30f3\u304c\u62bc\u3055\u308c\u305f\u969b\u306b\u9078\u629e\u3055\u308c\u308b\u30d1\u30cd\u30eb\u3092\u6307\u5b9a\u3067\u304d\u307e\u3059\u3002\u5404\u30d1\u30e9\u30e1\u30fc\u30bf\u3067\u306f\u3001Panel \u306e\u5b9f\u88c5\u304c\u7f6e\u304b\u308c\u3066\u3044\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u540d\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:python decode:true\" title=\"openstack_dashboard\/dashboards\/mydashboard\/dashboard.py\">\nclass Mydashboard(horizon.Dashboard):\n    name = _(\"Mydashboard\")\n    slug = \"mydashboard\"\n    panels = ('skelton','dummy_manager')  # Add your panels here.\n    default_panel = 'dummy_manager'  # Specify the slug of the dashboard's default panel.\n<\/pre>\n<p>\u3000\u6b21\u306b\u3001\u9078\u629e\u3055\u308c\u305f\u30d1\u30cd\u30eb\u306e\u4e2d\u8eab\u3067\u3059\u304c\u3001\u3053\u3053\u3067\u306f TabGroup \u53ca\u3073 Tab \u3092\u7701\u7565\u3057\u3001\u30da\u30fc\u30b8\u306b\u76f4\u63a5 Table \u3092\u8868\u793a\u3055\u305b\u3066\u3044\u307e\u3059\u3002Dummy_Manager \u306e\u30c8\u30c3\u30d7\u30da\u30fc\u30b8\u30d3\u30e5\u30fc\u306f dummy_manager\/views.py \u3067\u5b9a\u7fa9\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"lang:python decode:true\" title=\"openstack_dashboard\/dashboards\/mydashboard\/dummy_manager\/views.py\">\nclass IndexView(tables.DataTableView):\n    table_class = project_tables.DataSummaryTable\n    template_name = 'mydashboard\/dummy_manager\/index.html'\n\n    def get_data(self):\n        return test_service.TestService().list()\n<\/pre>\n<p>\u3000\u3053\u3053\u3067\u306f\u3001\u30da\u30fc\u30b8\u306b\u8868\u793a\u3055\u305b\u308b\u30c6\u30fc\u30d6\u30eb\u306e\u5b9f\u88c5 (\u30c7\u30fc\u30bf\u30c6\u30fc\u30d6\u30eb) \u306e\u6307\u5b9a (table_class \u30d1\u30e9\u30e1\u30fc\u30bf) \u3068\u3001\u8868\u793a\u3055\u305b\u308b\u30c7\u30fc\u30bf\u306e\u30e2\u30c7\u30eb\u306e\u6307\u5b9a (get_data \u30e1\u30bd\u30c3\u30c9) \u3092\u884c\u3063\u3066\u3044\u307e\u3059\u3002\u3053\u3053\u3067\u6307\u5b9a\u3055\u308c\u305f\u30c7\u30fc\u30bf\u304c\u30c7\u30fc\u30bf\u30c6\u30fc\u30d6\u30eb\u3067\u3088\u3057\u306a\u306b\u52a0\u5de5\u3055\u308c\u3066\u8868\u793a\u3055\u308c\u307e\u3059\u3002\u5c1a\u3001\u3053\u3053\u3067\u6307\u5b9a\u3057\u3066\u3044\u308b test_service \u3068\u3044\u3046\u306e\u306f\u30aa\u30ea\u30b8\u30ca\u30eb\u306e\u5b9f\u88c5\u3067\u3001\u5192\u982d\u3067\u7d39\u4ecb\u3057\u307e\u3057\u305f\u30c7\u30fc\u30bf\u30aa\u30d6\u30b8\u30a7\u30af\u30c8 (DummyData) \u304b\u3089\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3057\u305f\u308a\u3001\u30c7\u30fc\u30bf\u3092\u683c\u7d0d\u3057\u305f\u308a\u3059\u308b\u30b5\u30fc\u30d3\u30b9\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u306a\u308a\u307e\u3059\u3002\u3053\u3044\u3064\u306f\u30b5\u30fc\u30c9\u30d1\u30fc\u30c6\u30a3\u306e\u30b5\u30fc\u30d3\u30b9\u3092\u64ec\u4f3c\u7684\u306b\u8868\u73fe\u3057\u3066\u3044\u308b\u3082\u306e\u3067 Horizon \u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3068\u3082\u95a2\u4fc2\u306a\u3044\u305f\u3081\u8a73\u7d30\u306a\u8aac\u660e\u306f\u5272\u611b\u3057\u307e\u3059\u3002<br \/>\n\u3000\u6b21\u306b\u30c7\u30fc\u30bf\u30c6\u30fc\u30d6\u30eb\u5074\u3067\u306e\u51e6\u7406\u306b\u3064\u3044\u3066\u898b\u3066\u884c\u304d\u307e\u3059\u3002<br \/>\n\u3000<\/p>\n<h2>\u30c6\u30fc\u30d6\u30eb\u306e\u30c7\u30fc\u30bf\u8868\u793a<\/h2>\n<p>\u3000\u30c7\u30fc\u30bf\u30c6\u30fc\u30d6\u30eb\u306b\u4f55\u3092\u3069\u306e\u3088\u3046\u306b\u8868\u793a\u3055\u305b\u308b\u304b\u306f\u3001\u4ee5\u4e0b\u306e tables.py \u306e DataSummaryTable \u30af\u30e9\u30b9\u3067\u5b9a\u7fa9\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"lang:python decode:true\" title=\"openstack_dashboard\/dashboards\/mydashboard\/dummy_manager\/tables.py\">\ndef _check_status(data_id):\n    return True # This is dummy processing\n\ndef get_status(data):\n    ret = 'NG'\n    if _check_status(data.id):\n        ret = 'OK'\n    return ret\n\nclass DataSummaryTable(tables.DataTable):\n    status = tables.Column(get_status, verbose_name= _(\"Status\"))\n    name = tables.Column('name', verbose_name= _(\"Name\"))\n    size = tables.Column('size', verbose_name= _(\"Size\"))\n<\/pre>\n<p>\u3000\u524d\u7bc0\u3067\u3082\u7d39\u4ecb\u3057\u305f\u901a\u308a\u3001\u3053\u3053\u3067\u306f\u30b9\u30c6\u30fc\u30bf\u30b9\u3001\u540d\u524d\u3001\u30b5\u30a4\u30ba\u3092\u305d\u308c\u305e\u308c\u3053\u3053\u3067\u6307\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002Column \u30af\u30e9\u30b9\u306e\u7b2c\u4e00\u5f15\u6570\u306b\u306f\u30e1\u30bd\u30c3\u30c9\u3082\u6307\u5b9a\u3067\u304d\u3001\u30e1\u30bd\u30c3\u30c9 (\u306a\u3044\u3057\u9ad8\u968e\u95a2\u6570) \u3092\u6307\u5b9a\u3057\u305f\u5834\u5408\u306b\u306f\u30c7\u30fc\u30bf\u30aa\u30d6\u30b8\u30a7\u30af\u30c8 (\u3053\u306e\u5834\u5408 DummyData) \u304c\u5f15\u6570\u306b\u6e21\u3055\u308c\u3001\u5f53\u8a72\u30e1\u30bd\u30c3\u30c9\u306e\u8fd4\u623b\u5024\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<h2>\u30a2\u30af\u30b7\u30e7\u30f3\u306b\u3064\u3044\u3066<\/h2>\n<p>\u3000\u5192\u982d\u3067\u3082\u8aac\u660e\u3057\u305f\u3088\u3046\u306b Horizon \u306f\u3001\u30c6\u30fc\u30d6\u30eb\u306b\u5bfe\u3059\u308b\u30a2\u30af\u30b7\u30e7\u30f3\u3068\u3057\u3066\u300c\u30c6\u30fc\u30d6\u30eb\u30a2\u30af\u30b7\u30e7\u30f3\u300d\u3068\u300c\u30ed\u30fc(Row)\u30a2\u30af\u30b7\u30e7\u30f3\u300d\u306e\uff12\u7a2e\u985e\u3092\u7528\u610f\u3057\u3066\u3044\u307e\u3059\u3002\u305d\u308c\u305e\u308c\u3001\u30c6\u30fc\u30d6\u30eb\u30c7\u30fc\u30bf\u5168\u4f53\u306b\u5bfe\u3059\u308b\u51e6\u7406\u3068\u30c6\u30fc\u30d6\u30eb\u306e\u500b\u3005\u306e\u30c7\u30fc\u30bf\u306b\u5bfe\u3059\u308b\u51e6\u7406\u3068\u3057\u3066\u4f7f\u3044\u5206\u3051\u307e\u3059\u3002Dummy_Manager \u3067\u306f\u305d\u308c\u305e\u308c \"Create Data\" \u30dc\u30bf\u30f3\u306b\u3088\u308b\u30c7\u30fc\u30bf\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u8ffd\u52a0\u51e6\u7406\u304c\u30c6\u30fc\u30d6\u30eb\u30a2\u30af\u30b7\u30e7\u30f3\u306b\u3001\"Remove Data\" \u30dc\u30bf\u30f3\u306b\u3088\u308b\u5bfe\u8c61\u30c7\u30fc\u30bf\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u524a\u9664\u51e6\u7406\u304c\u30ed\u30fc\u30a2\u30af\u30b7\u30e7\u30f3\u306b\u5bfe\u5fdc\u3057\u307e\u3059\u3002\u4ee5\u4e0b\u3067\u306f\u305d\u308c\u305e\u308c\u306e\u5b9f\u88c5\u306b\u3064\u3044\u3066\u898b\u3066\u884c\u304d\u307e\u3059\u3002<\/p>\n<p>\u3000\u307e\u305a\u30a2\u30af\u30b7\u30e7\u30f3\u306e\u6307\u5b9a\u3067\u3059\u304c\u3001\u305d\u308c\u305e\u308c\u5148\u307b\u3069\u7d39\u4ecb\u3057\u305f\u30c7\u30fc\u30bf\u30c6\u30fc\u30d6\u30eb DataSummaryTable \u3067\u5b9a\u7fa9\u3057\u3066\u3044\u308b\u30e1\u30bf\u30af\u30e9\u30b9 (Meta) \u306e\u30d1\u30e9\u30e1\u30fc\u30bf (table_actions, row_actions) \u3067\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:python decode:true\" title=\"openstack_dashboard\/dashboards\/mydashboard\/dummy_manager\/tables.py\">\nclass DataSummaryTable(tables.DataTable):\n    status = tables.Column(get_status, verbose_name= _(\"Status\"))\n    name = tables.Column('name', verbose_name= _(\"Name\"))\n    size = tables.Column('size', verbose_name= _(\"Size\"))\n    \n    class Meta:\n        name = \"data_summary\"\n        verbose_name = _(\"DataSummary\")\n        table_actions = (CreateData,)\n        row_actions = (RemoveData,)\n<\/pre>\n<p>\u3000Horizon \u304c\u7528\u610f\u3057\u3066\u3044\u308b\u30a2\u30af\u30b7\u30e7\u30f3\u306e\u5f62\u5f0f\u306b\u306f\u69d8\u3005\u306a\u7a2e\u985e\u304c\u3042\u308a\u307e\u3059\u304c\u3001\u3053\u3053\u3067\u306f\u305d\u308c\u305e\u308c\u30ea\u30f3\u30af\u30dc\u30bf\u30f3\u3092\u8868\u793a\u3057\u30da\u30fc\u30b8\u9077\u79fb\u3092\u884c\u3046 LinkAction \u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"lang:python decode:true\" title=\"openstack_dashboard\/dashboards\/mydashboard\/dummy_manager\/tables.py\">\nclass CreateData(tables.LinkAction):\n    name = \"create\"\n    verbose_name = _(\"Create Data\")\n    url = \"horizon:mydashboard:dummy_manager:create\"\n    classes = (\"ajax-modal\",)\n    icon = \"plus\"\n\nclass RemoveData(tables.LinkAction):\n    name = \"delete\"\n    verbose_name = _(\"Remove Data\")\n    url = \"horizon:mydashboard:dummy_manager:delete\"\n    classes = (\"ajax-modal\",)\n    icon = \"plus\"\n<\/pre>\n<p>\u3000\u4e21\u65b9\u3068\u3082\u307b\u307c\u540c\u3058\u51e6\u7406\u3092\u884c\u3063\u3066\u304a\u308a\u3001\u305d\u308c\u305e\u308c\u6307\u5b9a\u3057\u305f URL \u306b\u5bfe\u3057\u3066\u753b\u9762\u9077\u79fb\u3092\u5b9f\u65bd\u3057\u307e\u3059\u3002\u305f\u3060\u3057\u3001classes \u30d1\u30e9\u30e1\u30fc\u30bf\u3067 \"ajax-modal\" \u3092\u6307\u5b9a\u3057\u3066\u3044\u308b\u305f\u3081\u3001\u753b\u9762\u9077\u79fb\u3059\u308b\u4ee3\u308f\u308a\u306b\u753b\u9762\u306e\u30e2\u30fc\u30c0\u30eb\u30d3\u30e5\u30fc\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002url \u30d1\u30e9\u30e1\u30fc\u30bf\u306f\u9077\u79fb\u5148\u753b\u9762\u306e\u30ea\u30f3\u30af\u5148 URL \u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\u3053\u3053\u3067\u306f urls.py \u3067\u5b9a\u7fa9\u3057\u305f URL \u30d1\u30bf\u30fc\u30f3\u306e name \u30d1\u30e9\u30e1\u30fc\u30bf\u3067\u6307\u5b9a\u3057\u305f\u5024\u3092\u8a2d\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002\u3053\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u304c django \u306e URL \u30c7\u30a3\u30b9\u30d1\u30c3\u30c1\u30e3\u306e\u4ed5\u7d44\u307f\u306b\u6e21\u3063\u3066 URL \u306b\u5909\u63db\u3057\u3066\u304f\u308c\u307e\u3059\u3002\u307e\u305f\u3001\u3053\u3053\u306b\u76f8\u5bfe\u30d1\u30b9\u3092\u6307\u5b9a\u3057\u305f\u5834\u5408\u306b\u306f\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u306e URL (\/mydashboard) \u4ee5\u964d\u306e\u30d1\u30b9\u304c\u5165\u308a\u307e\u3059\u3002<\/p>\n<h2>\u30e2\u30fc\u30c0\u30eb\u30d5\u30a9\u30fc\u30e0\u306e\u8868\u793a<\/h2>\n<p>\u3000\u30c6\u30fc\u30d6\u30eb\u30a2\u30af\u30b7\u30e7\u30f3 (CraeteData) \u3092\u5b9f\u884c\u3059\u308b\u3068\u3001views.py \u306e CreateView \u3067\u751f\u6210\u3057\u305f\u753b\u9762\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002CreateView \u306f Horizon \u306e ModalFormView \u30af\u30e9\u30b9\u3092\u7d99\u627f\u3057\u3066\u304a\u308a\u3001\u3053\u308c\u306f\u305d\u306e\u540d\u306e\u901a\u308a\u30e2\u30fc\u30c0\u30eb\u30d5\u30a9\u30fc\u30e0\u3092\u8868\u793a\u3055\u305b\u308b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u306a\u308a\u307e\u3059\u3002\u8868\u793a\u3055\u305b\u308b\u30d3\u30e5\u30fc\u306e\u4e2d\u8eab (\u30ec\u30a4\u30a2\u30a6\u30c8) \u306b\u3064\u3044\u3066\u306f\u3001template_name \u30d1\u30e9\u30e1\u30fc\u30bf\u3067\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8 html \u30d5\u30a1\u30a4\u30eb\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:python decode:true\" title=\"openstack_dashboard\/dashboards\/mydashboard\/dummy_manager\/views.py\">\nclass CreateView(forms.ModalFormView):\n    form_class = project_forms.CreateForm\n    template_name = 'mydashboard\/dummy_manager\/create.html'\n    success_url = reverse_lazy(\"horizon:mydashboard:dummy_manager:index\")\n<\/pre>\n<p>\u3000template_name \u30d1\u30e9\u30e1\u30fc\u30bf\u3067\u6307\u5b9a\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u540d\u306f\u5f53\u8a72\u30d1\u30cd\u30eb\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea (mydashboard\/dummy_manager) \u306e \"templates\" \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u4ee5\u4e0b\u306e\u76f8\u5bfe\u30d1\u30b9\u306b\u306a\u308a\u307e\u3059\u3002\u306a\u304a\u3001\u5f53\u8a72 HTTP \u30ea\u30af\u30a8\u30b9\u30c8\u304c XMLHttpRequest \u306b\u3088\u3063\u3066\u751f\u6210\u3055\u308c\u305f ajax \u30ea\u30af\u30a8\u30b9\u30c8\u3060\u3063\u305f\u5834\u5408\u3001Horizon \u306f template_name \u30d1\u30e9\u30e1\u30fc\u30bf\u3067\u6307\u5b9a\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u540d\u306b '_' \u306e\u30d7\u30ec\u30d5\u30a3\u30c3\u30af\u30b9\u304c\u4ed8\u3044\u305f\u30d5\u30a1\u30a4\u30eb (CreateView \u306e\u5834\u5408 \"_create.html\") \u304c\u8aad\u307e\u308c\u307e\u3059\u3002\u4ee5\u4e0b\u306f ModalFormView \u304c mix-in \u3057\u3066\u3044\u308b\u30af\u30e9\u30b9\u306b\u304a\u3051\u308b\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30d5\u30a1\u30a4\u30eb\u540d\u3092\u53d6\u5f97\u3059\u308b\u30e1\u30bd\u30c3\u30c9 \"get_template_names\" \u306e\u5b9f\u88c5\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"lang:python decode:true\" title=\"horizon\/forms\/views.py\">\nclass ModalFormMixin(object):\n    def get_template_names(self):\n        if self.request.is_ajax():\n            if not hasattr(self, \"ajax_template_name\"):\n                # Transform standard template name to ajax name (leading \"_\")\n                bits = list(os.path.split(self.template_name))\n                bits[1] = \"\".join((\"_\", bits[1]))\n                self.ajax_template_name = os.path.join(*bits)\n            template = self.ajax_template_name\n        else:\n            template = self.template_name\n        return template\n<\/pre>\n<p>\u3000\u306a\u306e\u3067 ModalFormView \u3092\u5229\u7528\u3059\u308b\u958b\u767a\u8005\u306f 2 \u7a2e\u985e\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u7528\u610f\u3057\u3066\u304a\u304f\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<h2>\u30d5\u30a9\u30fc\u30e0\u306e\u5024\u8a2d\u5b9a\u3068\u53d6\u5f97\u65b9\u6cd5<\/h2>\n<p>\u3000\u8868\u793a\u3055\u305b\u305f\u30d5\u30a9\u30fc\u30e0\u306b\u5165\u529b\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\u8a2d\u5b9a\u3057\u3001\u8a2d\u5b9a\u3057\u305f\u5165\u529b\u30d5\u30a3\u30fc\u30eb\u30c9\u304b\u3089\u5165\u529b\u5024\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p>\u3000CreateView \u306e\u30af\u30e9\u30b9\u5909\u6570 form_class \u3067\u6307\u5b9a\u3057\u305f forms.py \u306e CreateForm \u306b\u3066 2 \u3064\u306e\u5165\u529b\u30d5\u30a3\u30fc\u30eb\u30c9 (CharField, IntegerField) \u3092\u6307\u5b9a\u3057\u3066\u304a\u308a\u3001\u305d\u308c\u305e\u308c\u540d\u524d\u304c\u793a\u3059\u901a\u308a\u6587\u5b57\u5217\u5165\u529b\u3068\u6570\u5024\u5165\u529b\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\u8868\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:python decode:true\" title=\"openstack_dashboard\/dashboards\/mydashboard\/dummy_manager\/forms.py\">\nclass CreateForm(forms.SelfHandlingForm):\n    name = forms.CharField(max_length=255, label=_(\"Name\"))\n    size = forms.IntegerField(label=_(\"Size [GB]\"))\n<\/pre>\n<p>\u3000\u958b\u767a\u8005\u304c\u4e0a\u8a18\u306e\u3088\u3046\u306b SelfHandlingForm \u3092\u7d99\u627f\u3057\u305f\u30af\u30e9\u30b9\u306e\u30af\u30e9\u30b9\u5909\u6570\u3067\u3053\u308c\u3089\u306e\u5165\u529b\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u30af\u30e9\u30b9\u5909\u6570\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u8a2d\u5b9a\u3057\u3001\u30d3\u30e5\u30fc\u306b Horizon \u304c\u7528\u610f\u3057\u305f\u30d5\u30a9\u30fc\u30e0\u306e\u5165\u529b\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\u8868\u793a\u3059\u308b\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8 'horizon\/common\/_form_fields.html' \u3092\u547c\u3073\u51fa\u305b\u3070\u3001Horizon \u5074\u304c\u3088\u3057\u306a\u306b\u5165\u529b\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\u8868\u793a\u3057\u3066\u304f\u308c\u307e\u3059\u3002<\/p>\n<p><img src='https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2015\/04\/modal_form.png'\/><\/p>\n<p>\u3000\u307e\u305f\u5165\u529b\u30d5\u30a3\u30fc\u30eb\u30c9\u306b\u8a2d\u5b9a\u3057\u305f\u5024\u306e\u53d6\u5f97\u3067\u3059\u304c\u3001\u540c\u3058\u304f CreateForm \u306b\u5b9a\u7fa9\u3057\u305f handle \u30e1\u30bd\u30c3\u30c9\u306b\u3088\u3063\u3066\u5f53\u8a72 URL \u3078\u306e POST \u30ea\u30af\u30a8\u30b9\u30c8\u51e6\u7406\u3092\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:python decode:true\" title=\"openstack_dashboard\/dashboards\/mydashboard\/dummy_manager\/forms.py\">\nclass CreateForm(forms.SelfHandlingForm):\n    name = forms.CharField(max_length=255, label=_(\"Name\"))\n    size = forms.CharField(label=_(\"Size [GB]\"))\n\n    def handle(self, request, data):\n        service = test_service.TestService()\n\n        service.add(name=data['name'], size=data['size'])\n        service.save()\n\n        messages.success(request, _('Successfully to create (dummy) data object'))\n\n        return True\n<\/pre>\n<p>\u3000\u3053\u3053\u3067\u306f\u3001(\u6a21\u64ec)\u5916\u90e8\u30b5\u30fc\u30d3\u30b9 \"test_service\" \u306b\u5bfe\u3057\u3066\u30c7\u30fc\u30bf\u306e\u8ffd\u52a0\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u767a\u884c\u3057\u3001\u753b\u9762\u306b\u30c7\u30fc\u30bf\u304c\u4f5c\u6210\u3055\u308c\u305f\u65e8\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u8868\u793a\u3059\u308b\u51e6\u7406\u3092\u8a18\u8ff0\u3057\u3066\u3044\u307e\u3059\u3002handle \u30e1\u30bd\u30c3\u30c9\u304c True \u3092\u8fd4\u3057\u305f\u5834\u5408\u3001CreateView \u3067\u6307\u5b9a\u3057\u305f success_url \u30d1\u30e9\u30e1\u30fc\u30bf\u3067\u6307\u5b9a\u3057\u305f URL \u3078\u306e\u8ee2\u9001\u3092\u884c\u3044\u3001False \u3092\u8fd4\u3057\u305f\u5834\u5408\u306b\u306f\u884c\u308f\u308c\u305a\u306b\u540c\u3058\u30d5\u30a9\u30fc\u30e0\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<h1>\u307e\u3068\u3081<\/h1>\n<p>\u3000\u3053\u3053\u307e\u3067\u3067\u8aac\u660e\u3057\u305f\u5185\u5bb9\u3092\u99c6\u4f7f\u3059\u308b\u3053\u3068\u3067\u3001Horizon \u306b\u30b5\u30fc\u30c9\u30d1\u30fc\u30c6\u30a3\u306e\u30b7\u30b9\u30c6\u30e0\u3068\u9023\u643a\u3057\u305f\u4f55\u3089\u304b\u306e\u6a5f\u69cb\u3092\u4f5c\u6210\u3067\u304d\u308b\u3068\u601d\u3044\u307e\u3059\u3002\u3053\u3053\u3067\u306f dummy_manager \u306b\u5b9f\u88c5\u3057\u305f\u3046\u3061\u306e\u3054\u304f\u4e00\u90e8\u3057\u304b\u89e3\u8aac\u3057\u307e\u305b\u3093\u3067\u3057\u305f\u304c\u3001\u8208\u5473\u304c\u3042\u308c\u3070\u52d5\u304b\u3057\u306a\u304c\u3089\u5b9f\u88c5\u3092\u898b\u3066\u3069\u3093\u306a\u624b\u6cd5\u304c\u4f7f\u308f\u308c\u3066\u3044\u308b\u304b\u78ba\u8a8d\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002\u540c\u3058\u3088\u3046\u306a Horizon \u62e1\u5f35\u3092\u4f5c\u308b\u969b\u306b\u5f79\u7acb\u3064\u306f\u305a\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u306f\u3058\u3081\u306b \u3000\u3053\u3093\u306b\u3061\u306f\u3001\u30a4\u30f3\u30d5\u30e9\u672c\u90e8\u306e\u5927\u5c71\u88d5\u6cf0\u3067\u3059\u3002\u4eca\u56de\u306f OpenStack Horizon \u306e\u6a5f\u80fd\u3092\u62e1\u5f35\u3057\u3001\u30aa\u30ea\u30b8\u30ca\u30eb\u306e\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u3092\u4f5c\u6210\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u7d39\u4ecb\u3057\u307e\u3059\u3002 \u3000Horizon \u306f OpenStack \u304c\u7ba1 [&hellip;]<\/p>\n","protected":false},"author":121,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[],"tags":[81],"class_list":["post-13868","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","tag-openstack"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/posts\/13868","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/users\/121"}],"replies":[{"embeddable":true,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/comments?post=13868"}],"version-history":[{"count":3,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/posts\/13868\/revisions"}],"predecessor-version":[{"id":13978,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/posts\/13868\/revisions\/13978"}],"wp:attachment":[{"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/media?parent=13868"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/categories?post=13868"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/tags?post=13868"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}