/**
* portal/sites/ui.mjs — 사이트 화면 HTML 뼈대(목록·생성·상세 탭·배포·배포 방식·외부 배포). 데이터는 /ui/sites/sites.js 가 /api/sites/* 로 채운다.
* 각 화면은 data-page 속성으로 스크립트가 어떤 화면인지 알고, 모든 화면에 공통 상태 패널(불러오는 중·비어 있음·지연·부분 실패·전체 실패·권한 없음)이 있다.
*/
import { esc } from '../../lib/http.mjs';
import { t } from '../../lib/i18n.mjs';
const TABS = ['overview', 'build', 'source', 'deploy', 'domains', 'mail', 'backup', 'usage', 'activity', 'settings'];
export function listPage(ctx, deps, { filter = '' } = {}) {
const filters = ['all', 'draft', 'building', 'deploying', 'live', 'paused', 'cancel_pending'].map((f) => `${esc(t('sites.filters.' + f))}`).join('');
return shell(ctx, deps, { title: t('sites.title'), nav: 'sites', crumbs: [{ label: t('nav.dashboard'), href: '/' }, { label: t('sites.title') }], actions: [{ label: t('sites.new'), href: '/sites/new', kind: 'primary' }], body: `
${filters}
${deps.statePanel('loading')}
` });
}
export function newPage(ctx, deps) {
return shell(ctx, deps, { title: t('sites.new'), nav: 'sites', crumbs: [{ label: t('sites.title'), href: '/sites' }, { label: t('sites.new') }], body: `` });
}
export function detailPage(ctx, deps, site, { tab = 'overview' } = {}) {
if (!TABS.includes(tab)) tab = 'overview';
const tabs = TABS.map((k) => `${esc(t('sites.tabs.' + k))}`).join('');
const bodies = {
overview: `${deps.statePanel('loading')}
`,
build: `Webmaker 제작
제작·AI 생성·페이지 편집·미리보기·저장·이전 저장본 조회는 Webmaker 화면에서 그대로 합니다(별도 로그인 없음). 현재 그룹과 사이트 이름이 Webmaker 상단에 표시됩니다.
${deps.statePanel('loading')}
이 화면의 "프로젝트" 는 운영 사이트와 다릅니다. 프로젝트를 지워도 운영 사이트·배포본·도메인은 지워지지 않습니다. 콘텐츠 가져오기(기존 사이트 복사·가져오기)는 이번 버전에서 지원하지 않습니다.
`,
source: `${deps.statePanel('loading')}
`,
deploy: `${deps.statePanel('loading')}
`,
domains: `${deps.statePanel('loading')}
`,
mail: `메일
사이트 대표 메일과 메일함은 메일 화면에서 관리합니다.
메일 화면으로 `,
backup: `백업
관리형 사이트 백업 옵션·보관 목록·복원 요청은 백업 화면에서 관리합니다.
백업 화면으로 `,
usage: `${deps.statePanel('loading')}
`,
activity: `${deps.statePanel('loading')}
`,
settings: `
사이트별 접근 권한
${deps.statePanel('loading')}
중지 · 소유권 이전 · 해지
서비스 중단이 예상되는 작업은 영향과 예상 시간을 적용 전에 보여 줍니다.
`,
};
return shell(ctx, deps, { title: site.name, nav: 'sites', crumbs: [{ label: t('sites.title'), href: '/sites' }, { label: site.name }], actions: tab === 'overview' && site.primary_domain && site.lifecycle === 'live' ? [{ label: '사이트 열기', href: `https://${site.primary_domain}/`, kind: '' }, { label: '배포', href: `/sites/${site.id}?tab=deploy`, kind: 'primary' }] : [{ label: '배포', href: `/sites/${site.id}?tab=deploy`, kind: 'primary' }], body: `${tabs}
${bodies[tab]}
` });
}
export function modePage(ctx, deps, site) {
return shell(ctx, deps, { title: '배포 방식 선택', nav: 'sites', crumbs: [{ label: t('sites.title'), href: '/sites' }, { label: site.name, href: `/sites/${site.id}` }, { label: '배포 방식' }], body: `${deps.statePanel('loading')}
` });
}
export function externalPage(ctx, deps, site) {
return shell(ctx, deps, { title: t('sites.external.title'), nav: 'sites', crumbs: [{ label: t('sites.title'), href: '/sites' }, { label: site.name, href: `/sites/${site.id}` }, { label: t('sites.external.title') }], body: `${deps.statePanel('loading')}
` });
}
export function deployPage(ctx, deps, site) { return detailPage(ctx, deps, site, { tab: 'deploy' }); }
function shell(ctx, deps, o) { return deps.page({ ...o, user: ctx.user, group: ctx.group, groups: ctx.groups || [], unread: ctx.unread || 0, csrf: ctx.session ? ctx.session.csrf : '', scripts: ['/ui/sites/sites.js'] }); }