From 00272efe01f2376375a52e756fcf5ed0a782d38a Mon Sep 17 00:00:00 2001 From: deniz kusefoglu Date: Mon, 5 Feb 2018 12:13:07 -0800 Subject: [PATCH 01/20] Prevent disabling save button if update fails --- ui/src/kapacitor/components/AlertTabs.js | 2 ++ ui/src/kapacitor/components/config/AlertaConfig.js | 8 +++++--- ui/src/kapacitor/components/config/HipChatConfig.js | 8 +++++--- ui/src/kapacitor/components/config/OpsGenieConfig.js | 8 +++++--- ui/src/kapacitor/components/config/PagerDutyConfig.js | 8 +++++--- ui/src/kapacitor/components/config/PushoverConfig.js | 8 +++++--- ui/src/kapacitor/components/config/SMTPConfig.js | 9 +++++---- ui/src/kapacitor/components/config/SensuConfig.js | 8 +++++--- ui/src/kapacitor/components/config/SlackConfig.js | 8 +++++--- ui/src/kapacitor/components/config/TalkConfig.js | 8 +++++--- ui/src/kapacitor/components/config/TelegramConfig.js | 8 +++++--- ui/src/kapacitor/components/config/VictorOpsConfig.js | 8 +++++--- 12 files changed, 57 insertions(+), 34 deletions(-) diff --git a/ui/src/kapacitor/components/AlertTabs.js b/ui/src/kapacitor/components/AlertTabs.js index a427e7fdc2..bb94abef58 100644 --- a/ui/src/kapacitor/components/AlertTabs.js +++ b/ui/src/kapacitor/components/AlertTabs.js @@ -84,11 +84,13 @@ class AlertTabs extends Component { type: 'success', text: `Alert configuration for ${section} successfully saved.`, }) + return true } catch (error) { this.props.addFlashMessage({ type: 'error', text: `There was an error saving the alert configuration for ${section}.`, }) + return false } } } diff --git a/ui/src/kapacitor/components/config/AlertaConfig.js b/ui/src/kapacitor/components/config/AlertaConfig.js index 33eccff321..492bc1d13d 100644 --- a/ui/src/kapacitor/components/config/AlertaConfig.js +++ b/ui/src/kapacitor/components/config/AlertaConfig.js @@ -10,7 +10,7 @@ class AlertaConfig extends Component { } } - handleSubmit = e => { + handleSubmit = async e => { e.preventDefault() const properties = { @@ -20,8 +20,10 @@ class AlertaConfig extends Component { url: this.url.value, } - this.props.onSave(properties) - this.setState({testEnabled: true}) + const success = await this.props.onSave(properties) + if (success) { + this.setState({testEnabled: true}) + } } disableTest = () => { diff --git a/ui/src/kapacitor/components/config/HipChatConfig.js b/ui/src/kapacitor/components/config/HipChatConfig.js index e5cc205ad3..a8ebe9e549 100644 --- a/ui/src/kapacitor/components/config/HipChatConfig.js +++ b/ui/src/kapacitor/components/config/HipChatConfig.js @@ -12,7 +12,7 @@ class HipchatConfig extends Component { } } - handleSubmit = e => { + handleSubmit = async e => { e.preventDefault() const properties = { @@ -21,8 +21,10 @@ class HipchatConfig extends Component { token: this.token.value, } - this.props.onSave(properties) - this.setState({testEnabled: true}) + const success = await this.props.onSave(properties) + if (success) { + this.setState({testEnabled: true}) + } } disableTest = () => { diff --git a/ui/src/kapacitor/components/config/OpsGenieConfig.js b/ui/src/kapacitor/components/config/OpsGenieConfig.js index 70436afc0f..6172c6f361 100644 --- a/ui/src/kapacitor/components/config/OpsGenieConfig.js +++ b/ui/src/kapacitor/components/config/OpsGenieConfig.js @@ -16,7 +16,7 @@ class OpsGenieConfig extends Component { } } - handleSubmit = e => { + handleSubmit = async e => { e.preventDefault() const properties = { @@ -25,8 +25,10 @@ class OpsGenieConfig extends Component { recipients: this.state.currentRecipients, } - this.props.onSave(properties) - this.setState({testEnabled: true}) + const success = await this.props.onSave(properties) + if (success) { + this.setState({testEnabled: true}) + } } disableTest = () => { diff --git a/ui/src/kapacitor/components/config/PagerDutyConfig.js b/ui/src/kapacitor/components/config/PagerDutyConfig.js index 2a15826ce3..ecf79dbd9c 100644 --- a/ui/src/kapacitor/components/config/PagerDutyConfig.js +++ b/ui/src/kapacitor/components/config/PagerDutyConfig.js @@ -9,7 +9,7 @@ class PagerDutyConfig extends Component { } } - handleSubmit = e => { + handleSubmit = async e => { e.preventDefault() const properties = { @@ -17,8 +17,10 @@ class PagerDutyConfig extends Component { url: this.url.value, } - this.props.onSave(properties) - this.setState({testEnabled: true}) + const success = await this.props.onSave(properties) + if (success) { + this.setState({testEnabled: true}) + } } disableTest = () => { diff --git a/ui/src/kapacitor/components/config/PushoverConfig.js b/ui/src/kapacitor/components/config/PushoverConfig.js index d8efd29c64..5ad4665acb 100644 --- a/ui/src/kapacitor/components/config/PushoverConfig.js +++ b/ui/src/kapacitor/components/config/PushoverConfig.js @@ -13,7 +13,7 @@ class PushoverConfig extends Component { } } - handleSubmit = e => { + handleSubmit = async e => { e.preventDefault() const properties = { @@ -22,8 +22,10 @@ class PushoverConfig extends Component { 'user-key': this.userKey.value, } - this.props.onSave(properties) - this.setState({testEnabled: true}) + const success = await this.props.onSave(properties) + if (success) { + this.setState({testEnabled: true}) + } } disableTest = () => { diff --git a/ui/src/kapacitor/components/config/SMTPConfig.js b/ui/src/kapacitor/components/config/SMTPConfig.js index 2b4a027d74..caef4e6ac5 100644 --- a/ui/src/kapacitor/components/config/SMTPConfig.js +++ b/ui/src/kapacitor/components/config/SMTPConfig.js @@ -8,7 +8,7 @@ class SMTPConfig extends Component { } } - handleSubmit = e => { + handleSubmit = async e => { e.preventDefault() const properties = { @@ -18,9 +18,10 @@ class SMTPConfig extends Component { username: this.username.value, password: this.password.value, } - - this.props.onSave(properties) - this.setState({testEnabled: true}) + const success = await this.props.onSave(properties) + if (success) { + this.setState({testEnabled: true}) + } } disableTest = () => { diff --git a/ui/src/kapacitor/components/config/SensuConfig.js b/ui/src/kapacitor/components/config/SensuConfig.js index 862737dd25..11c9626b1c 100644 --- a/ui/src/kapacitor/components/config/SensuConfig.js +++ b/ui/src/kapacitor/components/config/SensuConfig.js @@ -8,7 +8,7 @@ class SensuConfig extends Component { } } - handleSubmit = e => { + handleSubmit = async e => { e.preventDefault() const properties = { @@ -16,8 +16,10 @@ class SensuConfig extends Component { addr: this.addr.value, } - this.props.onSave(properties) - this.setState({testEnabled: true}) + const success = await this.props.onSave(properties) + if (success) { + this.setState({testEnabled: true}) + } } disableTest = () => { diff --git a/ui/src/kapacitor/components/config/SlackConfig.js b/ui/src/kapacitor/components/config/SlackConfig.js index 462373317e..e26e560a4d 100644 --- a/ui/src/kapacitor/components/config/SlackConfig.js +++ b/ui/src/kapacitor/components/config/SlackConfig.js @@ -10,14 +10,16 @@ class SlackConfig extends Component { } } - handleSubmit = e => { + handleSubmit = async e => { e.preventDefault() const properties = { url: this.url.value, channel: this.channel.value, } - this.props.onSave(properties) - this.setState({testEnabled: true}) + const success = await this.props.onSave(properties) + if (success) { + this.setState({testEnabled: true}) + } } disableTest = () => { this.setState({testEnabled: false}) diff --git a/ui/src/kapacitor/components/config/TalkConfig.js b/ui/src/kapacitor/components/config/TalkConfig.js index 6c3bc8ebe7..573766fea8 100644 --- a/ui/src/kapacitor/components/config/TalkConfig.js +++ b/ui/src/kapacitor/components/config/TalkConfig.js @@ -10,7 +10,7 @@ class TalkConfig extends Component { } } - handleSubmit = e => { + handleSubmit = async e => { e.preventDefault() const properties = { @@ -18,8 +18,10 @@ class TalkConfig extends Component { author_name: this.author.value, } - this.props.onSave(properties) - this.setState({testEnabled: true}) + const success = await this.props.onSave(properties) + if (success) { + this.setState({testEnabled: true}) + } } disableTest = () => { diff --git a/ui/src/kapacitor/components/config/TelegramConfig.js b/ui/src/kapacitor/components/config/TelegramConfig.js index bf3200bfa0..e4f4114f8e 100644 --- a/ui/src/kapacitor/components/config/TelegramConfig.js +++ b/ui/src/kapacitor/components/config/TelegramConfig.js @@ -12,7 +12,7 @@ class TelegramConfig extends Component { } } - handleSubmit = e => { + handleSubmit = async e => { e.preventDefault() let parseMode @@ -31,8 +31,10 @@ class TelegramConfig extends Component { token: this.token.value, } - this.props.onSave(properties) - this.setState({testEnabled: true}) + const success = await this.props.onSave(properties) + if (success) { + this.setState({testEnabled: true}) + } } disableTest = () => { diff --git a/ui/src/kapacitor/components/config/VictorOpsConfig.js b/ui/src/kapacitor/components/config/VictorOpsConfig.js index ba8c929b40..958611f279 100644 --- a/ui/src/kapacitor/components/config/VictorOpsConfig.js +++ b/ui/src/kapacitor/components/config/VictorOpsConfig.js @@ -10,7 +10,7 @@ class VictorOpsConfig extends Component { } } - handleSubmit = e => { + handleSubmit = async e => { e.preventDefault() const properties = { @@ -19,8 +19,10 @@ class VictorOpsConfig extends Component { url: this.url.value, } - this.props.onSave(properties) - this.setState({testEnabled: true}) + const success = await this.props.onSave(properties) + if (success) { + this.setState({testEnabled: true}) + } } disableTest = () => { From 81bf0e80c72ab56d9c1a18ea05c38a5d4ee4c9a5 Mon Sep 17 00:00:00 2001 From: deniz kusefoglu Date: Mon, 5 Feb 2018 12:30:47 -0800 Subject: [PATCH 02/20] Reflect kapacitor test button responses in flash messages --- ui/src/kapacitor/components/AlertTabs.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/ui/src/kapacitor/components/AlertTabs.js b/ui/src/kapacitor/components/AlertTabs.js index bb94abef58..32e9fab7c0 100644 --- a/ui/src/kapacitor/components/AlertTabs.js +++ b/ui/src/kapacitor/components/AlertTabs.js @@ -99,11 +99,18 @@ class AlertTabs extends Component { e.preventDefault() try { - await testAlertOutput(this.props.kapacitor, section) - this.props.addFlashMessage({ - type: 'success', - text: `Successfully triggered an alert to ${section}. If the alert does not reach its destination, please check your configuration settings.`, - }) + const {data} = await testAlertOutput(this.props.kapacitor, section) + if (data.success) { + this.props.addFlashMessage({ + type: 'success', + text: `Successfully triggered an alert to ${section}. If the alert does not reach its destination, please check your configuration settings.`, + }) + } else { + this.props.addFlashMessage({ + type: 'error', + text: `There was an error sending an alert to ${section}: ${data.message}`, + }) + } } catch (error) { this.props.addFlashMessage({ type: 'error', From c71c4ac648e03058c108cae28bc55d2c2c78b020 Mon Sep 17 00:00:00 2001 From: deniz kusefoglu Date: Mon, 5 Feb 2018 15:37:10 -0800 Subject: [PATCH 03/20] Add TO field to SMTP config --- .../kapacitor/components/config/SMTPConfig.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/ui/src/kapacitor/components/config/SMTPConfig.js b/ui/src/kapacitor/components/config/SMTPConfig.js index caef4e6ac5..e6f457f972 100644 --- a/ui/src/kapacitor/components/config/SMTPConfig.js +++ b/ui/src/kapacitor/components/config/SMTPConfig.js @@ -15,6 +15,7 @@ class SMTPConfig extends Component { host: this.host.value, port: this.port.value, from: this.from.value, + to: this.to.value ? [this.to.value] : [], username: this.username.value, password: this.password.value, } @@ -29,7 +30,7 @@ class SMTPConfig extends Component { } render() { - const {host, port, from, username, password} = this.props.config.options + const {host, port, from, username, password, to} = this.props.config.options return (
@@ -57,7 +58,7 @@ class SMTPConfig extends Component { /> -
+
+
+ + (this.to = r)} + defaultValue={to || ''} + onChange={this.disableTest} + /> +
+
Date: Mon, 5 Feb 2018 16:04:30 -0800 Subject: [PATCH 04/20] Make config saving error messages more verbose --- ui/src/kapacitor/components/AlertTabs.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ui/src/kapacitor/components/AlertTabs.js b/ui/src/kapacitor/components/AlertTabs.js index 32e9fab7c0..77c21c7bb3 100644 --- a/ui/src/kapacitor/components/AlertTabs.js +++ b/ui/src/kapacitor/components/AlertTabs.js @@ -85,10 +85,11 @@ class AlertTabs extends Component { text: `Alert configuration for ${section} successfully saved.`, }) return true - } catch (error) { + } catch ({data: {error}}) { + const errorMsg = _.join(_.drop(_.split(error, ': '), 2), ': ') this.props.addFlashMessage({ type: 'error', - text: `There was an error saving the alert configuration for ${section}.`, + text: `There was an error saving the alert configuration for ${section}. ${errorMsg}`, }) return false } From 04ab5008337846e71de8461035d631740e3a751e Mon Sep 17 00:00:00 2001 From: deniz kusefoglu Date: Mon, 5 Feb 2018 16:12:32 -0800 Subject: [PATCH 05/20] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e81479066..11d1b4bb3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ ### Bug Fixes 1. [#2684](https://github.com/influxdata/chronograf/pull/2684): Fix TICKscript Sensu alerts when no group by tags selected 1. [#2735](https://github.com/influxdata/chronograf/pull/2735): Remove cli options from systemd service file +1. [#2757](https://github.com/influxdata/chronograf/pull/2757): Added "TO" field to kapacitor SMTP config, and improved error messages for config saving and testing ## v1.4.0.1 [2017-1-9] ### Features From 61e4e08991c93f62b29a18e754256ac959efc755 Mon Sep 17 00:00:00 2001 From: deniz kusefoglu Date: Wed, 7 Feb 2018 11:56:31 -0800 Subject: [PATCH 06/20] Rename link to pathname --- ui/src/kapacitor/components/KapacitorRule.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/src/kapacitor/components/KapacitorRule.js b/ui/src/kapacitor/components/KapacitorRule.js index 338a7b9426..dc06186f3d 100644 --- a/ui/src/kapacitor/components/KapacitorRule.js +++ b/ui/src/kapacitor/components/KapacitorRule.js @@ -25,7 +25,7 @@ class KapacitorRule extends Component { this.setState({timeRange}) } - handleCreate = link => { + handleCreate = pathname => { const { addFlashMessage, queryConfigs, @@ -42,7 +42,7 @@ class KapacitorRule extends Component { createRule(kapacitor, newRule) .then(() => { - router.push(link || `/sources/${source.id}/alert-rules`) + router.push(pathname || `/sources/${source.id}/alert-rules`) addFlashMessage({type: 'success', text: 'Rule successfully created'}) }) .catch(() => { @@ -53,7 +53,7 @@ class KapacitorRule extends Component { }) } - handleEdit = link => { + handleEdit = pathname => { const {addFlashMessage, queryConfigs, rule, router, source} = this.props const updatedRule = Object.assign({}, rule, { query: queryConfigs[rule.queryID], @@ -61,7 +61,7 @@ class KapacitorRule extends Component { editRule(updatedRule) .then(() => { - router.push(link || `/sources/${source.id}/alert-rules`) + router.push(pathname || `/sources/${source.id}/alert-rules`) addFlashMessage({ type: 'success', text: `${rule.name} successfully saved!`, From f03a698ccc4788eb55095167d97e217c291f61bb Mon Sep 17 00:00:00 2001 From: deniz kusefoglu Date: Wed, 7 Feb 2018 11:58:31 -0800 Subject: [PATCH 07/20] Prevent click event being passed to handleCreate and handleEdit --- ui/src/kapacitor/components/KapacitorRule.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ui/src/kapacitor/components/KapacitorRule.js b/ui/src/kapacitor/components/KapacitorRule.js index dc06186f3d..377be96aee 100644 --- a/ui/src/kapacitor/components/KapacitorRule.js +++ b/ui/src/kapacitor/components/KapacitorRule.js @@ -159,13 +159,20 @@ class KapacitorRule extends Component { } = this.props const {chooseTrigger, updateRuleValues} = ruleActions const {timeRange} = this.state + + const onSave = () => { + if (rule.id === DEFAULT_RULE_ID) { + this.handleCreate() + } else { + this.handleEdit() + } + } + return (
From 1eb36c340dff25b62347850c0fb9397ba5970b1c Mon Sep 17 00:00:00 2001 From: deniz kusefoglu Date: Wed, 7 Feb 2018 11:59:40 -0800 Subject: [PATCH 08/20] Route user to appropriate config panel at create and edit --- ui/src/kapacitor/components/KapacitorRule.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ui/src/kapacitor/components/KapacitorRule.js b/ui/src/kapacitor/components/KapacitorRule.js index 377be96aee..adfaf988b8 100644 --- a/ui/src/kapacitor/components/KapacitorRule.js +++ b/ui/src/kapacitor/components/KapacitorRule.js @@ -77,14 +77,15 @@ class KapacitorRule extends Component { handleSaveToConfig = configName => () => { const {rule, configLink, router} = this.props + const pathname = `${configLink}#${configName}` if (this.validationError()) { router.push({ - pathname: `${configLink}#${configName}`, + pathname, }) } else if (rule.id === DEFAULT_RULE_ID) { - this.handleCreate(configLink) + this.handleCreate(pathname) } else { - this.handleEdit(configLink) + this.handleEdit(pathname) } } From cc4b3c1bbc3b1e6947102a952e60174a6aff40c5 Mon Sep 17 00:00:00 2001 From: deniz kusefoglu Date: Wed, 7 Feb 2018 12:11:48 -0800 Subject: [PATCH 09/20] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b70e3b89a..b44d2cd730 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ 1. [#2684](https://github.com/influxdata/chronograf/pull/2684): Fix TICKscript Sensu alerts when no group by tags selected 1. [#2735](https://github.com/influxdata/chronograf/pull/2735): Remove cli options from systemd service file 1. [#2761](https://github.com/influxdata/chronograf/pull/2761): Remove cli options from sysvinit service file +1. [#2780](https://github.com/influxdata/chronograf/pull/2780): Fix routing on alert save ## v1.4.0.1 [2017-1-9] ### Features From 5acdd742116c8af33e4b0f81ab6d5d941c6e38f6 Mon Sep 17 00:00:00 2001 From: Iris Scholten Date: Wed, 7 Feb 2018 12:32:44 -0800 Subject: [PATCH 10/20] let users add users to any organization and add additional orgs after the fact --- .../admin/components/chronograf/AllUsersTable.js | 16 ++++++++-------- .../components/chronograf/AllUsersTableRowNew.js | 14 ++++++-------- .../admin/containers/chronograf/AllUsersPage.js | 2 +- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/ui/src/admin/components/chronograf/AllUsersTable.js b/ui/src/admin/components/chronograf/AllUsersTable.js index 1a7f3455f7..29de6b8cf3 100644 --- a/ui/src/admin/components/chronograf/AllUsersTable.js +++ b/ui/src/admin/components/chronograf/AllUsersTable.js @@ -128,14 +128,6 @@ class AllUsersTable extends Component { - {isCreatingUser - ? - : null} {users.length ? users.map(user => No Users to display

} + {isCreatingUser + ? + : null}
diff --git a/ui/src/admin/components/chronograf/AllUsersTableRowNew.js b/ui/src/admin/components/chronograf/AllUsersTableRowNew.js index c1e3aac683..29f340c9ee 100644 --- a/ui/src/admin/components/chronograf/AllUsersTableRowNew.js +++ b/ui/src/admin/components/chronograf/AllUsersTableRowNew.js @@ -11,7 +11,7 @@ const { colActions, } = ALL_USERS_TABLE -const nullOrganization = {id: null, name: 'None'} +const undefinedOrganization = {id: undefined, name: 'None'} class AllUsersTableRowNew extends Component { constructor(props) { @@ -23,7 +23,7 @@ class AllUsersTableRowNew extends Component { scheme: 'oauth2', roles: [ { - ...nullOrganization, + ...undefinedOrganization, }, ], } @@ -36,7 +36,6 @@ class AllUsersTableRowNew extends Component { handleConfirmCreateUser = () => { const {onBlur, onCreateUser} = this.props const {name, provider, scheme, roles, superAdmin} = this.state - const newUser = { name, provider, @@ -44,7 +43,6 @@ class AllUsersTableRowNew extends Component { superAdmin, roles: roles[0].id === null ? [] : roles, } - onCreateUser(newUser) onBlur() } @@ -57,10 +55,10 @@ class AllUsersTableRowNew extends Component { const newRoles = [ newOrganization.id === null ? { - ...nullOrganization, + ...undefinedOrganization, } : { - id: newOrganization.id, + organization: newOrganization.id, name: '*', // '*' causes the server to determine the current defaultRole of the selected organization }, ] @@ -91,14 +89,14 @@ class AllUsersTableRowNew extends Component { const {name, provider, scheme, roles} = this.state const dropdownOrganizationsItems = [ - {...nullOrganization}, + {...undefinedOrganization}, ...organizations, ].map(o => ({ ...o, text: o.name, })) const selectedRole = dropdownOrganizationsItems.find( - o => roles[0].id === o.id + o => roles[0].organization === o.id ) const preventCreate = !name || !provider diff --git a/ui/src/admin/containers/chronograf/AllUsersPage.js b/ui/src/admin/containers/chronograf/AllUsersPage.js index f7bf075312..8cc482444c 100644 --- a/ui/src/admin/containers/chronograf/AllUsersPage.js +++ b/ui/src/admin/containers/chronograf/AllUsersPage.js @@ -24,7 +24,7 @@ class AllUsersPage extends Component { handleCreateUser = user => { const {links, actionsAdmin: {createUserAsync}} = this.props - createUserAsync(links.users, user) + createUserAsync(links.allUsers, user) } handleUpdateUserRoles = (user, roles, successMessage) => { From b0159aa5eb1bd9ed79d2b8d30a14c4ce2f0ec5f6 Mon Sep 17 00:00:00 2001 From: Iris Scholten Date: Wed, 7 Feb 2018 14:47:12 -0800 Subject: [PATCH 11/20] add users without a specified organization --- .../components/chronograf/AllUsersTableRowNew.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ui/src/admin/components/chronograf/AllUsersTableRowNew.js b/ui/src/admin/components/chronograf/AllUsersTableRowNew.js index 29f340c9ee..af828848c9 100644 --- a/ui/src/admin/components/chronograf/AllUsersTableRowNew.js +++ b/ui/src/admin/components/chronograf/AllUsersTableRowNew.js @@ -11,7 +11,8 @@ const { colActions, } = ALL_USERS_TABLE -const undefinedOrganization = {id: undefined, name: 'None'} +const nullOrganization = {id: undefined, name: 'None'} +const nullRole = {name: '*', organization: undefined} class AllUsersTableRowNew extends Component { constructor(props) { @@ -23,7 +24,7 @@ class AllUsersTableRowNew extends Component { scheme: 'oauth2', roles: [ { - ...undefinedOrganization, + ...nullRole, }, ], } @@ -41,7 +42,7 @@ class AllUsersTableRowNew extends Component { provider, scheme, superAdmin, - roles: roles[0].id === null ? [] : roles, + roles: roles[0].organization === undefined ? [] : roles, } onCreateUser(newUser) onBlur() @@ -53,9 +54,9 @@ class AllUsersTableRowNew extends Component { handleSelectOrganization = newOrganization => { const newRoles = [ - newOrganization.id === null + newOrganization.id === undefined ? { - ...undefinedOrganization, + ...nullRole, } : { organization: newOrganization.id, @@ -89,7 +90,7 @@ class AllUsersTableRowNew extends Component { const {name, provider, scheme, roles} = this.state const dropdownOrganizationsItems = [ - {...undefinedOrganization}, + {...nullOrganization}, ...organizations, ].map(o => ({ ...o, From 70479c48b9b259acb3872774bdb73afb6af91b7d Mon Sep 17 00:00:00 2001 From: deniz kusefoglu Date: Wed, 7 Feb 2018 15:24:32 -0800 Subject: [PATCH 12/20] small fixes from PR review to pull request #2757 --- ui/src/kapacitor/components/AlertTabs.js | 2 +- ui/src/kapacitor/components/config/SMTPConfig.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/src/kapacitor/components/AlertTabs.js b/ui/src/kapacitor/components/AlertTabs.js index 77c21c7bb3..6aac73d014 100644 --- a/ui/src/kapacitor/components/AlertTabs.js +++ b/ui/src/kapacitor/components/AlertTabs.js @@ -89,7 +89,7 @@ class AlertTabs extends Component { const errorMsg = _.join(_.drop(_.split(error, ': '), 2), ': ') this.props.addFlashMessage({ type: 'error', - text: `There was an error saving the alert configuration for ${section}. ${errorMsg}`, + text: `There was an error saving the alert configuration for ${section}: ${errorMsg}`, }) return false } diff --git a/ui/src/kapacitor/components/config/SMTPConfig.js b/ui/src/kapacitor/components/config/SMTPConfig.js index e6f457f972..b77c0a1110 100644 --- a/ui/src/kapacitor/components/config/SMTPConfig.js +++ b/ui/src/kapacitor/components/config/SMTPConfig.js @@ -76,6 +76,7 @@ class SMTPConfig extends Component { (this.to = r)} defaultValue={to || ''} From fb6b674556b3ea82dffa697535c973322d97a25d Mon Sep 17 00:00:00 2001 From: Chris Goller Date: Wed, 7 Feb 2018 17:58:23 -0600 Subject: [PATCH 13/20] Update to go 1.9.4 --- circle.yml | 2 +- etc/Dockerfile_build | 2 +- etc/README.md | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/circle.yml b/circle.yml index 87ca400117..207d9d5d5f 100644 --- a/circle.yml +++ b/circle.yml @@ -3,7 +3,7 @@ machine: services: - docker environment: - DOCKER_TAG: chronograf-20180206 + DOCKER_TAG: chronograf-20180207 dependencies: override: diff --git a/etc/Dockerfile_build b/etc/Dockerfile_build index 32157e5d12..8493143ec0 100644 --- a/etc/Dockerfile_build +++ b/etc/Dockerfile_build @@ -37,7 +37,7 @@ RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ # Install go ENV GOPATH /root/go -ENV GO_VERSION 1.9.3 +ENV GO_VERSION 1.9.4 ENV GO_ARCH amd64 RUN wget https://storage.googleapis.com/golang/go${GO_VERSION}.linux-${GO_ARCH}.tar.gz; \ tar -C /usr/local/ -xf /go${GO_VERSION}.linux-${GO_ARCH}.tar.gz ; \ diff --git a/etc/README.md b/etc/README.md index 6e541ecee1..d94fd49056 100644 --- a/etc/README.md +++ b/etc/README.md @@ -10,3 +10,6 @@ After updating the Dockerfile_build run and push to quay with: `docker push quay.io/influxdb/builder:chronograf-$(date "+%Y%m%d")` + +### Update circle +Update DOCKER_TAG in circle.yml to the new container. From 7c112737550e85fbf1d5600c7cba313d4714e430 Mon Sep 17 00:00:00 2001 From: Edd Robinson Date: Thu, 8 Feb 2018 14:55:07 +0000 Subject: [PATCH 14/20] Switch jteeuwen/go-bindata for kevinburke/go-bindata --- Gopkg.toml | 6 +++--- Makefile | 4 ++-- docs/slides/mnGo/Makefile | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Gopkg.toml b/Gopkg.toml index 6d3735503d..387b3b26c8 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -1,4 +1,4 @@ -required = ["github.com/jteeuwen/go-bindata","github.com/gogo/protobuf/proto","github.com/gogo/protobuf/jsonpb","github.com/gogo/protobuf/protoc-gen-gogo","github.com/gogo/protobuf/gogoproto"] +required = ["github.com/kevinburke/go-bindata","github.com/gogo/protobuf/proto","github.com/gogo/protobuf/jsonpb","github.com/gogo/protobuf/protoc-gen-gogo","github.com/gogo/protobuf/gogoproto"] [[constraint]] name = "github.com/NYTimes/gziphandler" @@ -41,8 +41,8 @@ required = ["github.com/jteeuwen/go-bindata","github.com/gogo/protobuf/proto","g revision = "4cc2832a6e6d1d3b815e2b9d544b2a4dfb3ce8fa" [[constraint]] - name = "github.com/jteeuwen/go-bindata" - revision = "a0ff2567cfb70903282db057e799fd826784d41d" + name = "github.com/kevinburke/go-bindata" + revision = "46eb4c183bfc1ebb527d9d19bcded39476302eb8" [[constraint]] name = "github.com/satori/go.uuid" diff --git a/Makefile b/Makefile index cf866feb86..e226bb089f 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ VERSION ?= $(shell git describe --always --tags) COMMIT ?= $(shell git rev-parse --short=8 HEAD) -GOBINDATA := $(shell go list -f {{.Root}} github.com/jteeuwen/go-bindata 2> /dev/null) +GOBINDATA := $(shell go list -f {{.Root}} github.com/kevinburke/go-bindata 2> /dev/null) YARN := $(shell command -v yarn 2> /dev/null) SOURCES := $(shell find . -name '*.go' ! -name '*_gen.go' -not -path "./vendor/*" ) @@ -73,7 +73,7 @@ dep: .jsdep .godep .godep: ifndef GOBINDATA @echo "Installing go-bindata" - go get -u github.com/jteeuwen/go-bindata/... + go get -u github.com/kevinburke/go-bindata/... endif @touch .godep diff --git a/docs/slides/mnGo/Makefile b/docs/slides/mnGo/Makefile index a43b18e1cc..51a07599bb 100644 --- a/docs/slides/mnGo/Makefile +++ b/docs/slides/mnGo/Makefile @@ -3,7 +3,7 @@ VERSION ?= $(shell git describe --always --tags) COMMIT ?= $(shell git rev-parse --short=8 HEAD) GDM := $(shell command -v gdm 2> /dev/null) -GOBINDATA := $(shell go list -f {{.Root}} github.com/jteeuwen/go-bindata 2> /dev/null) +GOBINDATA := $(shell go list -f {{.Root}} github.com/kevinburke/go-bindata 2> /dev/null) YARN := $(shell command -v yarn 2> /dev/null) SOURCES := $(shell find . -name '*.go' ! -name '*_gen.go') @@ -63,7 +63,7 @@ ifndef GDM endif ifndef GOBINDATA @echo "Installing go-bindata" - go get -u github.com/jteeuwen/go-bindata/... + go get -u github.com/kevinburke/go-bindata/... endif gdm restore @touch .godep From aee50f036d2cbf423897c22979696e8b5e038bc7 Mon Sep 17 00:00:00 2001 From: Chris Goller Date: Thu, 8 Feb 2018 09:00:30 -0600 Subject: [PATCH 15/20] Update CHANGELOG.md to mention updating to go 1.9.4 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 51762e57c1..a2c15e0f8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ 1. [#2708](https://github.com/influxdata/chronograf/pull/2708): Link to specified kapacitor config panel from rule builder alert handlers 1. [#2722](https://github.com/influxdata/chronograf/pull/2722): Add auto refresh widget to hosts list page 1. [#2765](https://github.com/influxdata/chronograf/pull/2765): Update to go 1.9.3 and node 6.12.3 for releases +1. [#2784](https://github.com/influxdata/chronograf/pull/2784): Update to go 1.9.4 1. [#2703](https://github.com/influxdata/chronograf/pull/2703): Add global users page visible only to super admins 1. [#2777](https://github.com/influxdata/chronograf/pull/2777): Allow user to delete themselves From e7e6cf7cd5d7b58d7d608ae8bdec362dabf87a61 Mon Sep 17 00:00:00 2001 From: Edd Robinson Date: Thu, 8 Feb 2018 15:05:14 +0000 Subject: [PATCH 16/20] =?UTF-8?q?=F0=9F=98=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gopkg.lock | 112 +++++- bolt/internal/internal.pb.go | 713 ++++++++++++++++++++++++++++++++++- 2 files changed, 802 insertions(+), 23 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index af4f27d25a..d8eee5654c 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -30,7 +30,7 @@ branch = "master" name = "github.com/dustin/go-humanize" packages = ["."] - revision = "259d2a102b871d17f30e3cd9881a642961a1e486" + revision = "bb3d318650d48840a39aa21a027c6630e198e626" [[projects]] name = "github.com/elazarl/go-bindata-assetfs" @@ -39,18 +39,53 @@ [[projects]] name = "github.com/gogo/protobuf" - packages = ["gogoproto","jsonpb","plugin/compare","plugin/defaultcheck","plugin/description","plugin/embedcheck","plugin/enumstringer","plugin/equal","plugin/face","plugin/gostring","plugin/marshalto","plugin/oneofcheck","plugin/populate","plugin/size","plugin/stringer","plugin/testgen","plugin/union","plugin/unmarshal","proto","protoc-gen-gogo","protoc-gen-gogo/descriptor","protoc-gen-gogo/generator","protoc-gen-gogo/grpc","protoc-gen-gogo/plugin","vanity","vanity/command"] + packages = [ + "gogoproto", + "jsonpb", + "plugin/compare", + "plugin/defaultcheck", + "plugin/description", + "plugin/embedcheck", + "plugin/enumstringer", + "plugin/equal", + "plugin/face", + "plugin/gostring", + "plugin/marshalto", + "plugin/oneofcheck", + "plugin/populate", + "plugin/size", + "plugin/stringer", + "plugin/testgen", + "plugin/union", + "plugin/unmarshal", + "proto", + "protoc-gen-gogo", + "protoc-gen-gogo/descriptor", + "protoc-gen-gogo/generator", + "protoc-gen-gogo/grpc", + "protoc-gen-gogo/plugin", + "vanity", + "vanity/command" + ] revision = "6abcf94fd4c97dcb423fdafd42fe9f96ca7e421b" [[projects]] name = "github.com/golang/protobuf" packages = ["proto"] - revision = "8ee79997227bf9b34611aee7946ae64735e6fd93" + revision = "925541529c1fa6821df4e44ce2723319eb2be768" + version = "v1.0.0" [[projects]] name = "github.com/google/go-cmp" - packages = ["cmp","cmp/cmpopts"] - revision = "79b2d888f100ec053545168aa94bcfb322e8bfc8" + packages = [ + "cmp", + "cmp/cmpopts", + "cmp/internal/diff", + "cmp/internal/function", + "cmp/internal/value" + ] + revision = "8099a9787ce5dc5984ed879a3bda47dc730a8e97" + version = "v0.1.0" [[projects]] name = "github.com/google/go-github" @@ -58,19 +93,35 @@ revision = "1bc362c7737e51014af7299e016444b654095ad9" [[projects]] + branch = "master" name = "github.com/google/go-querystring" packages = ["query"] - revision = "9235644dd9e52eeae6fa48efd539fdc351a0af53" + revision = "53e6ce116135b80d037921a7fdd5138cf32d7a8a" [[projects]] name = "github.com/influxdata/influxdb" - packages = ["influxql","influxql/internal","influxql/neldermead","models","pkg/escape"] + packages = [ + "influxql", + "influxql/internal", + "influxql/neldermead", + "models", + "pkg/escape" + ] revision = "cd9363b52cac452113b95554d98a6be51beda24e" version = "v1.1.5" [[projects]] name = "github.com/influxdata/kapacitor" - packages = ["client/v1","pipeline","pipeline/tick","services/k8s/client","tick","tick/ast","tick/stateful","udf/agent"] + packages = [ + "client/v1", + "pipeline", + "pipeline/tick", + "services/k8s/client", + "tick", + "tick/ast", + "tick/stateful", + "udf/agent" + ] revision = "6de30070b39afde111fea5e041281126fe8aae31" [[projects]] @@ -84,15 +135,15 @@ revision = "4cc2832a6e6d1d3b815e2b9d544b2a4dfb3ce8fa" [[projects]] - name = "github.com/jteeuwen/go-bindata" + name = "github.com/kevinburke/go-bindata" packages = ["."] - revision = "a0ff2567cfb70903282db057e799fd826784d41d" + revision = "46eb4c183bfc1ebb527d9d19bcded39476302eb8" [[projects]] - branch = "master" name = "github.com/pkg/errors" packages = ["."] - revision = "ff09b135c25aae272398c51a07235b90a75aa4f0" + revision = "645ef00459ed84a119197bfb8d8205042c6df63d" + version = "v0.8.0" [[projects]] name = "github.com/satori/go.uuid" @@ -107,39 +158,60 @@ [[projects]] name = "github.com/tylerb/graceful" packages = ["."] - revision = "50a48b6e73fcc75b45e22c05b79629a67c79e938" - version = "v1.2.13" + revision = "4654dfbb6ad53cb5e27f37d99b02e16c1872fbbb" + version = "v1.2.15" [[projects]] name = "golang.org/x/net" - packages = ["context","context/ctxhttp"] + packages = [ + "context", + "context/ctxhttp" + ] revision = "749a502dd1eaf3e5bfd4f8956748c502357c0bbe" [[projects]] name = "golang.org/x/oauth2" - packages = [".","github","heroku","internal"] + packages = [ + ".", + "github", + "heroku", + "internal" + ] revision = "1e695b1c8febf17aad3bfa7bf0a819ef94b98ad5" [[projects]] branch = "master" name = "golang.org/x/sys" packages = ["unix"] - revision = "f3918c30c5c2cb527c0b071a27c35120a6c0719a" + revision = "37707fdb30a5b38865cfb95e5aab41707daec7fd" [[projects]] name = "google.golang.org/api" - packages = ["gensupport","googleapi","googleapi/internal/uritemplates","oauth2/v2"] + packages = [ + "gensupport", + "googleapi", + "googleapi/internal/uritemplates", + "oauth2/v2" + ] revision = "bc20c61134e1d25265dd60049f5735381e79b631" [[projects]] name = "google.golang.org/appengine" - packages = ["internal","internal/base","internal/datastore","internal/log","internal/remote_api","internal/urlfetch","urlfetch"] + packages = [ + "internal", + "internal/base", + "internal/datastore", + "internal/log", + "internal/remote_api", + "internal/urlfetch", + "urlfetch" + ] revision = "150dc57a1b433e64154302bdc40b6bb8aefa313a" version = "v1.0.0" [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "a5bd1aa82919723ff8ec5dd9d520329862de8181ca9dba75c6acb3a34df5f1a4" + inputs-digest = "11df631364d11bc05c8f71af1aa735360b5a40a793d32d47d1f1d8c694a55f6f" solver-name = "gps-cdcl" solver-version = 1 diff --git a/bolt/internal/internal.pb.go b/bolt/internal/internal.pb.go index 5a818dbc70..6e29bdcbac 100644 --- a/bolt/internal/internal.pb.go +++ b/bolt/internal/internal.pb.go @@ -70,6 +70,97 @@ func (m *Source) String() string { return proto.CompactTextString(m) func (*Source) ProtoMessage() {} func (*Source) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{0} } +func (m *Source) GetID() int64 { + if m != nil { + return m.ID + } + return 0 +} + +func (m *Source) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Source) GetType() string { + if m != nil { + return m.Type + } + return "" +} + +func (m *Source) GetUsername() string { + if m != nil { + return m.Username + } + return "" +} + +func (m *Source) GetPassword() string { + if m != nil { + return m.Password + } + return "" +} + +func (m *Source) GetURL() string { + if m != nil { + return m.URL + } + return "" +} + +func (m *Source) GetDefault() bool { + if m != nil { + return m.Default + } + return false +} + +func (m *Source) GetTelegraf() string { + if m != nil { + return m.Telegraf + } + return "" +} + +func (m *Source) GetInsecureSkipVerify() bool { + if m != nil { + return m.InsecureSkipVerify + } + return false +} + +func (m *Source) GetMetaURL() string { + if m != nil { + return m.MetaURL + } + return "" +} + +func (m *Source) GetSharedSecret() string { + if m != nil { + return m.SharedSecret + } + return "" +} + +func (m *Source) GetOrganization() string { + if m != nil { + return m.Organization + } + return "" +} + +func (m *Source) GetRole() string { + if m != nil { + return m.Role + } + return "" +} + type Dashboard struct { ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"` @@ -83,6 +174,20 @@ func (m *Dashboard) String() string { return proto.CompactTextString( func (*Dashboard) ProtoMessage() {} func (*Dashboard) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{1} } +func (m *Dashboard) GetID() int64 { + if m != nil { + return m.ID + } + return 0 +} + +func (m *Dashboard) GetName() string { + if m != nil { + return m.Name + } + return "" +} + func (m *Dashboard) GetCells() []*DashboardCell { if m != nil { return m.Cells @@ -97,6 +202,13 @@ func (m *Dashboard) GetTemplates() []*Template { return nil } +func (m *Dashboard) GetOrganization() string { + if m != nil { + return m.Organization + } + return "" +} + type DashboardCell struct { X int32 `protobuf:"varint,1,opt,name=x,proto3" json:"x,omitempty"` Y int32 `protobuf:"varint,2,opt,name=y,proto3" json:"y,omitempty"` @@ -116,6 +228,34 @@ func (m *DashboardCell) String() string { return proto.CompactTextStr func (*DashboardCell) ProtoMessage() {} func (*DashboardCell) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{2} } +func (m *DashboardCell) GetX() int32 { + if m != nil { + return m.X + } + return 0 +} + +func (m *DashboardCell) GetY() int32 { + if m != nil { + return m.Y + } + return 0 +} + +func (m *DashboardCell) GetW() int32 { + if m != nil { + return m.W + } + return 0 +} + +func (m *DashboardCell) GetH() int32 { + if m != nil { + return m.H + } + return 0 +} + func (m *DashboardCell) GetQueries() []*Query { if m != nil { return m.Queries @@ -123,6 +263,27 @@ func (m *DashboardCell) GetQueries() []*Query { return nil } +func (m *DashboardCell) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *DashboardCell) GetType() string { + if m != nil { + return m.Type + } + return "" +} + +func (m *DashboardCell) GetID() string { + if m != nil { + return m.ID + } + return "" +} + func (m *DashboardCell) GetAxes() map[string]*Axis { if m != nil { return m.Axes @@ -157,6 +318,41 @@ func (m *Color) String() string { return proto.CompactTextString(m) } func (*Color) ProtoMessage() {} func (*Color) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{3} } +func (m *Color) GetID() string { + if m != nil { + return m.ID + } + return "" +} + +func (m *Color) GetType() string { + if m != nil { + return m.Type + } + return "" +} + +func (m *Color) GetHex() string { + if m != nil { + return m.Hex + } + return "" +} + +func (m *Color) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Color) GetValue() string { + if m != nil { + return m.Value + } + return "" +} + type Legend struct { Type string `protobuf:"bytes,1,opt,name=Type,proto3" json:"Type,omitempty"` Orientation string `protobuf:"bytes,2,opt,name=Orientation,proto3" json:"Orientation,omitempty"` @@ -167,8 +363,22 @@ func (m *Legend) String() string { return proto.CompactTextString(m) func (*Legend) ProtoMessage() {} func (*Legend) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{4} } +func (m *Legend) GetType() string { + if m != nil { + return m.Type + } + return "" +} + +func (m *Legend) GetOrientation() string { + if m != nil { + return m.Orientation + } + return "" +} + type Axis struct { - LegacyBounds []int64 `protobuf:"varint,1,rep,name=legacyBounds" json:"legacyBounds,omitempty"` + LegacyBounds []int64 `protobuf:"varint,1,rep,packed,name=legacyBounds" json:"legacyBounds,omitempty"` Bounds []string `protobuf:"bytes,2,rep,name=bounds" json:"bounds,omitempty"` Label string `protobuf:"bytes,3,opt,name=label,proto3" json:"label,omitempty"` Prefix string `protobuf:"bytes,4,opt,name=prefix,proto3" json:"prefix,omitempty"` @@ -182,6 +392,55 @@ func (m *Axis) String() string { return proto.CompactTextString(m) } func (*Axis) ProtoMessage() {} func (*Axis) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{5} } +func (m *Axis) GetLegacyBounds() []int64 { + if m != nil { + return m.LegacyBounds + } + return nil +} + +func (m *Axis) GetBounds() []string { + if m != nil { + return m.Bounds + } + return nil +} + +func (m *Axis) GetLabel() string { + if m != nil { + return m.Label + } + return "" +} + +func (m *Axis) GetPrefix() string { + if m != nil { + return m.Prefix + } + return "" +} + +func (m *Axis) GetSuffix() string { + if m != nil { + return m.Suffix + } + return "" +} + +func (m *Axis) GetBase() string { + if m != nil { + return m.Base + } + return "" +} + +func (m *Axis) GetScale() string { + if m != nil { + return m.Scale + } + return "" +} + type Template struct { ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` TempVar string `protobuf:"bytes,2,opt,name=temp_var,json=tempVar,proto3" json:"temp_var,omitempty"` @@ -196,6 +455,20 @@ func (m *Template) String() string { return proto.CompactTextString(m func (*Template) ProtoMessage() {} func (*Template) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{6} } +func (m *Template) GetID() string { + if m != nil { + return m.ID + } + return "" +} + +func (m *Template) GetTempVar() string { + if m != nil { + return m.TempVar + } + return "" +} + func (m *Template) GetValues() []*TemplateValue { if m != nil { return m.Values @@ -203,6 +476,20 @@ func (m *Template) GetValues() []*TemplateValue { return nil } +func (m *Template) GetType() string { + if m != nil { + return m.Type + } + return "" +} + +func (m *Template) GetLabel() string { + if m != nil { + return m.Label + } + return "" +} + func (m *Template) GetQuery() *TemplateQuery { if m != nil { return m.Query @@ -221,6 +508,27 @@ func (m *TemplateValue) String() string { return proto.CompactTextStr func (*TemplateValue) ProtoMessage() {} func (*TemplateValue) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{7} } +func (m *TemplateValue) GetType() string { + if m != nil { + return m.Type + } + return "" +} + +func (m *TemplateValue) GetValue() string { + if m != nil { + return m.Value + } + return "" +} + +func (m *TemplateValue) GetSelected() bool { + if m != nil { + return m.Selected + } + return false +} + type TemplateQuery struct { Command string `protobuf:"bytes,1,opt,name=command,proto3" json:"command,omitempty"` Db string `protobuf:"bytes,2,opt,name=db,proto3" json:"db,omitempty"` @@ -235,6 +543,48 @@ func (m *TemplateQuery) String() string { return proto.CompactTextStr func (*TemplateQuery) ProtoMessage() {} func (*TemplateQuery) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{8} } +func (m *TemplateQuery) GetCommand() string { + if m != nil { + return m.Command + } + return "" +} + +func (m *TemplateQuery) GetDb() string { + if m != nil { + return m.Db + } + return "" +} + +func (m *TemplateQuery) GetRp() string { + if m != nil { + return m.Rp + } + return "" +} + +func (m *TemplateQuery) GetMeasurement() string { + if m != nil { + return m.Measurement + } + return "" +} + +func (m *TemplateQuery) GetTagKey() string { + if m != nil { + return m.TagKey + } + return "" +} + +func (m *TemplateQuery) GetFieldKey() string { + if m != nil { + return m.FieldKey + } + return "" +} + type Server struct { ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"` @@ -251,6 +601,62 @@ func (m *Server) String() string { return proto.CompactTextString(m) func (*Server) ProtoMessage() {} func (*Server) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{9} } +func (m *Server) GetID() int64 { + if m != nil { + return m.ID + } + return 0 +} + +func (m *Server) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Server) GetUsername() string { + if m != nil { + return m.Username + } + return "" +} + +func (m *Server) GetPassword() string { + if m != nil { + return m.Password + } + return "" +} + +func (m *Server) GetURL() string { + if m != nil { + return m.URL + } + return "" +} + +func (m *Server) GetSrcID() int64 { + if m != nil { + return m.SrcID + } + return 0 +} + +func (m *Server) GetActive() bool { + if m != nil { + return m.Active + } + return false +} + +func (m *Server) GetOrganization() string { + if m != nil { + return m.Organization + } + return "" +} + type Layout struct { ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` Application string `protobuf:"bytes,2,opt,name=Application,proto3" json:"Application,omitempty"` @@ -264,6 +670,27 @@ func (m *Layout) String() string { return proto.CompactTextString(m) func (*Layout) ProtoMessage() {} func (*Layout) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{10} } +func (m *Layout) GetID() string { + if m != nil { + return m.ID + } + return "" +} + +func (m *Layout) GetApplication() string { + if m != nil { + return m.Application + } + return "" +} + +func (m *Layout) GetMeasurement() string { + if m != nil { + return m.Measurement + } + return "" +} + func (m *Layout) GetCells() []*Cell { if m != nil { return m.Cells @@ -271,6 +698,13 @@ func (m *Layout) GetCells() []*Cell { return nil } +func (m *Layout) GetAutoflow() bool { + if m != nil { + return m.Autoflow + } + return false +} + type Cell struct { X int32 `protobuf:"varint,1,opt,name=x,proto3" json:"x,omitempty"` Y int32 `protobuf:"varint,2,opt,name=y,proto3" json:"y,omitempty"` @@ -279,7 +713,7 @@ type Cell struct { Queries []*Query `protobuf:"bytes,5,rep,name=queries" json:"queries,omitempty"` I string `protobuf:"bytes,6,opt,name=i,proto3" json:"i,omitempty"` Name string `protobuf:"bytes,7,opt,name=name,proto3" json:"name,omitempty"` - Yranges []int64 `protobuf:"varint,8,rep,name=yranges" json:"yranges,omitempty"` + Yranges []int64 `protobuf:"varint,8,rep,packed,name=yranges" json:"yranges,omitempty"` Ylabels []string `protobuf:"bytes,9,rep,name=ylabels" json:"ylabels,omitempty"` Type string `protobuf:"bytes,10,opt,name=type,proto3" json:"type,omitempty"` Axes map[string]*Axis `protobuf:"bytes,11,rep,name=axes" json:"axes,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value"` @@ -290,6 +724,34 @@ func (m *Cell) String() string { return proto.CompactTextString(m) } func (*Cell) ProtoMessage() {} func (*Cell) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{11} } +func (m *Cell) GetX() int32 { + if m != nil { + return m.X + } + return 0 +} + +func (m *Cell) GetY() int32 { + if m != nil { + return m.Y + } + return 0 +} + +func (m *Cell) GetW() int32 { + if m != nil { + return m.W + } + return 0 +} + +func (m *Cell) GetH() int32 { + if m != nil { + return m.H + } + return 0 +} + func (m *Cell) GetQueries() []*Query { if m != nil { return m.Queries @@ -297,6 +759,41 @@ func (m *Cell) GetQueries() []*Query { return nil } +func (m *Cell) GetI() string { + if m != nil { + return m.I + } + return "" +} + +func (m *Cell) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Cell) GetYranges() []int64 { + if m != nil { + return m.Yranges + } + return nil +} + +func (m *Cell) GetYlabels() []string { + if m != nil { + return m.Ylabels + } + return nil +} + +func (m *Cell) GetType() string { + if m != nil { + return m.Type + } + return "" +} + func (m *Cell) GetAxes() map[string]*Axis { if m != nil { return m.Axes @@ -321,6 +818,48 @@ func (m *Query) String() string { return proto.CompactTextString(m) } func (*Query) ProtoMessage() {} func (*Query) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{12} } +func (m *Query) GetCommand() string { + if m != nil { + return m.Command + } + return "" +} + +func (m *Query) GetDB() string { + if m != nil { + return m.DB + } + return "" +} + +func (m *Query) GetRP() string { + if m != nil { + return m.RP + } + return "" +} + +func (m *Query) GetGroupBys() []string { + if m != nil { + return m.GroupBys + } + return nil +} + +func (m *Query) GetWheres() []string { + if m != nil { + return m.Wheres + } + return nil +} + +func (m *Query) GetLabel() string { + if m != nil { + return m.Label + } + return "" +} + func (m *Query) GetRange() *Range { if m != nil { return m.Range @@ -328,6 +867,13 @@ func (m *Query) GetRange() *Range { return nil } +func (m *Query) GetSource() string { + if m != nil { + return m.Source + } + return "" +} + func (m *Query) GetShifts() []*TimeShift { if m != nil { return m.Shifts @@ -346,6 +892,27 @@ func (m *TimeShift) String() string { return proto.CompactTextString( func (*TimeShift) ProtoMessage() {} func (*TimeShift) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{13} } +func (m *TimeShift) GetLabel() string { + if m != nil { + return m.Label + } + return "" +} + +func (m *TimeShift) GetUnit() string { + if m != nil { + return m.Unit + } + return "" +} + +func (m *TimeShift) GetQuantity() string { + if m != nil { + return m.Quantity + } + return "" +} + type Range struct { Upper int64 `protobuf:"varint,1,opt,name=Upper,proto3" json:"Upper,omitempty"` Lower int64 `protobuf:"varint,2,opt,name=Lower,proto3" json:"Lower,omitempty"` @@ -356,6 +923,20 @@ func (m *Range) String() string { return proto.CompactTextString(m) } func (*Range) ProtoMessage() {} func (*Range) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{14} } +func (m *Range) GetUpper() int64 { + if m != nil { + return m.Upper + } + return 0 +} + +func (m *Range) GetLower() int64 { + if m != nil { + return m.Lower + } + return 0 +} + type AlertRule struct { ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` JSON string `protobuf:"bytes,2,opt,name=JSON,proto3" json:"JSON,omitempty"` @@ -368,6 +949,34 @@ func (m *AlertRule) String() string { return proto.CompactTextString( func (*AlertRule) ProtoMessage() {} func (*AlertRule) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{15} } +func (m *AlertRule) GetID() string { + if m != nil { + return m.ID + } + return "" +} + +func (m *AlertRule) GetJSON() string { + if m != nil { + return m.JSON + } + return "" +} + +func (m *AlertRule) GetSrcID() int64 { + if m != nil { + return m.SrcID + } + return 0 +} + +func (m *AlertRule) GetKapaID() int64 { + if m != nil { + return m.KapaID + } + return 0 +} + type User struct { ID uint64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"` @@ -382,6 +991,34 @@ func (m *User) String() string { return proto.CompactTextString(m) } func (*User) ProtoMessage() {} func (*User) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{16} } +func (m *User) GetID() uint64 { + if m != nil { + return m.ID + } + return 0 +} + +func (m *User) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *User) GetProvider() string { + if m != nil { + return m.Provider + } + return "" +} + +func (m *User) GetScheme() string { + if m != nil { + return m.Scheme + } + return "" +} + func (m *User) GetRoles() []*Role { if m != nil { return m.Roles @@ -389,6 +1026,13 @@ func (m *User) GetRoles() []*Role { return nil } +func (m *User) GetSuperAdmin() bool { + if m != nil { + return m.SuperAdmin + } + return false +} + type Role struct { Organization string `protobuf:"bytes,1,opt,name=Organization,proto3" json:"Organization,omitempty"` Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"` @@ -399,6 +1043,20 @@ func (m *Role) String() string { return proto.CompactTextString(m) } func (*Role) ProtoMessage() {} func (*Role) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{17} } +func (m *Role) GetOrganization() string { + if m != nil { + return m.Organization + } + return "" +} + +func (m *Role) GetName() string { + if m != nil { + return m.Name + } + return "" +} + type Organization struct { ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"` @@ -411,6 +1069,34 @@ func (m *Organization) String() string { return proto.CompactTextStri func (*Organization) ProtoMessage() {} func (*Organization) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{18} } +func (m *Organization) GetID() string { + if m != nil { + return m.ID + } + return "" +} + +func (m *Organization) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Organization) GetDefaultRole() string { + if m != nil { + return m.DefaultRole + } + return "" +} + +func (m *Organization) GetPublic() bool { + if m != nil { + return m.Public + } + return false +} + type Config struct { Auth *AuthConfig `protobuf:"bytes,1,opt,name=Auth" json:"Auth,omitempty"` } @@ -436,6 +1122,13 @@ func (m *AuthConfig) String() string { return proto.CompactTextString func (*AuthConfig) ProtoMessage() {} func (*AuthConfig) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{20} } +func (m *AuthConfig) GetSuperAdminNewUsers() bool { + if m != nil { + return m.SuperAdminNewUsers + } + return false +} + type BuildInfo struct { Version string `protobuf:"bytes,1,opt,name=Version,proto3" json:"Version,omitempty"` Commit string `protobuf:"bytes,2,opt,name=Commit,proto3" json:"Commit,omitempty"` @@ -446,6 +1139,20 @@ func (m *BuildInfo) String() string { return proto.CompactTextString( func (*BuildInfo) ProtoMessage() {} func (*BuildInfo) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{21} } +func (m *BuildInfo) GetVersion() string { + if m != nil { + return m.Version + } + return "" +} + +func (m *BuildInfo) GetCommit() string { + if m != nil { + return m.Commit + } + return "" +} + func init() { proto.RegisterType((*Source)(nil), "internal.Source") proto.RegisterType((*Dashboard)(nil), "internal.Dashboard") @@ -475,7 +1182,7 @@ func init() { proto.RegisterFile("internal.proto", fileDescriptorInternal) } var fileDescriptorInternal = []byte{ // 1379 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xbc, 0x57, 0x5f, 0x8f, 0xdb, 0x44, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x5f, 0x8f, 0xdb, 0x44, 0x10, 0x97, 0xe3, 0x38, 0x89, 0x27, 0xd7, 0x52, 0x99, 0x8a, 0x9a, 0x22, 0xa1, 0x60, 0x81, 0x08, 0x82, 0x1e, 0xe8, 0x2a, 0x24, 0x84, 0xa0, 0x52, 0xee, 0x82, 0xca, 0xd1, 0x6b, 0x7b, 0xdd, 0xdc, 0x1d, 0x4f, 0xa8, 0xda, 0x38, 0x93, 0xc4, 0xaa, 0x63, 0x9b, 0xb5, 0x7d, 0x17, 0xf3, 0x61, 0x90, From 95c24ef14b710ea095b3247f4bffee732ce4e5af Mon Sep 17 00:00:00 2001 From: deniz kusefoglu Date: Thu, 8 Feb 2018 12:27:04 -0800 Subject: [PATCH 17/20] take onSave out of render and rename to handleSave --- ui/src/kapacitor/components/KapacitorRule.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/ui/src/kapacitor/components/KapacitorRule.js b/ui/src/kapacitor/components/KapacitorRule.js index adfaf988b8..e86217e6fc 100644 --- a/ui/src/kapacitor/components/KapacitorRule.js +++ b/ui/src/kapacitor/components/KapacitorRule.js @@ -75,6 +75,15 @@ class KapacitorRule extends Component { }) } + handleSave = () => { + const {rule} = this.props + if (rule.id === DEFAULT_RULE_ID) { + this.handleCreate() + } else { + this.handleEdit() + } + } + handleSaveToConfig = configName => () => { const {rule, configLink, router} = this.props const pathname = `${configLink}#${configName}` @@ -161,19 +170,11 @@ class KapacitorRule extends Component { const {chooseTrigger, updateRuleValues} = ruleActions const {timeRange} = this.state - const onSave = () => { - if (rule.id === DEFAULT_RULE_ID) { - this.handleCreate() - } else { - this.handleEdit() - } - } - return (
From 326cbd26570580930d2ed488499fec091bcdde4b Mon Sep 17 00:00:00 2001 From: deniz kusefoglu Date: Thu, 8 Feb 2018 12:35:04 -0800 Subject: [PATCH 18/20] Simplify nested if else statements --- ui/src/kapacitor/components/KapacitorRule.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/src/kapacitor/components/KapacitorRule.js b/ui/src/kapacitor/components/KapacitorRule.js index e86217e6fc..af6d48d9fb 100644 --- a/ui/src/kapacitor/components/KapacitorRule.js +++ b/ui/src/kapacitor/components/KapacitorRule.js @@ -91,7 +91,9 @@ class KapacitorRule extends Component { router.push({ pathname, }) - } else if (rule.id === DEFAULT_RULE_ID) { + return + } + if (rule.id === DEFAULT_RULE_ID) { this.handleCreate(pathname) } else { this.handleEdit(pathname) From 98a4a04b21ce3eee9758c0cc2217ba777b58e9cd Mon Sep 17 00:00:00 2001 From: Iris Scholten Date: Thu, 8 Feb 2018 12:46:02 -0800 Subject: [PATCH 19/20] add comments to explain the comparing to nullorg/nullrule when adding new users via the global users page --- ui/src/admin/components/chronograf/AllUsersTableRowNew.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ui/src/admin/components/chronograf/AllUsersTableRowNew.js b/ui/src/admin/components/chronograf/AllUsersTableRowNew.js index af828848c9..9d9fab2b09 100644 --- a/ui/src/admin/components/chronograf/AllUsersTableRowNew.js +++ b/ui/src/admin/components/chronograf/AllUsersTableRowNew.js @@ -42,6 +42,9 @@ class AllUsersTableRowNew extends Component { provider, scheme, superAdmin, + // since you can only choose one organization, there is only one role in a new row + // if no organization is selected ie the "None" organization, + // then set roles to an empty array instead of sending the null role to the server roles: roles[0].organization === undefined ? [] : roles, } onCreateUser(newUser) @@ -54,6 +57,8 @@ class AllUsersTableRowNew extends Component { handleSelectOrganization = newOrganization => { const newRoles = [ + // if "None" was selected for organization, create a "null role" from the predefined null role + // else create a new role with the organization as the newOrganization's id newOrganization.id === undefined ? { ...nullRole, From ffbe628d186a8cf988fb26b3305dcdbe59f09126 Mon Sep 17 00:00:00 2001 From: Iris Scholten Date: Thu, 8 Feb 2018 14:55:56 -0800 Subject: [PATCH 20/20] keep track of only the single role instead of an array of one role in AllUsersTableRowNew and update the add user reducer so that it appends the new user instead of prepends them --- .../chronograf/AllUsersTableRowNew.js | 29 +++++++++---------- ui/src/admin/reducers/chronograf.js | 2 +- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/ui/src/admin/components/chronograf/AllUsersTableRowNew.js b/ui/src/admin/components/chronograf/AllUsersTableRowNew.js index 9d9fab2b09..b20d53d193 100644 --- a/ui/src/admin/components/chronograf/AllUsersTableRowNew.js +++ b/ui/src/admin/components/chronograf/AllUsersTableRowNew.js @@ -22,11 +22,9 @@ class AllUsersTableRowNew extends Component { name: '', provider: '', scheme: 'oauth2', - roles: [ - { - ...nullRole, - }, - ], + role: { + ...nullRole, + }, } } @@ -36,7 +34,7 @@ class AllUsersTableRowNew extends Component { handleConfirmCreateUser = () => { const {onBlur, onCreateUser} = this.props - const {name, provider, scheme, roles, superAdmin} = this.state + const {name, provider, scheme, role, superAdmin} = this.state const newUser = { name, provider, @@ -44,8 +42,8 @@ class AllUsersTableRowNew extends Component { superAdmin, // since you can only choose one organization, there is only one role in a new row // if no organization is selected ie the "None" organization, - // then set roles to an empty array instead of sending the null role to the server - roles: roles[0].organization === undefined ? [] : roles, + // then set roles to an empty array + roles: role.organization === undefined ? [] : [role], } onCreateUser(newUser) onBlur() @@ -56,9 +54,9 @@ class AllUsersTableRowNew extends Component { } handleSelectOrganization = newOrganization => { - const newRoles = [ - // if "None" was selected for organization, create a "null role" from the predefined null role - // else create a new role with the organization as the newOrganization's id + // if "None" was selected for organization, create a "null role" from the predefined null role + // else create a new role with the organization as the newOrganization's id + const newRole = newOrganization.id === undefined ? { ...nullRole, @@ -66,9 +64,8 @@ class AllUsersTableRowNew extends Component { : { organization: newOrganization.id, name: '*', // '*' causes the server to determine the current defaultRole of the selected organization - }, - ] - this.setState({roles: newRoles}) + } + this.setState({role: newRole}) } handleKeyDown = e => { @@ -92,7 +89,7 @@ class AllUsersTableRowNew extends Component { render() { const {organizations, onBlur} = this.props - const {name, provider, scheme, roles} = this.state + const {name, provider, scheme, role} = this.state const dropdownOrganizationsItems = [ {...nullOrganization}, @@ -102,7 +99,7 @@ class AllUsersTableRowNew extends Component { text: o.name, })) const selectedRole = dropdownOrganizationsItems.find( - o => roles[0].organization === o.id + o => role.organization === o.id ) const preventCreate = !name || !provider diff --git a/ui/src/admin/reducers/chronograf.js b/ui/src/admin/reducers/chronograf.js index dd99006c89..8f465cb45f 100644 --- a/ui/src/admin/reducers/chronograf.js +++ b/ui/src/admin/reducers/chronograf.js @@ -20,7 +20,7 @@ const adminChronograf = (state = initialState, action) => { case 'CHRONOGRAF_ADD_USER': { const {user} = action.payload - return {...state, users: [user, ...state.users]} + return {...state, users: [...state.users, user]} } case 'CHRONOGRAF_UPDATE_USER': {