#50535 Issue 50534 - CLI change schema edit subcommand to replace
Merged a year ago by mreynolds. Opened a year ago by mreynolds.
mreynolds/389-ds-base issue50534  into  master

@@ -226,11 +226,6 @@ 

                    </select>

                  </div>

                </div>

-               <div>

-                 <label for="oc-x-origin" class="ds-config-label-lrg"

-                        title="The objectClass X-ORIGIN (keep 'user defined' if it's a non-standard objectClass)"><b

-                 >ObjectClass X-ORIGIN</b></label><input class="ds-input" type="text" id="oc-x-origin" size="40"/>

-               </div>

              </div>

            </form>

            <div id="save-oc-spinner" class="ds-center" hidden>

@@ -84,7 +84,6 @@ 

    $("#schema-list").prop('selectedIndex',-1);

    $('#oc-required-list').find('option').remove();

    $('#oc-allowed-list').find('option').remove();

-   $("#oc-x-origin").val("");

    $("#save-oc-button").attr('disabled', false);

  }

  

@@ -106,7 +105,6 @@ 

    $("#attr-eq-mr-select").prop('selectedIndex',0);

    $("#attr-order-mr-select").prop('selectedIndex',0);

    $("#attr-sub-mr-select").prop('selectedIndex',0);

-   $("#attr-x-origin").val("");

    $("#save-attr-button").attr('disabled', false);

  }

  

@@ -410,7 +408,7 @@ 

        var oc_parent = $("#oc-parent").val();

        var oc_kind = $("#oc-kind").val();

        var oc_desc = $("#oc-desc").val();

-       var oc_x_origin = $("#oc-x-origin").val();

+       var oc_x_origin = "user defined";

        var oc_required_list = $('#oc-required-list option').map(function() { return $(this).val(); }).get();

        var oc_allowed_list = $('#oc-allowed-list option').map(function() { return $(this).val(); }).get();

  

@@ -418,7 +416,7 @@ 

        var edit = false;

        if ( $("#add-edit-oc-header").text().indexOf("Edit Objectclass") != -1){

          edit = true;

-         action = 'edit';

+         action = 'replace';

        }

        if (oc_name == '') {

          report_err($("#oc-name"), 'You must provide an objectClass name');

@@ -584,7 +582,7 @@ 

        var edit = false;

        if ( $("#add-edit-attr-header").text().indexOf("Edit Attribute") != -1){

          edit = true;

-         action = 'edit';

+         action = 'replace';

        }

  

        if (attr_name == '') {

@@ -793,7 +791,6 @@ 

        $("#oc-oid").val(edit_oc_oid);

        $("#oc-kind")[0].value = edit_oc_kind;

        $("#oc-desc").val(edit_oc_desc);

-       $("#oc-x-origin").val(edit_oc_x_origin);

        $("#oc-parent")[0].value = edit_oc_parent;

        $.each(edit_oc_required, function (i, item) {

          if (item) {

@@ -326,7 +326,7 @@ 

      at_add_parser.set_defaults(func=add_attributetype)

      _add_parser_args(at_add_parser, 'attributetypes')

      at_add_parser.add_argument('--syntax', required=True, help='OID of the LDAP syntax assigned to the attribute')

-     at_edit_parser = attributetypes_subcommands.add_parser('edit', help='Edit an attribute type on this system')

+     at_edit_parser = attributetypes_subcommands.add_parser('replace', help='Replace an attribute type on this system')

      at_edit_parser.set_defaults(func=edit_attributetype)

      _add_parser_args(at_edit_parser, 'attributetypes')

      at_edit_parser.add_argument('--syntax', help='OID of the LDAP syntax assigned to the attribute')

@@ -344,7 +344,7 @@ 

      oc_add_parser = objectclasses_subcommands.add_parser('add', help='Add an objectClass to this system')

      oc_add_parser.set_defaults(func=add_objectclass)

      _add_parser_args(oc_add_parser, 'objectclasses')

-     oc_edit_parser = objectclasses_subcommands.add_parser('edit', help='Edit an objectClass on this system')

+     oc_edit_parser = objectclasses_subcommands.add_parser('replace', help='Replace an objectClass on this system')

      oc_edit_parser.set_defaults(func=edit_objectclass)

      _add_parser_args(oc_edit_parser, 'objectclasses')

      oc_remove_parser = objectclasses_subcommands.add_parser('remove', help='Remove an objectClass on this system')

Description:

The way the CLI currently edits an attribute or objectclass is that it deletes it, and then adds the new attribute using only the params specified in "edit". So the subcommand "edit" is misleading as previous/untouched values will get overwritten, it should be "replace" instead to avoid confusion.

relates: https://pagure.io/389-ds-base/issue/50534

rebased onto b8c6485

a year ago

Pull-Request has been merged by mreynolds

a year ago