1 import React
from 'react';
2 import { storiesOf
, action
} from '@kadira/storybook';
3 import DashboardCard
from '../../framework/widgets/dashboard_card/dashboard_card.jsx'
4 import SshKeyCard
from '../../plugins/launchpad/src/ssh_keys/sshKeyCard.jsx';
5 import SshKeys
from '../../plugins/launchpad/src/ssh_keys/sshKeys.jsx';
6 import SshKeyStore
from '../../plugins/launchpad/src/ssh_keys/sshKeyStore.js';
7 import Alt
from '../../framework/widgets/skyquake_container/skyquakeAltInstance.js'
8 import reactToJsx
from 'react-to-jsx';
9 import '../../node_modules/open-iconic/font/css/open-iconic.css';
10 import 'style/base.scss';
11 // import StyleGuideItem from 'react-style-guide';
12 // import '../../node_modules/react-style-guide/node_modules/highlight.js/styles/github.css';
14 const Store
= Alt
.createStore(SshKeyStore
)
16 storiesOf('CatalogCard', module
)
17 // .add('page', () => (<SshKeys />))
18 .add('sshKeyPage', () => (<Test
/>))
21 class Test
extends React
.Component
{
25 this.state
= Store
.getState();
26 console
.log(this.state
)
27 Store
.listen(function(data
) {
28 self
.setState({data
: data
.data
})
36 self
.state
.data
&& self
.state
.data
.keys
.map(function(k
, i
) {
37 let sshKey
= self
.state
.data
.entities
[k
];
39 <SshKeyCard key
={i
} name
={sshKey
.name
} value
={sshKey
.key
}
40 editMode
={sshKey
.isEditable
}
41 editKey
= {Store
.editSshKeyPair(sshKey
.name
)}
42 updateSshKeyPair
={Store
.updateSshKeyPair
}
43 cancelEditSshKeyPair
={Store
.cancelEditSshKeyPair
}
44 saveEditSshKeyPair
={Store
.saveEditSshKeyPair(sshKey
.name
)}