Fix lint issues
And disable eslint when building in prod mode Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -21,7 +21,10 @@
|
||||
>
|
||||
</li>
|
||||
<li
|
||||
:class="{ 'is-active': index + 1 === ResourceMixin.resourcePathArray(resource).length }"
|
||||
:class="{
|
||||
'is-active':
|
||||
index + 1 === ResourceMixin.resourcePathArray(resource).length,
|
||||
}"
|
||||
v-for="(pathFragment, index) in filteredPath"
|
||||
:key="pathFragment"
|
||||
>
|
||||
@@ -29,7 +32,10 @@
|
||||
:to="{
|
||||
name: RouteName.RESOURCE_FOLDER,
|
||||
params: {
|
||||
path: ResourceMixin.resourcePathArray(resource).slice(0, index + 1),
|
||||
path: ResourceMixin.resourcePathArray(resource).slice(
|
||||
0,
|
||||
index + 1
|
||||
),
|
||||
preferredUsername: usernameWithDomain(resource.actor),
|
||||
},
|
||||
}"
|
||||
@@ -44,11 +50,17 @@
|
||||
<b-icon icon="folder" />
|
||||
{{ $t("New folder") }}
|
||||
</b-dropdown-item>
|
||||
<b-dropdown-item aria-role="listitem" @click="createLinkResourceModal = true">
|
||||
<b-dropdown-item
|
||||
aria-role="listitem"
|
||||
@click="createLinkResourceModal = true"
|
||||
>
|
||||
<b-icon icon="link" />
|
||||
{{ $t("New link") }}
|
||||
</b-dropdown-item>
|
||||
<hr class="dropdown-divider" v-if="config.resourceProviders.length" />
|
||||
<hr
|
||||
class="dropdown-divider"
|
||||
v-if="config.resourceProviders.length"
|
||||
/>
|
||||
<b-dropdown-item
|
||||
aria-role="listitem"
|
||||
v-for="resourceProvider in config.resourceProviders"
|
||||
@@ -64,7 +76,9 @@
|
||||
</nav>
|
||||
<section>
|
||||
<p v-if="resource.path === '/'" class="module-description">
|
||||
{{ $t("A place to store links to documents or resources of any type.") }}
|
||||
{{
|
||||
$t("A place to store links to documents or resources of any type.")
|
||||
}}
|
||||
</p>
|
||||
<div class="list-header">
|
||||
<div class="list-header-right">
|
||||
@@ -94,7 +108,10 @@
|
||||
v-if="resource.children.total > 0"
|
||||
>
|
||||
<transition-group>
|
||||
<div v-for="localResource in resource.children.elements" :key="localResource.id">
|
||||
<div
|
||||
v-for="localResource in resource.children.elements"
|
||||
:key="localResource.id"
|
||||
>
|
||||
<div class="resource-item">
|
||||
<div
|
||||
class="resource-checkbox"
|
||||
@@ -121,7 +138,10 @@
|
||||
</div>
|
||||
</transition-group>
|
||||
</draggable>
|
||||
<div class="content has-text-centered has-text-grey" v-if="resource.children.total === 0">
|
||||
<div
|
||||
class="content has-text-centered has-text-grey"
|
||||
v-if="resource.children.total === 0"
|
||||
>
|
||||
<p>{{ $t("No resources in this folder") }}</p>
|
||||
</div>
|
||||
</section>
|
||||
@@ -133,7 +153,9 @@
|
||||
<b-input aria-required="true" v-model="updatedResource.title" />
|
||||
</b-field>
|
||||
|
||||
<b-button native-type="submit">{{ $t("Rename resource") }}</b-button>
|
||||
<b-button native-type="submit">{{
|
||||
$t("Rename resource")
|
||||
}}</b-button>
|
||||
</form>
|
||||
</section>
|
||||
</div>
|
||||
@@ -158,7 +180,9 @@
|
||||
<b-input aria-required="true" v-model="newResource.title" />
|
||||
</b-field>
|
||||
|
||||
<b-button native-type="submit">{{ createResourceButtonLabel }}</b-button>
|
||||
<b-button native-type="submit">{{
|
||||
createResourceButtonLabel
|
||||
}}</b-button>
|
||||
</form>
|
||||
</section>
|
||||
</div>
|
||||
@@ -188,7 +212,9 @@
|
||||
<b-input type="textarea" v-model="newResource.summary" />
|
||||
</b-field>
|
||||
|
||||
<b-button native-type="submit">{{ $t("Create resource") }}</b-button>
|
||||
<b-button native-type="submit">{{
|
||||
$t("Create resource")
|
||||
}}</b-button>
|
||||
</form>
|
||||
</section>
|
||||
</div>
|
||||
@@ -204,7 +230,11 @@ import { RefetchQueryDescription } from "apollo-client/core/watchQueryOptions";
|
||||
import { CURRENT_ACTOR_CLIENT } from "../../graphql/actor";
|
||||
import { IActor, usernameWithDomain } from "../../types/actor";
|
||||
import RouteName from "../../router/name";
|
||||
import { IResource, mapServiceTypeToIcon, IProvider } from "../../types/resource";
|
||||
import {
|
||||
IResource,
|
||||
mapServiceTypeToIcon,
|
||||
IProvider,
|
||||
} from "../../types/resource";
|
||||
import {
|
||||
CREATE_RESOURCE,
|
||||
DELETE_RESOURCE,
|
||||
@@ -320,7 +350,9 @@ export default class Resources extends Mixins(ResourceMixin) {
|
||||
actorId: this.resource.actor.id,
|
||||
resourceUrl: this.newResource.resourceUrl,
|
||||
parentId:
|
||||
this.resource.id && this.resource.id.startsWith("root_") ? null : this.resource.id,
|
||||
this.resource.id && this.resource.id.startsWith("root_")
|
||||
? null
|
||||
: this.resource.id,
|
||||
type: this.newResource.type,
|
||||
},
|
||||
refetchQueries: () => this.postRefreshQueries(),
|
||||
@@ -379,7 +411,9 @@ export default class Resources extends Mixins(ResourceMixin) {
|
||||
const randomString = [...Array(10)]
|
||||
.map(() => Math.random().toString(36)[3])
|
||||
.join("")
|
||||
.replace(/(.|$)/g, (c) => c[!Math.round(Math.random()) ? "toString" : "toLowerCase"]());
|
||||
.replace(/(.|$)/g, (c) =>
|
||||
c[!Math.round(Math.random()) ? "toString" : "toLowerCase"]()
|
||||
);
|
||||
switch (provider.type) {
|
||||
case "ethercalc":
|
||||
case "etherpad":
|
||||
@@ -442,7 +476,9 @@ export default class Resources extends Mixins(ResourceMixin) {
|
||||
},
|
||||
refetchQueries: () => this.postRefreshQueries(),
|
||||
});
|
||||
this.validCheckedResources = this.validCheckedResources.filter((id) => id !== resourceID);
|
||||
this.validCheckedResources = this.validCheckedResources.filter(
|
||||
(id) => id !== resourceID
|
||||
);
|
||||
delete this.checkedResources[resourceID];
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
@@ -460,8 +496,12 @@ export default class Resources extends Mixins(ResourceMixin) {
|
||||
this.updatedResource = { ...resource };
|
||||
}
|
||||
|
||||
async moveResource(resource: IResource, oldParent: IResource | undefined): Promise<void> {
|
||||
const parentPath = oldParent && oldParent.path ? oldParent.path || "/" : "/";
|
||||
async moveResource(
|
||||
resource: IResource,
|
||||
oldParent: IResource | undefined
|
||||
): Promise<void> {
|
||||
const parentPath =
|
||||
oldParent && oldParent.path ? oldParent.path || "/" : "/";
|
||||
await this.updateResource(resource, parentPath);
|
||||
this.moveModal = false;
|
||||
}
|
||||
@@ -471,7 +511,10 @@ export default class Resources extends Mixins(ResourceMixin) {
|
||||
this.renameModal = false;
|
||||
}
|
||||
|
||||
async updateResource(resource: IResource, parentPath: string | null = null): Promise<void> {
|
||||
async updateResource(
|
||||
resource: IResource,
|
||||
parentPath: string | null = null
|
||||
): Promise<void> {
|
||||
try {
|
||||
await this.$apollo.mutate<{ updateResource: IResource }>({
|
||||
mutation: UPDATE_RESOURCE,
|
||||
@@ -483,7 +526,8 @@ export default class Resources extends Mixins(ResourceMixin) {
|
||||
},
|
||||
refetchQueries: () => this.postRefreshQueries(),
|
||||
update: (store, { data }) => {
|
||||
if (!data || data.updateResource == null || parentPath == null) return;
|
||||
if (!data || data.updateResource == null || parentPath == null)
|
||||
return;
|
||||
if (!this.resource.actor) return;
|
||||
|
||||
console.log("Removing ressource from old parent");
|
||||
@@ -497,7 +541,9 @@ export default class Resources extends Mixins(ResourceMixin) {
|
||||
if (oldParentCachedData == null) return;
|
||||
const { resource: oldParentCachedResource } = oldParentCachedData;
|
||||
if (oldParentCachedResource == null) {
|
||||
console.error("Cannot update resource cache, because of null value.");
|
||||
console.error(
|
||||
"Cannot update resource cache, because of null value."
|
||||
);
|
||||
return;
|
||||
}
|
||||
const updatedResource: IResource = data.updateResource;
|
||||
@@ -532,7 +578,9 @@ export default class Resources extends Mixins(ResourceMixin) {
|
||||
if (newParentCachedData == null) return;
|
||||
const { resource: newParentCachedResource } = newParentCachedData;
|
||||
if (newParentCachedResource == null) {
|
||||
console.error("Cannot update resource cache, because of null value.");
|
||||
console.error(
|
||||
"Cannot update resource cache, because of null value."
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user