Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// TODO: watch for namespace changes when the selection list is open
// and avoid 'n' key to trigger another request
get(session.openshift ? get_projects() : get_namespaces())
.then(response => JSON.parse(response.body.toString('utf8')))
// TODO: display a message in case the user has access to no namespaces
.then(namespaces => session.namespaces = namespaces)
.then(namespaces => namespaces_list.setItems(namespaces.items.reduce((data, namespace) => {
data.push(namespace.metadata.name === session.namespace ?
`{blue-fg}${namespace.metadata.name}{/blue-fg}` : namespace.metadata.name);
return data;
}, [])))
.then(() => screen.render())
.catch(error => console.error(error.stack));
});
const carousel = new contrib.carousel(
[
screen => {
// TODO: restore selection if any
screen.append(pods_table);
screen.append(pod_log);
pod_log.setScrollPerc(100);
pods_table.focus();
},
screen => {
screen.append(debug);
debug.setScrollPerc(100);
}
],
{
screen : screen,
interval : 0,
.then(boxes => {
/* put boxes into carousel */
var carousel = new contrib.carousel(boxes
, { screen: this.screen
, interval: 0
, rotate: false
, controlKeys: true });
carousel.start();
})
.catch(e => {
componentDidMount() {
this.carousel = new contrib.carousel(this.props.children, this.props);
this.carousel.move = () => {
this.setState({
page: this.carousel.currPage
});
}
this.carousel.start();
}