balanced/balanced-dashboard

View on GitHub
app/components/api-keys-table.js

Summary

Maintainability
A
35 mins
Test Coverage
import Ember from "ember";
import Auth from "balanced-dashboard/auth";

var ApiKeysTableComponent = Ember.Component.extend({
    oneKey: Ember.computed.equal('keys', 1),
    haveOtherSecrets: function() {
        return this.get('keys').filterBy('secret').length > 1;
    }.property('keys.@each'),

    knownApiKeys: Ember.computed.filterBy("keys", "secret"),
    canDeleteApiKeys: Ember.computed.gt("knownApiKeys.length", 1),

    actions: {
        delete: function(key) {
            this.get("container").lookup("controller:application").send("openModal", "modals/api-key-delete-modal", key);
        }
    }
});

export default ApiKeysTableComponent;