Skip to content

Commit 136687a

Browse files
author
Dennis Labordus
committed
Combine standard save project with save compas.
Signed-off-by: Dennis Labordus <[email protected]>
1 parent 2b8928a commit 136687a

17 files changed

+252
-139
lines changed

__snapshots__/compas-divider.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# `compas-divider`
2+
3+
#### `looks like the latest snapshot`
4+
5+
```html
6+
<div role="separator">
7+
</div>
8+
9+
```
10+

__snapshots__/compas-open.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
#### `looks like the latest snapshot`
66

77
```html
8+
<compas-divider>
9+
</compas-divider>
810
<section>
911
<h3>
10-
Local
12+
[compas.open.localTitle]
1113
</h3>
1214
<input
1315
accept=".sed,.scd,.ssd,.isd,.iid,.cid,.icd"
@@ -19,9 +21,11 @@
1921
<mwc-button label="[compas.open.selectFileButton]">
2022
</mwc-button>
2123
</section>
24+
<compas-divider>
25+
</compas-divider>
2226
<section>
2327
<h3>
24-
CoMPAS
28+
[compas.open.compasTitle]
2529
</h3>
2630
<p>
2731
[compas.open.listSclTypes]
@@ -37,9 +41,11 @@
3741
#### `looks like the latest snapshot`
3842

3943
```html
44+
<compas-divider>
45+
</compas-divider>
4046
<section>
4147
<h3>
42-
Local
48+
[compas.open.localTitle]
4349
</h3>
4450
<input
4551
accept=".sed,.scd,.ssd,.isd,.iid,.cid,.icd"
@@ -51,9 +57,11 @@
5157
<mwc-button label="[compas.open.selectFileButton]">
5258
</mwc-button>
5359
</section>
60+
<compas-divider>
61+
</compas-divider>
5462
<section>
5563
<h3>
56-
CoMPAS
64+
[compas.open.compasTitle]
5765
</h3>
5866
<p>
5967
[compas.open.listScls]

__snapshots__/compas-save-to.md

Lines changed: 0 additions & 44 deletions
This file was deleted.

__snapshots__/compas-save.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# `compas-save`
2+
3+
## `still determining if document exists in CoMPAS`
4+
5+
#### `looks like the latest snapshot`
6+
7+
```html
8+
<compas-divider>
9+
</compas-divider>
10+
<section>
11+
<h3>
12+
[compas.save.localTitle]
13+
</h3>
14+
<mwc-button label="[compas.save.saveFileButton]">
15+
</mwc-button>
16+
</section>
17+
<compas-divider>
18+
</compas-divider>
19+
<section>
20+
<h3>
21+
[compas.save.compasTitle]
22+
</h3>
23+
<compas-loading>
24+
</compas-loading>
25+
</section>
26+
27+
```
28+
29+
## `new document in compas`
30+
31+
#### `looks like the latest snapshot`
32+
33+
```html
34+
<compas-divider>
35+
</compas-divider>
36+
<section>
37+
<h3>
38+
[compas.save.localTitle]
39+
</h3>
40+
<mwc-button label="[compas.save.saveFileButton]">
41+
</mwc-button>
42+
</section>
43+
<compas-divider>
44+
</compas-divider>
45+
<section>
46+
<h3>
47+
[compas.save.compasTitle]
48+
</h3>
49+
<mwc-textfield
50+
dialoginitialfocus=""
51+
id="name"
52+
label="[scl.name]"
53+
required=""
54+
value="station123.scd"
55+
>
56+
</mwc-textfield>
57+
<compas-scltype-radiogroup>
58+
</compas-scltype-radiogroup>
59+
<compas-comment>
60+
</compas-comment>
61+
</section>
62+
63+
```
64+
65+
## `existing document in compas`
66+
67+
#### `looks like the latest snapshot`
68+
69+
```html
70+
<compas-divider>
71+
</compas-divider>
72+
<section>
73+
<h3>
74+
[compas.save.localTitle]
75+
</h3>
76+
<mwc-button label="[compas.save.saveFileButton]">
77+
</mwc-button>
78+
</section>
79+
<compas-divider>
80+
</compas-divider>
81+
<section>
82+
<h3>
83+
[compas.save.compasTitle]
84+
</h3>
85+
<compas-changeset-radiogroup>
86+
</compas-changeset-radiogroup>
87+
<compas-comment>
88+
</compas-comment>
89+
</section>
90+
91+
```
92+

__snapshots__/open-scd.md

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -88,24 +88,6 @@
8888
<mwc-linear-progress indeterminate="">
8989
</mwc-linear-progress>
9090
</mwc-list-item>
91-
<mwc-list-item
92-
aria-disabled="true"
93-
class="top"
94-
disabled=""
95-
graphic="icon"
96-
iconid="save"
97-
mwc-list-item=""
98-
tabindex="-1"
99-
>
100-
<mwc-icon slot="graphic">
101-
save
102-
</mwc-icon>
103-
<span>
104-
Save CoMPAS
105-
</span>
106-
<mwc-linear-progress indeterminate="">
107-
</mwc-linear-progress>
108-
</mwc-list-item>
10991
<li
11092
divider=""
11193
padded=""
@@ -763,29 +745,13 @@
763745
mwc-list-item=""
764746
selected=""
765747
tabindex="-1"
766-
value="/src/menu/SaveProject.js"
748+
value="/src/menu/CompasSave.js"
767749
>
768750
<mwc-icon slot="meta">
769751
save
770752
</mwc-icon>
771753
Save project
772754
</mwc-check-list-item>
773-
<mwc-check-list-item
774-
aria-disabled="false"
775-
class="official"
776-
graphic="control"
777-
hasmeta=""
778-
left=""
779-
mwc-list-item=""
780-
selected=""
781-
tabindex="-1"
782-
value="/src/menu/CompasSaveTo.js"
783-
>
784-
<mwc-icon slot="meta">
785-
save
786-
</mwc-icon>
787-
Save CoMPAS
788-
</mwc-check-list-item>
789755
<li
790756
divider=""
791757
inset=""

public/js/plugins.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,7 @@ export const officialPlugins = [
5656
},
5757
{
5858
name: 'Save project',
59-
src: '/src/menu/SaveProject.js',
60-
icon: 'save',
61-
default: true,
62-
kind: 'menu',
63-
requireDoc: true,
64-
position: 'top'
65-
},
66-
{
67-
name: 'Save CoMPAS',
68-
src: '/src/menu/CompasSaveTo.js',
59+
src: '/src/menu/CompasSave.js',
6960
icon: 'save',
7061
default: true,
7162
kind: 'menu',

src/compas/CompasDivider.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import {css, customElement, html, LitElement, TemplateResult} from "lit-element";
2+
3+
@customElement('compas-divider')
4+
export class CompasDividerElement extends LitElement {
5+
render(): TemplateResult {
6+
return html `
7+
<div role="separator"></div>
8+
`
9+
}
10+
11+
static styles = css`
12+
div {
13+
height: 0px;
14+
margin: 10px 0px 10px 0px;
15+
border-top: none;
16+
border-right: none;
17+
border-left: none;
18+
border-image: initial;
19+
border-bottom: 1px solid rgba(0, 0, 0, 0.12);
20+
}
21+
`
22+
}

src/compas/CompasExistsIn.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,27 @@ export type CompasExistsInElement = Mixin<typeof CompasExistsIn>;
1010

1111
export function CompasExistsIn<TBase extends LitElementConstructor>(Base: TBase) {
1212
class CompasExistsInElement extends Base {
13-
@property({type: String})
14-
docId!: string;
1513
@property({type: String})
1614
docName!: string;
15+
@property({type: String})
16+
docId?: string;
1717
@property({type: Boolean})
1818
existInCompas?: boolean;
1919

2020
firstUpdated(): void {
2121
this.checkExistInCompas();
2222
}
2323

24-
callService(docType: string) {
25-
return CompasSclDataService().listVersions(docType, this.docId);
24+
callService(docType: string, docId: string) {
25+
return CompasSclDataService().listVersions(docType, docId);
2626
}
2727

2828
checkExistInCompas(): void {
2929
if (this.docId) {
3030
// Use the versions call to check if any exist, because then the document also exists
3131
// And it safes bandwidth not to retrieve the whole document.
3232
const docType = getTypeFromDocName(this.docName);
33-
this.callService(docType)
33+
this.callService(docType, this.docId)
3434
.then(() => this.existInCompas = true)
3535
.catch(reason => {
3636
if (reason.type && reason.type === NOT_FOUND_ERROR) {

src/compas/CompasOpen.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,14 @@ export default class CompasOpenElement extends LitElement {
106106

107107
render(): TemplateResult {
108108
return html `
109+
<compas-divider></compas-divider>
109110
<section>
110-
<h3>Local</h3>
111+
<h3>${translate('compas.open.localTitle')}</h3>
111112
${this.renderFileSelect()}
112113
</section>
114+
<compas-divider></compas-divider>
113115
<section>
114-
<h3>CoMPAS</h3>
116+
<h3>${translate('compas.open.compasTitle')}</h3>
115117
${(this.selectedType) ? this.renderSclList() : this.renderSclTypeList()}
116118
</section>
117119
`

0 commit comments

Comments
 (0)