{"action":"created","comment":{"url":"https://api.github.com/repos/yast/yast-packager/pulls/comments/98489947","pull_request_review_id":19133114,"id":98489947,"diff_hunk":"@@ -1943,6 +1596,433 @@ def StartInstSource\n       UI.CloseDialog\n       ret\n     end\n+\n+    # Handle the \"Delete\" button in the service view\n+    def service_delete_handler(current)\n+      selected_service = @serviceStatesOut[current] || {}\n+\n+      service_alias = selected_service[\"alias\"]\n+      msg = _(\"The services of type 'plugin' cannot be removed.\")\n+      return if !plugin_service_check(service_alias, msg)\n+\n+      # yes-no popup\n+      return if !Popup.YesNo(\n+          Builtins.sformat(\n+            _(\"Delete service %1\\nand its repositories?\"),\n+            selected_service[\"name\"]\n+          )\n+        )\n+\n+      RemoveReposFromService(service_alias)\n+\n+      deleteService(current)\n+      fillTable(@repository_view, @displayed_service)\n+      fillCurrentRepoInfo\n+\n+      # refresh also the combobox widget\n+      UpdateCombobox()\n+    end\n+\n+    # Handle the \"Delete\" button in the repository view\n+    def repo_delete_handler(global_current)\n+      repo = @sourceStatesOut[global_current] || {}\n+\n+      msg = _(\"The repositories belonging to a service of type 'plugin' cannot be removed.\")\n+      return if !repo[\"service\"].to_s.empty? && !plugin_service_check(repo[\"service\"], msg)\n+\n+      # yes-no popup\n+      return if !Popup.YesNo(_(\"Delete the selected repository from the list?\"))\n+\n+      deleteSource(global_current)\n+      fillTable(@repository_view, @displayed_service)\n+      fillCurrentRepoInfo\n+    end\n+\n+    # Handle the \"Enable\" checkbox in the repository view\n+    def repo_enable_handler(sourceState, global_current, current)\n+      repo = @sourceStatesOut[global_current] || {}\n+      return if !repo[\"service\"].to_s.empty? && !plugin_service_check(repo[\"service\"], repo_change_msg)\n+\n+      state = !sourceState[\"enabled\"]\n+      # corresponds to the \"Enable/Disable\" button\n+      state_symbol = state ? UI.Glyph(:CheckMark) : \"\"\n+      UI.ChangeWidget(Id(:table), term(:Item, current, 1), state_symbol)\n+      sourceState[\"enabled\"] = state\n+      @sourceStatesOut[global_current] = sourceState\n+    end\n+\n+    # Handle the \"Enable\" checkbox in the service view\n+    def service_enable_handler(current)\n+      srv = @serviceStatesOut[current]\n+      return if !srv\n+\n+      log.info(\"Selected service: #{srv}\")\n+      state = !srv[\"enabled\"]\n+\n+      # disable/enable the repositories belonging to the service\n+      service_alias = srv[\"alias\"]\n+      return if !plugin_service_check(service_alias, plugin_change_msg)\n+\n+      SetReposStatusFromService(service_alias, state)\n+\n+      # update the table\n+      state_symbol = state ? UI.Glyph(:CheckMark) : \"\"\n+      UI.ChangeWidget(Id(:table), term(:Item, current, 0), state_symbol)\n+\n+      # store the change\n+      srv[\"enabled\"] = state\n+      @serviceStatesOut[current] = srv\n+    end\n+\n+    # Handle the \"Autorefresh\" checkbox in the repository view\n+    def repo_autorefresh_handler(sourceState, global_current, current)\n+      source_id = sourceState[\"SrcId\"]\n+      src_data = Pkg.SourceGeneralData(source_id)\n+      return if !plugin_service_check(sourceState[\"service\"], repo_change_msg)\n+\n+      type = src_data[\"type\"]\n+      state = !sourceState[\"autorefresh\"]\n+\n+      if type == \"PlainDir\" && state\n+        # popup message\n+        Popup.Message(_(\"For the selected repository, refresh\\ncannot be set.\"))\n+        return\n+      end\n+\n+      new_symbol = state ? UI.Glyph(:CheckMark) : \"\"\n+      UI.ChangeWidget(Id(:table), term(:Item, current, 2), new_symbol)\n+\n+      sourceState[\"autorefresh\"] = state\n+      @sourceStatesOut[global_current] = sourceState\n+    end\n+\n+    # Handle the \"Autorefresh\" checkbox in the service view\n+    def service_autorefresh_handler(current)\n+      srv = @serviceStatesOut[current]\n+      log.info(\"Selected service: #{srv}\")\n+\n+      service_alias = srv[\"alias\"]\n+      return if !plugin_service_check(service_alias, plugin_change_msg)\n+\n+      state = !srv[\"autorefresh\"]\n+      # update the table\n+      new_symbol = state ? UI.Glyph(:CheckMark) : \"\"\n+      UI.ChangeWidget(Id(:table), term(:Item, current, 1), new_symbol)\n+\n+      # store the change\n+      srv[\"autorefresh\"] = state\n+      @serviceStatesOut[current] = srv\n+    end\n+\n+    # Handle the \"Priority\" field in the repository view\n+    def repo_priority_handler(sourceState, global_current, current)\n+      return if !plugin_service_check(sourceState[\"service\"], repo_change_msg)\n+\n+      # refresh the value in the table\n+      new_priority = UI.QueryWidget(Id(:priority), :Value)\n+      log.debug(\"New priority: #{new_priority}\")\n+\n+      UI.ChangeWidget(\n+        Id(:table),\n+        term(:Item, current, 0),\n+        PriorityToString(new_priority)\n+      )\n+      sourceState[\"priority\"] = new_priority\n+      @sourceStatesOut[global_current] = sourceState\n+    end\n+\n+    # Handle the \"Keep packages\" check box in the repository view\n+    def repo_keeppackages_handler(sourceState, global_current)\n+      return if !plugin_service_check(sourceState[\"service\"], repo_change_msg)\n+\n+      # refresh the value in the table\n+      new_keep = UI.QueryWidget(Id(:keeppackages), :Value)\n+      log.info(\"New keep packages option: #{new_keep}\")\n+\n+      sourceState[\"keeppackages\"] = new_keep\n+      @sourceStatesOut[global_current] = sourceState\n+    end\n+\n+    # Handle the \"Edit\" button in the repository view\n+    def repo_replace_handler(id, sourceState, global_current)","path":"src/clients/repositories.rb","position":627,"original_position":627,"commit_id":"41b90608e22fe01c6d24e0df188b3e88b5f645dd","original_commit_id":"41b90608e22fe01c6d24e0df188b3e88b5f645dd","user":{"login":"imobachgs","id":15836,"avatar_url":"https://avatars.githubusercontent.com/u/15836?v=3","gravatar_id":"","url":"https://api.github.com/users/imobachgs","html_url":"https://github.com/imobachgs","followers_url":"https://api.github.com/users/imobachgs/followers","following_url":"https://api.github.com/users/imobachgs/following{/other_user}","gists_url":"https://api.github.com/users/imobachgs/gists{/gist_id}","starred_url":"https://api.github.com/users/imobachgs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imobachgs/subscriptions","organizations_url":"https://api.github.com/users/imobachgs/orgs","repos_url":"https://api.github.com/users/imobachgs/repos","events_url":"https://api.github.com/users/imobachgs/events{/privacy}","received_events_url":"https://api.github.com/users/imobachgs/received_events","type":"User","site_admin":false},"body":"np: What about adding some documentation for parameters?","created_at":"2017-01-30T17:10:24Z","updated_at":"2017-01-30T17:17:19Z","html_url":"https://github.com/yast/yast-packager/pull/225#discussion_r98489947","pull_request_url":"https://api.github.com/repos/yast/yast-packager/pulls/225","_links":{"self":{"href":"https://api.github.com/repos/yast/yast-packager/pulls/comments/98489947"},"html":{"href":"https://github.com/yast/yast-packager/pull/225#discussion_r98489947"},"pull_request":{"href":"https://api.github.com/repos/yast/yast-packager/pulls/225"}}},"pull_request":{"url":"https://api.github.com/repos/yast/yast-packager/pulls/225","id":103776957,"html_url":"https://github.com/yast/yast-packager/pull/225","diff_url":"https://github.com/yast/yast-packager/pull/225.diff","patch_url":"https://github.com/yast/yast-packager/pull/225.patch","issue_url":"https://api.github.com/repos/yast/yast-packager/issues/225","number":225,"state":"open","locked":false,"title":"Do not allow changing the plugin services (bsc#1021117)","user":{"login":"lslezak","id":907998,"avatar_url":"https://avatars.githubusercontent.com/u/907998?v=3","gravatar_id":"","url":"https://api.github.com/users/lslezak","html_url":"https://github.com/lslezak","followers_url":"https://api.github.com/users/lslezak/followers","following_url":"https://api.github.com/users/lslezak/following{/other_user}","gists_url":"https://api.github.com/users/lslezak/gists{/gist_id}","starred_url":"https://api.github.com/users/lslezak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lslezak/subscriptions","organizations_url":"https://api.github.com/users/lslezak/orgs","repos_url":"https://api.github.com/users/lslezak/repos","events_url":"https://api.github.com/users/lslezak/events{/privacy}","received_events_url":"https://api.github.com/users/lslezak/received_events","type":"User","site_admin":false},"body":"- This is an improvement for the fix for bug [bsc#1021117](https://bugzilla.suse.com/show_bug.cgi?id=1021117) in pkg-bindings (proposal: https://github.com/yast/yast-pkg-bindings/pull/64) which just avoids a hard error at save\r\n- This change prevents from modifying any libzypp plugin service and its repositories. They cannot be modified because there is no file where the changes could be saved, the repository metadata are dynamically generated by a script (see example in the https://github.com/yast/yast-pkg-bindings/pull/64 pull request)\r\n- See more details at https://doc.opensuse.org/projects/libzypp/SLE12SP2/zypp-plugins.html#plugin-services and https://doc.opensuse.org/projects/libzypp/SLE12SP2/zypp-services.html\r\n- The change is big because I have split a 900 (!) lines long method into smaller parts. Each method checks at the beginning whether the edited service or repository is of the `plugin` type. If yes a message is displayed and the change is not allowed.\r\n- That means you do not have to check the complete diff, just the added checks.\r\n- Tested manually\r\n- No unit tests as the code is in a client and it is UI related, making it testable would require a major rewrite... :grimacing:\r\n- The code would need even more refactoring, but that is out of scope for an L3 bug fix enhancement...","created_at":"2017-01-30T17:00:19Z","updated_at":"2017-01-30T17:17:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/yast/yast-packager/pulls/225/commits","review_comments_url":"https://api.github.com/repos/yast/yast-packager/pulls/225/comments","review_comment_url":"https://api.github.com/repos/yast/yast-packager/pulls/comments{/number}","comments_url":"https://api.github.com/repos/yast/yast-packager/issues/225/comments","statuses_url":"https://api.github.com/repos/yast/yast-packager/statuses/41b90608e22fe01c6d24e0df188b3e88b5f645dd","head":{"label":"yast:plugin_service","ref":"plugin_service","sha":"41b90608e22fe01c6d24e0df188b3e88b5f645dd","user":{"login":"yast","id":909990,"avatar_url":"https://avatars.githubusercontent.com/u/909990?v=3","gravatar_id":"","url":"https://api.github.com/users/yast","html_url":"https://github.com/yast","followers_url":"https://api.github.com/users/yast/followers","following_url":"https://api.github.com/users/yast/following{/other_user}","gists_url":"https://api.github.com/users/yast/gists{/gist_id}","starred_url":"https://api.github.com/users/yast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yast/subscriptions","organizations_url":"https://api.github.com/users/yast/orgs","repos_url":"https://api.github.com/users/yast/repos","events_url":"https://api.github.com/users/yast/events{/privacy}","received_events_url":"https://api.github.com/users/yast/received_events","type":"Organization","site_admin":false},"repo":{"id":4368179,"name":"yast-packager","full_name":"yast/yast-packager","owner":{"login":"yast","id":909990,"avatar_url":"https://avatars.githubusercontent.com/u/909990?v=3","gravatar_id":"","url":"https://api.github.com/users/yast","html_url":"https://github.com/yast","followers_url":"https://api.github.com/users/yast/followers","following_url":"https://api.github.com/users/yast/following{/other_user}","gists_url":"https://api.github.com/users/yast/gists{/gist_id}","starred_url":"https://api.github.com/users/yast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yast/subscriptions","organizations_url":"https://api.github.com/users/yast/orgs","repos_url":"https://api.github.com/users/yast/repos","events_url":"https://api.github.com/users/yast/events{/privacy}","received_events_url":"https://api.github.com/users/yast/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yast/yast-packager","description":"YaST module packager","fork":false,"url":"https://api.github.com/repos/yast/yast-packager","forks_url":"https://api.github.com/repos/yast/yast-packager/forks","keys_url":"https://api.github.com/repos/yast/yast-packager/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yast/yast-packager/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yast/yast-packager/teams","hooks_url":"https://api.github.com/repos/yast/yast-packager/hooks","issue_events_url":"https://api.github.com/repos/yast/yast-packager/issues/events{/number}","events_url":"https://api.github.com/repos/yast/yast-packager/events","assignees_url":"https://api.github.com/repos/yast/yast-packager/assignees{/user}","branches_url":"https://api.github.com/repos/yast/yast-packager/branches{/branch}","tags_url":"https://api.github.com/repos/yast/yast-packager/tags","blobs_url":"https://api.github.com/repos/yast/yast-packager/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yast/yast-packager/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yast/yast-packager/git/refs{/sha}","trees_url":"https://api.github.com/repos/yast/yast-packager/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yast/yast-packager/statuses/{sha}","languages_url":"https://api.github.com/repos/yast/yast-packager/languages","stargazers_url":"https://api.github.com/repos/yast/yast-packager/stargazers","contributors_url":"https://api.github.com/repos/yast/yast-packager/contributors","subscribers_url":"https://api.github.com/repos/yast/yast-packager/subscribers","subscription_url":"https://api.github.com/repos/yast/yast-packager/subscription","commits_url":"https://api.github.com/repos/yast/yast-packager/commits{/sha}","git_commits_url":"https://api.github.com/repos/yast/yast-packager/git/commits{/sha}","comments_url":"https://api.github.com/repos/yast/yast-packager/comments{/number}","issue_comment_url":"https://api.github.com/repos/yast/yast-packager/issues/comments{/number}","contents_url":"https://api.github.com/repos/yast/yast-packager/contents/{+path}","compare_url":"https://api.github.com/repos/yast/yast-packager/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yast/yast-packager/merges","archive_url":"https://api.github.com/repos/yast/yast-packager/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yast/yast-packager/downloads","issues_url":"https://api.github.com/repos/yast/yast-packager/issues{/number}","pulls_url":"https://api.github.com/repos/yast/yast-packager/pulls{/number}","milestones_url":"https://api.github.com/repos/yast/yast-packager/milestones{/number}","notifications_url":"https://api.github.com/repos/yast/yast-packager/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yast/yast-packager/labels{/name}","releases_url":"https://api.github.com/repos/yast/yast-packager/releases{/id}","deployments_url":"https://api.github.com/repos/yast/yast-packager/deployments","created_at":"2012-05-18T10:25:23Z","updated_at":"2017-01-16T09:27:52Z","pushed_at":"2017-01-30T17:00:20Z","git_url":"git://github.com/yast/yast-packager.git","ssh_url":"git@github.com:yast/yast-packager.git","clone_url":"https://github.com/yast/yast-packager.git","svn_url":"https://github.com/yast/yast-packager","homepage":"http://en.opensuse.org/Portal:YaST","size":30348,"stargazers_count":4,"watchers_count":4,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":5,"forks":12,"open_issues":5,"watchers":4,"default_branch":"master"}},"base":{"label":"yast:master","ref":"master","sha":"d3c1f7e566612e507dc835f36dce879541bd44ec","user":{"login":"yast","id":909990,"avatar_url":"https://avatars.githubusercontent.com/u/909990?v=3","gravatar_id":"","url":"https://api.github.com/users/yast","html_url":"https://github.com/yast","followers_url":"https://api.github.com/users/yast/followers","following_url":"https://api.github.com/users/yast/following{/other_user}","gists_url":"https://api.github.com/users/yast/gists{/gist_id}","starred_url":"https://api.github.com/users/yast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yast/subscriptions","organizations_url":"https://api.github.com/users/yast/orgs","repos_url":"https://api.github.com/users/yast/repos","events_url":"https://api.github.com/users/yast/events{/privacy}","received_events_url":"https://api.github.com/users/yast/received_events","type":"Organization","site_admin":false},"repo":{"id":4368179,"name":"yast-packager","full_name":"yast/yast-packager","owner":{"login":"yast","id":909990,"avatar_url":"https://avatars.githubusercontent.com/u/909990?v=3","gravatar_id":"","url":"https://api.github.com/users/yast","html_url":"https://github.com/yast","followers_url":"https://api.github.com/users/yast/followers","following_url":"https://api.github.com/users/yast/following{/other_user}","gists_url":"https://api.github.com/users/yast/gists{/gist_id}","starred_url":"https://api.github.com/users/yast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yast/subscriptions","organizations_url":"https://api.github.com/users/yast/orgs","repos_url":"https://api.github.com/users/yast/repos","events_url":"https://api.github.com/users/yast/events{/privacy}","received_events_url":"https://api.github.com/users/yast/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yast/yast-packager","description":"YaST module packager","fork":false,"url":"https://api.github.com/repos/yast/yast-packager","forks_url":"https://api.github.com/repos/yast/yast-packager/forks","keys_url":"https://api.github.com/repos/yast/yast-packager/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yast/yast-packager/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yast/yast-packager/teams","hooks_url":"https://api.github.com/repos/yast/yast-packager/hooks","issue_events_url":"https://api.github.com/repos/yast/yast-packager/issues/events{/number}","events_url":"https://api.github.com/repos/yast/yast-packager/events","assignees_url":"https://api.github.com/repos/yast/yast-packager/assignees{/user}","branches_url":"https://api.github.com/repos/yast/yast-packager/branches{/branch}","tags_url":"https://api.github.com/repos/yast/yast-packager/tags","blobs_url":"https://api.github.com/repos/yast/yast-packager/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yast/yast-packager/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yast/yast-packager/git/refs{/sha}","trees_url":"https://api.github.com/repos/yast/yast-packager/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yast/yast-packager/statuses/{sha}","languages_url":"https://api.github.com/repos/yast/yast-packager/languages","stargazers_url":"https://api.github.com/repos/yast/yast-packager/stargazers","contributors_url":"https://api.github.com/repos/yast/yast-packager/contributors","subscribers_url":"https://api.github.com/repos/yast/yast-packager/subscribers","subscription_url":"https://api.github.com/repos/yast/yast-packager/subscription","commits_url":"https://api.github.com/repos/yast/yast-packager/commits{/sha}","git_commits_url":"https://api.github.com/repos/yast/yast-packager/git/commits{/sha}","comments_url":"https://api.github.com/repos/yast/yast-packager/comments{/number}","issue_comment_url":"https://api.github.com/repos/yast/yast-packager/issues/comments{/number}","contents_url":"https://api.github.com/repos/yast/yast-packager/contents/{+path}","compare_url":"https://api.github.com/repos/yast/yast-packager/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yast/yast-packager/merges","archive_url":"https://api.github.com/repos/yast/yast-packager/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yast/yast-packager/downloads","issues_url":"https://api.github.com/repos/yast/yast-packager/issues{/number}","pulls_url":"https://api.github.com/repos/yast/yast-packager/pulls{/number}","milestones_url":"https://api.github.com/repos/yast/yast-packager/milestones{/number}","notifications_url":"https://api.github.com/repos/yast/yast-packager/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yast/yast-packager/labels{/name}","releases_url":"https://api.github.com/repos/yast/yast-packager/releases{/id}","deployments_url":"https://api.github.com/repos/yast/yast-packager/deployments","created_at":"2012-05-18T10:25:23Z","updated_at":"2017-01-16T09:27:52Z","pushed_at":"2017-01-30T17:00:20Z","git_url":"git://github.com/yast/yast-packager.git","ssh_url":"git@github.com:yast/yast-packager.git","clone_url":"https://github.com/yast/yast-packager.git","svn_url":"https://github.com/yast/yast-packager","homepage":"http://en.opensuse.org/Portal:YaST","size":30348,"stargazers_count":4,"watchers_count":4,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":5,"forks":12,"open_issues":5,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/yast/yast-packager/pulls/225"},"html":{"href":"https://github.com/yast/yast-packager/pull/225"},"issue":{"href":"https://api.github.com/repos/yast/yast-packager/issues/225"},"comments":{"href":"https://api.github.com/repos/yast/yast-packager/issues/225/comments"},"review_comments":{"href":"https://api.github.com/repos/yast/yast-packager/pulls/225/comments"},"review_comment":{"href":"https://api.github.com/repos/yast/yast-packager/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/yast/yast-packager/pulls/225/commits"},"statuses":{"href":"https://api.github.com/repos/yast/yast-packager/statuses/41b90608e22fe01c6d24e0df188b3e88b5f645dd"}}}}
{"actor":{"display_login":"imobachgs"}}