4 * Copyright 2016 RIFT.IO Inc
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
20 * Created by kkashalk on 11/10/15.
23 // NOTE: THIS FILE HAS BEEN DEPRECATED AND WILL BE REMOVED
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'
34 import '../styles/RiftHeader.scss'
36 const uiTransientState
= {
40 const RiftHeader
= React
.createClass({
41 mixins
: [PureRenderMixin
],
43 return RiftHeaderStore
.getState();
47 componentWillMount() {
50 RiftHeaderStore
.listen(this.onChange
);
51 const loadCatalogs = function () {
52 RiftHeaderStore
.loadCatalogs();
53 uiTransientState
.timeoutId
= setTimeout(loadCatalogs
, 2000);
55 RiftHeaderStore
.requestLaunchpadConfig();
58 componentDidUpdate() {
60 componentWillUnmount() {
61 if (uiTransientState
.timeoutId
) {
62 clearTimeout(uiTransientState
.timeoutId
);
64 RiftHeaderStore
.unlisten(this.onChange
);
70 onClickOpenDashboard() {
71 if (uiTransientState
.timeoutId
) {
72 clearTimeout(uiTransientState
.timeoutId
);
74 RiftHeaderStore
.unlisten(this.onChange
);
75 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
;
77 onClickOpenAccounts() {
78 if (uiTransientState
.timeoutId
) {
79 clearTimeout(uiTransientState
.timeoutId
);
81 RiftHeaderStore
.unlisten(this.onChange
);
82 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';
86 <header className
="header-app">
87 <h1
>{this.state
.headerTitle
}</h1
>
88 <nav className
="header-nav"> </nav
>
98 export default RiftHeader
;