Skip to content

Commit

Permalink
Merge branch 'main' into expand-client-timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
k1LoW authored Feb 15, 2021
2 parents 246a928 + 2e22046 commit c3c8751
Show file tree
Hide file tree
Showing 43 changed files with 1,153 additions and 277 deletions.
5 changes: 0 additions & 5 deletions config/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,6 @@ func (cfg *Config) buildRelations() error {
nrel.Components = append(nrel.Components, c)
}
cfg.Relations = append(cfg.Relations, nrel)

// labels
for _, l := range nrel.Labels {
l.Relations = append(l.Relations, nrel)
}
}
cfg.edges = SplitRelations(cfg.Relations)

Expand Down
36 changes: 19 additions & 17 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ type Config struct {
HideLabels bool `yaml:"hideLabels,omitempty"`
Views []*View `yaml:"views"`
Nodes []*Node `yaml:"nodes"`
Relations []*Relation `yaml:"relations,omitempty"`
Relations Relations `yaml:"relations,omitempty"`
Dict *dict.Dict `yaml:"dict,omitempty"`
BaseColor string `yaml:"baseColor,omitempty"`
TextColor string `yaml:"textColor,omitempty"`
Expand Down Expand Up @@ -303,33 +303,35 @@ func (cfg *Config) PruneClustersByLabels(clusters Clusters, globalNodes []*Node,
return clusters, globalNodes, globalComponents, filteredEdges, nil
}

func (cfg *Config) PruneNodesByLabels(nodes []*Node, labels []string) ([]*Node, error) {
if len(labels) == 0 {
func (cfg *Config) PruneNodesByLabels(nodes []*Node, labelStrs []string) ([]*Node, error) {
if len(labelStrs) == 0 {
return nodes, nil
}
nIds := orderedmap.NewOrderedMap()
comIds := orderedmap.NewOrderedMap()

for _, name := range labels {
labels := Labels{}
for _, name := range labelStrs {
l, err := cfg.FindLabel(name)
if err != nil {
return nodes, nil
}
edges := SplitRelations(l.Relations)

for _, e := range edges {
switch {
case e.Src.Node != nil:
nIds.Set(e.Src.Node.Id(), e.Src.Node)
}
comIds.Set(e.Src.Id(), e.Src)
labels = append(labels, l)
}
relations := cfg.Relations.FindByLabels(labels)
edges := SplitRelations(relations)
for _, e := range edges {
switch {
case e.Src.Node != nil:
nIds.Set(e.Src.Node.Id(), e.Src.Node)
}
comIds.Set(e.Src.Id(), e.Src)

switch {
case e.Dst.Node != nil:
nIds.Set(e.Dst.Node.Id(), e.Dst.Node)
}
comIds.Set(e.Dst.Id(), e.Dst)
switch {
case e.Dst.Node != nil:
nIds.Set(e.Dst.Node.Id(), e.Dst.Node)
}
comIds.Set(e.Dst.Id(), e.Dst)
}

filteredNodes := []*Node{}
Expand Down
5 changes: 2 additions & 3 deletions config/label.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ import (
)

type Label struct {
Name string
Desc string
Relations []*Relation
Name string
Desc string
}

type Labels []*Label
Expand Down
22 changes: 17 additions & 5 deletions config/relation.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,24 @@ type Relation struct {
Attrs []*Attr
}

func (n *Relation) FullName() string {
return n.relationId
func (r *Relation) FullName() string {
return r.relationId
}

func (n *Relation) Id() string {
return strings.ToLower(n.relationId)
func (r *Relation) Id() string {
return strings.ToLower(r.relationId)
}

type Relations []*Relation

func (relations Relations) FindByLabels(labels Labels) Relations {
filtered := Relations{}
for _, r := range relations {
if len(r.Labels.Subtract(labels)) > 0 {
filtered = append(filtered, r)
}
}
return filtered
}

type rawRelation struct {
Expand Down Expand Up @@ -105,7 +117,7 @@ func (rel *rawRelation) Id() string {
return strings.ToLower(fmt.Sprintf("%s-%s", queryTrim(rel.Components[0]), s[:7]))
}

func SplitRelations(relations []*Relation) []*Edge {
func SplitRelations(relations Relations) []*Edge {
var prev *Component
edges := []*Edge{}
for _, rel := range relations {
Expand Down
32 changes: 30 additions & 2 deletions docs/arch.ja/view-input.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,43 @@
[ <a href="../ndiag.descriptions.ja/_view-input.md">:pencil2: Edit description</a> ]
<p>



## 構成要素

| Name | Description |
| --- | --- |
| [input files](node-input_files.md) | <a href="../ndiag.descriptions.ja/_node-input_files.md">:pencil2:</a> |
| [ndiag](node-ndiag.md) | `ndiag doc` コマンド |

## Relations

<p align="right">
[ <a href="../ndiag.descriptions.ja/_relation-input_files_ndiag.yml-da3a497.md">:pencil2: Edit description</a> ]
<p>

| # | Component | Description |
| --- | --- | --- |
| 0 | input files:ndiag.yml | <a href="../ndiag.descriptions.ja/_component-input_files_ndiag.yml.md">:pencil2:</a> |
| 1 | ndiag:internal | ndiagの内部処理 <a href="../ndiag.descriptions.ja/_component-ndiag_internal.md">:pencil2:</a> |


<p align="right">
[ <a href="../ndiag.descriptions.ja/_relation-input_files_nodes.yml-efaf14b.md">:pencil2: Edit description</a> ]
<p>

| # | Component | Description |
| --- | --- | --- |
| 0 | input files:nodes.yml | <a href="../ndiag.descriptions.ja/_component-input_files_nodes.yml.md">:pencil2:</a> |
| 1 | ndiag:internal | ndiagの内部処理 <a href="../ndiag.descriptions.ja/_component-ndiag_internal.md">:pencil2:</a> |


<p align="right">
[ <a href="../ndiag.descriptions.ja/_relation-input_files_ndiag.descriptions__.md-1cdb9dd.md">:pencil2: Edit description</a> ]
<p>

| # | Component | Description |
| --- | --- | --- |
| 0 | input files:ndiag.descriptions/*.md | <a href="../ndiag.descriptions.ja/_component-input_files_ndiag.descriptions__.md.md">:pencil2:</a> |
| 1 | ndiag:internal | ndiagの内部処理 <a href="../ndiag.descriptions.ja/_component-ndiag_internal.md">:pencil2:</a> |

---

Expand Down
52 changes: 50 additions & 2 deletions docs/arch.ja/view-output.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ ndiag.ymlのviewsで設定したlayers、labelsを元にドキュメントを生
[ <a href="../ndiag.descriptions.ja/_view-output.md">:pencil2: Edit description</a> ]
<p>



## 構成要素

| Name | Description |
Expand All @@ -51,6 +49,56 @@ ndiag.ymlのviewsで設定したlayers、labelsを元にドキュメントを生
| [ndiag](node-ndiag.md) | `ndiag doc` コマンド |
| [documents](node-documents.md) | 出力されるアーキテクチャドキュメント ( [example](/example/output/README.md) ) |

## Relations

<p align="right">
[ <a href="../ndiag.descriptions.ja/_relation-ndiag_internal-5df3e05.md">:pencil2: Edit description</a> ]
<p>

| # | Component | Description |
| --- | --- | --- |
| 0 | ndiag:internal | ndiagの内部処理 <a href="../ndiag.descriptions.ja/_component-ndiag_internal.md">:pencil2:</a> |
| 1 | input files:ndiag.descriptions/*.md | <a href="../ndiag.descriptions.ja/_component-input_files_ndiag.descriptions__.md.md">:pencil2:</a> |


<p align="right">
[ <a href="../ndiag.descriptions.ja/_relation-ndiag_internal-ee6a0d2.md">:pencil2: Edit description</a> ]
<p>

| # | Component | Description |
| --- | --- | --- |
| 0 | ndiag:internal | ndiagの内部処理 <a href="../ndiag.descriptions.ja/_component-ndiag_internal.md">:pencil2:</a> |
| 1 | documents:index document | <a href="../ndiag.descriptions.ja/_component-documents_index_document.md">:pencil2:</a> |


<p align="right">
[ <a href="../ndiag.descriptions.ja/_relation-ndiag_internal-8143d95.md">:pencil2: Edit description</a> ]
<p>

| # | Component | Description |
| --- | --- | --- |
| 0 | ndiag:internal | ndiagの内部処理 <a href="../ndiag.descriptions.ja/_component-ndiag_internal.md">:pencil2:</a> |
| 1 | documents:custom documents | <a href="../ndiag.descriptions.ja/_component-documents_custom_documents.md">:pencil2:</a> |


<p align="right">
[ <a href="../ndiag.descriptions.ja/_relation-ndiag_internal-eece4dd.md">:pencil2: Edit description</a> ]
<p>

| # | Component | Description |
| --- | --- | --- |
| 0 | ndiag:internal | ndiagの内部処理 <a href="../ndiag.descriptions.ja/_component-ndiag_internal.md">:pencil2:</a> |
| 1 | documents:layer based documents | <a href="../ndiag.descriptions.ja/_component-documents_layer_based_documents.md">:pencil2:</a> |


<p align="right">
[ <a href="../ndiag.descriptions.ja/_relation-ndiag_internal-9d28271.md">:pencil2: Edit description</a> ]
<p>

| # | Component | Description |
| --- | --- | --- |
| 0 | ndiag:internal | ndiagの内部処理 <a href="../ndiag.descriptions.ja/_component-ndiag_internal.md">:pencil2:</a> |
| 1 | documents:label based documents | <a href="../ndiag.descriptions.ja/_component-documents_label_based_documents.md">:pencil2:</a> |

---

Expand Down
82 changes: 80 additions & 2 deletions docs/arch.ja/view-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
[ <a href="../ndiag.descriptions.ja/_view-overview.md">:pencil2: Edit description</a> ]
<p>



## 構成要素

| Name | Description |
Expand All @@ -19,6 +17,86 @@
| [ndiag](node-ndiag.md) | `ndiag doc` コマンド |
| [documents](node-documents.md) | 出力されるアーキテクチャドキュメント ( [example](/example/output/README.md) ) |

## Relations

<p align="right">
[ <a href="../ndiag.descriptions.ja/_relation-input_files_ndiag.yml-da3a497.md">:pencil2: Edit description</a> ]
<p>

| # | Component | Description |
| --- | --- | --- |
| 0 | input files:ndiag.yml | <a href="../ndiag.descriptions.ja/_component-input_files_ndiag.yml.md">:pencil2:</a> |
| 1 | ndiag:internal | ndiagの内部処理 <a href="../ndiag.descriptions.ja/_component-ndiag_internal.md">:pencil2:</a> |


<p align="right">
[ <a href="../ndiag.descriptions.ja/_relation-input_files_nodes.yml-efaf14b.md">:pencil2: Edit description</a> ]
<p>

| # | Component | Description |
| --- | --- | --- |
| 0 | input files:nodes.yml | <a href="../ndiag.descriptions.ja/_component-input_files_nodes.yml.md">:pencil2:</a> |
| 1 | ndiag:internal | ndiagの内部処理 <a href="../ndiag.descriptions.ja/_component-ndiag_internal.md">:pencil2:</a> |


<p align="right">
[ <a href="../ndiag.descriptions.ja/_relation-input_files_ndiag.descriptions__.md-1cdb9dd.md">:pencil2: Edit description</a> ]
<p>

| # | Component | Description |
| --- | --- | --- |
| 0 | input files:ndiag.descriptions/*.md | <a href="../ndiag.descriptions.ja/_component-input_files_ndiag.descriptions__.md.md">:pencil2:</a> |
| 1 | ndiag:internal | ndiagの内部処理 <a href="../ndiag.descriptions.ja/_component-ndiag_internal.md">:pencil2:</a> |


<p align="right">
[ <a href="../ndiag.descriptions.ja/_relation-ndiag_internal-5df3e05.md">:pencil2: Edit description</a> ]
<p>

| # | Component | Description |
| --- | --- | --- |
| 0 | ndiag:internal | ndiagの内部処理 <a href="../ndiag.descriptions.ja/_component-ndiag_internal.md">:pencil2:</a> |
| 1 | input files:ndiag.descriptions/*.md | <a href="../ndiag.descriptions.ja/_component-input_files_ndiag.descriptions__.md.md">:pencil2:</a> |


<p align="right">
[ <a href="../ndiag.descriptions.ja/_relation-ndiag_internal-ee6a0d2.md">:pencil2: Edit description</a> ]
<p>

| # | Component | Description |
| --- | --- | --- |
| 0 | ndiag:internal | ndiagの内部処理 <a href="../ndiag.descriptions.ja/_component-ndiag_internal.md">:pencil2:</a> |
| 1 | documents:index document | <a href="../ndiag.descriptions.ja/_component-documents_index_document.md">:pencil2:</a> |


<p align="right">
[ <a href="../ndiag.descriptions.ja/_relation-ndiag_internal-8143d95.md">:pencil2: Edit description</a> ]
<p>

| # | Component | Description |
| --- | --- | --- |
| 0 | ndiag:internal | ndiagの内部処理 <a href="../ndiag.descriptions.ja/_component-ndiag_internal.md">:pencil2:</a> |
| 1 | documents:custom documents | <a href="../ndiag.descriptions.ja/_component-documents_custom_documents.md">:pencil2:</a> |


<p align="right">
[ <a href="../ndiag.descriptions.ja/_relation-ndiag_internal-eece4dd.md">:pencil2: Edit description</a> ]
<p>

| # | Component | Description |
| --- | --- | --- |
| 0 | ndiag:internal | ndiagの内部処理 <a href="../ndiag.descriptions.ja/_component-ndiag_internal.md">:pencil2:</a> |
| 1 | documents:layer based documents | <a href="../ndiag.descriptions.ja/_component-documents_layer_based_documents.md">:pencil2:</a> |


<p align="right">
[ <a href="../ndiag.descriptions.ja/_relation-ndiag_internal-9d28271.md">:pencil2: Edit description</a> ]
<p>

| # | Component | Description |
| --- | --- | --- |
| 0 | ndiag:internal | ndiagの内部処理 <a href="../ndiag.descriptions.ja/_component-ndiag_internal.md">:pencil2:</a> |
| 1 | documents:label based documents | <a href="../ndiag.descriptions.ja/_component-documents_label_based_documents.md">:pencil2:</a> |

---

Expand Down
32 changes: 30 additions & 2 deletions docs/arch/view-input.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,43 @@
[ <a href="../ndiag.descriptions/_view-input.md">:pencil2: Edit description</a> ]
<p>



## Components

| Name | Description |
| --- | --- |
| [input files](node-input_files.md) | <a href="../ndiag.descriptions/_node-input_files.md">:pencil2:</a> |
| [ndiag](node-ndiag.md) | `ndiag doc` command |

## Relations

<p align="right">
[ <a href="../ndiag.descriptions/_relation-input_files_ndiag.yml-da3a497.md">:pencil2: Edit description</a> ]
<p>

| # | Component | Description |
| --- | --- | --- |
| 0 | input files:ndiag.yml | <a href="../ndiag.descriptions/_component-input_files_ndiag.yml.md">:pencil2:</a> |
| 1 | ndiag:internal | <a href="../ndiag.descriptions/_component-ndiag_internal.md">:pencil2:</a> |


<p align="right">
[ <a href="../ndiag.descriptions/_relation-input_files_nodes.yml-efaf14b.md">:pencil2: Edit description</a> ]
<p>

| # | Component | Description |
| --- | --- | --- |
| 0 | input files:nodes.yml | <a href="../ndiag.descriptions/_component-input_files_nodes.yml.md">:pencil2:</a> |
| 1 | ndiag:internal | <a href="../ndiag.descriptions/_component-ndiag_internal.md">:pencil2:</a> |


<p align="right">
[ <a href="../ndiag.descriptions/_relation-input_files_ndiag.descriptions__.md-1cdb9dd.md">:pencil2: Edit description</a> ]
<p>

| # | Component | Description |
| --- | --- | --- |
| 0 | input files:ndiag.descriptions/*.md | <a href="../ndiag.descriptions/_component-input_files_ndiag.descriptions__.md.md">:pencil2:</a> |
| 1 | ndiag:internal | <a href="../ndiag.descriptions/_component-ndiag_internal.md">:pencil2:</a> |

---

Expand Down
Loading

0 comments on commit c3c8751

Please sign in to comment.