remove class vue dep (2)
parent
07379d836c
commit
8d79151a30
|
@ -67,8 +67,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Component, Emit, Mixins, Prop, Watch } from "vue-property-decorator";
|
import { defineComponent, PropType } from "vue";
|
||||||
import GlobalMixin from "../../mixins/GlobalMixin";
|
|
||||||
|
|
||||||
import { getPreviewUrl } from "../../services/FileUtils";
|
import { getPreviewUrl } from "../../services/FileUtils";
|
||||||
import { IDay, IPhoto } from "../../types";
|
import { IDay, IPhoto } from "../../types";
|
||||||
|
@ -80,38 +79,48 @@ import Star from "vue-material-design-icons/Star.vue";
|
||||||
import Video from "vue-material-design-icons/PlayCircleOutline.vue";
|
import Video from "vue-material-design-icons/PlayCircleOutline.vue";
|
||||||
import LivePhoto from "vue-material-design-icons/MotionPlayOutline.vue";
|
import LivePhoto from "vue-material-design-icons/MotionPlayOutline.vue";
|
||||||
|
|
||||||
@Component({
|
export default defineComponent({
|
||||||
|
name: "Photo",
|
||||||
components: {
|
components: {
|
||||||
CheckCircle,
|
CheckCircle,
|
||||||
Video,
|
Video,
|
||||||
Star,
|
Star,
|
||||||
LivePhoto,
|
LivePhoto,
|
||||||
},
|
},
|
||||||
})
|
|
||||||
export default class Photo extends Mixins(GlobalMixin) {
|
|
||||||
private touchTimer = 0;
|
|
||||||
private src = null;
|
|
||||||
private hasFaceRect = false;
|
|
||||||
|
|
||||||
@Prop() data: IPhoto;
|
props: {
|
||||||
@Prop() day: IDay;
|
data: {
|
||||||
|
type: Object as PropType<IPhoto>,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
day: {
|
||||||
|
type: Object as PropType<IDay>,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
@Emit("select") emitSelect(data: IPhoto) {}
|
data() {
|
||||||
|
return {
|
||||||
|
touchTimer: 0,
|
||||||
|
src: null,
|
||||||
|
hasFaceRect: false,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
@Watch("data")
|
watch: {
|
||||||
onDataChange(newData: IPhoto, oldData: IPhoto) {
|
data(newData: IPhoto, oldData: IPhoto) {
|
||||||
// Copy flags relevant to this component
|
// Copy flags relevant to this component
|
||||||
if (oldData && newData) {
|
if (oldData && newData) {
|
||||||
newData.flag |=
|
newData.flag |=
|
||||||
oldData.flag & (this.c.FLAG_SELECTED | this.c.FLAG_LOAD_FAIL);
|
oldData.flag & (this.c.FLAG_SELECTED | this.c.FLAG_LOAD_FAIL);
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
|
||||||
@Watch("data.etag")
|
"data.etag": function () {
|
||||||
onEtagChange() {
|
|
||||||
this.hasFaceRect = false;
|
this.hasFaceRect = false;
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
},
|
||||||
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.hasFaceRect = false;
|
this.hasFaceRect = false;
|
||||||
|
@ -122,24 +131,36 @@ export default class Photo extends Mixins(GlobalMixin) {
|
||||||
if (video) {
|
if (video) {
|
||||||
utils.setupLivePhotoHooks(video);
|
utils.setupLivePhotoHooks(video);
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
|
||||||
get videoDuration() {
|
/** Clear timers */
|
||||||
|
beforeUnmount() {
|
||||||
|
clearTimeout(this.touchTimer);
|
||||||
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
videoDuration() {
|
||||||
if (this.data.video_duration) {
|
if (this.data.video_duration) {
|
||||||
return utils.getDurationStr(this.data.video_duration);
|
return utils.getDurationStr(this.data.video_duration);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
},
|
||||||
|
|
||||||
get videoUrl() {
|
videoUrl() {
|
||||||
if (this.data.liveid) {
|
if (this.data.liveid) {
|
||||||
return utils.getLivePhotoVideoUrl(this.data, true);
|
return utils.getLivePhotoVideoUrl(this.data, true);
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
emitSelect(data: IPhoto) {
|
||||||
|
this.$emit("select", data);
|
||||||
|
},
|
||||||
|
|
||||||
async refresh() {
|
async refresh() {
|
||||||
this.src = await this.getSrc();
|
this.src = await this.getSrc();
|
||||||
}
|
},
|
||||||
|
|
||||||
/** Get src for image to show */
|
/** Get src for image to show */
|
||||||
async getSrc() {
|
async getSrc() {
|
||||||
|
@ -150,7 +171,7 @@ export default class Photo extends Mixins(GlobalMixin) {
|
||||||
} else {
|
} else {
|
||||||
return this.url();
|
return this.url();
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
|
||||||
/** Get url of the photo */
|
/** Get url of the photo */
|
||||||
url() {
|
url() {
|
||||||
|
@ -177,7 +198,7 @@ export default class Photo extends Mixins(GlobalMixin) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return getPreviewUrl(this.data, false, size);
|
return getPreviewUrl(this.data, false, size);
|
||||||
}
|
},
|
||||||
|
|
||||||
/** Set src with overlay face rect */
|
/** Set src with overlay face rect */
|
||||||
async addFaceRect() {
|
async addFaceRect() {
|
||||||
|
@ -207,33 +228,28 @@ export default class Photo extends Mixins(GlobalMixin) {
|
||||||
"image/jpeg",
|
"image/jpeg",
|
||||||
0.95
|
0.95
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
|
|
||||||
/** Post load tasks */
|
/** Post load tasks */
|
||||||
load() {
|
load() {
|
||||||
this.addFaceRect();
|
this.addFaceRect();
|
||||||
}
|
},
|
||||||
|
|
||||||
/** Error in loading image */
|
/** Error in loading image */
|
||||||
error(e: any) {
|
error(e: any) {
|
||||||
this.data.flag |= this.c.FLAG_LOAD_FAIL;
|
this.data.flag |= this.c.FLAG_LOAD_FAIL;
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
},
|
||||||
|
|
||||||
/** Clear timers */
|
|
||||||
beforeUnmount() {
|
|
||||||
clearTimeout(this.touchTimer);
|
|
||||||
}
|
|
||||||
|
|
||||||
toggleSelect() {
|
toggleSelect() {
|
||||||
if (this.data.flag & this.c.FLAG_PLACEHOLDER) return;
|
if (this.data.flag & this.c.FLAG_PLACEHOLDER) return;
|
||||||
this.emitSelect(this.data);
|
this.emitSelect(this.data);
|
||||||
}
|
},
|
||||||
|
|
||||||
contextmenu(e: Event) {
|
contextmenu(e: Event) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
}
|
},
|
||||||
|
|
||||||
/** Start preview video */
|
/** Start preview video */
|
||||||
playVideo() {
|
playVideo() {
|
||||||
|
@ -242,7 +258,7 @@ export default class Photo extends Mixins(GlobalMixin) {
|
||||||
video.currentTime = 0;
|
video.currentTime = 0;
|
||||||
video.play();
|
video.play();
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
|
||||||
/** Stop preview video */
|
/** Stop preview video */
|
||||||
stopVideo() {
|
stopVideo() {
|
||||||
|
@ -250,8 +266,9 @@ export default class Photo extends Mixins(GlobalMixin) {
|
||||||
const video = this.$refs.video as HTMLVideoElement;
|
const video = this.$refs.video as HTMLVideoElement;
|
||||||
video.pause();
|
video.pause();
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
@ -29,34 +29,36 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Component, Prop, Mixins, Emit } from "vue-property-decorator";
|
import { defineComponent, PropType } from "vue";
|
||||||
|
|
||||||
import { IAlbum, ITag } from "../../types";
|
import { IAlbum, ITag } from "../../types";
|
||||||
import { getPreviewUrl } from "../../services/FileUtils";
|
import { getPreviewUrl } from "../../services/FileUtils";
|
||||||
import { getCurrentUser } from "@nextcloud/auth";
|
import { getCurrentUser } from "@nextcloud/auth";
|
||||||
|
|
||||||
import NcCounterBubble from "@nextcloud/vue/dist/Components/NcCounterBubble";
|
import NcCounterBubble from "@nextcloud/vue/dist/Components/NcCounterBubble";
|
||||||
|
|
||||||
import GlobalMixin from "../../mixins/GlobalMixin";
|
|
||||||
import { constants } from "../../services/Utils";
|
import { constants } from "../../services/Utils";
|
||||||
import { API } from "../../services/API";
|
import { API } from "../../services/API";
|
||||||
|
|
||||||
@Component({
|
export default defineComponent({
|
||||||
|
name: "Tag",
|
||||||
components: {
|
components: {
|
||||||
NcCounterBubble,
|
NcCounterBubble,
|
||||||
},
|
},
|
||||||
})
|
|
||||||
export default class Tag extends Mixins(GlobalMixin) {
|
|
||||||
@Prop() data: ITag;
|
|
||||||
@Prop() noNavigate: boolean;
|
|
||||||
|
|
||||||
/**
|
props: {
|
||||||
* Open tag event
|
data: {
|
||||||
* Unless noNavigate is set, the tag will be opened
|
type: Object as PropType<ITag>,
|
||||||
*/
|
required: true,
|
||||||
@Emit("open")
|
},
|
||||||
openTag(tag: ITag) {}
|
noNavigate: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
get previewUrl() {
|
computed: {
|
||||||
|
previewUrl() {
|
||||||
if (this.face) {
|
if (this.face) {
|
||||||
return API.FACE_PREVIEW(this.faceApp, this.face.fileid);
|
return API.FACE_PREVIEW(this.faceApp, this.face.fileid);
|
||||||
}
|
}
|
||||||
|
@ -67,37 +69,37 @@ export default class Tag extends Mixins(GlobalMixin) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return API.TAG_PREVIEW(this.data.name);
|
return API.TAG_PREVIEW(this.data.name);
|
||||||
}
|
},
|
||||||
|
|
||||||
get subtitle() {
|
subtitle() {
|
||||||
if (this.album && this.album.user !== getCurrentUser()?.uid) {
|
if (this.album && this.album.user !== getCurrentUser()?.uid) {
|
||||||
return `(${this.album.user})`;
|
return `(${this.album.user})`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
},
|
||||||
|
|
||||||
get face() {
|
face() {
|
||||||
return this.data.flag & constants.c.FLAG_IS_FACE_RECOGNIZE ||
|
return this.data.flag & constants.c.FLAG_IS_FACE_RECOGNIZE ||
|
||||||
this.data.flag & constants.c.FLAG_IS_FACE_RECOGNITION
|
this.data.flag & constants.c.FLAG_IS_FACE_RECOGNITION
|
||||||
? this.data
|
? this.data
|
||||||
: null;
|
: null;
|
||||||
}
|
},
|
||||||
|
|
||||||
get faceApp() {
|
faceApp() {
|
||||||
return this.data.flag & constants.c.FLAG_IS_FACE_RECOGNITION
|
return this.data.flag & constants.c.FLAG_IS_FACE_RECOGNITION
|
||||||
? "facerecognition"
|
? "facerecognition"
|
||||||
: "recognize";
|
: "recognize";
|
||||||
}
|
},
|
||||||
|
|
||||||
get album() {
|
album() {
|
||||||
return this.data.flag & constants.c.FLAG_IS_ALBUM
|
return this.data.flag & constants.c.FLAG_IS_ALBUM
|
||||||
? <IAlbum>this.data
|
? <IAlbum>this.data
|
||||||
: null;
|
: null;
|
||||||
}
|
},
|
||||||
|
|
||||||
/** Target URL to navigate to */
|
/** Target URL to navigate to */
|
||||||
get target() {
|
target() {
|
||||||
if (this.noNavigate) return {};
|
if (this.noNavigate) return {};
|
||||||
|
|
||||||
if (this.face) {
|
if (this.face) {
|
||||||
|
@ -113,15 +115,25 @@ export default class Tag extends Mixins(GlobalMixin) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return { name: "tags", params: { name: this.data.name } };
|
return { name: "tags", params: { name: this.data.name } };
|
||||||
}
|
},
|
||||||
|
|
||||||
get error() {
|
error() {
|
||||||
return (
|
return (
|
||||||
Boolean(this.data.flag & this.c.FLAG_LOAD_FAIL) ||
|
Boolean(this.data.flag & this.c.FLAG_LOAD_FAIL) ||
|
||||||
Boolean(this.album && this.album.last_added_photo <= 0)
|
Boolean(this.album && this.album.last_added_photo <= 0)
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
|
methods: {
|
||||||
|
/**
|
||||||
|
* Open tag event
|
||||||
|
* Unless noNavigate is set, the tag will be opened
|
||||||
|
*/
|
||||||
|
openTag(tag: ITag) {
|
||||||
|
this.$emit("open", tag);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
@ -20,8 +20,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Component, Emit, Mixins } from "vue-property-decorator";
|
import { defineComponent } from "vue";
|
||||||
import GlobalMixin from "../../mixins/GlobalMixin";
|
|
||||||
|
|
||||||
import * as dav from "../../services/DavRequests";
|
import * as dav from "../../services/DavRequests";
|
||||||
import { showInfo } from "@nextcloud/dialogs";
|
import { showInfo } from "@nextcloud/dialogs";
|
||||||
|
@ -30,36 +29,42 @@ import { IAlbum, IPhoto } from "../../types";
|
||||||
import AlbumPicker from "./AlbumPicker.vue";
|
import AlbumPicker from "./AlbumPicker.vue";
|
||||||
import Modal from "./Modal.vue";
|
import Modal from "./Modal.vue";
|
||||||
|
|
||||||
@Component({
|
export default defineComponent({
|
||||||
|
name: "AddToAlbumModal",
|
||||||
components: {
|
components: {
|
||||||
Modal,
|
Modal,
|
||||||
AlbumPicker,
|
AlbumPicker,
|
||||||
},
|
},
|
||||||
})
|
|
||||||
export default class AddToAlbumModal extends Mixins(GlobalMixin) {
|
|
||||||
private show = false;
|
|
||||||
private photos: IPhoto[] = [];
|
|
||||||
private photosDone: number = 0;
|
|
||||||
private processing: boolean = false;
|
|
||||||
|
|
||||||
public open(photos: IPhoto[]) {
|
data() {
|
||||||
|
return {
|
||||||
|
show: false,
|
||||||
|
photos: [] as IPhoto[],
|
||||||
|
photosDone: 0,
|
||||||
|
processing: false,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
open(photos: IPhoto[]) {
|
||||||
this.photosDone = 0;
|
this.photosDone = 0;
|
||||||
this.processing = false;
|
this.processing = false;
|
||||||
this.show = true;
|
this.show = true;
|
||||||
this.photos = photos;
|
this.photos = photos;
|
||||||
}
|
},
|
||||||
|
|
||||||
@Emit("added")
|
added(photos: IPhoto[]) {
|
||||||
public added(photos: IPhoto[]) {}
|
this.$emit("added", photos);
|
||||||
|
},
|
||||||
|
|
||||||
@Emit("close")
|
close() {
|
||||||
public close() {
|
|
||||||
this.photos = [];
|
this.photos = [];
|
||||||
this.processing = false;
|
this.processing = false;
|
||||||
this.show = false;
|
this.show = false;
|
||||||
}
|
this.$emit("close");
|
||||||
|
},
|
||||||
|
|
||||||
public async selectAlbum(album: IAlbum) {
|
async selectAlbum(album: IAlbum) {
|
||||||
const name = album.name || album.album_id.toString();
|
const name = album.name || album.album_id.toString();
|
||||||
const gen = dav.addToAlbum(album.user, name, this.photos);
|
const gen = dav.addToAlbum(album.user, name, this.photos);
|
||||||
this.processing = true;
|
this.processing = true;
|
||||||
|
@ -80,8 +85,9 @@ export default class AddToAlbumModal extends Mixins(GlobalMixin) {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
this.close();
|
this.close();
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
@ -141,8 +141,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Component, Mixins, Prop, Watch } from "vue-property-decorator";
|
import { defineComponent, PropType } from "vue";
|
||||||
import GlobalMixin from "../../mixins/GlobalMixin";
|
|
||||||
|
|
||||||
import Magnify from "vue-material-design-icons/Magnify.vue";
|
import Magnify from "vue-material-design-icons/Magnify.vue";
|
||||||
import Close from "vue-material-design-icons/Close.vue";
|
import Close from "vue-material-design-icons/Close.vue";
|
||||||
|
@ -173,7 +172,8 @@ type Collaborator = {
|
||||||
type: Type;
|
type: Type;
|
||||||
};
|
};
|
||||||
|
|
||||||
@Component({
|
export default defineComponent({
|
||||||
|
name: "AddToAlbumModal",
|
||||||
components: {
|
components: {
|
||||||
Magnify,
|
Magnify,
|
||||||
Close,
|
Close,
|
||||||
|
@ -188,28 +188,43 @@ type Collaborator = {
|
||||||
NcPopover,
|
NcPopover,
|
||||||
NcEmptyContent,
|
NcEmptyContent,
|
||||||
},
|
},
|
||||||
})
|
|
||||||
export default class AddToAlbumModal extends Mixins(GlobalMixin) {
|
|
||||||
@Prop() private albumName: string;
|
|
||||||
@Prop() collaborators: Collaborator[];
|
|
||||||
@Prop() allowPublicLink: boolean;
|
|
||||||
|
|
||||||
private searchText = "";
|
props: {
|
||||||
private availableCollaborators: { [key: string]: Collaborator } = {};
|
albumName: {
|
||||||
private selectedCollaboratorsKeys: string[] = [];
|
type: String,
|
||||||
private currentSearchResults = [];
|
required: true,
|
||||||
private loadingAlbum = false;
|
},
|
||||||
private errorFetchingAlbum = null;
|
collaborators: {
|
||||||
private loadingCollaborators = false;
|
type: Array as PropType<Collaborator[]>,
|
||||||
private errorFetchingCollaborators = null;
|
required: true,
|
||||||
private randomId = Math.random().toString().substring(2, 10);
|
},
|
||||||
private publicLinkCopied = false;
|
allowPublicLink: {
|
||||||
private config = {
|
type: Boolean,
|
||||||
|
required: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
searchText: "",
|
||||||
|
availableCollaborators: {} as { [key: string]: Collaborator },
|
||||||
|
selectedCollaboratorsKeys: [] as string[],
|
||||||
|
currentSearchResults: [] as Collaborator[],
|
||||||
|
loadingAlbum: false,
|
||||||
|
errorFetchingAlbum: null,
|
||||||
|
loadingCollaborators: false,
|
||||||
|
errorFetchingCollaborators: null,
|
||||||
|
randomId: Math.random().toString().substring(2, 10),
|
||||||
|
publicLinkCopied: false,
|
||||||
|
config: {
|
||||||
minSearchStringLength:
|
minSearchStringLength:
|
||||||
parseInt(window.OC.config["sharing.minSearchStringLength"], 10) || 0,
|
parseInt(window.OC.config["sharing.minSearchStringLength"], 10) || 0,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
},
|
||||||
|
|
||||||
get searchResults(): string[] {
|
computed: {
|
||||||
|
searchResults(): string[] {
|
||||||
return this.currentSearchResults
|
return this.currentSearchResults
|
||||||
.filter(({ id }) => id !== getCurrentUser()?.uid)
|
.filter(({ id }) => id !== getCurrentUser()?.uid)
|
||||||
.map(({ type, id }) => `${type}:${id}`)
|
.map(({ type, id }) => `${type}:${id}`)
|
||||||
|
@ -217,40 +232,42 @@ export default class AddToAlbumModal extends Mixins(GlobalMixin) {
|
||||||
(collaboratorKey) =>
|
(collaboratorKey) =>
|
||||||
!this.selectedCollaboratorsKeys.includes(collaboratorKey)
|
!this.selectedCollaboratorsKeys.includes(collaboratorKey)
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
|
|
||||||
get listableSelectedCollaboratorsKeys(): string[] {
|
listableSelectedCollaboratorsKeys(): string[] {
|
||||||
return this.selectedCollaboratorsKeys.filter(
|
return this.selectedCollaboratorsKeys.filter(
|
||||||
(collaboratorKey) =>
|
(collaboratorKey) =>
|
||||||
this.availableCollaborators[collaboratorKey].type !==
|
this.availableCollaborators[collaboratorKey].type !==
|
||||||
Type.SHARE_TYPE_LINK
|
Type.SHARE_TYPE_LINK
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
|
|
||||||
get selectedCollaborators(): Collaborator[] {
|
selectedCollaborators(): Collaborator[] {
|
||||||
return this.selectedCollaboratorsKeys.map(
|
return this.selectedCollaboratorsKeys.map(
|
||||||
(collaboratorKey) => this.availableCollaborators[collaboratorKey]
|
(collaboratorKey) => this.availableCollaborators[collaboratorKey]
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
|
|
||||||
get isPublicLinkSelected(): boolean {
|
isPublicLinkSelected(): boolean {
|
||||||
return this.selectedCollaboratorsKeys.includes(`${Type.SHARE_TYPE_LINK}`);
|
return this.selectedCollaboratorsKeys.includes(`${Type.SHARE_TYPE_LINK}`);
|
||||||
}
|
},
|
||||||
|
|
||||||
get publicLink(): Collaborator {
|
publicLink(): Collaborator {
|
||||||
return this.availableCollaborators[Type.SHARE_TYPE_LINK];
|
return this.availableCollaborators[Type.SHARE_TYPE_LINK];
|
||||||
}
|
},
|
||||||
|
},
|
||||||
@Watch("collaborators")
|
watch: {
|
||||||
collaboratorsChanged(collaborators) {
|
collaborators(collaborators) {
|
||||||
this.populateCollaborators(collaborators);
|
this.populateCollaborators(collaborators);
|
||||||
}
|
},
|
||||||
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.searchCollaborators();
|
this.searchCollaborators();
|
||||||
this.populateCollaborators(this.collaborators);
|
this.populateCollaborators(this.collaborators);
|
||||||
}
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
/**
|
/**
|
||||||
* Fetch possible collaborators.
|
* Fetch possible collaborators.
|
||||||
*/
|
*/
|
||||||
|
@ -276,7 +293,8 @@ export default class AddToAlbumModal extends Mixins(GlobalMixin) {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
this.currentSearchResults = response.data.ocs.data.map((collaborator) => {
|
this.currentSearchResults = response.data.ocs.data.map(
|
||||||
|
(collaborator) => {
|
||||||
switch (collaborator.source) {
|
switch (collaborator.source) {
|
||||||
case "users":
|
case "users":
|
||||||
return {
|
return {
|
||||||
|
@ -295,7 +313,8 @@ export default class AddToAlbumModal extends Mixins(GlobalMixin) {
|
||||||
`Invalid collaborator source ${collaborator.source}`
|
`Invalid collaborator source ${collaborator.source}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
this.availableCollaborators = {
|
this.availableCollaborators = {
|
||||||
...this.availableCollaborators,
|
...this.availableCollaborators,
|
||||||
|
@ -307,7 +326,7 @@ export default class AddToAlbumModal extends Mixins(GlobalMixin) {
|
||||||
} finally {
|
} finally {
|
||||||
this.loadingCollaborators = false;
|
this.loadingCollaborators = false;
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Populate selectedCollaboratorsKeys and availableCollaborators.
|
* Populate selectedCollaboratorsKeys and availableCollaborators.
|
||||||
|
@ -327,7 +346,7 @@ export default class AddToAlbumModal extends Mixins(GlobalMixin) {
|
||||||
...this.availableCollaborators,
|
...this.availableCollaborators,
|
||||||
...initialCollaborators,
|
...initialCollaborators,
|
||||||
};
|
};
|
||||||
}
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Object<string, Collaborator>} collaborators - Index of collaborators
|
* @param {Object<string, Collaborator>} collaborators - Index of collaborators
|
||||||
|
@ -344,7 +363,7 @@ export default class AddToAlbumModal extends Mixins(GlobalMixin) {
|
||||||
}${collaborator.type === Type.SHARE_TYPE_LINK ? "" : collaborator.id}`]:
|
}${collaborator.type === Type.SHARE_TYPE_LINK ? "" : collaborator.id}`]:
|
||||||
collaborator,
|
collaborator,
|
||||||
};
|
};
|
||||||
}
|
},
|
||||||
|
|
||||||
async createPublicLinkForAlbum() {
|
async createPublicLinkForAlbum() {
|
||||||
this.selectEntity(`${Type.SHARE_TYPE_LINK}`);
|
this.selectEntity(`${Type.SHARE_TYPE_LINK}`);
|
||||||
|
@ -369,7 +388,7 @@ export default class AddToAlbumModal extends Mixins(GlobalMixin) {
|
||||||
} finally {
|
} finally {
|
||||||
this.loadingAlbum = false;
|
this.loadingAlbum = false;
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
|
||||||
async deletePublicLink() {
|
async deletePublicLink() {
|
||||||
this.unselectEntity(`${Type.SHARE_TYPE_LINK}`);
|
this.unselectEntity(`${Type.SHARE_TYPE_LINK}`);
|
||||||
|
@ -380,7 +399,7 @@ export default class AddToAlbumModal extends Mixins(GlobalMixin) {
|
||||||
};
|
};
|
||||||
this.publicLinkCopied = false;
|
this.publicLinkCopied = false;
|
||||||
await this.updateAlbumCollaborators();
|
await this.updateAlbumCollaborators();
|
||||||
}
|
},
|
||||||
|
|
||||||
async updateAlbumCollaborators() {
|
async updateAlbumCollaborators() {
|
||||||
try {
|
try {
|
||||||
|
@ -399,7 +418,7 @@ export default class AddToAlbumModal extends Mixins(GlobalMixin) {
|
||||||
} finally {
|
} finally {
|
||||||
this.loadingAlbum = false;
|
this.loadingAlbum = false;
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
|
||||||
async copyPublicLink() {
|
async copyPublicLink() {
|
||||||
await navigator.clipboard.writeText(
|
await navigator.clipboard.writeText(
|
||||||
|
@ -411,7 +430,7 @@ export default class AddToAlbumModal extends Mixins(GlobalMixin) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.publicLinkCopied = false;
|
this.publicLinkCopied = false;
|
||||||
}, 10000);
|
}, 10000);
|
||||||
}
|
},
|
||||||
|
|
||||||
selectEntity(collaboratorKey) {
|
selectEntity(collaboratorKey) {
|
||||||
if (this.selectedCollaboratorsKeys.includes(collaboratorKey)) {
|
if (this.selectedCollaboratorsKeys.includes(collaboratorKey)) {
|
||||||
|
@ -420,7 +439,7 @@ export default class AddToAlbumModal extends Mixins(GlobalMixin) {
|
||||||
|
|
||||||
(<any>this.$refs.popover).$refs.popover.hide();
|
(<any>this.$refs.popover).$refs.popover.hide();
|
||||||
this.selectedCollaboratorsKeys.push(collaboratorKey);
|
this.selectedCollaboratorsKeys.push(collaboratorKey);
|
||||||
}
|
},
|
||||||
|
|
||||||
unselectEntity(collaboratorKey) {
|
unselectEntity(collaboratorKey) {
|
||||||
const index = this.selectedCollaboratorsKeys.indexOf(collaboratorKey);
|
const index = this.selectedCollaboratorsKeys.indexOf(collaboratorKey);
|
||||||
|
@ -430,8 +449,9 @@ export default class AddToAlbumModal extends Mixins(GlobalMixin) {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.selectedCollaboratorsKeys.splice(index, 1);
|
this.selectedCollaboratorsKeys.splice(index, 1);
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.manage-collaborators {
|
.manage-collaborators {
|
||||||
|
|
|
@ -21,8 +21,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Component, Emit, Mixins } from "vue-property-decorator";
|
import { defineComponent } from "vue";
|
||||||
import GlobalMixin from "../../mixins/GlobalMixin";
|
|
||||||
|
|
||||||
import { showError } from "@nextcloud/dialogs";
|
import { showError } from "@nextcloud/dialogs";
|
||||||
import * as dav from "../../services/DavRequests";
|
import * as dav from "../../services/DavRequests";
|
||||||
|
@ -30,21 +29,26 @@ import * as dav from "../../services/DavRequests";
|
||||||
import Modal from "./Modal.vue";
|
import Modal from "./Modal.vue";
|
||||||
import AlbumForm from "./AlbumForm.vue";
|
import AlbumForm from "./AlbumForm.vue";
|
||||||
|
|
||||||
@Component({
|
export default defineComponent({
|
||||||
|
name: "AlbumCreateModal",
|
||||||
components: {
|
components: {
|
||||||
Modal,
|
Modal,
|
||||||
AlbumForm,
|
AlbumForm,
|
||||||
},
|
},
|
||||||
})
|
|
||||||
export default class AlbumCreateModal extends Mixins(GlobalMixin) {
|
|
||||||
private show = false;
|
|
||||||
private album: any = null;
|
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
show: false,
|
||||||
|
album: null as any,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
/**
|
/**
|
||||||
* Open the modal
|
* Open the modal
|
||||||
* @param edit If true, the modal will be opened in edit mode
|
* @param edit If true, the modal will be opened in edit mode
|
||||||
*/
|
*/
|
||||||
public async open(edit: boolean) {
|
async open(edit: boolean) {
|
||||||
if (edit) {
|
if (edit) {
|
||||||
try {
|
try {
|
||||||
this.album = await dav.getAlbum(
|
this.album = await dav.getAlbum(
|
||||||
|
@ -61,22 +65,23 @@ export default class AlbumCreateModal extends Mixins(GlobalMixin) {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.show = true;
|
this.show = true;
|
||||||
}
|
},
|
||||||
|
|
||||||
@Emit("close")
|
close() {
|
||||||
public close() {
|
|
||||||
this.show = false;
|
this.show = false;
|
||||||
}
|
this.$emit("close");
|
||||||
|
},
|
||||||
|
|
||||||
public done({ album }: any) {
|
done({ album }: any) {
|
||||||
if (!this.album || album.basename !== this.album.basename) {
|
if (!this.album || album.basename !== this.album.basename) {
|
||||||
const user = album.filename.split("/")[2];
|
const user = album.filename.split("/")[2];
|
||||||
const name = album.basename;
|
const name = album.basename;
|
||||||
this.$router.push({ name: "albums", params: { user, name } });
|
this.$router.push({ name: "albums", params: { user, name } });
|
||||||
}
|
}
|
||||||
this.close();
|
this.close();
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
@ -23,58 +23,66 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Component, Emit, Mixins, Watch } from "vue-property-decorator";
|
import { defineComponent } from "vue";
|
||||||
|
|
||||||
import NcButton from "@nextcloud/vue/dist/Components/NcButton";
|
import NcButton from "@nextcloud/vue/dist/Components/NcButton";
|
||||||
const NcTextField = () => import("@nextcloud/vue/dist/Components/NcTextField");
|
const NcTextField = () => import("@nextcloud/vue/dist/Components/NcTextField");
|
||||||
import { showError } from "@nextcloud/dialogs";
|
import { showError } from "@nextcloud/dialogs";
|
||||||
import { getCurrentUser } from "@nextcloud/auth";
|
import { getCurrentUser } from "@nextcloud/auth";
|
||||||
import Modal from "./Modal.vue";
|
import Modal from "./Modal.vue";
|
||||||
import GlobalMixin from "../../mixins/GlobalMixin";
|
|
||||||
import client from "../../services/DavClient";
|
import client from "../../services/DavClient";
|
||||||
|
|
||||||
@Component({
|
export default defineComponent({
|
||||||
|
name: "AlbumDeleteModal",
|
||||||
components: {
|
components: {
|
||||||
NcButton,
|
NcButton,
|
||||||
NcTextField,
|
NcTextField,
|
||||||
Modal,
|
Modal,
|
||||||
},
|
},
|
||||||
})
|
|
||||||
export default class AlbumDeleteModal extends Mixins(GlobalMixin) {
|
|
||||||
private user: string = "";
|
|
||||||
private name: string = "";
|
|
||||||
private show = false;
|
|
||||||
|
|
||||||
@Emit("close")
|
data() {
|
||||||
public close() {
|
return {
|
||||||
|
show: false,
|
||||||
|
user: "",
|
||||||
|
name: "",
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
watch: {
|
||||||
|
$route: async function (from: any, to: any) {
|
||||||
|
this.refreshParams();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
this.refreshParams();
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
close() {
|
||||||
this.show = false;
|
this.show = false;
|
||||||
}
|
this.$emit("close");
|
||||||
|
},
|
||||||
|
|
||||||
public open() {
|
open() {
|
||||||
const user = this.$route.params.user || "";
|
const user = this.$route.params.user || "";
|
||||||
if (this.$route.params.user !== getCurrentUser()?.uid) {
|
if (this.$route.params.user !== getCurrentUser()?.uid) {
|
||||||
showError(
|
showError(
|
||||||
this.t("memories", 'Only user "{user}" can delete this album', { user })
|
this.t("memories", 'Only user "{user}" can delete this album', {
|
||||||
|
user,
|
||||||
|
})
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.show = true;
|
this.show = true;
|
||||||
}
|
},
|
||||||
|
|
||||||
@Watch("$route")
|
refreshParams() {
|
||||||
async routeChange(from: any, to: any) {
|
|
||||||
this.refreshParams();
|
|
||||||
}
|
|
||||||
|
|
||||||
mounted() {
|
|
||||||
this.refreshParams();
|
|
||||||
}
|
|
||||||
|
|
||||||
public refreshParams() {
|
|
||||||
this.user = this.$route.params.user || "";
|
this.user = this.$route.params.user || "";
|
||||||
this.name = this.$route.params.name || "";
|
this.name = this.$route.params.name || "";
|
||||||
}
|
},
|
||||||
|
|
||||||
public async save() {
|
async save() {
|
||||||
try {
|
try {
|
||||||
await client.deleteFile(`/photos/${this.user}/albums/${this.name}`);
|
await client.deleteFile(`/photos/${this.user}/albums/${this.name}`);
|
||||||
this.$router.push({ name: "albums" });
|
this.$router.push({ name: "albums" });
|
||||||
|
@ -87,6 +95,7 @@ export default class AlbumDeleteModal extends Mixins(GlobalMixin) {
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
|
});
|
||||||
</script>
|
</script>
|
|
@ -97,8 +97,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Component, Emit, Mixins, Prop } from "vue-property-decorator";
|
import { defineComponent, PropType } from "vue";
|
||||||
import GlobalMixin from "../../mixins/GlobalMixin";
|
|
||||||
|
|
||||||
import { getCurrentUser } from "@nextcloud/auth";
|
import { getCurrentUser } from "@nextcloud/auth";
|
||||||
import NcButton from "@nextcloud/vue/dist/Components/NcButton";
|
import NcButton from "@nextcloud/vue/dist/Components/NcButton";
|
||||||
|
@ -112,7 +111,8 @@ import AlbumCollaborators from "./AlbumCollaborators.vue";
|
||||||
import Send from "vue-material-design-icons/Send.vue";
|
import Send from "vue-material-design-icons/Send.vue";
|
||||||
import AccountMultiplePlus from "vue-material-design-icons/AccountMultiplePlus.vue";
|
import AccountMultiplePlus from "vue-material-design-icons/AccountMultiplePlus.vue";
|
||||||
|
|
||||||
@Component({
|
export default defineComponent({
|
||||||
|
name: "AlbumForm",
|
||||||
components: {
|
components: {
|
||||||
NcButton,
|
NcButton,
|
||||||
NcLoadingIcon,
|
NcLoadingIcon,
|
||||||
|
@ -122,35 +122,48 @@ import AccountMultiplePlus from "vue-material-design-icons/AccountMultiplePlus.v
|
||||||
Send,
|
Send,
|
||||||
AccountMultiplePlus,
|
AccountMultiplePlus,
|
||||||
},
|
},
|
||||||
})
|
|
||||||
export default class AlbumForm extends Mixins(GlobalMixin) {
|
|
||||||
@Prop() private album: any;
|
|
||||||
@Prop() private displayBackButton: boolean;
|
|
||||||
|
|
||||||
private showCollaboratorView = false;
|
props: {
|
||||||
private albumName = "";
|
album: {
|
||||||
private albumLocation = "";
|
type: Object as PropType<any>,
|
||||||
private loading = false;
|
default: null,
|
||||||
|
},
|
||||||
|
displayBackButton: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
showCollaboratorView: false,
|
||||||
|
albumName: "",
|
||||||
|
albumLocation: "",
|
||||||
|
loading: false,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
/**
|
/**
|
||||||
* @return Whether sharing is enabled.
|
* @return Whether sharing is enabled.
|
||||||
*/
|
*/
|
||||||
get editMode(): boolean {
|
editMode(): boolean {
|
||||||
return Boolean(this.album);
|
return Boolean(this.album);
|
||||||
}
|
},
|
||||||
|
|
||||||
get saveText(): string {
|
saveText(): string {
|
||||||
return this.editMode
|
return this.editMode
|
||||||
? this.t("photos", "Save")
|
? this.t("photos", "Save")
|
||||||
: this.t("photos", "Create album");
|
: this.t("photos", "Create album");
|
||||||
}
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Whether sharing is enabled.
|
* @return Whether sharing is enabled.
|
||||||
*/
|
*/
|
||||||
get sharingEnabled(): boolean {
|
sharingEnabled(): boolean {
|
||||||
return window.OC.Share !== undefined;
|
return window.OC.Share !== undefined;
|
||||||
}
|
},
|
||||||
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
if (this.editMode) {
|
if (this.editMode) {
|
||||||
|
@ -158,10 +171,11 @@ export default class AlbumForm extends Mixins(GlobalMixin) {
|
||||||
this.albumLocation = this.album.location;
|
this.albumLocation = this.album.location;
|
||||||
}
|
}
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
(<any>this.$refs.nameInput).$el.getElementsByTagName("input")[0].focus();
|
(<any>this.$refs.nameInput)?.$el.getElementsByTagName("input")[0].focus();
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
submit(collaborators = []) {
|
submit(collaborators = []) {
|
||||||
if (this.albumName === "" || this.loading) {
|
if (this.albumName === "" || this.loading) {
|
||||||
return;
|
return;
|
||||||
|
@ -171,7 +185,7 @@ export default class AlbumForm extends Mixins(GlobalMixin) {
|
||||||
} else {
|
} else {
|
||||||
this.handleCreateAlbum(collaborators);
|
this.handleCreateAlbum(collaborators);
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
|
||||||
async handleCreateAlbum(collaborators = []) {
|
async handleCreateAlbum(collaborators = []) {
|
||||||
try {
|
try {
|
||||||
|
@ -201,7 +215,7 @@ export default class AlbumForm extends Mixins(GlobalMixin) {
|
||||||
} finally {
|
} finally {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
|
||||||
async handleUpdateAlbum() {
|
async handleUpdateAlbum() {
|
||||||
try {
|
try {
|
||||||
|
@ -223,11 +237,13 @@ export default class AlbumForm extends Mixins(GlobalMixin) {
|
||||||
} finally {
|
} finally {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
|
||||||
@Emit("back")
|
back() {
|
||||||
back() {}
|
this.$emit("back");
|
||||||
}
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.album-form {
|
.album-form {
|
||||||
|
|
|
@ -57,8 +57,8 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Component, Emit, Mixins } from "vue-property-decorator";
|
import { defineComponent } from "vue";
|
||||||
import GlobalMixin from "../../mixins/GlobalMixin";
|
|
||||||
import { getCurrentUser } from "@nextcloud/auth";
|
import { getCurrentUser } from "@nextcloud/auth";
|
||||||
|
|
||||||
import AlbumForm from "./AlbumForm.vue";
|
import AlbumForm from "./AlbumForm.vue";
|
||||||
|
@ -74,7 +74,8 @@ import { IAlbum, IPhoto } from "../../types";
|
||||||
import axios from "@nextcloud/axios";
|
import axios from "@nextcloud/axios";
|
||||||
import { API } from "../../services/API";
|
import { API } from "../../services/API";
|
||||||
|
|
||||||
@Component({
|
export default defineComponent({
|
||||||
|
name: "AlbumPicker",
|
||||||
components: {
|
components: {
|
||||||
AlbumForm,
|
AlbumForm,
|
||||||
Plus,
|
Plus,
|
||||||
|
@ -83,6 +84,7 @@ import { API } from "../../services/API";
|
||||||
NcListItem,
|
NcListItem,
|
||||||
NcLoadingIcon,
|
NcLoadingIcon,
|
||||||
},
|
},
|
||||||
|
|
||||||
filters: {
|
filters: {
|
||||||
toCoverUrl(fileId: string) {
|
toCoverUrl(fileId: string) {
|
||||||
return getPreviewUrl(
|
return getPreviewUrl(
|
||||||
|
@ -94,27 +96,31 @@ import { API } from "../../services/API";
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
|
||||||
export default class AlbumPicker extends Mixins(GlobalMixin) {
|
data() {
|
||||||
private showAlbumCreationForm = false;
|
return {
|
||||||
private albums: IAlbum[] = [];
|
showAlbumCreationForm: false,
|
||||||
private loadingAlbums = true;
|
albums: [] as IAlbum[],
|
||||||
|
loadingAlbums: true,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.loadAlbums();
|
this.loadAlbums();
|
||||||
}
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
albumCreatedHandler() {
|
albumCreatedHandler() {
|
||||||
this.showAlbumCreationForm = false;
|
this.showAlbumCreationForm = false;
|
||||||
this.loadAlbums();
|
this.loadAlbums();
|
||||||
}
|
},
|
||||||
|
|
||||||
getAlbumName(album: IAlbum) {
|
getAlbumName(album: IAlbum) {
|
||||||
if (album.user === getCurrentUser()?.uid) {
|
if (album.user === getCurrentUser()?.uid) {
|
||||||
return album.name;
|
return album.name;
|
||||||
}
|
}
|
||||||
return `${album.name} (${album.user})`;
|
return `${album.name} (${album.user})`;
|
||||||
}
|
},
|
||||||
|
|
||||||
async loadAlbums() {
|
async loadAlbums() {
|
||||||
try {
|
try {
|
||||||
|
@ -125,11 +131,13 @@ export default class AlbumPicker extends Mixins(GlobalMixin) {
|
||||||
} finally {
|
} finally {
|
||||||
this.loadingAlbums = false;
|
this.loadingAlbums = false;
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
|
||||||
@Emit("select")
|
pickAlbum(album: IAlbum) {
|
||||||
pickAlbum(album: IAlbum) {}
|
this.$emit("select", album);
|
||||||
}
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
@ -28,8 +28,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Component, Emit, Mixins } from "vue-property-decorator";
|
import { defineComponent } from "vue";
|
||||||
import GlobalMixin from "../../mixins/GlobalMixin";
|
|
||||||
|
|
||||||
import NcButton from "@nextcloud/vue/dist/Components/NcButton";
|
import NcButton from "@nextcloud/vue/dist/Components/NcButton";
|
||||||
import NcLoadingIcon from "@nextcloud/vue/dist/Components/NcLoadingIcon";
|
import NcLoadingIcon from "@nextcloud/vue/dist/Components/NcLoadingIcon";
|
||||||
|
@ -39,33 +38,38 @@ import * as dav from "../../services/DavRequests";
|
||||||
import Modal from "./Modal.vue";
|
import Modal from "./Modal.vue";
|
||||||
import AlbumCollaborators from "./AlbumCollaborators.vue";
|
import AlbumCollaborators from "./AlbumCollaborators.vue";
|
||||||
|
|
||||||
@Component({
|
export default defineComponent({
|
||||||
|
name: "AlbumShareModal",
|
||||||
components: {
|
components: {
|
||||||
NcButton,
|
NcButton,
|
||||||
NcLoadingIcon,
|
NcLoadingIcon,
|
||||||
Modal,
|
Modal,
|
||||||
AlbumCollaborators,
|
AlbumCollaborators,
|
||||||
},
|
},
|
||||||
})
|
|
||||||
export default class AlbumShareModal extends Mixins(GlobalMixin) {
|
|
||||||
private album: any = null;
|
|
||||||
private show = false;
|
|
||||||
private loadingAddCollaborators = false;
|
|
||||||
|
|
||||||
@Emit("close")
|
data() {
|
||||||
public close() {
|
return {
|
||||||
|
album: null as any,
|
||||||
|
show: false,
|
||||||
|
loadingAddCollaborators: false,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
close() {
|
||||||
this.show = false;
|
this.show = false;
|
||||||
this.album = null;
|
this.album = null;
|
||||||
}
|
this.$emit("close");
|
||||||
|
},
|
||||||
|
|
||||||
public async open() {
|
async open() {
|
||||||
this.show = true;
|
this.show = true;
|
||||||
this.loadingAddCollaborators = true;
|
this.loadingAddCollaborators = true;
|
||||||
const user = this.$route.params.user || "";
|
const user = this.$route.params.user || "";
|
||||||
const name = this.$route.params.name || "";
|
const name = this.$route.params.name || "";
|
||||||
this.album = await dav.getAlbum(user, name);
|
this.album = await dav.getAlbum(user, name);
|
||||||
this.loadingAddCollaborators = false;
|
this.loadingAddCollaborators = false;
|
||||||
}
|
},
|
||||||
|
|
||||||
async handleSetCollaborators(collaborators: any[]) {
|
async handleSetCollaborators(collaborators: any[]) {
|
||||||
try {
|
try {
|
||||||
|
@ -80,6 +84,7 @@ export default class AlbumShareModal extends Mixins(GlobalMixin) {
|
||||||
} finally {
|
} finally {
|
||||||
this.loadingAddCollaborators = false;
|
this.loadingAddCollaborators = false;
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
|
});
|
||||||
</script>
|
</script>
|
Loading…
Reference in New Issue