Skip to content
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

Merged
merged 16 commits into from
Oct 1, 2015
Merged

feat: vocabularies' settings #1159

merged 16 commits into from
Oct 1, 2015

Conversation

actionless
Copy link
Contributor

2015-09-18--1442609701_2125x1396_scrot
UPD:
2015-09-19--1442616395_1730x1261_scrot


VocabularyService
.$inject = [ 'api', 'urls', 'session', '$upload', '$q', 'metadata' ];
function VocabularyService(api, urls, session, $upload, $q, metadata) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused injections $upload, metadata

@actionless
Copy link
Contributor Author

$scope.vocabularies = null;
$scope.vocabulary = null;

$scope.createVocabulary = function() {
Copy link
Contributor

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.

@sivakuna-aap
Copy link
Contributor

@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?

@actionless actionless force-pushed the add-vocab-settings branch 4 times, most recently from 59ca152 to dc68a0c Compare September 19, 2015 09:07
@actionless
Copy link
Contributor Author

@sivakuna-aap
mb for keywords we can just put directives from both PRs together into one settings.html? it shouldn't be a big issue to merge them together

@sivakuna-aap
Copy link
Contributor

@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:

  1. When a vocabulary is updated then respective metadata.values should also be updated
  2. Deleting an item in a vocabulary shouldn't delete the item from vocabulary.items. Instead it should change the value of is_active to false.

expect(scope.vocabulary.items[0]).toEqual({foo: null, bar: null});
scope.removeItem({foo: null, bar: null});
expect(scope.vocabulary.items.length).toBe(0);
});
Copy link

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.

@plamut
Copy link

plamut commented Sep 21, 2015

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);
Copy link
Member

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

@actionless actionless force-pushed the add-vocab-settings branch 2 times, most recently from 7e327eb to 81b694d Compare September 21, 2015 18:08
@actionless
Copy link
Contributor Author

@sivakuna-aap @plamut @petrjasek resolved comments

$scope._errorUniqueness = false;
api.save('vocabularies', $scope.vocabulary).then(onSuccess, onError);
// discard metadata cache:
metadata.initialize();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mdhaman
Copy link
Contributor

mdhaman commented Sep 21, 2015

@actionless it is good to have vocabulary management.
imo, some of the vocabularies don't require management. For example, type, signal, subscriber_type.

There are few question that needs to be discussed before we introduce vocab management. What should happen to the system if we mark the type=text as inactive or delete it? What should happen if I add a new subscriber_type or remove existing subscriber_type?

imo, categories, default_categories, genre, rightsinfo, locators will require management but not sure about others.

@ioanpocol
Copy link
Contributor

@actionless Do you need any help on this PR?

@actionless
Copy link
Contributor Author

rebased on current master

@plamut
Copy link

plamut commented Sep 28, 2015

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.

@ioanpocol
Copy link
Contributor

@actionless
Please rebase again, seams that some tests are old and don't contains the changes for desk management.

@actionless
Copy link
Contributor Author

rebased

@ioanpocol
Copy link
Contributor

The issue is still there. I will fix it.

@actionless
Copy link
Contributor Author

thanks, i have no idea how can it be related to these changes

@ioanpocol
Copy link
Contributor

@actionless
Please disable "monitoring view configure a stage and then delete the stage" test until the issue SD-3371 will be fixed.

@actionless
Copy link
Contributor Author

now travis is passing

@ioanpocol
Copy link
Contributor

cool, so we can merge it

@amagdas
Copy link
Contributor

amagdas commented Oct 1, 2015

👍

ioanpocol added a commit that referenced this pull request Oct 1, 2015
@ioanpocol ioanpocol merged commit 409bace into master Oct 1, 2015
@actionless actionless deleted the add-vocab-settings branch October 1, 2015 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants