Skip to content
Merged
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 @@ export const updateLogo = async ({ file, fileName, wikiId }) => {
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 @@ -93,8 +93,8 @@ export const wikiDiscovery = async ({ sort, direction, active, currentPage, resu
direction,
is_active: active,
page: currentPage,
per_page: resultsPerPage
}
per_page: resultsPerPage,
},
})).data
}

Expand All @@ -112,14 +112,14 @@ export const importEntities = async ({
'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 @@ -11,7 +11,7 @@ function makeUser (email = 'test@local') {
email,
verified: true,
created_at: '2020-01-01',
updated_at: '2020-01-01'
updated_at: '2020-01-01',
}
}

Expand All @@ -25,21 +25,21 @@ const makeNewWiki = ({ domain, sitename }) => {
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,12 +59,12 @@ const wikiDiscovery = (referrer, params) => {
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) => {
Expand All @@ -73,12 +73,12 @@ const wikiDiscovery = (referrer, params) => {
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 @@ const wikiDiscovery = (referrer, params) => {
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 @@ export const handlers = [
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 @@ export const handlers = [
}
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 @@ export const handlers = [
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 @@ export const handlers = [
return res(ctx.status(400, 'Mocked recaptcha empty Error'))
}
return res(ctx.status(200))
}
},
),

/* Wiki endpoints */
Expand Down Expand Up @@ -219,5 +219,5 @@ export const handlers = [
}),
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,33 +120,33 @@
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

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

View workflow job for this annotation

GitHub Actions / build (22)

Unexpected mutation of "value" prop
}
this.$refs.inputForm.validate()
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
28 changes: 14 additions & 14 deletions src/components/Cards/CreateWiki.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ export default {
SiteDetailsCreateWikiWizardStep,
AudienceAndPurposeWizardStep,
TemporalityCreateWikiWizardStep,
KnowledgeEquityCreateWikiWizardStep
KnowledgeEquityCreateWikiWizardStep,
},
props: [
'title'
'title',
],
computed: {
currentUser: function () {
return this.$store.getters.currentUser
}
},
},
data () {
return {
Expand All @@ -75,21 +75,21 @@ export default {
domainRadioChoice: 'sub',
subdomain: '',
domain: '',
username: ''
username: '',
},
stepTwo: {
purpose: '',
otherPurpose: '',
audience: '',
otherAudience: ''
otherAudience: '',
},
stepThree: {
temporality: '',
otherTemporality: ''
otherTemporality: '',
},
stepFour: {
selectedOption: '',
freeTextResponse: ''
freeTextResponse: '',
},
hasError: false,
error: [],
Expand All @@ -98,9 +98,9 @@ export default {
CNAME_RECORD: config.CNAME_RECORD,
errorMessages: {
domainTaken: 'The domain has already been taken.',
domainFormat: 'The subdomain must be at least five characters long and may contain only lowercase Latin letters (a-z), digits (0-9) and hyphens (-).'
domainFormat: 'The subdomain must be at least five characters long and may contain only lowercase Latin letters (a-z), digits (0-9) and hyphens (-).',
},
step: 1
step: 1,
}
},
created () {
Expand Down Expand Up @@ -142,20 +142,20 @@ export default {
...(this.stepTwo.audience && { audience: this.stepTwo.audience }),
...(this.stepTwo.otherAudience && { audience_other: this.stepTwo.otherAudience }),
temporality: this.stepThree.temporality,
...(this.stepThree.otherTemporality && { temporality_other: this.stepThree.otherTemporality })
...(this.stepThree.otherTemporality && { temporality_other: this.stepThree.otherTemporality }),
}

const requestBody = {
domain: domainToSubmit,
sitename: this.stepOne.sitename,
username: this.stepOne.username,
profile: JSON.stringify(profileObject)
profile: JSON.stringify(profileObject),
}

if (this.stepThree.temporality === 'permanent' && this.stepFour.selectedOption) {
requestBody.knowledgeEquityResponse = {
selectedOption: this.stepFour.selectedOption,
freeTextResponse: this.stepFour.freeTextResponse
freeTextResponse: this.stepFour.freeTextResponse,
}
}

Expand Down Expand Up @@ -216,8 +216,8 @@ export default {
if (!this.currentUser) {
this.$router.replace(this.$route.query.redirect || '/')
}
}
}
},
},
}
</script>

Expand Down
Loading
Loading