mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	Admin UI tweaking #153
This commit is contained in:
		
							parent
							
								
									276503ad20
								
							
						
					
					
						commit
						4fe332e906
					
				| @ -11,9 +11,7 @@ | |||||||
|             "name": "default", |             "name": "default", | ||||||
|             "parameters": {} |             "parameters": {} | ||||||
|           } |           } | ||||||
|         ], |         ] | ||||||
|         "strategy": "default", |  | ||||||
|         "parameters": {} |  | ||||||
|       }, |       }, | ||||||
|       { |       { | ||||||
|         "name": "Feature.B", |         "name": "Feature.B", | ||||||
| @ -32,11 +30,44 @@ | |||||||
|               "percentage": "10" |               "percentage": "10" | ||||||
|             } |             } | ||||||
|           } |           } | ||||||
|         ], |         ] | ||||||
|         "strategy": "ActiveForUserWithId", |       }, | ||||||
|         "parameters": { |       { | ||||||
|           "userIdList": "123,221,998" |         "name": "Feature.C", | ||||||
|         } |         "description": "lorem ipsum", | ||||||
|  |         "enabled": false, | ||||||
|  |         "strategies": [ | ||||||
|  |           { | ||||||
|  |             "name": "default", | ||||||
|  |             "parameters": {} | ||||||
|  |           } | ||||||
|  |         ] | ||||||
|  |       }, | ||||||
|  |       { | ||||||
|  |         "name": "Feature.D", | ||||||
|  |         "description": "lorem ipsum", | ||||||
|  |         "enabled": true, | ||||||
|  |         "strategies": [ | ||||||
|  |           { | ||||||
|  |             "name": "default", | ||||||
|  |             "parameters": {} | ||||||
|  |           } | ||||||
|  |         ] | ||||||
|  |       }, | ||||||
|  |       { | ||||||
|  |         "name": "Feature.E", | ||||||
|  |         "description": "lorem ipsum", | ||||||
|  |         "enabled": true, | ||||||
|  |         "strategies": [ | ||||||
|  |           { | ||||||
|  |             "name": "default", | ||||||
|  |             "parameters": {} | ||||||
|  |           }, | ||||||
|  |           { | ||||||
|  |             "name": "FancyStrat", | ||||||
|  |             "parameters": {} | ||||||
|  |           } | ||||||
|  |         ] | ||||||
|       } |       } | ||||||
|     ] |     ] | ||||||
|   } |   } | ||||||
|  | |||||||
| @ -64,14 +64,13 @@ class AddFeatureToggle extends React.Component { | |||||||
|                     </section> |                     </section> | ||||||
| 
 | 
 | ||||||
|                     <section> |                     <section> | ||||||
|                         <legend>Strategies</legend> |                         <a href="#" onClick="">Add strategy..</a> | ||||||
|                         <Button icon="add" floating /> |  | ||||||
|                     </section> |                     </section> | ||||||
| 
 | 
 | ||||||
|                     <br /> |                     <br /> | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|                     <Button type="submit" raised primary label="Create Feature Toggle" /> |                     <Button type="submit" raised primary label="Create" /> | ||||||
|                 </form> |                 </form> | ||||||
|             </div> |             </div> | ||||||
|         ); |         ); | ||||||
|  | |||||||
| @ -1,17 +1,24 @@ | |||||||
| /* eslint no-shadow: ["error", { "allow": ["name"] }]*/ | /* eslint no-shadow: ["error", { "allow": ["name"] }]*/ | ||||||
| 
 | 
 | ||||||
| import React, { PropTypes } from 'react'; | import React, { PropTypes } from 'react'; | ||||||
|  | import { Switch, FontIcon } from 'react-toolbox'; | ||||||
| 
 | 
 | ||||||
| const Feature = ({ onClick, name, enabled }) => ( | const Feature = ({ onClick, name, enabled, strategies }) => ( | ||||||
|   <li> |   <tr> | ||||||
|     {name} is {enabled ? 'enabled ' : 'disabled '} |     <td style={{ paddingTop: '1.5rem' }}><Switch onChange={onClick} checked={enabled} /></td> | ||||||
|     <a onClick={onClick} href="#">toggle</a> |     <td><a href="/edit">{name}</a></td> | ||||||
|   </li> |     <td>{strategies.map(s => `${s.name}, `)}</td> | ||||||
|  |     <td style={{ textAlign: 'right' }}> | ||||||
|  |       <FontIcon value="edit" /> | ||||||
|  |       <FontIcon value="delete"  style={{ color: 'red' }} /> | ||||||
|  |     </td> | ||||||
|  |   </tr> | ||||||
| ); | ); | ||||||
| 
 | 
 | ||||||
| Feature.propTypes = { | Feature.propTypes = { | ||||||
|     onClick: PropTypes.func.isRequired, |     onClick: PropTypes.func.isRequired, | ||||||
|     enabled: PropTypes.bool.isRequired, |     enabled: PropTypes.bool.isRequired, | ||||||
|  |     strategies: PropTypes.array.isRequired, | ||||||
|     name: PropTypes.string.isRequired, |     name: PropTypes.string.isRequired, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1,5 +1,6 @@ | |||||||
| import React, { PropTypes } from 'react'; | import React, { PropTypes } from 'react'; | ||||||
| import Feature from './Feature'; | import Feature from './Feature'; | ||||||
|  | import style from './table.scss'; | ||||||
| 
 | 
 | ||||||
| export default class FeatureList extends React.Component { | export default class FeatureList extends React.Component { | ||||||
|     constructor () { |     constructor () { | ||||||
| @ -27,10 +28,23 @@ export default class FeatureList extends React.Component { | |||||||
|                 <Feature key={featureToggle.name} |                 <Feature key={featureToggle.name} | ||||||
|                     {...featureToggle} |                     {...featureToggle} | ||||||
|                     onClick={() => onFeatureClick(featureToggle.name)} |                     onClick={() => onFeatureClick(featureToggle.name)} | ||||||
|                 />); |                 /> | ||||||
|  |             ); | ||||||
| 
 | 
 | ||||||
|         return ( |         return ( | ||||||
|             <ul>{features}</ul> |             <table className={style.ztable}> | ||||||
|  |                 <thead> | ||||||
|  |                     <tr> | ||||||
|  |                         <th width="80">Enabled</th> | ||||||
|  |                         <th>Feature Toggle</th> | ||||||
|  |                         <th>Strategies</th> | ||||||
|  |                         <th width="100" style={{ textAlign: 'right' }}>Actions</th> | ||||||
|  |                     </tr> | ||||||
|  |                 </thead> | ||||||
|  |                 <tbody> | ||||||
|  |                     {features} | ||||||
|  |                 </tbody> | ||||||
|  |             </table> | ||||||
|         ); |         ); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -0,0 +1,12 @@ | |||||||
|  | .ztable tbody tr:nth-child(odd) { | ||||||
|  |     background-color: #efefef; | ||||||
|  | } | ||||||
|  | .ztable { | ||||||
|  |     margin: 10px; | ||||||
|  |     border-collapse: separate; | ||||||
|  |     border-spacing: 0; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .ztable td, th { | ||||||
|  |     padding: 4px 10px; | ||||||
|  | } | ||||||
| @ -13,7 +13,7 @@ export default class Features extends Component { | |||||||
|         return ( |         return ( | ||||||
|             <div> |             <div> | ||||||
|                 <h1>Feature Toggles</h1> |                 <h1>Feature Toggles</h1> | ||||||
|                 <Button href={createHref} icon="add" label="Create feature toggle"/> |                 <Button href={createHref} icon="add" raised primary label="New Feature Toggle"/> | ||||||
|                 <FeatureListContainer /> |                 <FeatureListContainer /> | ||||||
|             </div> |             </div> | ||||||
|         ); |         ); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user