Skip to content

Commit

Permalink
normal commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Peng Kaifan committed Oct 30, 2020
1 parent cb92269 commit 7a7b236
Show file tree
Hide file tree
Showing 38 changed files with 5,441 additions and 308 deletions.
6 changes: 5 additions & 1 deletion src/components/IssuesPage/IssuesPageTemplate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@


<Entries class="flex-grow-1">
<EntriesFilterRow class="entries-filter-row Box-header mx-0 d-flex flex-justify-between">
<EntriesFilterRow v-if="!isEmpty" class="entries-filter-row Box-header mx-0 d-flex flex-justify-between">
<slot name="entriesFilterRow">
<EntriesFilterItem class="px-3">Visibility</EntriesFilterItem>
<EntriesFilterItem class="px-3">Organization</EntriesFilterItem>
Expand Down Expand Up @@ -118,6 +118,10 @@
perPage: {
type: Number,
default: 8
},
isEmpty: {
type: Boolean,
default: false
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/Label.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<span class="d-inline-block label css-truncate" :style="{color:fontColor,background:color}">
<span class="d-inline-block label css-truncate" :style="{color:fontColor,background:`${color}!important`}">
<span class="css-truncate-target" style="max-width: 100%">{{emojiHandledName}}</span>
</span>
</template>
Expand Down
1 change: 1 addition & 0 deletions src/components/Modal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
}
.loading-wrapper{
pointer-events: none;
position: absolute;
top: 0;
bottom: 0;
Expand Down
4 changes: 4 additions & 0 deletions src/network/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ export const API_REPOSITORY_RELEASE = payload => {
return `${GITHUB_REST_API_BASE}/repos/${payload.owner}/${payload.repo}/releases/${payload.releaseId}`
}

export const API_REPOSITORY_LATESTRELEASE = payload => {
return `${GITHUB_REST_API_BASE}/repos/${payload.owner}/${payload.repo}/releases/latest`
}

export const API_REPOSITORY_RELEASE_ASSETS = payload => {
return `${GITHUB_REST_API_BASE}/repos/${payload.owner}/${payload.repo}/releases/${payload.releaseId}/assets`
}
Expand Down
49 changes: 20 additions & 29 deletions src/pages/Repository/Compare/Compare.vue
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@
</p>
</EmptyNotice>

<Modal ref="chooseBaseRefModal" title="Choose a base ref" :modalStyle="{height:'80vh'}" @show="() => network_getAvailableRefs('base')">
<Modal :loading="modalRefsData.base[modalRefsData.base.currentTab].loading" ref="chooseBaseRefModal" title="Choose a base ref" :modalStyle="{height:'80vh'}" @show="() => network_getAvailableRefs('base')">
<div class="select-menu-text-filter">
<div class="p-3">
<input type="text" v-model="modalRefsData.base.searchQuery" class="form-control" placeholder="Find a branch" autofocus="" autocomplete="off"/>
Expand All @@ -227,18 +227,12 @@
<button class="SelectMenu-tab py-2" style="font-size:14px" @click="() => switchModalTab('base','tags')" :class="{'active-modal-tab':modalRefsData.base.currentTab == 'tags'}">Tags</button>
</ModalTab>
</div>
<div v-if="modalRefsData.base[modalRefsData.base.currentTab].loading" class="flex-row-center height-full">
<ModalLoadingIcon></ModalLoadingIcon>
</div>
<EmptyNotice v-else-if="modalRefsData.base.currentTab == 'tags' && modalRefsData.base.tags.data.length == 0">
<EmptyNotice v-if="modalRefsData.base.currentTab == 'tags' && modalRefsData.base.tags.isEmpty">
<div class="text-center SelectMenu-message">
Nothing to show
</div>
<footer class="SelectMenu-footer">
<router-link :to="`/${owner}/${repo}/tags`">View all tags</router-link>
</footer>
</EmptyNotice>
<div v-else style="overflow:auto">
<div v-else-if="!modalRefsData.base[modalRefsData.base.currentTab].loading" style="overflow:auto">
<transition-group v-if="modalRefsData.base.currentTab == 'branches'" name="fade-group" appear>
<SelectMenuItem :key="defaultBranch" v-if="defaultBranch" @click.native="() => routerWithRef(defaultBranch,'base')" :selected="baseRef == defaultBranch">
<span class="flex-1">{{defaultBranch}}</span>
Expand All @@ -252,11 +246,15 @@
<SelectMenuItem @click.native="() => routerWithRef(item,'base')" v-for="item in modalFilteredAvailableBaseTags" :key="item" :selected="baseRef == item">
<span>{{item}}</span>
</SelectMenuItem>
<footer key="footer" class="SelectMenu-footer">
<router-link :to="`/${owner}/${repo}/tags`">View all tags</router-link>
</footer>
</transition-group>
</div>

</Modal>

<Modal ref="chooseHeadRefModal" title="Choose a head ref" :modalStyle="{height:'80vh'}" @show="() => network_getAvailableRefs('head')">
<Modal ref="chooseHeadRefModal" title="Choose a head ref" :loading="modalRefsData.head[modalRefsData.head.currentTab].loading" :modalStyle="{height:'80vh'}" @show="() => network_getAvailableRefs('head')">
<div class="select-menu-text-filter">
<div class="p-3">
<input type="text" v-model="modalRefsData.head.searchQuery" class="form-control" placeholder="Find a branch" autofocus="" autocomplete="off"/>
Expand All @@ -266,18 +264,12 @@
<button class="SelectMenu-tab py-2" style="font-size:14px" @click="() => switchModalTab('head','tags')" :class="{'active-modal-tab':modalRefsData.head.currentTab == 'tags'}">Tags</button>
</ModalTab>
</div>
<div v-if="modalRefsData.head[modalRefsData.head.currentTab].loading" class="flex-row-center height-full">
<ModalLoadingIcon></ModalLoadingIcon>
</div>
<EmptyNotice v-else-if="modalRefsData.head.currentTab == 'tags' && modalRefsData.head.tags.data.length == 0">
<div class="text-center SelectMenu-message">
<EmptyNotice v-if="modalRefsData.head.currentTab == 'tags' && modalRefsData.head.tags.isEmpty">
<div class="text-center SelectMenu-message">
Nothing to show
</div>
<footer class="SelectMenu-footer">
<router-link :to="`/${owner}/${repo}/tags`">View all tags</router-link>
</footer>
</EmptyNotice>
<div v-else style="overflow:auto">
<div v-else-if="!modalRefsData.head[modalRefsData.head.currentTab].loading" style="overflow:auto">
<transition-group v-if="modalRefsData.head.currentTab == 'branches'" name="fade-group" appear>
<SelectMenuItem :key="defaultBranch" v-if="defaultBranch" @click.native="() => routerWithRef(defaultBranch,'head')" :selected="headRef == defaultBranch">
<span class="flex-1">{{defaultBranch}}</span>
Expand All @@ -291,32 +283,30 @@
<SelectMenuItem @click.native="() => routerWithRef(item,'head')" v-for="item in modalFilteredAvailableHeadTags" :key="item" :selected="headRef == item">
<span>{{item}}</span>
</SelectMenuItem>
<footer key="footer" class="SelectMenu-footer">
<router-link :to="`/${owner}/${repo}/tags`">View all tags</router-link>
</footer>
</transition-group>
</div>

</Modal>

<Modal ref="chooseBaseRepoModal" title="Choose a base repostiory" :modalStyle="{height:'80vh'}" @show="network_getAvailableRepos">
<Modal ref="chooseBaseRepoModal" title="Choose a base repostiory" :loading="modalReposData.loading" :modalStyle="{height:'80vh'}" @show="network_getAvailableRepos">
<div class="select-menu-text-filter p-3 position-sticky" style="top:0;z-index:2">
<input type="text" v-model="modalReposData.searchQuery" class="form-control" placeholder="Filter repos" autofocus="" autocomplete="off"/>
</div>
<div v-if="modalReposData.loading" class="flex-row-center height-full">
<ModalLoadingIcon></ModalLoadingIcon>
</div>
<div v-else>
<div v-if="modalFiltermodalReposData.length > 0">
<SelectMenuItem @click.native="() => routerWithRefOwner(item,'base')" v-for="item in modalFiltermodalReposData" :key="item" :selected="`${owner}/${repo}` == item">
<span>{{item}}</span>
</SelectMenuItem>
</div>
</Modal>

<Modal ref="chooseHeadRepoModal" title="Choose a head repostiory" :modalStyle="{height:'80vh'}" @show="network_getAvailableRepos">
<Modal ref="chooseHeadRepoModal" title="Choose a head repostiory" :loading="modalReposData.loading" :modalStyle="{height:'80vh'}" @show="network_getAvailableRepos">
<div class="select-menu-text-filter p-3">
<input type="text" v-model="modalReposData.searchQuery" class="form-control" placeholder="Filter repos" autofocus="" autocomplete="off"/>
</div>
<div v-if="modalReposData.loading" class="flex-row-center height-full">
<ModalLoadingIcon></ModalLoadingIcon>
</div>
<div v-else style="overflow:auto">
<div v-if="modalFiltermodalReposData.length" style="overflow:auto">
<transition-group name="fade-group" appear>
<SelectMenuItem @click.native="() => routerWithRefOwner(item,'head')" v-for="item in modalFiltermodalReposData" :key="item" :selected="`${headRefOwner}/${repo}` == item">
<span>{{item}}</span>
Expand Down Expand Up @@ -600,6 +590,7 @@
}
)
this.modalRefsData[meta].tags.data = this.parseTagsFromHTML(res.data)
if(this.modalRefsData[meta].tags.data.length == 0) this.modalRefsData[meta].tags.isEmpty = true
}catch(e) {
console.log(e)
}finally{
Expand Down
99 changes: 6 additions & 93 deletions src/pages/Repository/Issues/IssueDetail/IssueDetail.vue
Original file line number Diff line number Diff line change
@@ -1,74 +1,11 @@



<template>
<CommonLoadingWrapper :loading="loading || timeline.loading || timeline.extraData.loading" :position="loading ? 'center' : 'corner'" class="px-3 bg-white flex-grow-1">

<Header>
<HeaderActions v-if="!titleEditPane.show" class="d-flex flex-justify-between flex-items-center mb-3">
<span>
<AnimatedWidthWrapper class="v-align-bottom">
<button v-if="extraData.data.viewerCanUpdate" @click="triggerShowTitleEditPane" class="btn btn-sm d-inline-block float-none mr-2">
Edit
</button>
</AnimatedWidthWrapper>
<router-link to="/" class="btn btn-primary d-inline-block btn-sm">
New issue
</router-link>
</span>


<button class="btn-link" @click="scrollToBottom">Jump to bottom</button>
</HeaderActions>

<HeaderTitle v-if="!titleEditPane.show" class="title f1">
<transition-group name="fade-group">
<Skeleton key="1" v-if="!data.id && loading">
<SkeletonRectangle :height="20" style="width:100%"></SkeletonRectangle>
<SkeletonRectangle :height="20" style="width:80%" class="mt-3"></SkeletonRectangle>
</Skeleton>
<div key="2" v-else>
{{data.title}}
<span class="number">#{{data.number}}</span>
</div>
</transition-group>

</HeaderTitle>

<TitleEditPane v-if="titleEditPane.show" class="mb-3">
<input :disabled="titleEditPane.loading" v-model="titleEditPane.title" ref="titleEditInput" class="form-control flex-auto input-lg input-contrast mr-0 width-full" autofocus="autofocus" autocomplete="off" type="text">
<div style="margin-top:12px">
<button class="btn btn-sm mr-2" :disabled="titleEditPane.loading || !titleEditPane.title" @click="network_updateIssueTitle">{{titleEditPane.loading ? 'Saving' : 'Save'}}</button>
<button class="btn btn-link" style="background:white" :disabled="titleEditPane.loading || !titleEditPane.title" @click="() => triggerShowTitleEditPane(false)">Cancel</button>
</div>
</TitleEditPane>

<HeaderMeta class="d-flex mt-2 mb-3 flex-items-center header-meta">
<State v-if="!data.state" class="State State--green mr-2 d-inline-flex flex-items-center"
:class="{'State--green':data.state === 'open','State--red':data.state === 'closed'}"
style="text-transform:capitalize;border-radius: 2em">
<IssueIcon class="flex-shrink-0 mr-1" color="#fff" :issue="data"></IssueIcon>
&nbsp;
&nbsp;
&nbsp;
&nbsp;
</State>
<State v-else class="State State--green mr-2 d-inline-flex flex-items-center"
:class="{'State--green':data.state === 'open','State--red':data.state === 'closed'}"
style="text-transform:capitalize;border-radius: 2em">
<IssueIcon class="flex-shrink-0 mr-1" color="#fff" :issue="data"></IssueIcon>
{{data.state}}
</State>

<Skeleton v-if="!data.id && loading" class="flex-grow-1">
<SkeletonRectangle :height="16" style="width:100%"></SkeletonRectangle>
</Skeleton>

<MetaContent v-else class="meta-content">
<router-link to="/" class="text-bold link-gray">{{data.user && data.user.login}}</router-link>
{{data.state == 'open' ? 'opened' : data.state}} this issue
<span class="no-wrap">on {{data.created_at | dateFormat('dd zzz yyyy')}}</span>
· {{data.comments}} {{data.comments > 1 ? 'comments' : 'comment'}}
</MetaContent>
</HeaderMeta>
</Header>
<IssueHeader :data="data" :viewerCanUpdate="extraData.data.viewerCanUpdate" :issueUpdateFunc="network_updateIssue"></IssueHeader>


<Info class="border-bottom border-top pt-3 mt-3"
Expand Down Expand Up @@ -452,7 +389,7 @@
SkeletonRectangle,
HiddenItemLoading} from '@/components'
import {ScrollTopListenerMixin,RouteUpdateAwareMixin} from '@/mixins'
import {TimelineItem,Comment,IssueBody,ProjectCard,CommentCreatePane,LoadMore} from './components'
import {TimelineItem,Comment,IssueBody,ProjectCard,CommentCreatePane,LoadMore,IssueHeader} from './components'
import {IssueNotificationSettingPane,LockIssueButton} from '../../components'
import {util_dateFormat} from '@/util'
import {
Expand Down Expand Up @@ -648,12 +585,6 @@
createdComments: [],
deletedComments: [],
isDynamicDocumentTitle: true,
titleEditPane: {
show: false,
loading: false,
title: ''
},
}
},
Expand Down Expand Up @@ -1213,17 +1144,6 @@
throw(e)
}
},
async network_updateIssueTitle() {
try {
this.titleEditPane.loading = true
await this.network_updateIssue({title: this.titleEditPane.title})
this.titleEditPane.show = false
} catch (e) {
}finally{
this.titleEditPane.loading = false
}
},
triggerSubscription() {
if(this.extraData.data.viewerSubscription == 'SUBSCRIBED') {
this.network_setSubscription('UNSUBSCRIBED')
Expand Down Expand Up @@ -1271,14 +1191,6 @@
Object.assign(theComment,payload)
}
},
triggerShowTitleEditPane(payload = true) {
this.titleEditPane.show = payload
if(payload) {
this.$nextTick(() => {
this.$refs.titleEditInput.focus()
})
}
},
changeLockStatusSuccessPostHandler(payload) {
this.data.locked = payload
}
Expand All @@ -1292,6 +1204,7 @@
},
},
components: {
IssueHeader,
CommonLoadingWrapper,
Label,
Comment,
Expand Down
Loading

0 comments on commit 7a7b236

Please sign in to comment.