Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module.exports = {
parser: '@babel/eslint-parser'
},
rules: {
'comma-dangle': ['error', 'always-multiline'],
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'vue/multi-word-component-names': 'warn',
Expand Down
8 changes: 4 additions & 4 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,20 @@ export default {
components: {
Navbar,
Foot,
Interval
Interval,
},
computed: {
customLayout: function () {
return this.$route.meta.customLayout
}
},
},
methods: {
checkVerified () {
this.$api
.checkVerified()
.then(verified => verified && this.$store.dispatch('markAsVerified'))
}
}
},
},
}
</script>

Expand Down
16 changes: 8 additions & 8 deletions src/backend/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@
form,
{
headers: {
'Content-Type': 'multipart/form-data'
}
}
'Content-Type': 'multipart/form-data',
},
},
)
}
// TODO the api should get the setting from the path (so it isn't needed in the payload)
Expand All @@ -89,12 +89,12 @@
export const wikiDiscovery = async ({ sort, direction, active, currentPage, resultsPerPage }) => {
return (await axios.get('/wiki', {
params: {
sort: sort,

Check warning on line 92 in src/backend/api.js

View workflow job for this annotation

GitHub Actions / build (22)

Expected property shorthand
direction: direction,

Check warning on line 93 in src/backend/api.js

View workflow job for this annotation

GitHub Actions / build (22)

Expected property shorthand
is_active: active,
page: currentPage,
per_page: resultsPerPage
}
per_page: resultsPerPage,
},
})).data
}

Expand All @@ -112,14 +112,14 @@
'Q5@2212749099',
'Q64@2215506799',
'Q42@2213635313',
'Q3107329@2211072210'
'Q3107329@2211072210',
],
sourceWikiUrl = 'https://www.wikidata.org'
sourceWikiUrl = 'https://www.wikidata.org',
}) => {
const { data: { data } } = await axios.post('/wiki/entityImport', {
wiki: wikiId,
entity_ids: entityIds.join(','),
source_wiki_url: sourceWikiUrl
source_wiki_url: sourceWikiUrl,
})
return data
}
Expand Down
4 changes: 2 additions & 2 deletions src/backend/axios.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import Axios from 'axios'
const axios = Axios.create({
baseURL: '/api',
headers: {
'Content-Type': 'application/json'
}
'Content-Type': 'application/json',
},
})

export default axios
2 changes: 1 addition & 1 deletion src/backend/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import axios from './axios'

export {
api,
axios
axios,
}
34 changes: 17 additions & 17 deletions src/backend/mocks/default_handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
function makeUser (email = 'test@local') {
return {
id: 1,
email: email,

Check warning on line 11 in src/backend/mocks/default_handlers.js

View workflow job for this annotation

GitHub Actions / build (22)

Expected property shorthand
verified: true,
created_at: '2020-01-01',
updated_at: '2020-01-01'
updated_at: '2020-01-01',
}
}

Expand All @@ -25,21 +25,21 @@
updated_at: '2020-01-01',
pivot: {
user_id: user.id,
wiki_id: lastWikiId
wiki_id: lastWikiId,
},
wiki_managers: [{
email: user.email,
pivot: {
user_id: user.id,
wiki_id: lastWikiId
}
wiki_id: lastWikiId,
},
}],
wiki_db_version: {
id: 101,
wiki_id: lastWikiId,
version: 'mw1.33-wbs1'
version: 'mw1.33-wbs1',
},
public_settings: []
public_settings: [],
}

myWikis.push(newWiki)
Expand All @@ -59,26 +59,26 @@
next: function () {
const x = Math.sin(this.seed++) * 10000
return x - Math.floor(x)
}
},
}

const names = [
'Wikibase Name',
'A Very Long Wikibase Name'
'A Very Long Wikibase Name',
]

let wikis = [...Array(75).keys()].map((id) => {
const wiki = {
id: id,

Check warning on line 72 in src/backend/mocks/default_handlers.js

View workflow job for this annotation

GitHub Actions / build (22)

Expected property shorthand
domain: id + '-wikibase.wbaas.localhost',
sitename: id + ' - ' + names[id % names.length],
wiki_site_stats: null,
logo_url: null
logo_url: null,
}

if (pseudorandom.next() >= 0.1) {
wiki.wiki_site_stats = {
pages: Math.ceil(pseudorandom.next() * 250)
pages: Math.ceil(pseudorandom.next() * 250),
}
}

Expand Down Expand Up @@ -125,8 +125,8 @@
data: wikis.slice(start, end),
meta: {
last_page: Math.ceil(wikis.length / resultsPerPage),
total: wikis.length
}
total: wikis.length,
},
}
}

Expand All @@ -135,7 +135,7 @@
rest.post(/\/api\/auth\/login$/, (req, res, ctx) => {
user = makeUser(req.body.email)
return res(ctx.json({
user
user,
}), ctx.cookie('authToken', 'token_value'))
}),
rest.get(/\/api\/auth\/login$/, (req, res, ctx) => {
Expand All @@ -145,7 +145,7 @@
}
user = makeUser(req.body.email)
return res(ctx.json({
user
user,
}))
}),
rest.delete(/\/api\/auth\/login$/, (req, res, ctx) => {
Expand All @@ -157,7 +157,7 @@
return res(ctx.status(400, 'Mocked Server Error'))
}
return res(ctx.status(200))
}
},
),
rest.post(/\/api\/user\/resetPassword$/, (_, res, ctx) => res(ctx.status(200))),
rest.post(/\/api\/user\/sendVerifyEmail$/, (_, res, ctx) => res(ctx.json({ message: 'Already verified' }))),
Expand All @@ -174,7 +174,7 @@
return res(ctx.status(400, 'Mocked recaptcha empty Error'))
}
return res(ctx.status(200))
}
},
),

/* Wiki endpoints */
Expand Down Expand Up @@ -219,5 +219,5 @@
}),
rest.get(/\/api\/wiki$/, (req, res, ctx) => {
return res(ctx.json(wikiDiscovery(req.referrer, req.url.searchParams)))
})
}),
]
8 changes: 4 additions & 4 deletions src/components/Cards/AudienceAndPurposeWizardStep.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<v-card-text>
<h3>What best describes how you intend to use this Wikibase?</h3>
<v-form ref="inputForm" v-on:submit.prevent>
<v-radio-group v-model="value.purpose" :rules="[() => !!value.purpose || 'Please select an option.']">

Check warning on line 14 in src/components/Cards/AudienceAndPurposeWizardStep.vue

View workflow job for this annotation

GitHub Actions / build (22)

Unexpected mutation of "value" prop
<v-radio value="data_hub" ref="test">
<template v-slot:label>
<div>To <b>publish potentially useful data</b></div>
Expand Down Expand Up @@ -40,7 +40,7 @@
counter="200"
dense class="pl-1
mt-n1 mb-n2"
v-model="value.otherPurpose"

Check warning on line 43 in src/components/Cards/AudienceAndPurposeWizardStep.vue

View workflow job for this annotation

GitHub Actions / build (22)

Unexpected mutation of "value" prop
:rules="
[
() => value.purpose !== 'other'
Expand All @@ -64,7 +64,7 @@
<div v-if="value.purpose==='data_hub'" class="pt-3">
<h3>Who is the intended audience for this data?</h3>

<v-radio-group v-model="value.audience" :rules="

Check warning on line 67 in src/components/Cards/AudienceAndPurposeWizardStep.vue

View workflow job for this annotation

GitHub Actions / build (22)

Unexpected mutation of "value" prop
[
value.purpose !== 'data_hub'
|| !! value.audience
Expand All @@ -82,7 +82,7 @@
</v-radio>
<v-radio value="other" class="mt-n3">
<template v-slot:label>
Other: <v-text-field counter="200" dense class="pl-1" v-model="value.otherAudience"

Check warning on line 85 in src/components/Cards/AudienceAndPurposeWizardStep.vue

View workflow job for this annotation

GitHub Actions / build (22)

Unexpected mutation of "value" prop
:rules="
[
() => value.purpose !== 'data_hub'
Expand Down Expand Up @@ -120,23 +120,23 @@
title: String,
inFlight: Boolean,
value: Object,
dismissable: Boolean
dismissable: Boolean,
},
data () {
return {
purposeError: '',
audienceError: '',
purposeOtherError: '',
audienceOtherError: ''
audienceOtherError: '',
}
},
methods: {
nextStep () {
if (this.value.purpose !== 'data_hub') {
this.value.audience = undefined

Check warning on line 136 in src/components/Cards/AudienceAndPurposeWizardStep.vue

View workflow job for this annotation

GitHub Actions / build (22)

Unexpected mutation of "value" prop
}
if (this.value.purpose !== 'other') {
this.value.otherPurpose = undefined

Check warning on line 139 in src/components/Cards/AudienceAndPurposeWizardStep.vue

View workflow job for this annotation

GitHub Actions / build (22)

Unexpected mutation of "value" prop
}
if (this.value.audience !== 'other') {
this.value.otherAudience = undefined
Expand All @@ -145,8 +145,8 @@
if (this.$refs.inputForm.validate() === true) {
this.$emit('next-step')
}
}
}
},
},
}
</script>

Expand Down
12 changes: 6 additions & 6 deletions src/components/Cards/CreateAccount.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ export default {
name: 'CreateAccountCard',
props: [
'title',
'buttonText'
'buttonText',
],
components: {},
computed: {
isLoggedIn: function () {
return this.$store.getters.isLoggedIn
}
},
},
data () {
return {
Expand All @@ -105,7 +105,7 @@ export default {
terms: false,
hasError: false,
error: [],
inFlight: false
inFlight: false,
}
},
created () {
Expand Down Expand Up @@ -165,7 +165,7 @@ export default {
{
email: this.email,
password: this.password,
recaptcha: token
recaptcha: token,
})
.then(success => this.createSuccessful(success))
.catch(errors => {
Expand Down Expand Up @@ -214,8 +214,8 @@ export default {
if (this.isLoggedIn) {
this.$router.replace(this.$route.query.redirect || '/dashboard')
}
}
}
},
},
}
</script>

Expand Down
Loading
Loading