{"action":"created","comment":{"url":"https://api.github.com/repos/dcos/dcos-ui/pulls/comments/82379102","pull_request_review_id":3291649,"id":82379102,"diff_hunk":"@@ -0,0 +1,159 @@\n+import {Confirm} from 'reactjs-components';\n+import mixin from 'reactjs-mixin';\n+import React from 'react';\n+import {StoreMixin} from 'mesosphere-shared-reactjs';\n+\n+import MarathonStore from '../../stores/MarathonStore';\n+import Pod from '../../structs/Pod';\n+import StringUtil from '../../utils/StringUtil';\n+\n+const METHODS_TO_BIND = [\n+  'handleButtonConfirm'\n+];\n+\n+const ACTION_DISPLAY_NAMES = {\n+  kill: 'Kill',\n+  killAndScale: 'Kill and Scale'\n+};\n+\n+class KillPodInstanceModal extends mixin(StoreMixin) {\n+  constructor() {\n+    super(...arguments);\n+\n+    this.store_listeners = [\n+      {\n+        name: 'marathon',\n+        events: ['podInstanceKillSuccess', 'podInstanceKillError'],\n+        suppressUpdate: true\n+      }\n+    ];\n+\n+    this.state = {\n+      pendingRequest: false\n+    };\n+\n+    METHODS_TO_BIND.forEach((method) => {\n+      this[method] = this[method].bind(this);\n+    });\n+  }\n+\n+  componentWillReceiveProps(nextProps) {\n+    if (this.props.open !== nextProps.open) {\n+      this.setState({\n+        errorMsg: null\n+      });\n+    }\n+  }\n+\n+  shouldForceAction(message = this.state.errorMsg) {\n+    return message && /force=true/.test(message);\n+  }\n+\n+  handleButtonConfirm() {\n+    let {pod, selectedItems} = this.props;\n+    let killIDs = selectedItems.map(function (item) {\n+      return item.id;\n+    });\n+\n+    MarathonStore.killPodInstances(\n+      pod,\n+      killIDs,\n+      this.shouldForceAction()\n+    );\n+    this.setState({pendingRequest: true});\n+  }\n+\n+  onMarathonStorePodInstanceKillSuccess() {\n+    this.setState({pendingRequest: false});\n+    this.props.onClose();\n+    this.props.onSuccess();\n+  }\n+\n+  onMarathonStorePodInstanceKillError(errorMsg) {\n+    this.setState({\n+      pendingRequest: false,\n+      errorMsg\n+    });\n+  }\n+\n+  getErrorMessage() {\n+    let {errorMsg} = this.state;\n+\n+    if (!errorMsg) {\n+      return null;\n+    }\n+\n+    if (this.shouldForceAction(errorMsg)) {\n+      return (\n+        <h4 className=\"text-align-center text-danger flush-top\">\n+          App is currently locked by one or more deployments. Press the button\n+          again to forcefully change and deploy the new configuration.\n+        </h4>\n+      );\n+    }\n+\n+    return (\n+      <p className=\"text-danger flush-top\">{errorMsg}</p>\n+    );\n+  }\n+\n+  getModalContents() {\n+    let selectedItemsLength = this.props.selectedItems.length;\n+    let action = ACTION_DISPLAY_NAMES[this.props.action] || '';\n+    let instanceCountContent = `${selectedItemsLength} ${StringUtil.pluralize('Instance', selectedItemsLength)}`;\n+\n+    return (\n+      <div className={'container container-pod container-pod-short-top text-align-center flush-bottom'}>\n+        <h2 className=\"text-danger text-align-center flush-top\">\n+          {action} {StringUtil.pluralize('Instance', selectedItemsLength)}\n+        </h2>\n+        <p>\n+          You are about to {action.toLowerCase()} {instanceCountContent}.\n+          <br />\n+          Are you sure you want to continue?\n+        </p>\n+        {this.getErrorMessage()}\n+      </div>\n+    );\n+  }\n+\n+  render() {\n+    let {action, onClose, open} = this.props;\n+    let buttonText = ACTION_DISPLAY_NAMES[action];\n+\n+    if (this.shouldForceAction()) {\n+      buttonText = 'Force ' + buttonText;","path":"src/js/components/modals/KillPodInstanceModal.js","position":125,"original_position":125,"commit_id":"2b62993405983e2aa498755a92f4966e1794ef75","original_commit_id":"2b62993405983e2aa498755a92f4966e1794ef75","user":{"login":"nLight","id":186223,"avatar_url":"https://avatars.githubusercontent.com/u/186223?v=3","gravatar_id":"","url":"https://api.github.com/users/nLight","html_url":"https://github.com/nLight","followers_url":"https://api.github.com/users/nLight/followers","following_url":"https://api.github.com/users/nLight/following{/other_user}","gists_url":"https://api.github.com/users/nLight/gists{/gist_id}","starred_url":"https://api.github.com/users/nLight/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nLight/subscriptions","organizations_url":"https://api.github.com/users/nLight/orgs","repos_url":"https://api.github.com/users/nLight/repos","events_url":"https://api.github.com/users/nLight/events{/privacy}","received_events_url":"https://api.github.com/users/nLight/received_events","type":"User","site_admin":false},"body":"There's a eslint rule for that! :)","created_at":"2016-10-07T12:27:52Z","updated_at":"2016-10-07T12:27:52Z","html_url":"https://github.com/dcos/dcos-ui/pull/1176#discussion_r82379102","pull_request_url":"https://api.github.com/repos/dcos/dcos-ui/pulls/1176","_links":{"self":{"href":"https://api.github.com/repos/dcos/dcos-ui/pulls/comments/82379102"},"html":{"href":"https://github.com/dcos/dcos-ui/pull/1176#discussion_r82379102"},"pull_request":{"href":"https://api.github.com/repos/dcos/dcos-ui/pulls/1176"}}},"pull_request":{"url":"https://api.github.com/repos/dcos/dcos-ui/pulls/1176","id":87345367,"html_url":"https://github.com/dcos/dcos-ui/pull/1176","diff_url":"https://github.com/dcos/dcos-ui/pull/1176.diff","patch_url":"https://github.com/dcos/dcos-ui/pull/1176.patch","issue_url":"https://api.github.com/repos/dcos/dcos-ui/issues/1176","number":1176,"state":"open","locked":false,"title":"[Pods] DCOS-10108 [3/3]: Adding KillPodInstanceModal","user":{"login":"wavesoft","id":883486,"avatar_url":"https://avatars.githubusercontent.com/u/883486?v=3","gravatar_id":"","url":"https://api.github.com/users/wavesoft","html_url":"https://github.com/wavesoft","followers_url":"https://api.github.com/users/wavesoft/followers","following_url":"https://api.github.com/users/wavesoft/following{/other_user}","gists_url":"https://api.github.com/users/wavesoft/gists{/gist_id}","starred_url":"https://api.github.com/users/wavesoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wavesoft/subscriptions","organizations_url":"https://api.github.com/users/wavesoft/orgs","repos_url":"https://api.github.com/users/wavesoft/repos","events_url":"https://api.github.com/users/wavesoft/events{/privacy}","received_events_url":"https://api.github.com/users/wavesoft/received_events","type":"User","site_admin":false},"body":"---\r\n⚠️ Requires #1174 to be merged\r\n\r\n---\r\n\r\nThis PR introduces the `KillPodInstanceModal` that can be used to process the kill instance request from the user.\r\n\r\nOnly the last commit is relevant to this PR: https://github.com/dcos/dcos-ui/pull/1176/commits/be706ae05cb4d95c6c38c53af69c62a77a36d083\r\n\r\n![image](https://cloud.githubusercontent.com/assets/883486/18962867/c83ec8fe-8672-11e6-81b4-9a2bc16cd07c.png)\r\n","created_at":"2016-09-29T16:13:17Z","updated_at":"2016-10-07T12:27:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"717936f212cf9287dd486b6b66c1d0aec7f4a394","assignee":{"login":"nLight","id":186223,"avatar_url":"https://avatars.githubusercontent.com/u/186223?v=3","gravatar_id":"","url":"https://api.github.com/users/nLight","html_url":"https://github.com/nLight","followers_url":"https://api.github.com/users/nLight/followers","following_url":"https://api.github.com/users/nLight/following{/other_user}","gists_url":"https://api.github.com/users/nLight/gists{/gist_id}","starred_url":"https://api.github.com/users/nLight/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nLight/subscriptions","organizations_url":"https://api.github.com/users/nLight/orgs","repos_url":"https://api.github.com/users/nLight/repos","events_url":"https://api.github.com/users/nLight/events{/privacy}","received_events_url":"https://api.github.com/users/nLight/received_events","type":"User","site_admin":false},"assignees":[{"login":"nLight","id":186223,"avatar_url":"https://avatars.githubusercontent.com/u/186223?v=3","gravatar_id":"","url":"https://api.github.com/users/nLight","html_url":"https://github.com/nLight","followers_url":"https://api.github.com/users/nLight/followers","following_url":"https://api.github.com/users/nLight/following{/other_user}","gists_url":"https://api.github.com/users/nLight/gists{/gist_id}","starred_url":"https://api.github.com/users/nLight/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nLight/subscriptions","organizations_url":"https://api.github.com/users/nLight/orgs","repos_url":"https://api.github.com/users/nLight/repos","events_url":"https://api.github.com/users/nLight/events{/privacy}","received_events_url":"https://api.github.com/users/nLight/received_events","type":"User","site_admin":false},{"login":"mlunoe","id":1097941,"avatar_url":"https://avatars.githubusercontent.com/u/1097941?v=3","gravatar_id":"","url":"https://api.github.com/users/mlunoe","html_url":"https://github.com/mlunoe","followers_url":"https://api.github.com/users/mlunoe/followers","following_url":"https://api.github.com/users/mlunoe/following{/other_user}","gists_url":"https://api.github.com/users/mlunoe/gists{/gist_id}","starred_url":"https://api.github.com/users/mlunoe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlunoe/subscriptions","organizations_url":"https://api.github.com/users/mlunoe/orgs","repos_url":"https://api.github.com/users/mlunoe/repos","events_url":"https://api.github.com/users/mlunoe/events{/privacy}","received_events_url":"https://api.github.com/users/mlunoe/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/dcos/dcos-ui/pulls/1176/commits","review_comments_url":"https://api.github.com/repos/dcos/dcos-ui/pulls/1176/comments","review_comment_url":"https://api.github.com/repos/dcos/dcos-ui/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dcos/dcos-ui/issues/1176/comments","statuses_url":"https://api.github.com/repos/dcos/dcos-ui/statuses/2b62993405983e2aa498755a92f4966e1794ef75","head":{"label":"dcos:ic/add/DCOS-10108-pod-kill-instance-3","ref":"ic/add/DCOS-10108-pod-kill-instance-3","sha":"2b62993405983e2aa498755a92f4966e1794ef75","user":{"login":"dcos","id":17648048,"avatar_url":"https://avatars.githubusercontent.com/u/17648048?v=3","gravatar_id":"","url":"https://api.github.com/users/dcos","html_url":"https://github.com/dcos","followers_url":"https://api.github.com/users/dcos/followers","following_url":"https://api.github.com/users/dcos/following{/other_user}","gists_url":"https://api.github.com/users/dcos/gists{/gist_id}","starred_url":"https://api.github.com/users/dcos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcos/subscriptions","organizations_url":"https://api.github.com/users/dcos/orgs","repos_url":"https://api.github.com/users/dcos/repos","events_url":"https://api.github.com/users/dcos/events{/privacy}","received_events_url":"https://api.github.com/users/dcos/received_events","type":"Organization","site_admin":false},"repo":{"id":56547504,"name":"dcos-ui","full_name":"dcos/dcos-ui","owner":{"login":"dcos","id":17648048,"avatar_url":"https://avatars.githubusercontent.com/u/17648048?v=3","gravatar_id":"","url":"https://api.github.com/users/dcos","html_url":"https://github.com/dcos","followers_url":"https://api.github.com/users/dcos/followers","following_url":"https://api.github.com/users/dcos/following{/other_user}","gists_url":"https://api.github.com/users/dcos/gists{/gist_id}","starred_url":"https://api.github.com/users/dcos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcos/subscriptions","organizations_url":"https://api.github.com/users/dcos/orgs","repos_url":"https://api.github.com/users/dcos/repos","events_url":"https://api.github.com/users/dcos/events{/privacy}","received_events_url":"https://api.github.com/users/dcos/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dcos/dcos-ui","description":"The UI for The Datacenter Operating System","fork":false,"url":"https://api.github.com/repos/dcos/dcos-ui","forks_url":"https://api.github.com/repos/dcos/dcos-ui/forks","keys_url":"https://api.github.com/repos/dcos/dcos-ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dcos/dcos-ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dcos/dcos-ui/teams","hooks_url":"https://api.github.com/repos/dcos/dcos-ui/hooks","issue_events_url":"https://api.github.com/repos/dcos/dcos-ui/issues/events{/number}","events_url":"https://api.github.com/repos/dcos/dcos-ui/events","assignees_url":"https://api.github.com/repos/dcos/dcos-ui/assignees{/user}","branches_url":"https://api.github.com/repos/dcos/dcos-ui/branches{/branch}","tags_url":"https://api.github.com/repos/dcos/dcos-ui/tags","blobs_url":"https://api.github.com/repos/dcos/dcos-ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dcos/dcos-ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dcos/dcos-ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/dcos/dcos-ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dcos/dcos-ui/statuses/{sha}","languages_url":"https://api.github.com/repos/dcos/dcos-ui/languages","stargazers_url":"https://api.github.com/repos/dcos/dcos-ui/stargazers","contributors_url":"https://api.github.com/repos/dcos/dcos-ui/contributors","subscribers_url":"https://api.github.com/repos/dcos/dcos-ui/subscribers","subscription_url":"https://api.github.com/repos/dcos/dcos-ui/subscription","commits_url":"https://api.github.com/repos/dcos/dcos-ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/dcos/dcos-ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/dcos/dcos-ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/dcos/dcos-ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/dcos/dcos-ui/contents/{+path}","compare_url":"https://api.github.com/repos/dcos/dcos-ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dcos/dcos-ui/merges","archive_url":"https://api.github.com/repos/dcos/dcos-ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dcos/dcos-ui/downloads","issues_url":"https://api.github.com/repos/dcos/dcos-ui/issues{/number}","pulls_url":"https://api.github.com/repos/dcos/dcos-ui/pulls{/number}","milestones_url":"https://api.github.com/repos/dcos/dcos-ui/milestones{/number}","notifications_url":"https://api.github.com/repos/dcos/dcos-ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dcos/dcos-ui/labels{/name}","releases_url":"https://api.github.com/repos/dcos/dcos-ui/releases{/id}","deployments_url":"https://api.github.com/repos/dcos/dcos-ui/deployments","created_at":"2016-04-18T22:48:06Z","updated_at":"2016-10-06T13:09:25Z","pushed_at":"2016-10-07T12:16:26Z","git_url":"git://github.com/dcos/dcos-ui.git","ssh_url":"git@github.com:dcos/dcos-ui.git","clone_url":"https://github.com/dcos/dcos-ui.git","svn_url":"https://github.com/dcos/dcos-ui","homepage":null,"size":21775,"stargazers_count":105,"watchers_count":105,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":26,"mirror_url":null,"open_issues_count":30,"forks":26,"open_issues":30,"watchers":105,"default_branch":"master"}},"base":{"label":"dcos:master","ref":"master","sha":"adb100d1258cfc3e3a6c5ee0e903414d8ebe7d92","user":{"login":"dcos","id":17648048,"avatar_url":"https://avatars.githubusercontent.com/u/17648048?v=3","gravatar_id":"","url":"https://api.github.com/users/dcos","html_url":"https://github.com/dcos","followers_url":"https://api.github.com/users/dcos/followers","following_url":"https://api.github.com/users/dcos/following{/other_user}","gists_url":"https://api.github.com/users/dcos/gists{/gist_id}","starred_url":"https://api.github.com/users/dcos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcos/subscriptions","organizations_url":"https://api.github.com/users/dcos/orgs","repos_url":"https://api.github.com/users/dcos/repos","events_url":"https://api.github.com/users/dcos/events{/privacy}","received_events_url":"https://api.github.com/users/dcos/received_events","type":"Organization","site_admin":false},"repo":{"id":56547504,"name":"dcos-ui","full_name":"dcos/dcos-ui","owner":{"login":"dcos","id":17648048,"avatar_url":"https://avatars.githubusercontent.com/u/17648048?v=3","gravatar_id":"","url":"https://api.github.com/users/dcos","html_url":"https://github.com/dcos","followers_url":"https://api.github.com/users/dcos/followers","following_url":"https://api.github.com/users/dcos/following{/other_user}","gists_url":"https://api.github.com/users/dcos/gists{/gist_id}","starred_url":"https://api.github.com/users/dcos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcos/subscriptions","organizations_url":"https://api.github.com/users/dcos/orgs","repos_url":"https://api.github.com/users/dcos/repos","events_url":"https://api.github.com/users/dcos/events{/privacy}","received_events_url":"https://api.github.com/users/dcos/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dcos/dcos-ui","description":"The UI for The Datacenter Operating System","fork":false,"url":"https://api.github.com/repos/dcos/dcos-ui","forks_url":"https://api.github.com/repos/dcos/dcos-ui/forks","keys_url":"https://api.github.com/repos/dcos/dcos-ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dcos/dcos-ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dcos/dcos-ui/teams","hooks_url":"https://api.github.com/repos/dcos/dcos-ui/hooks","issue_events_url":"https://api.github.com/repos/dcos/dcos-ui/issues/events{/number}","events_url":"https://api.github.com/repos/dcos/dcos-ui/events","assignees_url":"https://api.github.com/repos/dcos/dcos-ui/assignees{/user}","branches_url":"https://api.github.com/repos/dcos/dcos-ui/branches{/branch}","tags_url":"https://api.github.com/repos/dcos/dcos-ui/tags","blobs_url":"https://api.github.com/repos/dcos/dcos-ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dcos/dcos-ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dcos/dcos-ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/dcos/dcos-ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dcos/dcos-ui/statuses/{sha}","languages_url":"https://api.github.com/repos/dcos/dcos-ui/languages","stargazers_url":"https://api.github.com/repos/dcos/dcos-ui/stargazers","contributors_url":"https://api.github.com/repos/dcos/dcos-ui/contributors","subscribers_url":"https://api.github.com/repos/dcos/dcos-ui/subscribers","subscription_url":"https://api.github.com/repos/dcos/dcos-ui/subscription","commits_url":"https://api.github.com/repos/dcos/dcos-ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/dcos/dcos-ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/dcos/dcos-ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/dcos/dcos-ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/dcos/dcos-ui/contents/{+path}","compare_url":"https://api.github.com/repos/dcos/dcos-ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dcos/dcos-ui/merges","archive_url":"https://api.github.com/repos/dcos/dcos-ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dcos/dcos-ui/downloads","issues_url":"https://api.github.com/repos/dcos/dcos-ui/issues{/number}","pulls_url":"https://api.github.com/repos/dcos/dcos-ui/pulls{/number}","milestones_url":"https://api.github.com/repos/dcos/dcos-ui/milestones{/number}","notifications_url":"https://api.github.com/repos/dcos/dcos-ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dcos/dcos-ui/labels{/name}","releases_url":"https://api.github.com/repos/dcos/dcos-ui/releases{/id}","deployments_url":"https://api.github.com/repos/dcos/dcos-ui/deployments","created_at":"2016-04-18T22:48:06Z","updated_at":"2016-10-06T13:09:25Z","pushed_at":"2016-10-07T12:16:26Z","git_url":"git://github.com/dcos/dcos-ui.git","ssh_url":"git@github.com:dcos/dcos-ui.git","clone_url":"https://github.com/dcos/dcos-ui.git","svn_url":"https://github.com/dcos/dcos-ui","homepage":null,"size":21775,"stargazers_count":105,"watchers_count":105,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":26,"mirror_url":null,"open_issues_count":30,"forks":26,"open_issues":30,"watchers":105,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dcos/dcos-ui/pulls/1176"},"html":{"href":"https://github.com/dcos/dcos-ui/pull/1176"},"issue":{"href":"https://api.github.com/repos/dcos/dcos-ui/issues/1176"},"comments":{"href":"https://api.github.com/repos/dcos/dcos-ui/issues/1176/comments"},"review_comments":{"href":"https://api.github.com/repos/dcos/dcos-ui/pulls/1176/comments"},"review_comment":{"href":"https://api.github.com/repos/dcos/dcos-ui/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dcos/dcos-ui/pulls/1176/commits"},"statuses":{"href":"https://api.github.com/repos/dcos/dcos-ui/statuses/2b62993405983e2aa498755a92f4966e1794ef75"}}}}
{"actor":{"display_login":"nLight"}}