From 03bdf0b1aa5df716f71bbcb8279c2af57dd8b578 Mon Sep 17 00:00:00 2001 From: Leigh Date: Thu, 12 May 2016 09:26:54 -0400 Subject: [PATCH] Add aw-tool-tip directive to Form > Add disabled tabs, clean up forms --- awx/ui/client/src/forms.js | 4 - awx/ui/client/src/forms/Credentials.js | 2 + awx/ui/client/src/forms/Inventories.js | 4 + awx/ui/client/src/forms/JobTemplates.js | 2 + awx/ui/client/src/forms/LicenseForm.js | 95 ------------------- awx/ui/client/src/forms/LicenseUpdate.js | 57 ----------- awx/ui/client/src/forms/Organizations.js | 2 + awx/ui/client/src/forms/Projects.js | 4 +- awx/ui/client/src/forms/Teams.js | 4 + awx/ui/client/src/forms/Users.js | 6 ++ awx/ui/client/src/lists/CompletedJobs.js | 4 +- .../src/notifications/notifications.list.js | 3 + awx/ui/client/src/shared/form-generator.js | 4 +- 13 files changed, 32 insertions(+), 159 deletions(-) delete mode 100644 awx/ui/client/src/forms/LicenseForm.js delete mode 100644 awx/ui/client/src/forms/LicenseUpdate.js diff --git a/awx/ui/client/src/forms.js b/awx/ui/client/src/forms.js index 913ebb4859..51cbc4a6e7 100644 --- a/awx/ui/client/src/forms.js +++ b/awx/ui/client/src/forms.js @@ -17,8 +17,6 @@ import JobSummary from "./forms/JobSummary"; import JobTemplates from "./forms/JobTemplates"; import JobVarsPrompt from "./forms/JobVarsPrompt"; import Jobs from "./forms/Jobs"; -import LicenseForm from "./forms/LicenseForm"; -import LicenseUpdate from "./forms/LicenseUpdate"; import LogViewerOptions from "./forms/LogViewerOptions"; import LogViewerStatus from "./forms/LogViewerStatus"; import Organizations from "./forms/Organizations"; @@ -42,8 +40,6 @@ export JobTemplates, JobVarsPrompt, Jobs, - LicenseForm, - LicenseUpdate, LogViewerOptions, LogViewerStatus, Organizations, diff --git a/awx/ui/client/src/forms/Credentials.js b/awx/ui/client/src/forms/Credentials.js index 6b9902fa97..8f1c84fc38 100644 --- a/awx/ui/client/src/forms/Credentials.js +++ b/awx/ui/client/src/forms/Credentials.js @@ -418,6 +418,8 @@ export default related: { permissions: { + awToolTip: 'Please save before assigning permissions', + dataPlacement: 'top', basePath: 'credentials/:id/access_list/', type: 'collection', title: 'Permissions', diff --git a/awx/ui/client/src/forms/Inventories.js b/awx/ui/client/src/forms/Inventories.js index 2c649af601..c748f0d225 100644 --- a/awx/ui/client/src/forms/Inventories.js +++ b/awx/ui/client/src/forms/Inventories.js @@ -79,6 +79,8 @@ export default related: { scan_job_templates: { + awToolTip: 'Please save before adding a scan job template', + dataPlacement: 'top', basePath: 'inventories/:id/scan_job_templates', type: 'collection', title: 'Scan Job Templates', @@ -153,6 +155,8 @@ export default } }, permissions: { + awToolTip: 'Please save before assigning permissions', + dataPlacement: 'top', basePath: 'projects/:id/access_list/', type: 'collection', title: 'Permissions', diff --git a/awx/ui/client/src/forms/JobTemplates.js b/awx/ui/client/src/forms/JobTemplates.js index b5e5c52e7d..16620b8fc5 100644 --- a/awx/ui/client/src/forms/JobTemplates.js +++ b/awx/ui/client/src/forms/JobTemplates.js @@ -334,6 +334,8 @@ export default include: "CompletedJobsList" }, permissions: { + awToolTip: 'Please save before assigning permissions', + dataPlacement: 'top', basePath: 'job_templates/:id/access_list/', type: 'collection', title: 'Permissions', diff --git a/awx/ui/client/src/forms/LicenseForm.js b/awx/ui/client/src/forms/LicenseForm.js deleted file mode 100644 index 672144d210..0000000000 --- a/awx/ui/client/src/forms/LicenseForm.js +++ /dev/null @@ -1,95 +0,0 @@ -/************************************************* - * Copyright (c) 2015 Ansible, Inc. - * - * All Rights Reserved - *************************************************/ - -/** - * @ngdoc function - * @name forms.function:LicenseForm - * @description This form is for viewing the license information -*/ - - -export default - angular.module('LicenseFormDefinition', []) - .value('LicenseForm', { - - name: 'license', - well: false, - editTitle: "License", - - licenseTabs: [{ - name: 'license', - label: 'License' - }, { - name: 'managed', - label: 'Managed Hosts' - }], - - fields: { - license_status: { - type: 'custom', - control: "
{{ license_status }}
", - readonly: true, - tab: 'license' - }, - tower_version: { - label: 'Tower Version', - type: 'text', - readonly: true, - tab: 'license' - }, - license_type: { - label: 'License Type', - type: 'text', - readonly: true, - tab: 'license' - }, - subscription_name: { - label: 'Subscription Name', - type: 'text', - readonly: true, - tab: 'license' - }, - license_key: { - label: 'License Key', - type: 'textarea', - 'class': 'modal-input-xlarge', - readonly: true, - tab: 'license' - }, - license_date: { - label: 'Expires On', - type: 'text', - readonly: true, - tab: 'license' - }, - time_remaining: { - label: 'Time Remaining', - type: 'text', - readonly: true, - tab: 'license' - }, - available_instances: { - label: 'Available', - type: 'text', - readonly: true, - tab: 'managed' - }, - current_instances: { - label: 'Used', - type: 'text', - readonly: true, - tab: 'managed' - }, - free_instances: { - label: 'Remaining', - type: 'text', - readonly: true, - controlNGClass: 'free_instances_class', - labelNGClass: 'free_instances_class', - tab: 'managed' - } - } - }); diff --git a/awx/ui/client/src/forms/LicenseUpdate.js b/awx/ui/client/src/forms/LicenseUpdate.js deleted file mode 100644 index 841e0a7ece..0000000000 --- a/awx/ui/client/src/forms/LicenseUpdate.js +++ /dev/null @@ -1,57 +0,0 @@ -/************************************************* - * Copyright (c) 2015 Ansible, Inc. - * - * All Rights Reserved - *************************************************/ - - /** - * @ngdoc function - * @name forms.function:LicenseUpdate - * @description This form is for updating a license -*/ - -export default - angular.module('LicenseUpdateFormDefinition', []) - .value('LicenseUpdateForm', { - - name: 'license', - well: false, - - fields: { - license_json: { - label: 'License File', - type: 'textarea', - 'class' : 'prepend-asterisk', - addRequired: true, - editRequired: true, - rows: 10, - 'default': '---' - }, - eula: { - label: 'End User License Agreement', - type: 'textarea', - addRequired: true, - editRequired: true, - 'class' : 'prepend-asterisk', - rows: 5, - readonly: true - }, - eula_agreement: { - label: 'I agree to the End User License Agreement', - type: 'checkbox', - addRequired: true, - editRequired: true - } - }, - buttons: { - form_submit: { - label: "Submit", - "class": "pull-right btn-primary", - ngClick: "submitLicenseKey()", - // ngDisabled: "true" - } - }, - - related: { } - - }); //LicenseUpdateForm diff --git a/awx/ui/client/src/forms/Organizations.js b/awx/ui/client/src/forms/Organizations.js index 5de0570ae6..12e8356267 100644 --- a/awx/ui/client/src/forms/Organizations.js +++ b/awx/ui/client/src/forms/Organizations.js @@ -47,6 +47,8 @@ export default related: { permissions: { + awToolTip: 'Please save before assigning permissions', + dataPlacement: 'top', type: 'collection', title: 'Permissions', iterator: 'permission', diff --git a/awx/ui/client/src/forms/Projects.js b/awx/ui/client/src/forms/Projects.js index b18e2f60f2..c1d479acca 100644 --- a/awx/ui/client/src/forms/Projects.js +++ b/awx/ui/client/src/forms/Projects.js @@ -232,6 +232,8 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition']) related: { permissions: { + awToolTip: 'Please save before assigning permissions', + dataPlacement: 'top', basePath: 'projects/:id/access_list/', type: 'collection', title: 'Permissions', @@ -264,7 +266,7 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition']) } } }, - "notifications": { + notifications: { include: "NotificationsList" } }, diff --git a/awx/ui/client/src/forms/Teams.js b/awx/ui/client/src/forms/Teams.js index 4d56a75f7e..f674bd8dc8 100644 --- a/awx/ui/client/src/forms/Teams.js +++ b/awx/ui/client/src/forms/Teams.js @@ -60,6 +60,8 @@ export default related: { access_list: { + dataPlacement: 'top', + awToolTip: 'Please save before adding users', basePath: 'teams/:id/access_list/', type: 'collection', title: 'Users', @@ -93,6 +95,8 @@ export default } }, roles: { + dataPlacement: 'top', + awToolTip: 'Please save before assigning permissions', type: 'collection', title: 'Permissions', iterator: 'role', diff --git a/awx/ui/client/src/forms/Users.js b/awx/ui/client/src/forms/Users.js index 954a61225b..1fa3db40d6 100644 --- a/awx/ui/client/src/forms/Users.js +++ b/awx/ui/client/src/forms/Users.js @@ -116,6 +116,8 @@ export default related: { organizations: { + awToolTip: 'Please save before assigning to organizations', + dataPlacement: 'top', type: 'collection', title: 'Organizations', iterator: 'organization', @@ -136,6 +138,8 @@ export default hideOnSuperuser: true }, teams: { + awToolTip: 'Please save before assigning to teams', + dataPlacement: 'top', type: 'collection', title: 'Teams', iterator: 'team', @@ -156,6 +160,8 @@ export default hideOnSuperuser: true }, roles: { + awToolTip: 'Please save before assigning to organizations', + dataPlacement: 'top', hideSearchAndActions: true, type: 'collection', title: 'Permissions', diff --git a/awx/ui/client/src/lists/CompletedJobs.js b/awx/ui/client/src/lists/CompletedJobs.js index da6c1220c4..0e3193fbb8 100644 --- a/awx/ui/client/src/lists/CompletedJobs.js +++ b/awx/ui/client/src/lists/CompletedJobs.js @@ -10,7 +10,9 @@ export default angular.module('CompletedJobsDefinition', ['sanitizeFilter']) .value( 'CompletedJobsList', { - + // These tooltip fields are consumed to build disabled related tabs tooltips in the form > add view + awToolTip: 'Please save and run a job to view', + dataPlacement: 'top', name: 'completed_jobs', basePath: 'job_templates/:id/jobs/?or__status=successful&or__status=failed&or__status=error&or__status=canceled', iterator: 'completed_job', diff --git a/awx/ui/client/src/notifications/notifications.list.js b/awx/ui/client/src/notifications/notifications.list.js index e61e2e9007..5520de2210 100644 --- a/awx/ui/client/src/notifications/notifications.list.js +++ b/awx/ui/client/src/notifications/notifications.list.js @@ -6,6 +6,9 @@ export default function(){ return { + // These tooltip fields are consumed to build disabled related tabs tooltips in the form > add view + dataPlacement: 'top', + awToolTip: 'Please save before adding notifications', name: 'notifications' , title: 'Notifications', iterator: 'notification', diff --git a/awx/ui/client/src/shared/form-generator.js b/awx/ui/client/src/shared/form-generator.js index 033c31d082..a69175ad4d 100644 --- a/awx/ui/client/src/shared/form-generator.js +++ b/awx/ui/client/src/shared/form-generator.js @@ -1511,7 +1511,9 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat for (itm in this.form.related) { collection = this.form.related[itm]; - html += "
" + (collection.title || collection.editTitle) + "
\n"; }