-
Notifications
You must be signed in to change notification settings - Fork 216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: vocabularies' settings #1159
Conversation
|
||
VocabularyService | ||
.$inject = [ 'api', 'urls', 'session', '$upload', '$q', 'metadata' ]; | ||
function VocabularyService(api, urls, session, $upload, $q, metadata) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused injections $upload
, metadata
$scope.vocabularies = null; | ||
$scope.vocabulary = null; | ||
|
||
$scope.createVocabulary = function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since metadata.values
is cached we either need to update the metadata.values
or invalidate the metadata.values
.
@actionless after this ticket we had a discussion and finalized that vocabularies will not have UI. Not sure if this is been changed. @akintolga @ioanpocol has this been discussed with Lasky or Vince about this ticket before adding this ticket to the current sprint? |
59ca152
to
dc68a0c
Compare
@sivakuna-aap |
@actionless I had a discussion with @andrew Lasky and @akintolga. The keywords management will fall under the same UI you put in this PR. I will close my PR and rework after this is merged. However, this PR needs to address below things:
|
expect(scope.vocabulary.items[0]).toEqual({foo: null, bar: null}); | ||
scope.removeItem({foo: null, bar: null}); | ||
expect(scope.vocabulary.items.length).toBe(0); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better that the test for removing an item does not rely on the correct behavior of the scope.addItem()
method - a bug in the latter could cause the former to fail as well, even though there would be nothing worng with the scope.removeItem()
method.
A recommended approach is to directly create the desired fixture (i.e. setting the scope.vocabulary.items
list), and run the method under tests (and nothing else) and observe the outcome.
The code looks good IMO, it just needs a few extra tests, docstrings (as @sivakuna-aap said) and perhaps some minor changes in the templates. |
it('can fetch vocabularies', inject(function(api, vocabularies, $q, $rootScope) { | ||
spyOn(api, 'query').and.returnValue($q.when()); | ||
var scope = $rootScope.$new(); | ||
vocabularies.getVocabularies(scope); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the scope param is not used
7e327eb
to
81b694d
Compare
@sivakuna-aap @plamut @petrjasek resolved comments |
81b694d
to
061952f
Compare
$scope._errorUniqueness = false; | ||
api.save('vocabularies', $scope.vocabulary).then(onSuccess, onError); | ||
// discard metadata cache: | ||
metadata.initialize(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't force the metadata to reinitialize. https://github.com/superdesk/superdesk/blob/master/client/app/scripts/superdesk-authoring/metadata/metadata.js#L507
@actionless it is good to have vocabulary management. There are few question that needs to be discussed before we introduce vocab management. What should happen to the system if we mark the imo, |
@actionless Do you need any help on this PR? |
rebased on current master |
Looking at the failed test I think these code changes have not caused them (at least not all of them), it is just our e2e tests failing randomly (again). One or two protractor tests that failed in my PR (basically just a minor CSS change) were the same that failed here, too, and every time a build was restarted, a different test (or a combination of them) failed. Restarting build jobs enough times will IMO make the build pass eventually, though this is of course not a definite solution of any kind... Update: It seems that (from a limited sample, though) that this build consistently fails on the test "monitoring view configure a stage and then delete the stage", and occasionally one or two other tests randomly fail on top of that. |
@actionless |
…ates; remove unused injects
…ith promise; fix some tests
42081ce
to
dcbb4c5
Compare
rebased |
The issue is still there. I will fix it. |
thanks, i have no idea how can it be related to these changes |
@actionless |
…ete the stage" test
now travis is passing |
cool, so we can merge it |
👍 |
UPD: