Skip to content

Commit

Permalink
Run npm lint on code changes
Browse files Browse the repository at this point in the history
  • Loading branch information
gfaudriga committed Mar 25, 2024
1 parent 9195aca commit 955b6b8
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 131 deletions.
4 changes: 2 additions & 2 deletions src/components/Message.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<Itinerary :entries="itineraries" :message-id="message.messageId" />
</div>
<div v-if="Object.entries(schema).length > 0" class="message-schema">
<Schema :json="schema"/>
<Schema :json="schema" />
</div>
<div v-if="message.scheduling.length > 0" class="message-imip">
<Imip v-for="scheduling in message.scheduling"
Expand Down Expand Up @@ -74,7 +74,7 @@
<template #icon>
<ReplyIcon />
</template>
{{t('mail','Reply')}}
{{ t('mail','Reply') }}
</NcButton>
</div>
</div>
Expand Down
26 changes: 12 additions & 14 deletions src/components/Schema.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
- along with this program. If not, see <https://www.gnu.org/licenses/>.
-
-->

<template>
<div class="schema">
<div v-html="html"></div>
<div v-html="html" />
<div class="schema-action-bar">
<SchemaActionBar v-on:update-from-live-uri="updateData" />
<SchemaActionBar @update-from-live-uri="updateData" />
</div>
</div>
</template>
Expand All @@ -35,7 +35,7 @@ import SchemaActionBar from './SchemaActionBar'
export default {
name: 'Schema',
components: {
SchemaActionBar
SchemaActionBar,

Check failure on line 38 in src/components/Schema.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Mixed spaces and tabs
},
props: {
json: {
Expand All @@ -47,13 +47,13 @@ export default {
required: false,
},
},
data: function() {
data() {
return {
html: ""
};
html: '',
}
},
created () {
this.getRenderedSchema()
created() {
this.getRenderedSchema()
},
methods: {
getRenderedSchema() {
Expand All @@ -71,8 +71,8 @@ export default {
}

this.getRenderedSchema()
}
}
},
},
}

</script>
Expand Down Expand Up @@ -120,7 +120,6 @@ export default {

background: var(--color-main-background);


}

.schema >>> .smlCard .header {
Expand Down Expand Up @@ -192,7 +191,6 @@ export default {

margin: 4px 0px;


font-size: 20px;
font-weight: bold;
min-height: 20%;
Expand All @@ -204,7 +202,7 @@ export default {
text-overflow: ellipsis;
white-space: nowrap;
overflow-x: auto;

}

.schema >>> .smlCardRow .card_content {
Expand Down
221 changes: 109 additions & 112 deletions src/components/SchemaActionBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,58 +20,55 @@
-->

<template>
<div class="action-bar">
<NcActions
:force-name="true"
:secondary="true"
:inline="1" >
<NcActionButton v-if="schemaType === 'Recipe'"
:aria-label="t('mail', 'Add Recipe To Cookbook')"
@click.prevent="sendRecipeToCookbook()" >
<template #icon>
<IconLoading v-if="recipeSendLoading"
:size="20" />
<SilverwareForkKnifeIcon v-else-if="recipeSendSuccess === null"
:size="20" />
<CheckIcon v-else-if="recipeSendSuccess === true"
:size="20" />
<CloseIcon v-else-if="recipeSendSuccess === false"
:size="20" />
</template>
Add Recipe To Cookbook
</NcActionButton>
<NcActionButton v-if="schemaType === 'Place' && hasLiveUri"
:aria-label="t('mail', 'Refresh Live Location')"
@click.prevent="refreshLiveUri()" >
<template #icon>
<IconLoading v-if="refreshLocationLoading"
:size="20" />
<MapMarkerIcon v-else
:size="20" />
</template>
Refresh Live Location
</NcActionButton>
<NcActionButton v-if="schemaType === 'Place'"
:aria-label="t('mail', 'Open in Google Maps')"
@click.prevent="openLocationInGoogleMaps()" >
<template #icon>
<MapSearchOutlineIcon
:size="20" />
</template>
Open in Google Maps
</NcActionButton>
<NcActionButton v-if="hasUrlValue"
:aria-label="t('mail','Open Source URL')"
@click.prevent="openUrlInNewWindow()" >
<template #icon>
<OpenInNewIcon
:title="t('mail', 'Open Source URL')"
:size="20" />
</template>
Open Source URL
</NcActionButton>
</NcActions>
</div>
<div class="action-bar">
<NcActions :force-name="true"
:secondary="true"
:inline="1">
<NcActionButton v-if="schemaType === 'Recipe'"
:aria-label="t('mail', 'Add Recipe To Cookbook')"
@click.prevent="sendRecipeToCookbook()">
<template #icon>
<IconLoading v-if="recipeSendLoading"
:size="20" />
<SilverwareForkKnifeIcon v-else-if="recipeSendSuccess === null"
:size="20" />
<CheckIcon v-else-if="recipeSendSuccess === true"
:size="20" />
<CloseIcon v-else-if="recipeSendSuccess === false"
:size="20" />
</template>
Add Recipe To Cookbook
</NcActionButton>
<NcActionButton v-if="schemaType === 'Place' && hasLiveUri"
:aria-label="t('mail', 'Refresh Live Location')"
@click.prevent="refreshLiveUri()">
<template #icon>
<IconLoading v-if="refreshLocationLoading"
:size="20" />
<MapMarkerIcon v-else
:size="20" />
</template>
Refresh Live Location
</NcActionButton>
<NcActionButton v-if="schemaType === 'Place'"
:aria-label="t('mail', 'Open in Google Maps')"
@click.prevent="openLocationInGoogleMaps()">
<template #icon>
<MapSearchOutlineIcon :size="20" />
</template>
Open in Google Maps
</NcActionButton>
<NcActionButton v-if="hasUrlValue"
:aria-label="t('mail','Open Source URL')"
@click.prevent="openUrlInNewWindow()">
<template #icon>
<OpenInNewIcon :title="t('mail', 'Open Source URL')"
:size="20" />
</template>
Open Source URL
</NcActionButton>
</NcActions>
</div>
</template>

<script>
Expand All @@ -89,88 +86,88 @@ import IconLoading from '@nextcloud/vue/dist/Components/NcLoadingIcon.js'
export default {
name: 'SchemaActionBar',
components: {
NcActions,
NcActions,
NcActionButton,
SilverwareForkKnifeIcon,
CheckIcon,
CloseIcon,
OpenInNewIcon,
MapMarkerIcon,
MapSearchOutlineIcon,
IconLoading,
},
data: function() {
return {
recipeSendSuccess: null,
recipeSendLoading: false,
refreshLocationLoading: false,
}
},
computed: {
schemaType() {
return this.$parent.json['@type']
},
hasUrlValue() {
return this.$parent.json.hasOwnProperty('url')
},
hasLiveUri() {
return this.$parent.json.hasOwnProperty('liveUri')
}
},
methods: {
async sendRecipeToCookbook () {
try {
/* Send the recipe to the cookbook api and
CheckIcon,
CloseIcon,
OpenInNewIcon,
MapMarkerIcon,
MapSearchOutlineIcon,
IconLoading,
},
data() {
return {
recipeSendSuccess: null,
recipeSendLoading: false,
refreshLocationLoading: false,
}
},
computed: {
schemaType() {
return this.$parent.json['@type']
},
hasUrlValue() {
return this.$parent.json.hasOwnProperty('url')
},
hasLiveUri() {
return this.$parent.json.hasOwnProperty('liveUri')
},
},
methods: {
async sendRecipeToCookbook() {
try {
/* Send the recipe to the cookbook api and
* wait for the response status. Set to loading
* icon in the meantime.
*/
this.recipeSendLoading = true;
this.recipeSendLoading = true

const success = this.$store.dispatch('sendRecipeToCookbook', {
recipe: this.$parent.json,
recipe: this.$parent.json,
})

success.then((value) => {
this.recipeSendSuccess = value
this.recipeSendLoading = false
})
this.recipeSendSuccess = value
this.recipeSendLoading = false
})

} catch (e) {
this.recipeSendLoading = false
this.recipeSendLoading = false
throw e
}
},
refreshLiveUri() {
try {
this.refreshLocationLoading = true
refreshLiveUri() {

try {
this.refreshLocationLoading = true

const result = this.$store.dispatch('callLiveUri', {
liveUri: encodeURIComponent(this.$parent.json["liveUri"]),
const result = this.$store.dispatch('callLiveUri', {
liveUri: encodeURIComponent(this.$parent.json.liveUri),
})

result.then((updatedValues) => {
this.refreshLocationLoading = false
this.$emit('update-from-live-uri', updatedValues)
})

result.then((updatedValues) => {
this.refreshLocationLoading = false
this.$emit('update-from-live-uri', updatedValues)
})
} catch (e) {
this.refreshLocationLoading = false
this.refreshLocationLoading = false
throw e
}

},
openLocationInGoogleMaps() {
const lat = this.$parent.json["geo"]["latitude"]
const lon = this.$parent.json["geo"]["longitude"]
},
openLocationInGoogleMaps() {
const lat = this.$parent.json.geo.latitude
const lon = this.$parent.json.geo.longitude

const url = 'https://www.google.com/maps/search/?api=1&query=' + lat + ',' + lon
const url = 'https://www.google.com/maps/search/?api=1&query=' + lat + ',' + lon

window.open(url, '_blank').focus()
},
openUrlInNewWindow() {
window.open(this.json["url"], '_blank').focus()
},
}
window.open(url, '_blank').focus()
},
openUrlInNewWindow() {
window.open(this.json.url, '_blank').focus()
},
},
}
</script>

Expand All @@ -187,4 +184,4 @@ export default {
display: none;
}

</style>
</style>
6 changes: 3 additions & 3 deletions src/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1505,7 +1505,7 @@ export default {
return handleHttpAuthErrors(commit, async () => {
try {
const result = await sendRecipe(recipe)

return result
} catch (e) {
throw e
Expand All @@ -1517,11 +1517,11 @@ export default {
return handleHttpAuthErrors(commit, async () => {
try {
const result = await updateSchema(liveUri)

return result
} catch (e) {
throw e
}
})
}
},
}

0 comments on commit 955b6b8

Please sign in to comment.