元に戻すと履歴
上部バーの 2 つのボタンは分割ボタンです。アイコンが 1 回進み、キャレットが開きます。 歴史全体。これは 1 つのタイムラインであり、その中に now という行が含まれています。上の行は 元に戻しても、以下の行はまだ元に戻すことができるものであり、行をクリックするとそこに移動します。
履歴を作成してから開きます。
- ノードの右クリック メニューから ノードを非表示 または ノードを削除
- 左側のレールに作成▸ノードを追加し、キャンバスをクリックします
- ピボットがある場合は、ピボットを実行します。インジェストは他のエントリと同様のエントリです。
行にカーソルを置くと、クリックが反転する範囲がマークされ、フッターに最終的な効果が記載されます。 そしてそれをキャンバス上で予測します。現状の場所から何が起こるか、そして何が起こるか 背面には着地する場所の輪郭が描かれています。 Ctrl + Z は何もせずに戻ります メニュー。
元に戻すは連続的です。3 行下を目指すと、その 3 行が 1 つのバッチとして逆になります。
js
// Nothing here switches the history on: `graph.history` records the four kinds of
// composition change on its own, and the two split buttons in the header are wired to
// it. `mode: 'full'` is what brings the header the buttons live in, and the left rail's
// Create tool.
const options = {
UI: {
mode: 'full',
// Off: this card is about the top bar, and `full` mode's minimap and data dock
// are neither (see the Minimap and Data table cards for those).
minimap: false,
table: false
},
render: { nodeTypeAccessor: (node) => node.getData().kind }
}js
// A consumer that writes a change through to its own backend says so. Undo makes no
// compensating write, so it follows the direction of yours: a creation still reverses
// and the row is chipped `saved`, while a deletion is sealed — undoing it would put
// back a node your backend no longer has.
const writeThrough = {
callbacks: {
onBeforeNodeCreate: async (ctx) => {
const values = await ctx.promptData({
fields: [{ key: 'label', label: 'Name', type: 'text' }]
})
if (!values) return false
const saved = await myBackend.create(values)
return { accept: true, id: saved.uuid, data: values, persisted: true }
},
onBeforeDelete: async (ctx) => {
await myBackend.remove(ctx.nodes.map((node) => node.id))
return { accept: true, persisted: true }
}
}
}js
const data = {
nodes: [
{ id: 'gw', data: { label: 'gateway-01', kind: 'Host' } },
{ id: 'db', data: { label: 'orders-db', kind: 'Database' } },
{ id: 'api', data: { label: 'orders-api', kind: 'Service' } },
{ id: 'cache', data: { label: 'session-cache', kind: 'Service' } },
{ id: 'job', data: { label: 'nightly-export', kind: 'Job' } },
{ id: 'sftp', data: { label: 'partner-sftp', kind: 'Host' } }
],
edges: [
{ from: 'gw', to: 'api', data: { label: 'routes' } },
{ from: 'api', to: 'db', data: { label: 'reads' } },
{ from: 'api', to: 'cache', data: { label: 'reads' } },
{ from: 'job', to: 'db', data: { label: 'reads' } },
{ from: 'job', to: 'sftp', data: { label: 'writes' } }
]
}Undo はバックエンドに書き込むことはありません。そのため、書き込んだ変更はバックエンドの指示に従います。 行きました。 creation は依然として反転します。キャンバスはバックエンドが保持しているものとフッターを失います。 それを数えます (Undoes 2 steps · 1 item saved upstream)。 削除は封印: リストされ、 反転することはなく、1 を含むスパンがその上を通過します (Undoes 2 of 3 · 1 saved item kept)。
意図的に禁止されている 4 種類のエントリについては、元に戻すと履歴 を参照してください。 取り込みを取り消して候補をトリアージ ペインに戻す方法について説明します。