Просмотр исходного кода

Merge branch 'main' into imprv/download-path

jam411 3 лет назад
Родитель
Сommit
7225fd93bf

+ 1 - 1
packages/app/src/components/Admin/Common/AdminNavigation.jsx

@@ -38,7 +38,7 @@ const AdminNavigation = (props) => {
         { t('full_text_search_management.full_text_search_management') }</>;
         { t('full_text_search_management.full_text_search_management') }</>;
       // TODO: Consider where to place the "AuditLog"
       // TODO: Consider where to place the "AuditLog"
       case 'audit-log':                return <><i className="icon-fw icon-feed"></i>            { t('audit_log_management.audit_log')}</>;
       case 'audit-log':                return <><i className="icon-fw icon-feed"></i>            { t('audit_log_management.audit_log')}</>;
-      case 'plugins-extention':        return <><i className="icon-fw icon-cloud-download"></i>  { t('plugins-extention.title')}</>;
+      case 'plugins-extention':        return <><i className="icon-fw fa fa-plug"></i>           Plugins Extention </>;
       case 'cloud':                    return <><i className="icon-fw icon-share-alt"></i>       { t('to_cloud_settings')} </>;
       case 'cloud':                    return <><i className="icon-fw icon-share-alt"></i>       { t('to_cloud_settings')} </>;
       default:                         return <><i className="icon-fw icon-home"></i>            { t('wiki_management_home_page') }</>;
       default:                         return <><i className="icon-fw icon-home"></i>            { t('wiki_management_home_page') }</>;
       /* eslint-enable no-multi-spaces */
       /* eslint-enable no-multi-spaces */

+ 43 - 12
packages/app/src/components/Admin/PluginsExtension/PluginCard.tsx

@@ -1,14 +1,36 @@
-import { faCircleArrowDown, faCircleCheck } from '@fortawesome/free-solid-svg-icons';
-import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
+// import { faCircleArrowDown, faCircleCheck } from '@fortawesome/free-solid-svg-icons';
+// import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
+import { useState } from 'react';
+
 import Image from 'next/image';
 import Image from 'next/image';
 import Link from 'next/link';
 import Link from 'next/link';
 
 
 import { SearchResultItem } from '~/models/SearchResultItem';
 import { SearchResultItem } from '~/models/SearchResultItem';
 
 
-export const PluginCard = (props: SearchResultItem) => {
+
+type Props = {
+  name: string,
+  url: string,
+  description: string,
+}
+
+export const PluginCard = (props: Props) => {
+  // const {
+  //   name, fullName, description, htmlUrl, topics, stargazersCount, owner,
+  // } = props;
   const {
   const {
-    name, full_name, description, html_url, topics, stargazers_count, owner,
+    name, url, description,
   } = props;
   } = props;
+  const [isEnabled, setIsEnabled] = useState(true);
+
+  const updateCheckboxHandler = (event: { target: { checked: boolean }; }) => {
+    if (isEnabled === true) {
+      setIsEnabled(true);
+    }
+    else {
+      setIsEnabled(false);
+    }
+  };
 
 
   return (
   return (
     <div className="card shadow border-0" key={name}>
     <div className="card shadow border-0" key={name}>
@@ -16,38 +38,47 @@ export const PluginCard = (props: SearchResultItem) => {
         <div className="row mb-3">
         <div className="row mb-3">
           <div className="col-9">
           <div className="col-9">
             <h2 className="card-title h3 border-bottom pb-2 mb-3">
             <h2 className="card-title h3 border-bottom pb-2 mb-3">
-              <Link href={`/${full_name}`}>{name}</Link>
+              <Link href={`${url}`}>{name}</Link>
             </h2>
             </h2>
             <p className="card-text text-muted">{description}</p>
             <p className="card-text text-muted">{description}</p>
           </div>
           </div>
           <div className="col-3">
           <div className="col-3">
-            <Image className="mx-auto" alt="GitHub avator image" src={owner.avatar_url} width={250} height={250} />
+            <div className="custom-control custom-switch custom-switch-lg custom-switch-slack">
+              <input
+                type="checkbox"
+                className="custom-control-input border-0"
+                checked={isEnabled}
+                onChange={updateCheckboxHandler}
+              />
+              <label className="custom-control-label align-center"></label>
+            </div>
+            {/* <Image className="mx-auto" alt="GitHub avator image" src={owner.avatar_url} width={250} height={250} /> */}
           </div>
           </div>
         </div>
         </div>
         <div className="row">
         <div className="row">
           <div className="col-12 d-flex flex-wrap gap-2">
           <div className="col-12 d-flex flex-wrap gap-2">
-            {topics?.map((topic: string) => {
+            {/* {topics?.map((topic: string) => {
               return (
               return (
                 <span key={`${name}-${topic}`} className="badge rounded-1 mp-bg-light-blue text-dark fw-normal">
                 <span key={`${name}-${topic}`} className="badge rounded-1 mp-bg-light-blue text-dark fw-normal">
                   {topic}
                   {topic}
                 </span>
                 </span>
               );
               );
-            })}
+            })} */}
           </div>
           </div>
         </div>
         </div>
       </div>
       </div>
       <div className="card-footer px-5 border-top-0 mp-bg-light-blue">
       <div className="card-footer px-5 border-top-0 mp-bg-light-blue">
         <p className="d-flex justify-content-between align-self-center mb-0">
         <p className="d-flex justify-content-between align-self-center mb-0">
           <span>
           <span>
-            {owner.login === 'weseek' ? <FontAwesomeIcon icon={faCircleCheck} className="me-1 text-primary" /> : <></>}
+            {/* {owner.login === 'weseek' ? <FontAwesomeIcon icon={faCircleCheck} className="me-1 text-primary" /> : <></>}
 
 
             <a href={owner.html_url} target="_blank" rel="noreferrer">
             <a href={owner.html_url} target="_blank" rel="noreferrer">
               {owner.login}
               {owner.login}
-            </a>
+            </a> */}
           </span>
           </span>
-          <span>
+          {/* <span>
             <FontAwesomeIcon icon={faCircleArrowDown} className="me-1" /> {stargazersCount}
             <FontAwesomeIcon icon={faCircleArrowDown} className="me-1" /> {stargazersCount}
-          </span>
+          </span> */}
         </p>
         </p>
       </div>
       </div>
     </div>
     </div>

+ 3 - 3
packages/app/src/components/Admin/PluginsExtension/PluginInstallerForm.tsx

@@ -10,7 +10,7 @@ import AdminInstallButtonRow from '../Common/AdminUpdateButtonRow';
 // TODO: i18n
 // TODO: i18n
 
 
 export const PluginInstallerForm = (): JSX.Element => {
 export const PluginInstallerForm = (): JSX.Element => {
-  const { t } = useTranslation('admin');
+  // const { t } = useTranslation('admin');
 
 
   const submitHandler = useCallback(async(e) => {
   const submitHandler = useCallback(async(e) => {
     e.preventDefault();
     e.preventDefault();
@@ -31,13 +31,13 @@ export const PluginInstallerForm = (): JSX.Element => {
 
 
     try {
     try {
       await apiv3Post('/plugins-extention', { pluginInstallerForm });
       await apiv3Post('/plugins-extention', { pluginInstallerForm });
-      toastSuccess(t('toaster.update_successed', { target: t('app_settings') }));
+      toastSuccess('Plugin Install Successed!');
     }
     }
     catch (err) {
     catch (err) {
       toastError(err);
       toastError(err);
       // logger.error(err);
       // logger.error(err);
     }
     }
-  }, [t]);
+  }, []);
 
 
   return (
   return (
     <form role="form" onSubmit={submitHandler}>
     <form role="form" onSubmit={submitHandler}>

+ 16 - 1
packages/app/src/components/Admin/PluginsExtension/PluginsExtensionPageContents.tsx

@@ -22,7 +22,7 @@ export const PluginsExtensionPageContents = (): JSX.Element => {
 
 
       <div className="row mb-5">
       <div className="row mb-5">
         <div className="col-lg-12">
         <div className="col-lg-12">
-          <h2 className="admin-setting-header">Plugins Installer</h2>
+          <h2 className="admin-setting-header">Plugin Installer</h2>
           <PluginInstallerForm />
           <PluginInstallerForm />
         </div>
         </div>
       </div>
       </div>
@@ -31,6 +31,21 @@ export const PluginsExtensionPageContents = (): JSX.Element => {
         <div className="col-lg-12">
         <div className="col-lg-12">
           <h2 className="admin-setting-header">Plugins</h2>
           <h2 className="admin-setting-header">Plugins</h2>
           <div className="d-grid gap-5">
           <div className="d-grid gap-5">
+            <PluginCard
+              name={'growi-plugin-templates-for-office'}
+              url={'https://github.com/weseek/growi-plugin-templates-for-office'}
+              description={'growi-plugin-templates-for-office'}
+            />
+            <PluginCard
+              name={'growi-plugin-theme-welcome-to-fumiya-room'}
+              url={'https://github.com/weseek/growi-plugin-theme-welcome-to-fumiya-room'}
+              description={'growi-plugin-theme-welcome-to-fumiya-room'}
+            />
+            <PluginCard
+              name={'growi-plugin-copy-code-to-clipboard'}
+              url={'https://github.com/weseek/growi-plugin-copy-code-to-clipboard'}
+              description={'growi-plugin-copy-code-to-clipboard'}
+            />
             {/* {data?.items.map((item: SearchResultItem) => {
             {/* {data?.items.map((item: SearchResultItem) => {
               return <PluginCard key={item.name} {...item} />;
               return <PluginCard key={item.name} {...item} />;
             })} */}
             })} */}

+ 2 - 2
packages/app/src/components/Layout/BasicLayout.tsx

@@ -3,7 +3,7 @@ import React, { ReactNode } from 'react';
 import dynamic from 'next/dynamic';
 import dynamic from 'next/dynamic';
 
 
 import { GrowiNavbar } from '../Navbar/GrowiNavbar';
 import { GrowiNavbar } from '../Navbar/GrowiNavbar';
-// import Sidebar from '../Sidebar';
+import Sidebar from '../Sidebar';
 
 
 import { RawLayout } from './RawLayout';
 import { RawLayout } from './RawLayout';
 
 
@@ -43,7 +43,7 @@ export const BasicLayout = ({
 
 
       <div className="page-wrapper d-flex d-print-block">
       <div className="page-wrapper d-flex d-print-block">
         <div className="grw-sidebar-wrapper">
         <div className="grw-sidebar-wrapper">
-          {/* <Sidebar /> */}
+          <Sidebar />
         </div>
         </div>
 
 
         <div className="flex-fill mw-0" style={{ position: 'relative' }}>
         <div className="flex-fill mw-0" style={{ position: 'relative' }}>

+ 3 - 4
packages/app/src/components/PageEditor/EditorIcon.jsx

@@ -141,11 +141,10 @@ const EditorIcon = (props) => {
         </svg>
         </svg>
       );
       );
     case 'Template':
     case 'Template':
-      // TODO: Fix template icon
+      // TODO: fix
       return (
       return (
-        <svg xmlns="http://www.w3.org/2000/svg" height="30" viewBox="0 0 30 30">
-          <rect fillOpacity="0" width="30" height="30" />
-          <path d="M9.71,22.5a2.57,2.57,0,0,1-1.85-.79,2.79,2.79,0,0,1,0-4l9-9.23a3.21,3.21,0,0,1,1.59-.87,3.39,3.39,0,0,1,1.81.1,4.38,4.38,0,0,1,1.7,1.05,4.15,4.15,0,0,1,.46.56,3.73,3.73,0,0,1,.35.65,4.25,4.25,0,0,1,.2.72,3.91,3.91,0,0,1,.07.76,3.71,3.71,0,0,1-1.12,2.67l-6.79,7a.48.48,0,0,1-.34.16.51.51,0,0,1-.35-.13.48.48,0,0,1,0-.7l6.78-7a2.8,2.8,0,0,0,.84-2,2.58,2.58,0,0,0-.79-2,3.63,3.63,0,0,0-1.11-.75,2.41,2.41,0,0,0-1.31-.17,2.19,2.19,0,0,0-1.25.62l-9,9.22A1.8,1.8,0,0,0,8,19.69,1.78,1.78,0,0,0,8.58,21a1.81,1.81,0,0,0,.57.39,1.48,1.48,0,0,0,.66.1,2,2,0,0,0,1.28-.62l7.12-7.35.15-.16a1.15,1.15,0,0,0,.15-.2.9.9,0,0,0,.12-.24,1.17,1.17,0,0,0,.07-.25.52.52,0,0,0-.05-.27.75.75,0,0,0-.19-.26.73.73,0,0,0-.58-.27,1.29,1.29,0,0,0-.67.38l-5.36,5.53a.5.5,0,0,1-.22.13.46.46,0,0,1-.26,0,.48.48,0,0,1-.22-.12A.41.41,0,0,1,11,17.5a.5.5,0,0,1,.14-.35L16.5,11.6a2.19,2.19,0,0,1,1.29-.67,1.69,1.69,0,0,1,1.37.55,1.54,1.54,0,0,1,.53,1.31,2.26,2.26,0,0,1-.76,1.42L11.8,21.58a3.06,3.06,0,0,1-2,.91H9.71Z" />
+        <svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" fill="currentColor" className="bi bi-filetype-md" viewBox="-2 -3 28 21">
+          <path fillRule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2H9v-1h3a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5ZM.706 13.189v2.66H0V11.85h.806l1.14 2.596h.026l1.14-2.596h.8v3.999h-.716v-2.66h-.038l-.946 2.159h-.516l-.952-2.16H.706Zm3.919 2.66V11.85h1.459c.406 0 .741.078 1.005.234.263.157.46.383.589.68.13.297.196.655.196 1.075 0 .422-.066.784-.196 1.084-.131.301-.33.53-.595.689-.264.158-.597.237-1 .237H4.626Zm1.353-3.354h-.562v2.707h.562c.186 0 .347-.028.484-.082a.8.8 0 0 0 .334-.252 1.14 1.14 0 0 0 .196-.422c.045-.168.067-.365.067-.592a2.1 2.1 0 0 0-.117-.753.89.89 0 0 0-.354-.454c-.159-.102-.362-.152-.61-.152Z"/>
         </svg>
         </svg>
       );
       );
   }
   }

+ 8 - 3
packages/app/src/models/SearchResultItem.ts

@@ -1,10 +1,15 @@
 export type SearchResultItem = {
 export type SearchResultItem = {
   id: number,
   id: number,
   name: string,
   name: string,
-  full_name: string,
-  html_url: string,
+  owner: {
+    login: string,
+    html_url: string,
+    avatar_url: string,
+  },
+  fullName: string,
+  htmlUrl: string,
   description: string,
   description: string,
   topics: string[],
   topics: string[],
   homepage: string,
   homepage: string,
-  stargazers_count: number,
+  stargazersCount: number,
 }
 }

+ 7 - 7
packages/app/src/pages/[[...path]].page.tsx

@@ -20,7 +20,7 @@ import superjson from 'superjson';
 // import { Comments } from '~/components/Comments';
 // import { Comments } from '~/components/Comments';
 // import { PageAlerts } from '~/components/PageAlert/PageAlerts';
 // import { PageAlerts } from '~/components/PageAlert/PageAlerts';
 // import { useTranslation } from '~/i18n';
 // import { useTranslation } from '~/i18n';
-// import { CurrentPageContentFooter } from '~/components/PageContentFooter';
+import { CurrentPageContentFooter } from '~/components/PageContentFooter';
 // import { UsersHomePageFooterProps } from '~/components/UsersHomePageFooter';
 // import { UsersHomePageFooterProps } from '~/components/UsersHomePageFooter';
 import { CrowiRequest } from '~/interfaces/crowi-request';
 import { CrowiRequest } from '~/interfaces/crowi-request';
 // import { renderScriptTagByName, renderHighlightJsStyleTag } from '~/service/cdn-resources-loader';
 // import { renderScriptTagByName, renderHighlightJsStyleTag } from '~/service/cdn-resources-loader';
@@ -46,7 +46,7 @@ import loggerFactory from '~/utils/logger';
 
 
 // import GrowiSubNavigation from '../client/js/components/Navbar/GrowiSubNavigation';
 // import GrowiSubNavigation from '../client/js/components/Navbar/GrowiSubNavigation';
 // import GrowiSubNavigationSwitcher from '../client/js/components/Navbar/GrowiSubNavigationSwitcher';
 // import GrowiSubNavigationSwitcher from '../client/js/components/Navbar/GrowiSubNavigationSwitcher';
-// import { DescendantsPageListModal } from '../components/DescendantsPageListModal';
+import { DescendantsPageListModal } from '../components/DescendantsPageListModal';
 import { BasicLayout } from '../components/Layout/BasicLayout';
 import { BasicLayout } from '../components/Layout/BasicLayout';
 import GrowiContextualSubNavigation from '../components/Navbar/GrowiContextualSubNavigation';
 import GrowiContextualSubNavigation from '../components/Navbar/GrowiContextualSubNavigation';
 import DisplaySwitcher from '../components/Page/DisplaySwitcher';
 import DisplaySwitcher from '../components/Page/DisplaySwitcher';
@@ -324,18 +324,18 @@ const GrowiPage: NextPage<Props> = (props: Props) => {
               </div>
               </div>
             </div>
             </div>
           </div>
           </div>
-          {/* { !props.isIdenticalPathPage && !props.isNotFound && (
+          { !props.isIdenticalPathPage && !props.isNotFound && (
             <footer className="footer d-edit-none">
             <footer className="footer d-edit-none">
-              { pageWithMeta != null && !isTopPagePath && (<Comments pageId={pageId} revision={pageWithMeta.data.revision} />) }
+              {/* { pageWithMeta != null && !isTopPagePath && (<Comments pageId={pageId} revision={pageWithMeta.data.revision} />) }
               { pageWithMeta != null && isUsersHomePage(pageWithMeta.data.path) && (
               { pageWithMeta != null && isUsersHomePage(pageWithMeta.data.path) && (
                 <UsersHomePageFooter creatorId={pageWithMeta.data.creator._id}/>
                 <UsersHomePageFooter creatorId={pageWithMeta.data.creator._id}/>
-              ) }
+              ) } */}
               <CurrentPageContentFooter />
               <CurrentPageContentFooter />
             </footer>
             </footer>
-          )} */}
+          )}
 
 
           {/* <UnsavedAlertDialog /> */}
           {/* <UnsavedAlertDialog /> */}
-          {/* <DescendantsPageListModal /> */}
+          <DescendantsPageListModal />
           {/* {shouldRenderPutbackPageModal && <PutbackPageModal />} */}
           {/* {shouldRenderPutbackPageModal && <PutbackPageModal />} */}
         </div>
         </div>
       </BasicLayout>
       </BasicLayout>

+ 1 - 1
packages/app/src/pages/admin/[[...path]].page.tsx

@@ -181,7 +181,7 @@ const AdminMarkdownSettingsPage: NextPage<Props> = (props: Props) => {
       component: <AuditLogManagement />,
       component: <AuditLogManagement />,
     },
     },
     'plugins-extention': {
     'plugins-extention': {
-      title: t('plugins-extention.title'),
+      title: 'Plugins Extention',
       component: <PluginsExtensionPageContents />,
       component: <PluginsExtensionPageContents />,
     },
     },
   };
   };

+ 1 - 0
packages/app/src/server/crowi/index.js

@@ -27,6 +27,7 @@ import { InstallerService } from '../service/installer';
 import PageService from '../service/page';
 import PageService from '../service/page';
 import PageGrantService from '../service/page-grant';
 import PageGrantService from '../service/page-grant';
 import PageOperationService from '../service/page-operation';
 import PageOperationService from '../service/page-operation';
+// eslint-disable-next-line import/no-cycle
 import { PluginService } from '../service/plugin';
 import { PluginService } from '../service/plugin';
 import SearchService from '../service/search';
 import SearchService from '../service/search';
 import { SlackIntegrationService } from '../service/slack-integration';
 import { SlackIntegrationService } from '../service/slack-integration';