-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Routes for community #947
Merged
Merged
Routes for community #947
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* eslint-env node */ | ||
module.exports = { | ||
extends: ['../../.eslintrc.cjs'], | ||
rules: { | ||
// Page components will not be used by name in other components' template. | ||
// Disable this rule to simplify naming of page components. | ||
'vue/multi-word-component-names': 'off' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template> | ||
<div>Explore</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template> | ||
<div>Home</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<template> | ||
<header>Community Navbar</header> | ||
<router-view /> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<template> | ||
<RunnerContainer v-if="project != null" mode="share" :project="project" /> | ||
<UILoading :visible="project == null" cover /> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { useAsyncComputed } from '@/utils/utils' | ||
import { Project } from '@/models/project' | ||
import RunnerContainer from '@/components/project/runner/RunnerContainer.vue' | ||
import { UILoading } from '@/components/ui' | ||
|
||
const props = defineProps<{ | ||
owner: string | ||
name: string | ||
}>() | ||
|
||
const project = useAsyncComputed(async () => { | ||
const p = new Project() | ||
await p.loadFromCloud(props.owner, props.name) | ||
return p | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template> | ||
<div>Projects</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template> | ||
<div>Followers</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template> | ||
<div>Following</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<template> | ||
<h2>User {{ name }}</h2> | ||
<router-view /> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
defineProps<{ | ||
name: string | ||
}>() | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template> | ||
<div>Likes</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template> | ||
<div>Overview</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template> | ||
<div>Projects</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
关于这种 path style,我在想如果对于资源集合咱们使用复数(比如
/projects
),那对于特定资源实例如果用“复数集合+标识符“的格式看起来会不会更统一些?比如,/users/:name
。另外,咱们不使用类似 twitter、github 那种资源所有者优先的 path style 的主要原因是什么?是关键词保留方面的吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个是目前 spx-backend HTTP 接口的路由风格,对于资源集合的操作(如列举),就用复数;对于单个资源,则单数 + 标识
你说的总是用复数的方式我觉得也 OK 的,只是这二者间,这里会倾向跟已有的风格一致
Github 是
/:user/:repo
,Twitter 是/:user/status/:id
,在:user
这里确实会容易有路由冲突的问题,虽然不是不能解决,不过感觉好处有限There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
其实我挺想改一下接口的整体风格的,改得更 RESTful 些,只不过牵扯到兼容性问题不太好下手。
我在想对于类似 path style 这种后期很难再做改动的东西来说,咱们是不是可以尽量向 github 靠拢?感觉他们的大多数风格都挺优雅的。
嗯想了一下好处是有限,主要好处可能是短一点分享的时候会方便些。咱们可以先不用这种风格。就算后面因为某些原因想用了也可以换过去,而且应该不会造成什么兼容性问题。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是的,不过 github 自己也有一些混乱的地方;比如 pull 跟 commit 都是像上面说的“对资源集合复数,对单个资源单数”(这个风格我觉得也是逻辑自洽的),而 issue、project 这些又像你说的“都是复数”
哈哈哈会有问题吧,如果用户名叫“explore”或者“projects”,他的个人主页就没法访问了..Twitter 用户应该就不能起名叫“explore”或者“notifications”?这个是我不喜欢这种路由的主要原因
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
以及 Github 的
/:owner/:repo
这种路由风格的实施好像后来也遇到了障碍,对于 organization,其 repo 的路由还是/:owner/:repo
,但是这些就变成多了个
/orgs
前缀;我不太清楚这里边具体的原因,但是这种不一致应该是不得已There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
对是的,刚我也想到了,但我想的是 oauth provider 会帮咱们屏蔽掉一些关键词。不过我忽略了咱们后面还会引入邮箱登录允许自定义用户名……
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
嗯同意不要用这种风格了,感觉引入的问题远比好处多
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
嗯 github 确实也不是完全统一的……
对于
/users/:user
这种风格来说,应该是把每一级都看作“目录”。所以/users
表示目录本身,/users/:user
表示目录下的具体项。倒也不是非得遵循这种目录结构风格。想了一下如果遵循“对资源集合复数,对单个资源单数”,这样接口改动也会更小一些。