GithubHelp home page GithubHelp logo

openshift / angular-key-value-editor Goto Github PK

View Code? Open in Web Editor NEW
14.0 11.0 13.0 404 KB

A simple UI for editing key-value pairs

License: Other

JavaScript 56.19% HTML 42.71% CSS 0.92% Shell 0.18%

angular-key-value-editor's Issues

Fix the validator error tooltip title attrib

Code snippet when bug found:

<span ng-if="entry.keyValidatorErrorTooltip || keyValidatorErrorTooltip" class="help action-inline">
            <a aria-hidden="true" data-toggle="tooltip" data-placement="top" title="{{entry.keyValidatorErrorTooltip || keyValidatorErrorTooltip}}">
              <i class="{{entry.keyValidatorErrorTooltipIcon || keyValidatorErrorTooltipIcon}}"></i>
            </a>
          </span>

did not render properly via bootstrap tooltip, hack around was to use data-original-title="" directly, but this isn't right.

@rhamilto

Support readonly secrets

This is a "key value pair"... but the value is something complicated that really can't be displayed. Therefore we probably need a displayName property on the entry.

Are the config & $attrs assignments backwards in the link fn?

in this code:

  // min/max lengths
            $scope.keyMinlength = keyValueEditorConfig.keyMinlength || $attrs.keyMinlength;
            $scope.keyMaxlength = keyValueEditorConfig.keyMaxlength || $attrs.keyMaxlength;
            $scope.valueMinlength = keyValueEditorConfig.valueMinlength || $attrs.valueMinlength;
            $scope.valueMaxlength = keyValueEditorConfig.valueMaxlength || $attrs.valueMaxlength;
            // validation regex
            $scope.keyValidator = keyValueEditorConfig.keyValidator || $attrs.keyValidator;
            $scope.valueValidator = keyValueEditorConfig.valueValidator || $attrs.valueValidator;
            $scope.keyValidatorError = keyValueEditorConfig.keyValidatorError || $attrs.keyValidatorError;
            $scope.valueValidatorError = keyValueEditorConfig.valueValidatorError || $attrs.valueValidatorError;
            // key value validator error tooltip
            $scope.keyValidatorErrorTooltip = keyValueEditorConfig.keyValidatorErrorTooltip || $attrs.keyValidatorErrorTooltip;
            $scope.keyValidatorErrorTooltipIcon = keyValueEditorConfig.keyValidatorErrorTooltipIcon || $attrs.keyValidatorErrorTooltipIcon;
            // secret values
            $scope.secretValueTooltip = keyValueEditorConfig.secretValueTooltip || $attrs.secretValueTooltip;
            $scope.secretValueIcon = keyValueEditorConfig.secretValueIcon || $attrs.secretValueIcon;
            // placeholders
            $scope.keyPlaceholder = keyValueEditorConfig.keyPlaceholder || $attrs.keyPlaceholder;
            $scope.valuePlaceholder = keyValueEditorConfig.valuePlaceholder || $attrs.valuePlaceholder;

Seems like the $attrs should come first. @rhamilto

support object as well as array

Opening this mostly to illustrate why it won't be supported.

Illustration:

var list = [{
  name: 'foo',
  value: 'bar'
  isReadonly: true
}, {
  name: 'foo2',
  value: 'bar2'
  cannotDelete: true
}];

var list2 = {
  foo: 'bar',        // now, how to add additional props? mess. nope.
  foo2: 'bar2'
}

A plain object of key-value pairs can't be supported while also supporting the additional properties desired. For this reason, objects should be converted to a list to display with this control, then back to an object when user interaction is complete (save, etc).

@rhamilto just documenting why this wont work

Setup e2e style tests

Prob some of the features cannot be easily tested via standard unit tests. Therefore setting up protractor would probably be handy.

Doc some corner case attrib mixes

Example:

<key-value-editor
    entries="entries"
    is-readonly
    add-row-link></key-value-editor>

the add-row-link will exist, but is-readonly means no rows can be edited. Don't use add-row-link with is-readonly. This is simple enough, but could be problematic if some attribs are conditionally applied via ng-attr-* usage.

Add labels for inputs

Need to ensure that screen readers can clearly communicate the purpose of each input.

Ensure no empty pairs in returned source

Right now we are tacking on an extra empty pair every time the last pair is clicked. This may need to be adjusted, perhaps by putting the "new" empty item in its own separate block until the user interacts with it. $dirty may be the route to take, however it may just end up being the responsibity of the object receiving the pairs to ensure final validation (ie, no lingering empty pairs anywhere, as the user could blank them all out).

Create a picker directive for complex key value pairs

In the web console of openshift we will have key value pars where the value is a complex object (something like choosing a value from a secret, or from a config map). This directive needs to be able to take an array of data to "choose" from, or perhaps take a url that would allow it to fetch data to then present as a picker.

I'm leaning towards no HTTP calls, that should be provided by calling code (controller).

Finish demo by saving modifications

add a "save" button to the demo that will take the UI copy of the data and merge it back into the original data to conceptually send to server (or whatever is going to be done with it).

Setup unit tests

We have enough dense complexity here that it really would be nice to run tests when we commit at this point & avoid regressions.

'is-readonly' attribute should take boolean

'is-readonly' attribute should take boolean, since the there are cases we want to have the envVar editor readlony and cases we don't.
Eg: different users have different actions allowed, so when checking user's permissions we would pass the result into the attribute

Add cache to travis.yml?

Removed this block, but perhaps should put it back:

#cache:
#  directories:
#  - node_modules
#  - bower_components

Fix main entry in bower.json

bower complains:

bower angular-key-value-editor#1.1.0     invalid-meta The "main" field has to contain only 1 file per filetype; found multiple .js files: ["dist/angular-key-value-editor.js","dist/compiled-templates.js"]

Fix is probably to create a third file & put the minified js + compiled templates together (but leaves option for someone to opt out of templates).

update main in bower.json

@rhamilto just found this when added to web console :)

  "main": [
    "dist/angular-key-value-editor.css",
    "dist/angular-key-value-editor.js",
    "dist/compiled-templates.js"
  ],

value as a textarea

Some values may be quite a bit larger and require a textbox instead of an input.

@rhamilto im adding as issues so we can work on them if we divvy out anything

validation

A general keyValidator and valueValidator property should be able to be set to provide regex validation for the key-value pairs.

Ideally these should be able to be provided on each entry as keyValidator: '<some-regex>' so individual entries can be uniquely validated if they serve different purposes

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.