Revision 978648f4

b/ui/static/main.css
4562 4562
    display: none;
4563 4563
}
4564 4564

  
4565
.overlay .copy-content .clip-copy {
4566
    right: 10px;
4567
    top:8px;
4568
    border: 1px solid #fff;
4569
}
4570

  
4571
.overlay .copy-content {
4572
    background-color: #387693;
4573
    color: #fff;
4574
    padding: 10px;
4575
    font-size: 1.2em;
4576
    text-align: center;
4577
    position: relative;
4578
}
4579

  
4565 4580
.overlay {
4566 4581
    background-color: #fff;
4567 4582
    border: 2px solid #444;
b/ui/static/snf/js/ui/web/ui_create_view.js
48 48
        },
49 49
        
50 50
        beforeOpen: function() {
51
            if (this.clipboard) { return };
51
            try { delete this.clipboard } catch (err) { console.log(err) };
52 52
            this.clipboard = new util.ClipHelper(this.copy);
53 53
        },
54 54
        
b/ui/static/snf/js/ui/web/ui_main_view.js
15 15
    var bb = root.Backbone;
16 16
    var util = snf.util;
17 17
    
18
    views.ApiInfoView = views.Overlay.extend({
19
        view_id: "api_info_view",
20
        
21
        content_selector: "#api-info-overlay",
22
        css_class: 'overlay-api-info overlay-info',
23
        overlay_id: "overlay-api-info",
24

  
25
        subtitle: "",
26
        title: "API Access",
27

  
28
        beforeOpen: function() {
29
            var cont = this.$(".copy-content p");
30
            var token = $.cookie("X-Auth-Token");
31

  
32
            cont.html("");
33
            cont.text(token);
34

  
35
            var clip = new snf.util.ClipHelper();
36
            cont.parent().append(clip.cont);
37
            clip.setText(token);
38
        },
39

  
40
        onClose: function() {
41
            var cont = this.$(".copy-content p");
42
            var token = $.cookie("X-Auth-Token");
43
            cont.html("");
44
        }
45
    });
46

  
18 47
    // TODO: implement me
19 48
    views.NoticeView = views.Overlay.extend({});
20 49

  
......
404 433

  
405 434
        init_overlays: function() {
406 435
            this.create_vm_view = new views.CreateVMView();
436
            this.api_info_view = new views.ApiInfoView();
407 437
            //this.notice_view = new views.NoticeView();
408 438
        },
409 439
        
b/ui/static/snf/js/utils.js
161 161
        this.clip.addEventListener('complete', _.bind(function(client, text) {
162 162
            var tip = el.data("tooltip")
163 163
            tip.hide().getTip().text("Copied");
164
            
164 165
            window.setTimeout(function() {
165 166
                tip.show();
166 167
            }, 70)
168

  
167 169
            window.setTimeout(function() {
168 170
                tip.hide().getTip().text(copy_prompt);
169
                window.setTimeout(function(){
170
                    tip.show();
171
                }, 100)
172 171
            }, 3000)
173 172
        }, this));
174 173
    }
b/ui/static/synnefo.js
177 177
    return false;
178 178
}
179 179

  
180

  
181
function show_api_overlay() {
182
    var config = {
183
        title: window.API_OVERLAY_TITLE,
184
        content: $(".api_overlay_content").html().replace("$api_key", $.cookie("X-Auth-Token")),
185
        extra: $.cookie("X-Auth-Token"),
186
        sub_content: window.API_OVERLAY_SUBCONTENT,
187
        cls: "api_content",
188
        ajax: false
189
    }
190
    msg_box(config);
191
}
192

  
193 180
function show_invitations() {
194 181
    
195 182
    function display_resend_success(msg) {
b/ui/templates/home.html
51 51
    <script src="{{ SYNNEFO_JS_WEB_URL}}ui_single_view.js"></script>
52 52
    <script src="{{ SYNNEFO_JS_WEB_URL}}ui_list_view.js"></script>
53 53
    <script src="{{ SYNNEFO_JS_WEB_URL}}ui_networks_view.js"></script>
54
    <script src="{{ SYNNEFO_JS_WEB_URL}}ui_main_view.js"></script>
55 54
    <script src="{{ SYNNEFO_JS_WEB_URL}}ui_metadata_view.js"></script>
56 55
    <script src="{{ SYNNEFO_JS_WEB_URL}}ui_feedback_view.js"></script>
57 56
    <script src="{{ SYNNEFO_JS_WEB_URL}}ui_create_view.js"></script>
58 57
    <script src="{{ SYNNEFO_JS_WEB_URL}}ui_connect_view.js"></script>
58
    <script src="{{ SYNNEFO_JS_WEB_URL}}ui_main_view.js"></script>
59 59

  
60 60
    <!-- the following views require refactor -->
61 61
    <script src="static/invitations.js"></script>
......
290 290
            });
291 291

  
292 292
            $(".usermenu .invitations").click(show_invitations);
293
            $(".usermenu .api").click(show_api_overlay);
293
            $(".usermenu .api").click(function(){
294
                synnefo.ui.main.api_info_view.show();
295
            });
294 296

  
295 297
        });
296 298
        
......
459 461
        </div>
460 462
    </div>
461 463
    
464
    <div id="api-info-overlay" class="overlay-content overlay-info hidden">
465
        <div class="description">
466
            <p>{% blocktrans with EXTERNAL_CLIENT_URL as EXTERNAL_CLIENT_URL %}Use the following API key along with the <a
467
                href="{{ EXTERNAL_CLIENT_URL }}">./kamaki</a> client to manage
468
            your cloud resources from outside this page.{% endblocktrans %}</p>
469
        </div>
470
        <div class="copy-content">
471
            <p></p>
472
        </div>
473
        <div class="description subinfo">
474
            <p>
475
            {% trans "The API key provides full access to your <em>~okeanos</em> account, so always keep it private." %}
476
            </p>
477
        </div>
478
    </div>
479

  
462 480
    <div class="api_overlay_template">
463 481
        <div class="api_overlay_content">
464 482
            <p>Use the following API key along with the <a href="{{ EXTERNAL_CLIENT_URL }}">./kamaki</a> client to manage your cloud resources from outside this page.</p>
......
517 535
            synnefo.config.machines_icons_url = '{{ UI_MEDIA_URL }}icons/machines/';
518 536

  
519 537
            synnefo.ui.init();
538

  
539
            synnefo.ui.main.bind("initial", function(){})
520 540
        })
521 541
    </script>
522 542
</body>

Also available in: Unified diff