/* * * Copyright 2016 RIFT.IO Inc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ import './sshKeyCard.scss'; import React, {Component} from 'react'; import TextInput from 'widgets/form_controls/textInput.jsx'; import SshKeyActions from './sshKeyActions.js'; import Button from 'widgets/button/rw.button.js'; export default class SshKeyCard extends Component { constructor(props) { super(props); this.state = {}; this.state.isExpanded = false; } cancelEdit(name) { SshKeyActions.cancelEditSshKeyPair(name) } render() { let {className, ...props} = this.props; let editMode = props.editMode.toString().toUpperCase(); let editToolsHTML = null; let isInEditMode = null; let isInCreateMode = null; className = "sshKeyCard " + className; isInEditMode = editMode == "TRUE" ? true : false; isInCreateMode = editMode == "CREATE" ? true : false; if(isInEditMode) { editToolsHTML = (
) } else { if(isInCreateMode) { editToolsHTML = (
); } else { editToolsHTML = (
); } } return (
{ editToolsHTML }
) } } SshKeyCard.defaultProps = { className: null, editMode: false, saveKey: function(e) { console.log('saving key'); }, cancelEdit: function(e) { console.log('canceling edit'); }, editKey: function(e) { console.log('Starting edit') }, deleteKey: function(e) { console.log('deleting key') } }