lukaswelte / PICO

Personal Internet Context Organizer
Other
1 stars 0 forks source link

Search Entry #37

Closed GoPlunder closed 9 years ago

GoPlunder commented 9 years ago

In this component there will be an input field where you can type in a term and see matching entry items

lukaswelte commented 9 years ago

In searchentry.js ist hier das Problem.

    getStateFromFlux: function() {
        var flux = this.getFlux();
        var fetchedEntries = flux.stores.EntryStore.getAllEntries().entries;
        var fetchedEntriesLabels = fetchedEntries.map(function(entry) {
            return entry.labels.map(function(label) {
                return label;
            });
        });
        return {
            entries: fetchedEntries,
            suggestedEntries: fetchedEntries,
            availableLabels: fetchedEntriesLabels,
            selectedLabels: []
        };
    },
var fetchedEntries = flux.stores.EntryStore.getAllEntries().entries;

produziert output der die id und dann den entry als Objekt hält. z.B.:

{"33":{"id":33, "url": "http://google.de", "labels": [{"name": "hallo"}, {"name": "google"}]}}

Die funktion:

var fetchedEntriesLabels = fetchedEntries.map(function(entry)

macht dann nichts anderes als die value eines solchen Key-Value Paares zu ändern. Das Resultat wäre also:

{"33": [{"name": "hallo"}, {"name": "google"}]}

Was du aber willst ist eine Liste aus Labels also

 [{"name": "hallo"}, {"name": "google"}]