Prettier format all js files

This commit is contained in:
George Drummond
2019-01-24 09:38:43 -05:00
parent 20604e6ca9
commit 619bc9fe59
32 changed files with 553 additions and 443 deletions

View File

@@ -6,22 +6,22 @@ export default {
components: {
textinput,
LocalDatetime
LocalDatetime,
},
props: {
initialState: String
initialState: String,
},
data: function () {
data: function() {
return {
approving: this.initialState === 'approving',
denying: this.initialState === 'denying'
denying: this.initialState === 'denying',
}
},
methods: {
setReview: function (e) {
setReview: function(e) {
if (e.target.value === 'approving') {
this.approving = true
this.denying = false
@@ -30,5 +30,5 @@ export default {
this.denying = true
}
},
}
},
}

View File

@@ -18,47 +18,47 @@ export default {
props: {
initialData: {
type: Object,
default: () => ({})
}
default: () => ({}),
},
},
data: function () {
data: function() {
const {
estimated_monthly_spend = 0,
jedi_migration = '',
technical_support_team = ''
technical_support_team = '',
} = this.initialData
return {
estimated_monthly_spend,
jedi_migration,
technical_support_team
technical_support_team,
}
},
computed: {
annualSpend: function () {
annualSpend: function() {
const monthlySpend = this.estimated_monthly_spend || 0
return monthlySpend * 12
},
annualSpendStr: function () {
annualSpendStr: function() {
return this.formatDollars(this.annualSpend)
},
jediMigrationOptionSelected: function () {
jediMigrationOptionSelected: function() {
return this.jedi_migration !== ''
},
isJediMigration: function () {
isJediMigration: function() {
return this.jedi_migration === 'yes'
},
hasTechnicalSupportTeam: function () {
hasTechnicalSupportTeam: function() {
return this.technical_support_team === 'yes'
}
},
},
methods: {
formatDollars: function (intValue) {
formatDollars: function(intValue) {
const mask = createNumberMask({ prefix: '$', allowDecimal: true })
return conformToMask(intValue.toString(), mask).conformedValue
}
}
},
},
}

View File

@@ -15,12 +15,12 @@ export default {
props: {
name: String,
id: String
id: String,
},
methods: {
doRevoke: function () {
doRevoke: function() {
this.$root.$emit('revoke-' + this.id)
}
}
},
},
}

View File

@@ -4,7 +4,6 @@ import Selector from '../selector'
import Modal from '../../mixins/modal'
import toggler from '../toggler'
export default {
name: 'edit-environment-role',
@@ -14,16 +13,16 @@ export default {
toggler,
Modal,
Selector,
textinput
textinput,
},
props: {
choices: Array,
initialData: String,
applicationId: String
applicationId: String,
},
data: function () {
data: function() {
return {
new_role: this.initialData,
}
@@ -34,19 +33,19 @@ export default {
},
methods: {
change: function (e) {
change: function(e) {
this.new_role = e.target.value
},
cancel: function () {
cancel: function() {
this.new_role = this.initialData
},
revoke: function () {
this.new_role = ""
}
revoke: function() {
this.new_role = ''
},
},
computed: {
displayName: function () {
displayName: function() {
const newRole = this.newRole
for (var arr in this.choices) {
if (this.choices[arr][0] == newRole) {
@@ -54,12 +53,11 @@ export default {
}
}
},
label_class: function () {
return this.newRole === "" ?
"label" : "label label--success"
label_class: function() {
return this.newRole === '' ? 'label' : 'label label--success'
},
newRole: function () {
newRole: function() {
return this.new_role
}
},
},
}

View File

@@ -17,32 +17,32 @@ export default {
props: {
initialData: {
type: Object,
default: () => ({})
}
default: () => ({}),
},
},
data: function () {
const {
funding_type = ""
} = this.initialData
data: function() {
const { funding_type = '' } = this.initialData
return {
funding_type,
shouldForceShowTaskOrder: false
shouldForceShowTaskOrder: false,
}
},
computed: {
showTaskOrderUpload: function() {
return !this.initialData.legacy_task_order.pdf || this.shouldForceShowTaskOrder
}
return (
!this.initialData.legacy_task_order.pdf || this.shouldForceShowTaskOrder
)
},
},
methods: {
forceShowTaskOrderUpload: function(e) {
console.log("forceShowTaskOrder", e)
console.log('forceShowTaskOrder', e)
e.preventDefault()
this.shouldForceShowTaskOrder = true
}
}
},
},
}

View File

@@ -12,21 +12,21 @@ export default {
components: {
textinput,
optionsinput
optionsinput,
},
props: {
initialData: {
type: Object,
default: () => ({})
default: () => ({}),
},
uploadErrors: {
type: Array,
default: () => ([])
}
default: () => [],
},
},
data: function () {
data: function() {
const {
clin_01 = 0,
clin_02 = 0,
@@ -40,26 +40,27 @@ export default {
clin_02,
clin_03,
clin_04,
showUpload: !csp_estimate || this.uploadErrors.length > 0
showUpload: !csp_estimate || this.uploadErrors.length > 0,
}
},
computed: {
totalBudget: function () {
totalBudget: function() {
return [this.clin_01, this.clin_02, this.clin_03, this.clin_04].reduce(
function(acc, curr) {
curr = !curr ? 0 : parseInt(curr)
return acc + curr;
}, 0
return acc + curr
},
0
)
},
totalBudgetStr: function () {
return this.formatDollars(this.totalBudget);
totalBudgetStr: function() {
return this.formatDollars(this.totalBudget)
},
},
methods: {
formatDollars: function (intValue) {
formatDollars: function(intValue) {
const mask = createNumberMask({ prefix: '$', allowDecimal: true })
return conformToMask(intValue.toString(), mask).conformedValue
},
@@ -68,7 +69,7 @@ export default {
},
updateBudget: function() {
document.querySelector('#to-target').innerText = this.totalBudgetStr
}
},
},
watch: {
@@ -80,5 +81,5 @@ export default {
mounted: function() {
this.updateBudget()
}
},
}

View File

@@ -1,7 +1,7 @@
import FormMixin from '../../mixins/form'
import textinput from '../text_input'
const createEnvironment = (name) => ({ name })
const createEnvironment = name => ({ name })
export default {
name: 'new-application',
@@ -9,97 +9,107 @@ export default {
mixins: [FormMixin],
components: {
textinput
textinput,
},
props: {
initialData: {
type: Object,
default: () => ({})
default: () => ({}),
},
modalName: String
modalName: String,
},
data: function () {
const {
environment_names,
name,
} = this.initialData
data: function() {
const { environment_names, name } = this.initialData
const environments = (
environment_names.length > 0
const environments = (environment_names.length > 0
? environment_names
: ["Development", "Testing", "Staging", "Production"]
: ['Development', 'Testing', 'Staging', 'Production']
).map(createEnvironment)
return {
validations: [
{func: this.hasEnvironments, message: "Provide at least one environment name."},
{func: this.envNamesAreUnique, message: "Environment names must be unique."},
{func: this.environmentsHaveNames, message: "Environment names cannot be empty."},
{
func: this.hasEnvironments,
message: 'Provide at least one environment name.',
},
{
func: this.envNamesAreUnique,
message: 'Environment names must be unique.',
},
{
func: this.environmentsHaveNames,
message: 'Environment names cannot be empty.',
},
],
errors: [],
environments,
name,
readyToSubmit: false
readyToSubmit: false,
}
},
mounted: function () {
mounted: function() {
this.$root.$on('onEnvironmentAdded', this.addEnvironment)
},
methods: {
addEnvironment: function (event) {
this.environments.push(createEnvironment(""))
addEnvironment: function(event) {
this.environments.push(createEnvironment(''))
},
removeEnvironment: function (index) {
removeEnvironment: function(index) {
if (this.environments.length > 1) {
this.environments.splice(index, 1)
}
},
validate: function() {
this.errors = this.validations.map((validation) => {
if (!validation.func()) {
return validation.message
}
}).filter(Boolean)
this.errors = this.validations
.map(validation => {
if (!validation.func()) {
return validation.message
}
})
.filter(Boolean)
},
hasEnvironments: function () {
return this.environments.length > 0 && this.environments.some((e) => e.name !== "")
hasEnvironments: function() {
return (
this.environments.length > 0 &&
this.environments.some(e => e.name !== '')
)
},
environmentsHaveNames: function () {
environmentsHaveNames: function() {
if (this.environments.length > 1) {
// only want to display this error if we have multiple envs and one or
// more do not have names
return this.environments.every((e) => e.name !== "")
return this.environments.every(e => e.name !== '')
} else {
return true
}
},
envNamesAreUnique: function () {
const names = this.environments.map((e) => e.name)
envNamesAreUnique: function() {
const names = this.environments.map(e => e.name)
return names.every((n, index) => names.indexOf(n) === index)
},
handleSubmit: function (event) {
handleSubmit: function(event) {
if (!this.readyToSubmit) {
event.preventDefault()
this.validateAndOpenModal()
}
},
handleCancelSubmit: function () {
handleCancelSubmit: function() {
this.readyToSubmit = false
this.closeModal(this.modalName)
},
validateAndOpenModal: function () {
validateAndOpenModal: function() {
let isValid = this.$children.reduce((previous, newVal) => {
// display textInput error if it is not valid
if (!newVal.showValid) {
@@ -116,6 +126,6 @@ export default {
this.readyToSubmit = true
this.openModal(this.modalName)
}
}
}
},
},
}

View File

@@ -15,11 +15,11 @@ export default {
props: {
initialData: {
type: Object,
default: () => ({})
}
default: () => ({}),
},
},
data: function () {
data: function() {
const {
am_cor = false,
ko_invite = false,
@@ -28,10 +28,10 @@ export default {
} = this.initialData
return {
am_cor,
ko_invite,
cor_invite,
so_invite,
am_cor,
ko_invite,
cor_invite,
so_invite,
}
}
},
}

View File

@@ -15,17 +15,15 @@ export default {
props: {
initialData: {
type: Object,
default: () => ({})
}
default: () => ({}),
},
},
data: function () {
const {
am_poc = false
} = this.initialData
data: function() {
const { am_poc = false } = this.initialData
return {
am_poc
am_poc,
}
}
},
}