update from RIFT as of 696b75d2fe9fb046261b08c616f1bcf6c0b54a9b third try
[osm/UI.git] / skyquake / plugins / composer / src / src / components / RiftHeader.js
1
2 /*
3 *
4 * Copyright 2016 RIFT.IO Inc
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 */
19 /**
20 * Created by kkashalk on 11/10/15.
21 */
22
23 // NOTE: THIS FILE HAS BEEN DEPRECATED AND WILL BE REMOVED
24
25 'use strict';
26
27 import utils from '../libraries/utils'
28 import React from 'react'
29 import ClassNames from 'classnames'
30 import PureRenderMixin from 'react-addons-pure-render-mixin'
31 import RiftHeaderActions from '../actions/RiftHeaderActions'
32 import RiftHeaderStore from '../stores/RiftHeaderStore'
33
34 import '../styles/RiftHeader.scss'
35
36 const uiTransientState = {
37 timeoutId: 0
38 };
39
40 const RiftHeader = React.createClass({
41 mixins: [PureRenderMixin],
42 getInitialState() {
43 return RiftHeaderStore.getState();
44 },
45 getDefaultProps() {
46 },
47 componentWillMount() {
48 },
49 componentDidMount() {
50 RiftHeaderStore.listen(this.onChange);
51 RiftHeaderStore.requestLaunchpadConfig();
52 },
53 componentDidUpdate() {
54 },
55 componentWillUnmount() {
56 if (uiTransientState.timeoutId) {
57 clearTimeout(uiTransientState.timeoutId);
58 }
59 RiftHeaderStore.unlisten(this.onChange);
60 },
61
62 onChange(state) {
63 this.setState(state);
64 },
65 onClickOpenDashboard() {
66 RiftHeaderStore.unlisten(this.onChange);
67 window.location.href = '//' + window.location.hostname + ':8000/index.html?api_server=' + utils.getSearchParams(window.location).api_server + '#/launchpad/' + utils.getSearchParams(window.location).mgmt_domain_name;
68 },
69 onClickOpenAccounts() {
70 if (uiTransientState.timeoutId) {
71 clearTimeout(uiTransientState.timeoutId);
72 }
73 RiftHeaderStore.unlisten(this.onChange);
74 window.location.href = '//' + window.location.hostname + ':8000/index.html?api_server=' + utils.getSearchParams(window.location).api_server + '#/launchpad/' + utils.getSearchParams(window.location).mgmt_domain_name + '/cloud-account/dashboard';
75 },
76 render() {
77 let Header = (
78 <header className="header-app">
79 <h1>{this.state.headerTitle}</h1>
80 <nav className="header-nav"> </nav>
81 </header>
82 );
83 Header = null;
84 return (
85 null
86 );
87 }
88 });
89
90 export default RiftHeader;