diff --git a/domain/setting/endpoint.go b/domain/setting/endpoint.go index 6a6a3e83..75f4169f 100644 --- a/domain/setting/endpoint.go +++ b/domain/setting/endpoint.go @@ -217,7 +217,11 @@ func (h *Handler) GetInstanceSetting(w http.ResponseWriter, r *http.Request) { key := request.Query(r, "key") setting, _ := h.Store.Setting.GetUser(orgID, "", key, "") if len(setting) == 0 { - setting = "{}" + if key == "flowchart" { + setting = fmt.Sprintf(`{ "url": "%s" }`, "https://embed.diagrams.net/?embed=1&ui=Kennedy&spin=0&proto=json&splash=0") + } else { + setting = "{}" + } } response.WriteJSON(w, setting) diff --git a/gui/app/components/customize/integration-settings.js b/gui/app/components/customize/integration-settings.js index 7cc06601..f9568509 100644 --- a/gui/app/components/customize/integration-settings.js +++ b/gui/app/components/customize/integration-settings.js @@ -45,6 +45,14 @@ export default Component.extend(Notifier, { this.set('trelloCreds', trello); } + + let flowchart = this.get('flowchart'); + if (_.isEmpty(flowchart) || !_.isObject(flowchart)) { + flowchart = { + url: '', + }; + } + this.set('flowchart', flowchart); }, actions: { @@ -61,6 +69,8 @@ export default Component.extend(Notifier, { this.get('orgSvc').saveGlobalSetting('SECTION-TRELLO', this.get('trelloCreds')); } + this.get('orgSvc').saveOrgSetting(orgId, 'flowchart', this.get('flowchart')); + this.notifySuccess(this.i18n.localize('saved')); }); } diff --git a/gui/app/components/section/flowchart/type-editor.js b/gui/app/components/section/flowchart/type-editor.js index 6aaccf79..5bb82f79 100644 --- a/gui/app/components/section/flowchart/type-editor.js +++ b/gui/app/components/section/flowchart/type-editor.js @@ -17,6 +17,7 @@ import Component from '@ember/component'; export default Component.extend({ appMeta: service(), sectionSvc: service('section'), + orgService: service('organization'), i18n: service(), isDirty: false, waiting: false, @@ -26,6 +27,7 @@ export default Component.extend({ readyToSave: false, previewButtonCaption: '', flowCallback: null, + serviceUrl: '', editorId: computed('page', function () { let page = this.get('page'); return `flowchart-editor-${page.id}`; @@ -41,10 +43,16 @@ export default Component.extend({ didInsertElement() { this._super(...arguments); - this.previewButtonCaption = this.i18n.localize('preview'); - schedule('afterRender', () => { - this.setupEditor(); + let orgId = this.get("appMeta.orgId"); + this.get('orgService').getOrgSetting(orgId, 'flowchart').then((s) => { + this.set('serviceUrl', s.url); + + this.previewButtonCaption = this.i18n.localize('preview'); + + schedule('afterRender', () => { + this.setupEditor(); + }); }); }, diff --git a/gui/app/pods/customize/integrations/route.js b/gui/app/pods/customize/integrations/route.js index 225f86eb..a75ea445 100644 --- a/gui/app/pods/customize/integrations/route.js +++ b/gui/app/pods/customize/integrations/route.js @@ -32,11 +32,13 @@ export default Route.extend(AuthenticatedRouteMixin, { if (this.get("session.isGlobalAdmin")) { return RSVP.hash({ jira: this.get('orgService').getOrgSetting(orgId, 'jira'), + flowchart: this.get('orgService').getOrgSetting(orgId, 'flowchart'), trello: this.get('orgService').getGlobalSetting('SECTION-TRELLO') }); } else { return RSVP.hash({ jira: this.get('orgService').getOrgSetting(orgId, 'jira'), + flowchart: this.get('orgService').getOrgSetting(orgId, 'flowchart'), trello: { appKey: '' } }); } diff --git a/gui/app/pods/customize/integrations/template.hbs b/gui/app/pods/customize/integrations/template.hbs index d6168b92..b4a71a07 100644 --- a/gui/app/pods/customize/integrations/template.hbs +++ b/gui/app/pods/customize/integrations/template.hbs @@ -3,4 +3,4 @@ desc=(localize 'admin_integrations_explain') icon=constants.Icon.Integrations}} -{{customize/integration-settings jira=model.jira trello=model.trello}} +{{customize/integration-settings jira=model.jira trello=model.trello flowchart=model.flowchart}} diff --git a/gui/app/templates/components/customize/integration-settings.hbs b/gui/app/templates/components/customize/integration-settings.hbs index a5bf67dc..b4a33d26 100644 --- a/gui/app/templates/components/customize/integration-settings.hbs +++ b/gui/app/templates/components/customize/integration-settings.hbs @@ -17,11 +17,18 @@ {{localize 'integration_jira_password_explain'}} +