2019-05-15 16:01:41 +01:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
<template>
|
2019-07-09 16:04:51 +01:00
|
|
|
<div>
|
|
|
|
<div class="project-details">
|
2019-09-26 14:36:12 +01:00
|
|
|
<h1 class="project-details__title">Project Details</h1>
|
2019-07-09 16:04:51 +01:00
|
|
|
<div class="project-details-info-container">
|
|
|
|
<div class="project-details-info-container__name-container">
|
2019-09-26 14:36:12 +01:00
|
|
|
<h2 class="project-details-info-container__name-container__title">Project Name</h2>
|
|
|
|
<h3 class="project-details-info-container__name-container__project-name">{{name}}</h3>
|
2019-07-09 16:04:51 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="project-details-info-container">
|
|
|
|
<div class="project-details-info-container__description-container" v-if="!isEditing">
|
|
|
|
<div class="project-details-info-container__description-container__text">
|
2019-09-26 14:36:12 +01:00
|
|
|
<h2 class="project-details-info-container__description-container__text__title">Description</h2>
|
2019-10-01 11:10:18 +01:00
|
|
|
<h3 class="project-details-info-container__description-container__text__project-description">{{displayedDescription}}</h3>
|
2019-07-09 16:04:51 +01:00
|
|
|
</div>
|
2019-10-23 13:26:39 +01:00
|
|
|
<EditIcon
|
|
|
|
class="project-details-svg"
|
|
|
|
@click="toggleEditing"
|
|
|
|
/>
|
2019-07-09 16:04:51 +01:00
|
|
|
</div>
|
|
|
|
<div class="project-details-info-container__description-container--editing" v-if="isEditing">
|
|
|
|
<HeaderedInput
|
|
|
|
label="Description"
|
2019-07-18 14:39:39 +01:00
|
|
|
placeholder="Enter Description"
|
2019-09-26 14:36:12 +01:00
|
|
|
width="205%"
|
2019-07-09 16:04:51 +01:00
|
|
|
height="10vh"
|
2019-09-23 12:31:42 +01:00
|
|
|
is-multiline="true"
|
2019-10-01 11:10:18 +01:00
|
|
|
:init-value="storedDescription"
|
2019-10-07 15:51:33 +01:00
|
|
|
@setData="setNewDescription"
|
2019-10-02 10:42:12 +01:00
|
|
|
/>
|
2019-07-09 16:04:51 +01:00
|
|
|
<div class="project-details-info-container__description-container__buttons-area">
|
2019-09-26 14:36:12 +01:00
|
|
|
<VButton
|
|
|
|
label="Cancel"
|
|
|
|
width="180px"
|
|
|
|
height="48px"
|
|
|
|
:on-press="toggleEditing"
|
2019-10-02 10:42:12 +01:00
|
|
|
is-white="true"
|
|
|
|
/>
|
2019-09-26 14:36:12 +01:00
|
|
|
<VButton
|
|
|
|
label="Save"
|
|
|
|
width="180px"
|
|
|
|
height="48px"
|
2019-10-02 10:42:12 +01:00
|
|
|
:on-press="onSaveButtonClick"
|
|
|
|
/>
|
2019-07-09 16:04:51 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-05-15 16:01:41 +01:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2019-09-09 11:33:39 +01:00
|
|
|
import { Component, Vue } from 'vue-property-decorator';
|
2019-07-18 14:39:39 +01:00
|
|
|
|
2019-09-09 11:33:39 +01:00
|
|
|
import EmptyState from '@/components/common/EmptyStateArea.vue';
|
|
|
|
import HeaderedInput from '@/components/common/HeaderedInput.vue';
|
2019-09-26 14:36:12 +01:00
|
|
|
import VButton from '@/components/common/VButton.vue';
|
2019-09-09 11:33:39 +01:00
|
|
|
import DeleteProjectPopup from '@/components/project/DeleteProjectPopup.vue';
|
2019-07-18 14:39:39 +01:00
|
|
|
|
2019-10-23 13:26:39 +01:00
|
|
|
import EditIcon from '@/../static/images/project/edit.svg';
|
|
|
|
|
2019-09-09 11:33:39 +01:00
|
|
|
import { RouteConfig } from '@/router';
|
|
|
|
import { PROJECTS_ACTIONS } from '@/store/modules/projects';
|
|
|
|
import { UpdateProjectModel } from '@/types/projects';
|
2019-10-28 17:33:06 +00:00
|
|
|
import { APP_STATE_ACTIONS } from '@/utils/constants/actionNames';
|
2019-12-11 20:07:15 +00:00
|
|
|
import { SegmentEvent } from '@/utils/constants/analyticsEventNames';
|
2019-11-12 12:14:05 +00:00
|
|
|
import { LocalData } from '@/utils/localData';
|
2019-07-18 14:39:39 +01:00
|
|
|
|
2019-09-09 11:33:39 +01:00
|
|
|
@Component({
|
|
|
|
components: {
|
2019-09-26 14:36:12 +01:00
|
|
|
VButton,
|
2019-09-09 11:33:39 +01:00
|
|
|
HeaderedInput,
|
|
|
|
EmptyState,
|
|
|
|
DeleteProjectPopup,
|
2019-10-23 13:26:39 +01:00
|
|
|
EditIcon,
|
2019-09-13 15:58:18 +01:00
|
|
|
},
|
2019-09-09 11:33:39 +01:00
|
|
|
})
|
|
|
|
export default class ProjectDetailsArea extends Vue {
|
|
|
|
private isEditing: boolean = false;
|
|
|
|
private newDescription: string = '';
|
2019-07-18 14:39:39 +01:00
|
|
|
|
2019-09-09 11:33:39 +01:00
|
|
|
public async mounted(): Promise<void> {
|
|
|
|
try {
|
|
|
|
await this.$store.dispatch(PROJECTS_ACTIONS.FETCH);
|
2019-12-11 20:07:15 +00:00
|
|
|
this.$segment.track(SegmentEvent.PROJECT_VIEWED, {
|
|
|
|
project_id: this.$store.getters.selectedProject.id,
|
|
|
|
});
|
2019-09-26 14:36:12 +01:00
|
|
|
} catch (error) {
|
2019-10-28 17:33:06 +00:00
|
|
|
await this.$notify.error(error.message);
|
2019-07-18 14:39:39 +01:00
|
|
|
}
|
2019-09-09 11:33:39 +01:00
|
|
|
}
|
2019-07-18 14:39:39 +01:00
|
|
|
|
2019-09-09 11:33:39 +01:00
|
|
|
public get name(): string {
|
|
|
|
return this.$store.getters.selectedProject.name;
|
|
|
|
}
|
2019-07-18 14:39:39 +01:00
|
|
|
|
2019-10-01 11:10:18 +01:00
|
|
|
public get storedDescription(): string {
|
|
|
|
return this.$store.getters.selectedProject.description;
|
|
|
|
}
|
|
|
|
|
|
|
|
public get displayedDescription(): string {
|
2019-09-09 11:33:39 +01:00
|
|
|
return this.$store.getters.selectedProject.description ?
|
|
|
|
this.$store.getters.selectedProject.description :
|
|
|
|
'No description yet. Please enter some information about the project if any.';
|
|
|
|
}
|
2019-07-18 14:39:39 +01:00
|
|
|
|
2019-09-09 11:33:39 +01:00
|
|
|
public get isPopupShown(): boolean {
|
|
|
|
return this.$store.state.appStateModule.appState.isDeleteProjectPopupShown;
|
|
|
|
}
|
|
|
|
|
|
|
|
public setNewDescription(value: string): void {
|
|
|
|
this.newDescription = value;
|
|
|
|
}
|
2019-07-18 14:39:39 +01:00
|
|
|
|
2019-09-09 11:33:39 +01:00
|
|
|
public async onSaveButtonClick(): Promise<void> {
|
|
|
|
try {
|
|
|
|
await this.$store.dispatch(
|
2019-09-13 15:58:18 +01:00
|
|
|
PROJECTS_ACTIONS.UPDATE,
|
|
|
|
new UpdateProjectModel(this.$store.getters.selectedProject.id, this.newDescription),
|
2019-09-09 11:33:39 +01:00
|
|
|
);
|
2019-11-12 12:14:05 +00:00
|
|
|
LocalData.setSelectedProjectId(this.$store.getters.selectedProject.id);
|
2019-09-26 14:36:12 +01:00
|
|
|
} catch (error) {
|
2019-10-28 17:33:06 +00:00
|
|
|
await this.$notify.error(`Unable to update project description. ${error.message}`);
|
2019-10-07 15:51:33 +01:00
|
|
|
|
|
|
|
return;
|
2019-07-18 14:39:39 +01:00
|
|
|
}
|
2019-09-09 11:33:39 +01:00
|
|
|
|
|
|
|
this.toggleEditing();
|
2019-10-28 17:33:06 +00:00
|
|
|
await this.$notify.success('Project updated successfully!');
|
2019-09-09 11:33:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public toggleDeleteDialog(): void {
|
|
|
|
this.$store.dispatch(APP_STATE_ACTIONS.TOGGLE_DEL_PROJ);
|
|
|
|
}
|
|
|
|
|
|
|
|
public onMoreClick(): void {
|
|
|
|
this.$router.push(RouteConfig.UsageReport.path);
|
|
|
|
}
|
|
|
|
|
2019-10-01 11:10:18 +01:00
|
|
|
public toggleEditing(): void {
|
2019-09-09 11:33:39 +01:00
|
|
|
this.isEditing = !this.isEditing;
|
2019-10-01 11:10:18 +01:00
|
|
|
this.newDescription = this.storedDescription;
|
2019-07-18 14:39:39 +01:00
|
|
|
}
|
2019-09-09 11:33:39 +01:00
|
|
|
}
|
2019-05-15 16:01:41 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
2019-09-26 14:36:12 +01:00
|
|
|
h1,
|
|
|
|
h2,
|
|
|
|
h3 {
|
|
|
|
margin-block-start: 0.5em;
|
|
|
|
margin-block-end: 0.5em;
|
|
|
|
}
|
|
|
|
|
2019-07-10 10:55:40 +01:00
|
|
|
.project-details {
|
|
|
|
position: relative;
|
|
|
|
overflow: hidden;
|
2019-10-28 15:59:19 +00:00
|
|
|
font-family: 'font_regular', sans-serif;
|
|
|
|
|
2019-09-26 14:36:12 +01:00
|
|
|
&__title {
|
2019-10-28 15:59:19 +00:00
|
|
|
font-family: 'font_bold', sans-serif;
|
2019-11-29 21:31:52 +00:00
|
|
|
font-size: 32px;
|
|
|
|
line-height: 39px;
|
|
|
|
color: #263549;
|
2019-11-01 16:00:28 +00:00
|
|
|
user-select: none;
|
2019-11-29 21:31:52 +00:00
|
|
|
margin: 0;
|
2019-07-10 10:55:40 +01:00
|
|
|
}
|
2019-10-28 15:59:19 +00:00
|
|
|
|
2019-07-10 10:55:40 +01:00
|
|
|
&__button-area {
|
|
|
|
margin-top: 3vh;
|
|
|
|
margin-bottom: 100px;
|
|
|
|
}
|
|
|
|
}
|
2019-10-28 15:59:19 +00:00
|
|
|
|
2019-07-10 10:55:40 +01:00
|
|
|
.project-details-info-container {
|
|
|
|
height: auto;
|
|
|
|
margin-top: 37px;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
justify-content: space-between;
|
|
|
|
align-items: flex-start;
|
2019-10-28 15:59:19 +00:00
|
|
|
|
2019-07-10 10:55:40 +01:00
|
|
|
&__name-container {
|
|
|
|
min-height: 67px;
|
|
|
|
width: 100%;
|
|
|
|
border-radius: 6px;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: flex-start;
|
|
|
|
padding: 28px;
|
|
|
|
background-color: #fff;
|
2019-09-26 14:36:12 +01:00
|
|
|
|
|
|
|
&__title {
|
|
|
|
font-size: 16px;
|
|
|
|
line-height: 21px;
|
|
|
|
color: rgba(56, 75, 101, 0.4);
|
2019-11-01 16:00:28 +00:00
|
|
|
user-select: none;
|
2019-09-26 14:36:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
&__project-name {
|
|
|
|
font-size: 16px;
|
|
|
|
line-height: 21px;
|
|
|
|
color: #354049;
|
|
|
|
}
|
2019-07-10 10:55:40 +01:00
|
|
|
}
|
2019-10-28 15:59:19 +00:00
|
|
|
|
2019-07-10 10:55:40 +01:00
|
|
|
&__description-container {
|
|
|
|
min-height: 67px;
|
2019-10-28 15:59:19 +00:00
|
|
|
width: 100%;
|
|
|
|
border-radius: 6px;
|
|
|
|
display: flex;
|
2019-07-10 10:55:40 +01:00
|
|
|
height: auto;
|
|
|
|
flex-direction: row;
|
|
|
|
justify-content: space-between;
|
|
|
|
align-items: center;
|
2019-10-28 15:59:19 +00:00
|
|
|
padding: 28px;
|
|
|
|
background-color: #fff;
|
|
|
|
|
2019-11-05 16:15:27 +00:00
|
|
|
::-webkit-scrollbar,
|
|
|
|
::-webkit-scrollbar-track,
|
|
|
|
::-webkit-scrollbar-thumb {
|
|
|
|
margin-top: 0;
|
|
|
|
}
|
|
|
|
|
2019-07-10 10:55:40 +01:00
|
|
|
&__text {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: flex-start;
|
2019-09-20 11:21:22 +01:00
|
|
|
margin-right: 20px;
|
2019-11-05 16:15:27 +00:00
|
|
|
width: 100%;
|
2019-09-26 14:36:12 +01:00
|
|
|
|
|
|
|
&__title {
|
|
|
|
font-size: 16px;
|
|
|
|
line-height: 21px;
|
|
|
|
color: rgba(56, 75, 101, 0.4);
|
2019-11-01 16:00:28 +00:00
|
|
|
user-select: none;
|
2019-09-26 14:36:12 +01:00
|
|
|
}
|
2019-10-28 15:59:19 +00:00
|
|
|
|
2019-09-26 14:36:12 +01:00
|
|
|
&__project-description {
|
|
|
|
font-size: 16px;
|
|
|
|
line-height: 21px;
|
|
|
|
color: #354049;
|
2019-07-10 10:55:40 +01:00
|
|
|
width: 100%;
|
2019-10-07 15:51:33 +01:00
|
|
|
max-height: 25vh;
|
|
|
|
overflow-y: scroll;
|
2019-10-01 11:10:18 +01:00
|
|
|
word-break: break-word;
|
2019-11-05 16:15:27 +00:00
|
|
|
white-space: pre-line;
|
2019-07-10 10:55:40 +01:00
|
|
|
}
|
|
|
|
}
|
2019-10-28 15:59:19 +00:00
|
|
|
|
2019-07-10 10:55:40 +01:00
|
|
|
&--editing {
|
2019-10-28 15:59:19 +00:00
|
|
|
min-height: 67px;
|
|
|
|
width: 100%;
|
|
|
|
border-radius: 6px;
|
2019-07-10 10:55:40 +01:00
|
|
|
display: flex;
|
2019-10-28 15:59:19 +00:00
|
|
|
height: auto;
|
|
|
|
padding: 28px;
|
|
|
|
background-color: #fff;
|
2019-07-10 10:55:40 +01:00
|
|
|
flex-direction: column;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: flex-start;
|
|
|
|
}
|
2019-10-28 15:59:19 +00:00
|
|
|
|
2019-07-10 10:55:40 +01:00
|
|
|
&__buttons-area {
|
|
|
|
margin-top: 2vh;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
align-items: center;
|
|
|
|
width: 380px;
|
|
|
|
justify-content: space-between;
|
|
|
|
}
|
2019-10-28 15:59:19 +00:00
|
|
|
|
2019-09-26 14:36:12 +01:00
|
|
|
.project-details-svg {
|
2019-07-10 10:55:40 +01:00
|
|
|
cursor: pointer;
|
2019-10-28 17:33:06 +00:00
|
|
|
min-width: 40px;
|
2019-10-28 15:59:19 +00:00
|
|
|
|
2019-07-10 10:55:40 +01:00
|
|
|
&:hover {
|
2019-09-26 14:36:12 +01:00
|
|
|
|
|
|
|
.project-details-svg__rect {
|
2019-10-28 15:59:19 +00:00
|
|
|
fill: #2683ff;
|
2019-07-10 10:55:40 +01:00
|
|
|
}
|
2019-09-26 14:36:12 +01:00
|
|
|
|
|
|
|
.project-details-svg__path {
|
|
|
|
fill: white;
|
2019-07-10 10:55:40 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-10-28 15:59:19 +00:00
|
|
|
|
2019-07-10 10:55:40 +01:00
|
|
|
&__portability-container {
|
2019-10-28 15:59:19 +00:00
|
|
|
min-height: 67px;
|
|
|
|
width: 100%;
|
|
|
|
border-radius: 6px;
|
|
|
|
display: flex;
|
|
|
|
height: auto;
|
|
|
|
flex-direction: row;
|
|
|
|
justify-content: space-between;
|
|
|
|
align-items: center;
|
|
|
|
padding: 28px;
|
|
|
|
background-color: #fff;
|
|
|
|
|
2019-07-10 10:55:40 +01:00
|
|
|
&__info {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
align-items: center;
|
2019-10-28 15:59:19 +00:00
|
|
|
|
2019-07-10 10:55:40 +01:00
|
|
|
&__text {
|
|
|
|
margin-left: 2vw;
|
|
|
|
}
|
|
|
|
}
|
2019-10-28 15:59:19 +00:00
|
|
|
|
2019-07-10 10:55:40 +01:00
|
|
|
&__buttons-area {
|
2019-10-28 15:59:19 +00:00
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
align-items: center;
|
2019-07-10 10:55:40 +01:00
|
|
|
width: 380px;
|
|
|
|
justify-content: space-between;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-05-15 16:01:41 +01:00
|
|
|
</style>
|