Merge pull request '更新' (#483) from durian/forgeplus-react:gitlink_server into gitlink_server

This commit is contained in:
xxq250 2022-12-08 14:53:47 +08:00
commit 3bec9b5a1c
80 changed files with 668 additions and 94 deletions

View File

@ -232,7 +232,7 @@ class App extends Component {
this.setState({
mygetHelmetapi: undefined
});
document.title = "Forge";
// document.title = "GitLink | 确实开源";
var link = document.createElement('link'),
oldLink = document.getElementById('dynamic-favicon');
link.id = 'dynamic-favicon';
@ -246,7 +246,7 @@ class App extends Component {
//获取数据的时候
gettablogourldata = (response) => {
document.title = response.data.setting.name;
// document.title = `app${response.data.setting.name}`;
var link = document.createElement('link'),
oldLink = document.getElementById('dynamic-favicon');
link.id = 'dynamic-favicon';

View File

@ -16,14 +16,14 @@ function Index(props){
const [ fileList , setFileList ] = useState(undefined);
const [ editOpration , setEditOpration ] = useState(false);
const { owner , projectsId } = props.match.params;
const { isManager , isDeveloper , current_user } = props;
const { isManager , isDeveloper , current_user, projectDetail } = props;
useEffect(()=>{
if(owner && projectsId){
if(owner && projectsId && projectDetail){
Init();
document.title = `主页-${projectDetail.author.name}/${projectDetail.name}`;
}
},[owner,projectsId])
},[owner,projectsId, projectDetail])
useEffect(()=>{
if( (current_user && current_user.login) && (isManager === true || isDeveloper === true)){

View File

@ -32,6 +32,7 @@ function AboutUs(){
const [units, setUnits] = useState([]);
useEffect(()=>{
document.title="关于我们";
//
window.addEventListener('scroll', scrollListener);
//topics.json

View File

@ -53,6 +53,7 @@ class Activity extends Component{
}
}
componentDidMount=()=>{
this.updateDocumentTitle();
const { time,type,status,page } = this.state;
this.setState({
isSpin:true
@ -60,6 +61,19 @@ class Activity extends Component{
this.getInfo(time,type,status,page);
}
componentDidUpdate(){
this.updateDocumentTitle();
}
// 更新网页标题
updateDocumentTitle(){
const {projectDetail} = this.props;
if(projectDetail && document.title.indexOf('动态-') === -1){
const { author, name} = projectDetail;
document.title = `动态-${author.name}/${name}`;
}
}
getInfo =(time,type,status,page)=>{
const { projectsId , owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/activity.json`;

View File

@ -57,7 +57,7 @@ export default (({ projectsId , branch , owner , changeBranch , branchList , tag
<div className="branch-tagBox" ref={refBox} onClick={()=>setVisible(visible ? false : true)}>
{/* {nav === 0 ?"分支":"标签"} */}
<span className="color-grey-9 mr3 ml8"><i className="iconfont icon-fenzhi2 font-18"></i></span>
<span className="ant-dropdown-link task-hide" style={{fontWeight:"500",minWidth:"45px",maxWidth:"270px"}}>
<span className="ant-dropdown-link task-hide" style={{fontWeight:"500",minWidth:"45px",maxWidth:"180px"}}>
{showValue}
</span>
<i className="showtag iconfont icon-sanjiaoxing-down font-15 color-grey-9 mr5 ml5 mt1" />

View File

@ -161,7 +161,7 @@ function SiderBar(props) {
</div>
{/* /Gitlink/forgeplus */}
{failApply && <div className='mt10' style={{color: '#f60011'}}>{failApply}</div>}
<div className='mt15 font-15 pln'>若需上传截图<a onClick={()=>{setFeedBackModal(false); history.push('/xxq250/BootstrapAdmin/issues/new?type=feedback')}} className='gotoIssueFeedBack'>点击此处</a></div>
<div className='mt15 font-15 pln'>若需上传截图<a onClick={()=>{setFeedBackModal(false); history.push('/Gitlink/forgeplus/issues/new?type=feedback')}} className='gotoIssueFeedBack'>点击此处</a></div>
</Modal>
</div>
)

View File

@ -33,10 +33,17 @@ const Params = Loadable({
})
export default ((props)=>{
const {isManager, project} = props;
const {isManager, project, projectDetail} = props;
const { projectsId, owner } = props.match.params;
const [jianmu_devops, setJianmu_devops] = useState(undefined);
useEffect(()=>{
if(projectDetail){
const { author, name} = projectDetail;
document.title = `引擎-${author.name}/${name}`;
}
}, [projectDetail])
useEffect(()=>{
// simplejianmu_devops
const url = `/${owner}/${projectsId}/simple.json`;

View File

@ -41,7 +41,7 @@ function CoderDepot(props){
const [ fileInfo ,setFileInfo ] = useState(undefined);//
const [ zip_url , setZip_url ] = useState(undefined);
const [ tar_url , setTar_url ] = useState(undefined);
const [ readOnly , setReadOnly] = useState(true);
const [ readOnly , setReadOnly] = useState(undefined);
const [ isSpin , setIsSpin] = useState(true);
const [ visible ,setVisible ] = useState(false);
const [ mainFlag ,setMainFlag ] = useState(false);
@ -65,7 +65,6 @@ function CoderDepot(props){
//distribution
const distribution = details && details.type != 2 && (details.permission === "Admin" || details.permission === "Owner" || details.permission === "Manager");
const { bannerList } = props;
useEffect(()=>{
if(bannerList && bannerList.length>0){
let a = bannerList.filter(i=>i.menu_name === "pulls");
@ -102,6 +101,19 @@ function CoderDepot(props){
}
},[details])
useEffect(()=>{
//
if(details){
const { author, name, description, default_branch} = details;
if(branchName && branchName !== default_branch){
// /
document.title = `${author.name}/${name}-${branchName}`;
}else{
document.title = `${author.name}/${name}${description?': '+description:''}`;
}
}
}, [treeValuePath, details, branchName])
useEffect(()=>{
if(treeValue){
setTreeValuePath(decodeURIComponent(treeValue).split('/'));
@ -127,6 +139,7 @@ function CoderDepot(props){
},[projectsId,owner,pathname,defaultBranch])
useEffect(()=>{
setReadOnly(props.history.location.search.indexOf('edit') !== -1);
axios.get(`/${owner}/${projectsId}/releases.json`).then((result)=>{
if(result && result.data){
const release = {
@ -289,12 +302,18 @@ function CoderDepot(props){
function onEdit(readOnly){
setReadOnly(readOnly);
setEditReadme(false);
const {history} = props;
if(readOnly){
history.push(history.location.pathname);
}else{
history.push(`${history.location.pathname}?edit`);
}
}
function ChangeFile(path, readOnly){
//
let enBranch = branchName || defaultBranch;
let checkvalue = turnbar(enBranch);
props.history.push(`/${owner}/${projectsId}/tree/${checkvalue}/${path}`);
props.history.push(`/${owner}/${projectsId}/tree/${checkvalue}/${path}?edit`);
setType("file");
setEditReadme(true);
};
@ -537,6 +556,7 @@ function CoderDepot(props){
currentBranch={branchName || defaultBranch}
branch={branchName || defaultBranch}
type={projectDetail.type}
treeValuePath={treeValuePath}
></CoderRootFileDetail>
}
</ul>

View File

@ -31,10 +31,20 @@ class CoderRootCommit extends Component{
}
componentDidMount=()=>{
this.updateDocumentTitle();
this.Init();
this.getBranchs();
}
// 更新网页标题
updateDocumentTitle(){
const {projectDetail} = this.props;
if(projectDetail && document.title.indexOf('提交-') === -1){
const { author, name} = projectDetail;
document.title = `提交-${author.name}/${name}`;
}
}
// 获取分支列表
getBranchs=()=>{
const { projectsId , owner } = this.props.match.params;
@ -46,6 +56,7 @@ class CoderRootCommit extends Component{
}
componentDidUpdate=(prevProps)=>{
this.updateDocumentTitle();
const { location } = this.props;
const prevlocation = prevProps && prevProps.location;
if (location !== prevlocation) {

View File

@ -27,6 +27,7 @@ class CoderRootFileDetail extends Component {
}
componentDidMount = () => {
this.updateDocumentTitle();
window.scrollTo(0, 0);
const { detail , mdFlag } = this.props;
this.setState({
@ -36,6 +37,7 @@ class CoderRootFileDetail extends Component {
};
componentDidUpdate=(prevProps)=>{
this.updateDocumentTitle();
const { replace_content } = this.props && this.props.detail;
const prevcontent = prevProps.detail && prevProps.detail.replace_content;
if (replace_content && prevcontent) {
@ -47,6 +49,16 @@ class CoderRootFileDetail extends Component {
}
}
// 更新网页标题
updateDocumentTitle(){
const {projectDetail, treeValuePath, location} = this.props;
const readOnly = location && location.search.indexOf('edit') === -1
if(projectDetail && treeValuePath){
const { author, name} = projectDetail;
document.title = `${readOnly ? treeValuePath.join('/') : '编辑'+treeValuePath[treeValuePath.length-1]}-${author.name}/${name}`;
}
}
languages_total = () => {
const { detail } = this.props;
const file_name = detail.path.split("/").pop().split(".").pop();
@ -200,7 +212,6 @@ class CoderRootFileDetail extends Component {
render() {
const {
readOnly,
detail,
current_user,
isManager,
@ -210,6 +221,8 @@ class CoderRootFileDetail extends Component {
md,
type
} = this.props;
// 文件只读状态
const readOnly = this.props.history.location.search.indexOf('edit') === -1
const { language, languages, description } = this.state;
let flag = current_user && current_user.login && (isManager || isDeveloper);
const Option = Select.Option;

View File

@ -403,7 +403,6 @@ class Detail extends Component {
forked_count: result.data.forked_count,
defaultBranch: result.data.default_branch
});
document.title = `${result.data.author.name}/${result.data.name}${result.data.description?''+result.data.description:''}`;
}
}
}).catch((error) => { })

View File

@ -49,13 +49,21 @@ const Infos = styled.div`
`;
//
export default (props) => {
const {match , history } = props;
const {match , history, projectDetail } = props;
const [data, setData] = useState({undefined});
const [commit, setCommit] = useState(undefined);
const [parents, setParents] = useState(undefined);
const [committer, setCommitter] = useState(undefined);
const [isSpin, setIsSpin] = useState(true);
const { sha , projectsId, owner } = match.params;
useEffect(()=>{
if(projectDetail){
const { author, name} = projectDetail;
document.title = `${commit && commit.message ? commit.message+'-' : ''}${sha}-${author.name}/${name}`;
}
}, [projectDetail, sha, commit])
useEffect(() => {
if (projectsId && owner && sha) {
const url = `/${owner}/${projectsId}/commits/${sha}.json`;

View File

@ -59,6 +59,7 @@ class Index extends Component {
this.getLanguage();
// this.getRecommandOri();
document.title='开源项目';
}
// 获取语言列表

View File

@ -24,6 +24,7 @@ function Index() {
useEffect(()=>{
getCate();
document.title='开源项目';
},[])
useEffect(()=>{

View File

@ -18,6 +18,14 @@ function Tags(props) {
const [total,setTotal] =useState(0);
const [limit,setLimit] =useState(10);
const { projectsId, owner } = props.match.params;
const { projectDetail} = props;
useEffect(()=>{
if(projectDetail && document.title.indexOf('所有标签-') === -1){
const { author, name} = projectDetail;
document.title = `所有标签-${author.name}/${name}`;
}
}, [projectDetail])
useEffect(() => {
if (projectsId) {

View File

@ -20,6 +20,13 @@ function Index(props) {
getList();
},[])
useEffect(()=>{
if(projectDetail && document.title.indexOf('所有分支-') === -1){
const { author, name} = projectDetail;
document.title = `所有分支-${author.name}/${name}`;
}
}, [projectDetail])
const menu =(zip_url,tar_url)=> (
<Menu>

View File

@ -42,6 +42,12 @@ export default Form.create()(
}
},[projectDetail])
useEffect(()=>{
if(projectDetail){
const { author, name} = projectDetail;
document.title = `${versionId ? "编辑" : "创建"}发行版-${author.name}/${name}`;
}
}, [projectDetail, versionId])
useEffect(() => {
if (versionId) {

View File

@ -17,12 +17,20 @@ function version(props) {
const [ releases , setReleases ] = useState(undefined);
const [ isSpin , setIsSpin ] = useState(true);
const { projectsId ,owner } = props.match.params;
const { location } = props;
const { location, projectDetail } = props;
const type = props.projectDetail && props.projectDetail.type;
const turnFromNew = location && location.query && location.query.turnFromNew;
useEffect(()=>{
getIssueList();
},[])
useEffect(()=>{
if(projectDetail){
const { author, name} = projectDetail;
document.title = `发行版-${author.name}/${name}`;
}
}, [projectDetail])
// 获取列表数据
function getIssueList(){
const url = `/${owner}/${projectsId}/releases.json`;

View File

@ -96,6 +96,7 @@ class CreateMerge extends Component {
}
componentDidMount = () => {
this.updateDocumentTitle();
// 初始化时根据url获取目标仓库、分支源仓库、分支
// 再获取对应的仓库列表、分支列表
// 再调用比较接口
@ -105,6 +106,7 @@ class CreateMerge extends Component {
};
componentDidUpdate = (preProps) => {
this.updateDocumentTitle();
// url变化触发时切换源分支、切换目标仓库、切换目标分支回退
const oldPathname = preProps.location.pathname;
const newPathname = this.props.location.pathname;
@ -115,6 +117,15 @@ class CreateMerge extends Component {
}
};
// 更新网页标题
updateDocumentTitle(){
const {projectDetail} = this.props;
if(projectDetail && document.title.indexOf('新建合并请求-') === -1){
const { author, name} = projectDetail;
document.title = `新建合并请求-${author.name}/${name}`;
}
}
//获取新建合并请求数据
getMergeInfo = (branchParams,init) => {
this.setState({ isSpin: true });

View File

@ -43,7 +43,12 @@ class MessageCount extends Component {
};
}
componentDidUpdate(){
this.updateDocumentTitle();
}
componentDidMount = () => {
this.updateDocumentTitle();
this.setState({
SpinFlag: true,
});
@ -58,6 +63,16 @@ class MessageCount extends Component {
}
};
// 更新网页标题
updateDocumentTitle(){
const {projectDetail} = this.props;
const {data} = this.state;
if(projectDetail && data){
const { author, name} = projectDetail;
document.title = `${data.issue.subject}-合并请求-${author.name}/${name}`;
}
}
bindFootRef = (footRef) => {
this.footRef = footRef;
}

View File

@ -21,6 +21,20 @@ class UpdateMerge extends Component {
this.getmergelist();
};
componentDidUpdate(){
this.updateDocumentTitle();
}
// 更新网页标题
updateDocumentTitle(){
const {projectDetail} = this.props;
const {data} = this.state;
if(projectDetail && data){
const { author, name} = projectDetail;
document.title = `${data.title}-合并请求-${author.name}/${name}`;
}
}
//获取新建分枝数据
getmergelist = () => {
this.setState({ isSpin: true });

View File

@ -68,6 +68,19 @@ class merge extends Component {
this.getIssueList();
};
componentDidUpdate(){
this.updateDocumentTitle();
}
// 更新网页标题
updateDocumentTitle(){
const {projectDetail} = this.props;
if(projectDetail){
const { author, name} = projectDetail;
document.title = `合并请求-${author.name}/${name}`;
}
}
getSelectList = () => {
const { projectsId,owner } = this.props.match.params;

View File

@ -54,18 +54,26 @@ class Index extends Component {
}
}
componentDidMount = () => {
this.updateDocumentTitle();
// 获取拥有者列表
this.getOwner();
//判断是否为删除新建项目失败后返回,并执行对应逻辑
this.isDeleteProjectBack();
}
componentDidUpdate=(prevPros)=>{
this.updateDocumentTitle();
if(prevPros && this.props && !this.props.checkIfLogin()){
this.props.history.push("/403")
return
}
}
// 更新网页标题
updateDocumentTitle(){
const { projectsType } = this.props.match.params;
document.title = `${projectsType && projectsType === "mirror" ? "导入" : "新建"}项目`;
}
getOwner=()=>{
const { OIdentifier } = this.props.match.params;
const { user_id } = this.props && this.props.current_user;
@ -561,7 +569,7 @@ class Index extends Component {
className="privatePart"
>
{getFieldDecorator('is_mirror')(
<Checkbox value="limit">该仓库将是一个<span className="color-blue">镜像</span>(push)</Checkbox>
<Checkbox value="limit">该仓库将是一个<span className="color-blue">镜像</span>(24)</Checkbox>
)}
</Form.Item >
}

View File

@ -15,6 +15,23 @@ class Index extends Component {
};
}
componentDidUpdate(){
this.updateDocumentTitle();
}
componentDidMount(){
this.updateDocumentTitle();
}
// 更新网页标题
updateDocumentTitle(){
const {projectDetail} = this.props;
if(projectDetail && document.title.indexOf('新建文件-') === -1){
const { author, name} = projectDetail;
document.title = `新建文件-${author.name}/${name}`;
}
}
// 命名文件
changeFileName = (e) => {
this.setState({

View File

@ -82,6 +82,15 @@ const CodeReview = (props) => {
);
}, []);
useEffect(()=>{
//
if(pr && projectDetail){
const { title} = pr;
const { author, name} = projectDetail;
document.title = `代码评审-${title}-${author.name}/${name}`;
}
}, [pr, projectDetail])
useEffect(() => {
if (!pluginActivated) {
return;
@ -109,7 +118,6 @@ const CodeReview = (props) => {
function EditorEmpty() {
const system=windowsOrMac();
console.log(system);
return <div className='ide-logo'>
<img className='ide-logo-img' src={ideLogo} />
<div>
@ -246,8 +254,6 @@ const CodeReview = (props) => {
zIndex: 1002,
};
console.log('propsIDE:');
console.log(propsIDE);
return (
<div style={{ height: '100%', lineHeight: '1.4' }}>

View File

@ -35,8 +35,6 @@ class m_editor extends Component {
render() {
const { editorValue, changeValue } = this.state;
const { readOnly, editorType, currentBranch, descName, checkName, detail, match: { params },filepath,ideTheme } = this.props;
console.log('params')
console.log(params)
const editor_options = {
lineNumbers: "on",
lineWrapping: true, //强制换行

View File

@ -15,6 +15,23 @@ class UploadFile extends Component {
};
}
componentDidUpdate(){
this.updateDocumentTitle();
}
componentDidMount(){
this.updateDocumentTitle();
}
// 更新网页标题
updateDocumentTitle(){
const {projectDetail} = this.props;
if(projectDetail && document.title.indexOf('上传文件-') === -1){
const { author, name} = projectDetail;
document.title = `上传文件-${author.name}/${name}`;
}
}
// 获取上传后的文件id数组
UploadFunc = (fileList) => {
this.setState({

View File

@ -74,12 +74,18 @@ const layoutConfig = {
const platform = 'gitlink';
const WebIDE = ( props) => {
const { match: { params: { owner, projectsId, branchName } }, } = props;
const { match: { params: { owner, projectsId, branchName } }, mygetHelmetapi } = props;
let origin=window.location.origin;
if(origin.indexOf('localhost')>-1){
origin='https://testforgeplus.trustie.net';
}
useEffect(()=>{
if(mygetHelmetapi && mygetHelmetapi.name){
document.title= mygetHelmetapi.name
}
},[mygetHelmetapi])
return (<AppRenderer
appConfig={{
plugins: [SCMPlugin, AlexApp],

View File

@ -27,6 +27,14 @@ function Index(props){
const [ flag , setFlag ] = useState(true);
const { current_user } = props;
useEffect(()=>{
if(user){
//
const {username, login} = user;
document.title = `${menu === "undo" ? '接收仓库' : '成员申请'}-${username}/${login}`;
}
},[user, menu])
useEffect(()=>{
if((username && current_user && (current_user.login !== username))){
props.history.push(`/${username}`);

View File

@ -44,6 +44,20 @@ class Detail extends Component {
this.getDetail();
};
componentDidUpdate=()=>{
this.updateDocumentTitle();
}
// 更新网页标题
updateDocumentTitle(){
const {projectDetail} = this.props;
const {data} = this.state;
if(projectDetail && data){
const { author, name} = projectDetail;
document.title = `${data.subject}-疑修-${author.name}/${name}`;
}
}
getDetail = () => {
const { projectsId, orderId, owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/issues/${orderId}.json`;

View File

@ -26,9 +26,22 @@ class Milepost extends Component {
spinings: true
}
}
componentDidUpdate(){
this.updateDocumentTitle();
}
componentDidMount = () => {
this.getList(1, this.state.status, 'desc');
this.updateDocumentTitle();
}
// 更新网页标题
updateDocumentTitle(){
const {projectDetail} = this.props;
if(projectDetail){
const { author, name} = projectDetail;
document.title = `里程碑-${author.name}/${name}`;
}
}
getList = (page, status, order_type, order_name) => {

View File

@ -59,6 +59,7 @@ class MilepostDetail extends Component {
}
componentDidUpdate=(prevProps)=>{
this.updateDocumentTitle();
const prebannerList = prevProps && prevProps.bannerList;
const bannerList = this.props && this.props.bannerList;
if(prebannerList !== bannerList){
@ -71,6 +72,16 @@ class MilepostDetail extends Component {
}
}
// 更新网页标题
updateDocumentTitle(){
const {projectDetail} = this.props;
const {data} = this.state;
if(projectDetail && data){
const { author, name} = projectDetail;
document.title = `${data.name}-里程碑-${author.name}/${name}`;
}
}
getSelectList = () => {
const { projectsId , owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/issues/index_chosen.json`;

View File

@ -22,6 +22,20 @@ class UpdateMilepost extends Component {
this.getmeil();
}
componentDidUpdate=()=>{
this.updateDocumentTitle();
}
// 更新网页标题
updateDocumentTitle(){
const {projectDetail} = this.props;
const {data} = this.state;
if(projectDetail && data){
const { author, name} = projectDetail;
document.title = `${data.name}-里程碑-${author.name}/${name}`;
}
}
onPanelChange = (time, mode) => {
this.setState({
value: time
@ -53,7 +67,6 @@ class UpdateMilepost extends Component {
name: result.data.name,
description: result.data.description
});
}
}).catch((error) => {
console.log(error);

View File

@ -16,11 +16,26 @@ class NewMilepost extends Component {
isSpin: false
}
}
componentDidMount = () => {
this.updateDocumentTitle();
}
componentDidUpdate=(prevPros)=>{
if(prevPros && this.props && !this.props.checkIfLogin()){
this.props.history.push("/403")
return
}
this.updateDocumentTitle();
}
// 更新网页标题
updateDocumentTitle(){
const {projectDetail} = this.props;
if(projectDetail){
const { author, name} = projectDetail;
document.title = `新建里程碑-${author.name}/${name}`;
}
}
// componentDidMount = () => {
// this.check_is_login();
@ -101,7 +116,7 @@ class NewMilepost extends Component {
required: true, message: '请输入标题'
}],
})(
<Input placeholder="标题" autoComplete="off" maxLength="30" />
<Input placeholder="标题" autoComplete="off" maxLength={30} />
)}
</Form.Item>
</div>

View File

@ -75,10 +75,12 @@ class order extends Component {
};
}
componentDidUpdate(){
this.updateDocumentTitle();
}
componentDidMount = () => {
this.updateDocumentTitle();
const datas = cookie.load('states');
let states = datas === "undefined" ? undefined : datas;
if(states){
@ -94,6 +96,14 @@ class order extends Component {
}
};
// 更新网页标题
updateDocumentTitle(){
const {projectDetail} = this.props;
if(projectDetail){
const { author, name} = projectDetail;
document.title = `疑修-${author.name}/${name}`;
}
}
getSelectList = () => {
this.setState({

View File

@ -44,11 +44,28 @@ class order_form extends Component {
this.props.history.push("/403")
return
}
this.updateDocumentTitle();
}
componentDidMount = () => {
this.getSelectList();
};
// 更新网页标题
updateDocumentTitle(){
const {form_type, projectDetail} = this.props;
const {subject} = this.state;
if(projectDetail && form_type){
const { author, name} = projectDetail;
if(form_type === 'feedback'){
document.title = `意见反馈`
}else if(form_type === 'new'){
document.title = `新建疑修-${author.name}/${name}`
}else{
subject && (document.title = `${subject}-疑修-${author.name}/${name}`);
}
}
}
copyIssueAtWhoInit = (description) =>{
if (description.indexOf("@") !== -1){
this.setState({isSpin: true});

View File

@ -40,6 +40,7 @@ function NoticeManager(props){
}
useEffect(()=>{
document.title = '通知管理';
axios.get("/template_message_settings.json").then(response => {
if (response && response.status === 200) {
setSettingTypes(response.data.setting_types);

View File

@ -27,6 +27,10 @@ function MyNotice(props) {
const [currentPage, setCurrentPage] = useState(1);//
const [onlyUnread, setOnlyUnread] = useState();
useEffect(()=>{
document.title = "我的通知";
}, [])
//访/settings/profile
//访/explore
useEffect(()=>{
@ -244,7 +248,6 @@ function MyNotice(props) {
})}
{false && messageList && messageList.map(item => {
console.log('item',item);
//
if (noticeType === "0") {
//

View File

@ -1,4 +1,4 @@
import React , { forwardRef, useState } from 'react';
import React , { forwardRef, useState, useEffect } from 'react';
import { Link } from 'react-router-dom';
import { Button, Form , Input } from 'antd';
import Axios from 'axios';
@ -8,6 +8,10 @@ function New({ form , showNotification , history }) {
const { getFieldDecorator, validateFields , setFieldsValue } = form;
const [ msg , setMsg ] = useState(undefined);
useEffect(()=>{
document.title = '添加SSH密钥'
}, [])
function submit() {
validateFields((error,values)=>{
if(!error){
@ -51,7 +55,7 @@ function New({ form , showNotification , history }) {
<TextArea placeholder="支持以'ssh-rsa','ssh-ed25519','ecdsa-sha2-nistp256','ecdsa-sha2-nistp384','ecdsa-sha2-nistp521'开头" autoSize={{ minRows: 6, maxRows: 6 }}/>
)}
</Form.Item>
<button style={{width:"100px"}} onClick={submit} className="but25">确定</button>
<button style={{width:"100px", height: '36px'}} onClick={submit} className="but25">确定</button>
</Form>
</div>
)

View File

@ -15,6 +15,10 @@ function SSH(props) {
const [ visibleDesc , setVisibleDesc ] = useState(false);
const [ content , setContent ] = useState(undefined);
useEffect(()=>{
document.title = 'SSH密钥';
}, [])
useEffect(()=>{
Init();
},[page])

View File

@ -9,6 +9,14 @@ function Main(props){
const { current_user , resetUserInfo, projectDetail, showNotification } = props;
useEffect(()=>{
//
if(projectDetail){
const { author, name} = projectDetail;
document.title = `服务-${author.name}/${name}`;
}
}, [projectDetail])
useEffect(()=>{
if(current_user && !current_user.login){
props.history.push(`/login?go_page=/${owner}/${projectsId}/service`);

View File

@ -63,6 +63,10 @@ function Data(props) {
useEffect(() => {
if(projectDetail){
//
const { author, name} = projectDetail;
document.title = `codeanalysis-${author.name}/${name}`;
if(projectDetail.forked_from_project_id){
history.go(-1);
}else{

View File

@ -28,6 +28,15 @@ function Reposyncer(propsF){
const { owner , projectsId } = propsF.match.params;
const [storeDetail, setStoreDetail] = useState(null);
const { projectDetail } = propsF;
useEffect(()=>{
//
if(projectDetail){
const { author, name} = projectDetail;
document.title = `reposyncer-${author.name}/${name}`;
}
}, [projectDetail])
useEffect(()=>{
//

View File

@ -32,6 +32,12 @@ export default ((props)=>{
const { projectsId , owner } = props.match.params;
const projectDetail = props.projectDetail;
useEffect(()=>{
if(projectDetail && document.title.indexOf('分支设置-') === -1){
const { author, name} = projectDetail;
document.title = `分支设置-${author.name}/${name}`;
}
}, [projectDetail])
useEffect(()=>{
if(owner){

View File

@ -5,7 +5,7 @@ import { Cancel } from "../Component/layout";
import axios from "axios";
export default Form.create()(
forwardRef(({ form, match, history , showNotification }) => {
forwardRef(({ form, match, history , showNotification, projectDetail }) => {
const [ protect , setProtect ] = useState(false);
const [ protects , setProtects ] = useState(false);
const [ mergeOptions , setMergeOptions ] = useState(undefined);
@ -31,6 +31,13 @@ export default Form.create()(
}
},[]);
useEffect(()=>{
if(projectDetail && document.title.indexOf('分支设置-') === -1){
const { author, name} = projectDetail;
document.title = `分支设置-${author.name}/${name}`;
}
}, [projectDetail])
function getGuardDetail(owner,projectsId,branch){
const url = `/${owner}/${projectsId}/protected_branches/${branch}/edit.json`;
axios.get(url).then((result)=>{

View File

@ -1,4 +1,4 @@
import React, { useState , useRef } from "react";
import React, { useState , useRef, useEffect } from "react";
import {WhiteBack} from '../Component/layout';
import AddMember from '../Component/AddMember';
import AddGroup from '../Component/AddGroup';
@ -13,9 +13,17 @@ function Collaborator(props){
const [ addOperation , setAddOperation] = useState(true);
const [ newGroupId , setNewGroupId] = useState(undefined);
const {projectsId ,owner} = props.match.params;
const {projectDetail} = props;
const author = props && props.projectDetail && props.projectDetail.author;
useEffect(()=>{
if(projectDetail && document.title.indexOf('成员管理-') === -1){
const { author, name} = projectDetail;
document.title = `成员管理-${author.name}/${name}`;
}
}, [projectDetail])
function getID(id){
setNewId(id);
setNewIdFlag(!newIdFlag);

View File

@ -37,17 +37,28 @@ class Setting extends Component {
}
componentDidUpdate=(prevPros)=>{
this.updateDocumentTitle();
if(prevPros && this.props && !this.props.checkIfLogin()){
this.props.history.push("/403")
return;
}
}
componentDidMount = () => {
this.updateDocumentTitle();
this.getCategory();
this.getLanguage();
this.getInfo();
};
// 更新网页标题
updateDocumentTitle(){
const {projectDetail} = this.props;
if(projectDetail && document.title.indexOf('基本设置-') === -1){
const { author, name} = projectDetail;
document.title = `基本设置-${author.name}/${name}`;
}
}
getLanguage = () => {
const url = `/project_languages.json`;
axios

View File

@ -19,6 +19,14 @@ function Index(props) {
const [ totalByUserCreate, setTotalByUserCreate] = useState(undefined);
const { owner , projectsId } = props.match.params;
const { projectDetail } = props;
useEffect(()=>{
if(projectDetail && document.title.indexOf('网络钩子-') === -1){
const { author, name} = projectDetail;
document.title = `网络钩子-${author.name}/${name}`;
}
}, [projectDetail])
useEffect(()=>{
if(owner && projectsId){

View File

@ -12,7 +12,7 @@ import './Index.scss';
const eventArray = [
"create","delete","push","pull_request_assign","pull_request_review","pull_request_only"
]
function New({ form , match , showNotification , history }) {
function New({ form , match , showNotification , history, projectDetail }) {
const [ httpValue , setHttpValue ] = useState("POST");
const [ posthttpValue , setPostHttpValue ] = useState("json");
const [ condition , setCondition ] = useState("push");
@ -24,6 +24,13 @@ function New({ form , match , showNotification , history }) {
const { getFieldDecorator, validateFields , setFieldsValue } = form;
const { id , owner , projectsId } = match.params;
useEffect(()=>{
if(projectDetail && document.title.indexOf('网络钩子-') === -1){
const { author, name} = projectDetail;
document.title = `网络钩子-${author.name}/${name}`;
}
}, [projectDetail])
function compareArray(params) {
if(params && params.length > 0){
if(params.length === 1 && params[0] === "push"){

View File

@ -50,6 +50,7 @@ class NewTags extends Component {
};
}
componentDidUpdate=(prevPros)=>{
this.updateDocumentTitle();
if(prevPros && this.props && !this.props.checkIfLogin()){
this.props.history.push("/403")
return
@ -57,8 +58,18 @@ class NewTags extends Component {
}
componentDidMount = () => {
this.getList();
this.updateDocumentTitle();
};
// 更新网页标题
updateDocumentTitle(){
const {projectDetail} = this.props;
if(projectDetail){
const { author, name} = projectDetail;
document.title = `项目标记-${author.name}/${name}`;
}
}
getList = (page, order_name, order_type) => {
this.setState({
isSpin:true

View File

@ -1,4 +1,4 @@
import React from 'react';
import React, { useEffect } from 'react';
import { TPMIndexHOC } from '../../modules/tpm/TPMIndexHOC';
import head from './image/head.png';
import img1 from './image/img1.png';
@ -20,6 +20,9 @@ import img19 from './image/49.png';
import './Teaching.scss';
function Teaching(){
useEffect(()=>{
document.title="教学实践";
},[])
return(
<div className="teaching">
<div className="tea_head">

View File

@ -19,6 +19,7 @@ const Div = styled.div`{
}`
const Imgs = styled.img`{
width:60px;
height: 60px;
margin-right:12px;
border-radius:50%;
}`

View File

@ -25,7 +25,7 @@ export default ((props) => {
const [ members , setMembers ] = useState(undefined);
const [ group , setGroup ] = useState(undefined);
const { OIdentifier, groupId } = props.match.params;
const { current_user } = props;
const { current_user, organizeDetail } = props;
useEffect(()=>{
if(groupId){
@ -42,6 +42,13 @@ export default ((props) => {
}).catch(error=>{})
}
useEffect(()=>{
if(group && organizeDetail){
const {nickname} = organizeDetail;
document.title = `${group.nickname}-${nickname}`
}
}, [organizeDetail, group])
useEffect(()=>{
if(nav === "0"){
getMember(OIdentifier, groupId,page);

View File

@ -1,7 +1,19 @@
import React from 'react';
import React, { useEffect } from 'react';
import GroupFrom from './GroupForm'
import axios from 'axios';
function GropNew(props){
const OIdentifier = props.match.params.OIdentifier;
//
useEffect(()=>{
OIdentifier && axios.get(`/organizations/${OIdentifier}.json`).then(result=>{
if(result && result.data){
const {nickname} = result.data;
document.title = `新建团队-${nickname}`
}
}).catch(error=>{})
},[OIdentifier])
return(
<div className="teamDetail">
<GroupFrom {...props}></GroupFrom>

View File

@ -23,6 +23,14 @@ function List(props){
const OIdentifier = props.match.params.OIdentifier;
const organizeDetail = props.organizeDetail;
useEffect(()=>{
if(organizeDetail){
//
const {nickname} = organizeDetail;
document.title = `${nickname}`
}
},[organizeDetail])
useEffect(()=>{
if(OIdentifier){
setIsSpin(true);

View File

@ -58,6 +58,7 @@ export default Form.create()(
}
useEffect(()=>{
document.title = '新建组织';
setFieldsValue({
visibility:"common"
})

View File

@ -27,6 +27,14 @@ const Hooks = Loadable({
export default (( props )=>{
const pathname = props.location.pathname;
const OIdentifier = props.match.params.OIdentifier;
const {organizeDetail} = props;
useEffect(()=>{
if(organizeDetail){
const {nickname} = organizeDetail;
document.title = `组织设置-${nickname}`
}
}, [organizeDetail])
function returnActive (pathname){
let a = 0;

View File

@ -114,7 +114,7 @@ function Detail(props){
<Route
path="/:OIdentifier/teams/:groupId"
render={(p) => {
return <GroupDetails {...props} {...p} group={detail}/>
return <GroupDetails {...props} {...p} organizeDetail={detail}/>
}}
></Route>
{/* 组织成员 */}

View File

@ -44,6 +44,13 @@ export default ((props)=>{
}
}).catch(error=>{})
}
useEffect(()=>{
if(detail){
const {nickname, organization} = detail;
document.title = `团队设置-${nickname}-${organization.nickname}`
}
}, [detail])
return(
<div className="teamDetail" style={{paddingTop:"0px"}}>
<div>

View File

@ -1,9 +1,18 @@
import React from 'react';
import React, {useEffect} from 'react';
import { Banner } from '../Component/layout';
import GroupItems from './TeamGroupItems';
const limit = 14;
function TeamGroup({organizeDetail,history,current_user}){
useEffect(()=>{
if(organizeDetail){
//
const {nickname} = organizeDetail;
document.title = `组织团队-${nickname}`
}
},[organizeDetail])
return(
<div style={{background:"#fff",marginBottom:"30px",border:'1px solid #eee'}}>
<Banner>组织团队</Banner>

View File

@ -20,6 +20,14 @@ function TeamMember({organizeDetail,current_user,history,match}){
}
},[organizeDetail,page]);
useEffect(()=>{
if(organizeDetail){
//
const {nickname} = organizeDetail;
document.title = `组织成员-${nickname}`
}
},[organizeDetail])
function getData(){
setIsSpin(true);
const url = `/organizations/${organizeDetail.id}/organization_users.json`;

View File

@ -1,8 +1,5 @@
import React, { Component } from "react";
import { Upload, Icon } from "antd";
import { getUploadActionUrl, appendFileSizeToUploadFileAll } from "educoder";
import axios from "axios";
const { Dragger } = Upload;
class Read extends Component {
constructor(props) {
@ -22,57 +19,43 @@ class Read extends Component {
});
};
handleChange = (info) => {
let reader = new FileReader();
reader.readAsText(info.fileList[0].originFileObj, "UTF-8");
reader.onload = (e) => {
this.state.fileContent = e.target.result;
this.props.load && this.props.load(this.state);
};
};
beforeUpload = (file) => {
const forbidden_type = [
"jpg",
"jpeg",
"png",
"ico",
"bmp",
"gif",
"pdf",
"csv",
"xlsx",
"xls",
"tif",
"svg",
"psd",
"cdr",
"webp",
"vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"vnd.ms-powerpoint",
"vnd.openxmlformats-officedocument.presentationml.presentation",
"vnd.ms-excel"
];
const { fileList } = this.state;
const { size } = this.props;
const isLt100M = file.size / 1024 / 1024 < size;
const file_type = file.type.split("/").slice(-1)[0];
if (fileList && fileList.length > 0) {
this.props.showNotification("文件已存在, 请删除后再上传");
return false;
} else if (!isLt100M) {
this.props.showNotification(`文件大小必须小于${size}MB!`);
} else if (file_type && forbidden_type.indexOf(file_type) !== -1) {
this.props.showNotification(`仅支持文本格式,不支持图片,excel等不可以txt读取的文件`);
return false;
} else {
this.setState({
fileList: [file],
fileName: file.name,
})
}
return false;
};
// 上传 文件转base64
customRequest = (option) =>{
const formData = new FormData();
formData.append('files[]', option.file);
const reader = new FileReader();
reader.readAsDataURL(option.file);
const {load} = this.props;
reader.onloadend = function(e){
if(e.target.result){
option.onSuccess();
const base64 = e.target.result.substring(e.target.result.indexOf('base64')+7, e.target.result.length);
load({
fileName: option.file.name,
fileContent: base64
});
}
}
}
render() {
//判断是否已经提交,如已提交评论则上一条评论数据清除
const { icon, size } = this.props;
@ -80,10 +63,10 @@ class Read extends Component {
const upload = {
name: "file",
fileList: fileList,
onChange: this.handleChange,
customRequest: this.customRequest,
onRemove: this.onAttachmentRemove,
beforeUpload: this.beforeUpload
};
beforeUpload: this.beforeUpload,
};
return (
<Dragger {...upload} className={this.props.className}>
@ -95,9 +78,9 @@ class Read extends Component {
<p className="ant-upload-text">
拖动文件或<span className="color-blue">点击此处上传</span>
</p>
<p className="mt10">
{/* <p className="mt10">
暂仅支持文本格式不支持图片,excel等不可以txt读取的文件
</p>
</p> */}
<p className="mt10">
文件名请使用英文且不得超过{size}MB
</p>

View File

@ -19,8 +19,21 @@ class ForkUsers extends Component {
componentDidMount = () => {
this.getUsersList();
this.updateTitle();
};
componentDidUpdate=()=>{
this.updateTitle();
}
updateTitle=()=>{
const {projectDetail} = this.props;
if(projectDetail){
const {author, name} = projectDetail;
document.title = `Fork用户-${author.name}/${name}`
}
}
getUsersList = (page, limit) => {
this.setState({
isSpin: true,

View File

@ -1,7 +1,21 @@
import React, { Component } from "react";
import CommonUsers from "./common_users"
class PraiseUsers extends Component {
componentDidMount=()=>{
this.updateTitle();
}
componentDidUpdate=()=>{
this.updateTitle();
}
updateTitle=()=>{
const {projectDetail} = this.props;
if(projectDetail){
const {author, name} = projectDetail;
document.title = `点赞用户-${author.name}/${name}`
}
}
render() {
const { owner , projectsId } = this.props.match.params;
return (

View File

@ -1,6 +1,21 @@
import React, { Component } from "react";
import CommonUsers from "./common_users"
class WatchUsers extends Component {
componentDidMount=()=>{
this.updateTitle();
}
componentDidUpdate=()=>{
this.updateTitle();
}
updateTitle=()=>{
const {projectDetail} = this.props;
if(projectDetail){
const {author, name} = projectDetail;
document.title = `关注用户-${author.name}/${name}`
}
}
render() {
const { owner , projectsId } = this.props.match.params;
return (

View File

@ -25,6 +25,16 @@ export default Form.create()(({ form, history, showNotification, projectDetail,
const [modal, setModal] = useState(false);
const [modalType, setModalType] = useState();
useEffect(()=>{
if(projectDetail){
const { author, name} = projectDetail;
if(wikiName){
document.title = `编辑${wikiName}-维基-${author.name}/${name}`;
}else{
document.title = `新建维基-${author.name}/${name}`;
}
}
}, [projectDetail, wikiName])
useEffect(() => {
wikiName && project && getWiki({

View File

@ -31,6 +31,17 @@ export default (props) => {
const [urlType, setUrlType] = useState('HTTPS');
useEffect(()=>{
if(projectDetail){
const { author, name} = projectDetail;
if(Object.keys(checkItem).length === 0){
document.title = `维基-${author.name}/${name}`;
}else{
document.title = `${checkItem.name}-维基-${author.name}/${name}`;
}
}
}, [projectDetail, checkItem])
// wiki
useEffect(() => {
project && wikiPages({

View File

@ -18,15 +18,18 @@ export default (props) => {
let projectName = match.params.projectName;
let projectId = match.params.projectId;
console.log('projectName:');
console.log(projectName);
const [checkItem, setCheckItem] = useState({});
const [itemDetail, setItemDetail] = useState({});
const [fileArr, setFileArr] = useState([]);
const [urlType, setUrlType] = useState('HTTPS');
useEffect(()=>{
if(checkItem){
document.title = `${checkItem.name}-维基预览`
}
}, [checkItem, projectDetail])
useEffect(() => {
projectsId && wikiPages({
owner: owner,
@ -99,7 +102,7 @@ export default (props) => {
<span className="copy-desc">克隆地址</span>
{
checkItem.wiki_clone_link && <InputGroup className="copy-url" compact>
<Select dropdownClassName="wiki-url-type" defaultValue="HTTPS" onChange={(v) => { console.log(v); setUrlType(v) }}>
<Select dropdownClassName="wiki-url-type" defaultValue="HTTPS" onChange={(v) => { setUrlType(v) }}>
<Option value="HTTPS">HTTPS</Option>
<Option value="SSH">SSH</Option>
</Select>

View File

@ -32,7 +32,18 @@ function Index(props) {
const username = props.match.params.username;
const current_user = props.current_user;
const user = props.user;
const {menuKey, user} = props;
useEffect(()=>{
if(user){
const {username, login} = user;
if(menuKey === '0'){
document.title = `${username}(${login})`
}else{
document.title = `个人简介-${username}/${login}`
}
}
},[menuKey])
useEffect(()=>{
if(user){
@ -97,7 +108,7 @@ function Index(props) {
}).catch(error=>{})
}
return(
props && props.menuKey === "0" ?
menuKey && menuKey === "0" ?
<div>
<div>
<ConcentrateProject

View File

@ -147,7 +147,7 @@ class Infos extends Component {
});
const { pathname } = this.props.location;
this.renderPath(pathname,result.data);
document.title = result.data.username+'('+ username +')';
document.title = result.data.username ? result.data.username : username;
})
.catch((error) => {
this.setState({

View File

@ -25,10 +25,12 @@ class InfosUser extends Component {
}
componentDidMount = () => {
this.updateTitle();
this.get_projects();
};
componentDidUpdate = (prevProps) => {
this.updateTitle();
const { username } = this.props.match.params;
const prevUser = prevProps.match.params.username;
if (prevProps.project_type !== this.props.project_type || (prevUser && username && prevUser !== username)) {
@ -36,6 +38,15 @@ class InfosUser extends Component {
}
};
// 更改网页标题
updateTitle=()=>{
const {user} = this.props;
if(user){
const {username, login} = user;
document.title = `参与项目-${username}/${login}`
}
}
get_projects = (isPublic) => {
const { username } = this.props.match.params;
const { project_type } = this.props;

View File

@ -13,6 +13,10 @@ export default Form.create()(
// const { username } = props && props.match && props.match.params;
const { resetUserInfo , current_user } = props;
useEffect(()=>{
document.title="基本资料"
}, [])
useEffect(()=>{
if(current_user && current_user.login){
setFieldsValue({

View File

@ -24,6 +24,7 @@ export default Form.create()(
useEffect(()=>{
setPassMap({password: undefined, email: undefined, code: undefined});
setUpdatePsdMap({oldPassword: undefined, password: undefined, password1: undefined});
document.title = type === '0' ? '邮箱管理' : type === '1' ? '密码管理' : type === '2' ? '账号注销' : '手机号管理';
}, type)
function submit() {

View File

@ -30,11 +30,19 @@ function Index(props) {
const [ cData, setCData ] = useState(undefined);
const [ cloudData, setCloudData ] = useState(undefined);
const {user} = props;
const disabledDate = current => {
return current && current > moment().endOf('day');
};
useEffect(()=>{
if(user){
const {username, login} = user;
document.title = `数据统计-${username}/${login}`
}
}, [])
//
useEffect(()=>{
getRoleSta();

View File

@ -17,6 +17,16 @@ function Team(props){
const [ search ,setSearch ] = useState(undefined);
const { checkIfLogin , showLoginDialog , current_user } = props;
const { username } = props.match.params;
const {user} = props;
useEffect(()=>{
if(user){
//
const {username, login} = user;
document.title = `参与组织-${username}/${login}`;
}
},[user])
useEffect(()=>{
if(username){
getList(search);

View File

@ -7,6 +7,15 @@ import CIList from './CIList';
function DevOpsCI(props){
const [ selectKey , setSelectKey ] = useState("dispose");
const {user} = props;
useEffect(()=>{
if(user){
//
const {username, login} = user;
document.title = `DevOps引擎-${username}/${login}`;
}
},[user])
function changeKeys(e){
setSelectKey(e.key);

View File

@ -103,6 +103,10 @@ const Glcc = (propsF) => {
const [checkedTaskId, setCheckedTaskId] = useState(undefined);
const [studentRegId, setStudentRegId] = useState(undefined);
useEffect(()=>{
document.title='开源夏令营';
}, [])
useEffect(()=>{
//
current_user && current_user.login && getStudentApplyInfo({userId: current_user.user_id}).then(response=>{

View File

@ -18,14 +18,19 @@ function Index(props) {
const [ bannerTab , setBannerTab ] = useState(undefined);
const register = props && props.mygetHelmetapi && props.mygetHelmetapi.common && props.mygetHelmetapi.common.register;
const {mygetHelmetapi:{name}} = props
const { current_user } = props;
useEffect(()=>{
window.addEventListener("scroll",scrollListener);
getTab();
return ComponentWillUnmount;
},[])
useEffect(()=>{
name && (document.title = name)
}, [name])
function ComponentWillUnmount() {
window.removeEventListener("scroll",scrollListener);
}

View File

@ -512,7 +512,6 @@ class NewHeader extends Component {
//获取数据的时候
gettablogourldata = (response) => {
document.title = response.data.setting.name;
var link = document.createElement('link'),
oldLink = document.getElementById('dynamic-favicon');
link.id = 'dynamic-favicon';

View File

@ -83,7 +83,6 @@ export function TPMIndexHOC(WrappedComponent) {
this.setState({
mygetHelmetapi: undefined
});
document.title = "Forge";
var link = document.createElement('link'),
oldLink = document.getElementById('dynamic-favicon');
link.id = 'dynamic-favicon';
@ -97,7 +96,6 @@ export function TPMIndexHOC(WrappedComponent) {
//获取数据的时候
gettablogourldata = (response) => {
document.title = response.data.setting.name;
var link = document.createElement('link'),
oldLink = document.getElementById('dynamic-favicon');
link.id = 'dynamic-favicon';