mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	fix: Cannot remove all variants in Admin UI
see https://github.com/Unleash/unleash/issues/544
This commit is contained in:
		
							parent
							
								
									e837aebb66
								
							
						
					
					
						commit
						d297186acb
					
				@ -205,6 +205,59 @@ exports[`renders correctly with without variants 1`] = `
 | 
				
			|||||||
      Add variant
 | 
					      Add variant
 | 
				
			||||||
    </a>
 | 
					    </a>
 | 
				
			||||||
  </p>
 | 
					  </p>
 | 
				
			||||||
 | 
					  <form>
 | 
				
			||||||
 | 
					    <table
 | 
				
			||||||
 | 
					      className="mdl-data-table mdl-shadow--2dp variantTable"
 | 
				
			||||||
 | 
					    >
 | 
				
			||||||
 | 
					      <thead>
 | 
				
			||||||
 | 
					        <tr>
 | 
				
			||||||
 | 
					          <th>
 | 
				
			||||||
 | 
					            Name
 | 
				
			||||||
 | 
					          </th>
 | 
				
			||||||
 | 
					          <th>
 | 
				
			||||||
 | 
					            Weight
 | 
				
			||||||
 | 
					          </th>
 | 
				
			||||||
 | 
					          <th
 | 
				
			||||||
 | 
					            className="actions"
 | 
				
			||||||
 | 
					          />
 | 
				
			||||||
 | 
					        </tr>
 | 
				
			||||||
 | 
					      </thead>
 | 
				
			||||||
 | 
					      <tbody />
 | 
				
			||||||
 | 
					    </table>
 | 
				
			||||||
 | 
					    <br />
 | 
				
			||||||
 | 
					    <div>
 | 
				
			||||||
 | 
					      <react-mdl-Button
 | 
				
			||||||
 | 
					        icon="add"
 | 
				
			||||||
 | 
					        primary={true}
 | 
				
			||||||
 | 
					        raised={true}
 | 
				
			||||||
 | 
					        ripple={true}
 | 
				
			||||||
 | 
					        type="submit"
 | 
				
			||||||
 | 
					      >
 | 
				
			||||||
 | 
					        <react-mdl-Icon
 | 
				
			||||||
 | 
					          name="add"
 | 
				
			||||||
 | 
					        />
 | 
				
			||||||
 | 
					           
 | 
				
			||||||
 | 
					        Save
 | 
				
			||||||
 | 
					      </react-mdl-Button>
 | 
				
			||||||
 | 
					       
 | 
				
			||||||
 | 
					      <react-mdl-Button
 | 
				
			||||||
 | 
					        onClick={[MockFunction]}
 | 
				
			||||||
 | 
					        raised={true}
 | 
				
			||||||
 | 
					        ripple={true}
 | 
				
			||||||
 | 
					        style={
 | 
				
			||||||
 | 
					          Object {
 | 
				
			||||||
 | 
					            "float": "right",
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        type="cancel"
 | 
				
			||||||
 | 
					      >
 | 
				
			||||||
 | 
					        <react-mdl-Icon
 | 
				
			||||||
 | 
					          name="cancel"
 | 
				
			||||||
 | 
					        />
 | 
				
			||||||
 | 
					            Cancel
 | 
				
			||||||
 | 
					      </react-mdl-Button>
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
 | 
					  </form>
 | 
				
			||||||
</section>
 | 
					</section>
 | 
				
			||||||
`;
 | 
					`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -240,5 +293,26 @@ exports[`renders correctly with without variants and no permissions 1`] = `
 | 
				
			|||||||
  >
 | 
					  >
 | 
				
			||||||
    The sum of variants weights needs to be a constant number to guarantee consistent hashing in the client implementations, this is why we will sometime allocate a few more percentages to the first variant if the sum is not exactly 100. In a final version of this feature it should be possible to the user to manually set the percentages for each variant.
 | 
					    The sum of variants weights needs to be a constant number to guarantee consistent hashing in the client implementations, this is why we will sometime allocate a few more percentages to the first variant if the sum is not exactly 100. In a final version of this feature it should be possible to the user to manually set the percentages for each variant.
 | 
				
			||||||
  </p>
 | 
					  </p>
 | 
				
			||||||
 | 
					  <form>
 | 
				
			||||||
 | 
					    <table
 | 
				
			||||||
 | 
					      className="mdl-data-table mdl-shadow--2dp variantTable"
 | 
				
			||||||
 | 
					    >
 | 
				
			||||||
 | 
					      <thead>
 | 
				
			||||||
 | 
					        <tr>
 | 
				
			||||||
 | 
					          <th>
 | 
				
			||||||
 | 
					            Name
 | 
				
			||||||
 | 
					          </th>
 | 
				
			||||||
 | 
					          <th>
 | 
				
			||||||
 | 
					            Weight
 | 
				
			||||||
 | 
					          </th>
 | 
				
			||||||
 | 
					          <th
 | 
				
			||||||
 | 
					            className="actions"
 | 
				
			||||||
 | 
					          />
 | 
				
			||||||
 | 
					        </tr>
 | 
				
			||||||
 | 
					      </thead>
 | 
				
			||||||
 | 
					      <tbody />
 | 
				
			||||||
 | 
					    </table>
 | 
				
			||||||
 | 
					    <br />
 | 
				
			||||||
 | 
					  </form>
 | 
				
			||||||
</section>
 | 
					</section>
 | 
				
			||||||
`;
 | 
					`;
 | 
				
			||||||
 | 
				
			|||||||
@ -122,9 +122,9 @@ class UpdateVariantComponent extends Component {
 | 
				
			|||||||
                            Add variant
 | 
					                            Add variant
 | 
				
			||||||
                        </a>
 | 
					                        </a>
 | 
				
			||||||
                    </p>
 | 
					                    </p>
 | 
				
			||||||
 | 
					                    
 | 
				
			||||||
                ) : null}
 | 
					                ) : null}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                {variants.length > 0 ? (
 | 
					 | 
				
			||||||
                <form onSubmit={onSubmit(input, features)}>
 | 
					                <form onSubmit={onSubmit(input, features)}>
 | 
				
			||||||
                    <table className={['mdl-data-table mdl-shadow--2dp', styles.variantTable].join(' ')}>
 | 
					                    <table className={['mdl-data-table mdl-shadow--2dp', styles.variantTable].join(' ')}>
 | 
				
			||||||
                        <thead>
 | 
					                        <thead>
 | 
				
			||||||
@ -141,7 +141,6 @@ class UpdateVariantComponent extends Component {
 | 
				
			|||||||
                        <FormButtons submitText={'Save'} onCancel={onCancel} />
 | 
					                        <FormButtons submitText={'Save'} onCancel={onCancel} />
 | 
				
			||||||
                    ) : null}
 | 
					                    ) : null}
 | 
				
			||||||
                </form>
 | 
					                </form>
 | 
				
			||||||
                ) : null}
 | 
					 | 
				
			||||||
            </section>
 | 
					            </section>
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user