Skip to content

Commit 0c59572

Browse files
committedNov 29, 2024
update CreationModal
1 parent 69f7b2d commit 0c59572

File tree

9 files changed

+27
-18
lines changed

9 files changed

+27
-18
lines changed
 

‎lapdev-dashboard/src/cluster.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ pub fn NewWorkspaceHostView(
140140
<CreationInput label="Disk (GB)".to_string() value=disk placeholder="disk in GB".to_string() />
141141
};
142142
view! {
143-
<CreationModal title="Create New Workspace Host".to_string() modal_hidden=new_workspace_host_modal_hidden action body update_text=Some("Create".to_string()) updating_text=Some("Creating".to_string()) create_button_hidden=false />
143+
<CreationModal title="Create New Workspace Host".to_string() modal_hidden=new_workspace_host_modal_hidden action body update_text=Some("Create".to_string()) updating_text=Some("Creating".to_string()) width_class=None create_button_hidden=|| false />
144144
}
145145
}
146146

@@ -184,7 +184,7 @@ pub fn UpdateWorkspaceHostModal(
184184
<CreationInput label="Disk (GB)".to_string() value=disk placeholder="disk in GB".to_string() />
185185
};
186186
view! {
187-
<CreationModal title="Update Workspace Host".to_string() modal_hidden=update_workspace_host_modal_hidden action body update_text=None updating_text=None create_button_hidden=false />
187+
<CreationModal title="Update Workspace Host".to_string() modal_hidden=update_workspace_host_modal_hidden action body update_text=None updating_text=None width_class=None create_button_hidden=|| false />
188188
}
189189
}
190190

@@ -1096,7 +1096,7 @@ pub fn NewMachineTypeView(
10961096
</div>
10971097
};
10981098
view! {
1099-
<CreationModal title="Create New Machine Type".to_string() modal_hidden=new_machine_type_modal_hidden action body update_text=Some("Create".to_string()) updating_text=Some("Creating".to_string()) create_button_hidden=false />
1099+
<CreationModal title="Create New Machine Type".to_string() modal_hidden=new_machine_type_modal_hidden action body update_text=Some("Create".to_string()) updating_text=Some("Creating".to_string()) width_class=None create_button_hidden=|| false />
11001100
}
11011101
}
11021102

@@ -1127,7 +1127,7 @@ pub fn UpdateMachineTypeModal(
11271127
</div>
11281128
};
11291129
view! {
1130-
<CreationModal title="Update Workspace Host".to_string() modal_hidden=update_machine_type_modal_hidden action body update_text=None updating_text=None create_button_hidden=false />
1130+
<CreationModal title="Update Workspace Host".to_string() modal_hidden=update_machine_type_modal_hidden action body update_text=None updating_text=None width_class=None create_button_hidden=|| false />
11311131
}
11321132
}
11331133

@@ -1680,6 +1680,6 @@ fn ClusterUserItemView(
16801680
</button>
16811681
</td>
16821682
</tr>
1683-
<CreationModal title=format!("Update Cluster User") modal_hidden=update_modal_hidden action=update_action body=update_modal_body update_text=None updating_text=None create_button_hidden=false />
1683+
<CreationModal title=format!("Update Cluster User") modal_hidden=update_modal_hidden action=update_action body=update_modal_body update_text=None updating_text=None width_class=None create_button_hidden=|| false />
16841684
}
16851685
}

‎lapdev-dashboard/src/git_provider.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,8 @@ pub fn UpdateScopeModal(
381381
body
382382
update_text=None
383383
updating_text=None
384-
create_button_hidden=false
384+
create_button_hidden=|| false
385+
width_class=None
385386
/>
386387
}
387388
}

‎lapdev-dashboard/src/license.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ pub fn UpdateLicenseView(update_counter: RwSignal<i32>) -> impl IntoView {
117117
>
118118
Update Enterprise License
119119
</button>
120-
<CreationModal title="Update Enterprise License".to_string() modal_hidden body action update_text=None updating_text=None create_button_hidden=false />
120+
<CreationModal title="Update Enterprise License".to_string() modal_hidden body action update_text=None updating_text=None width_class=None create_button_hidden=|| false />
121121
}
122122
}
123123

@@ -202,6 +202,6 @@ pub fn SignLicenseView() -> impl IntoView {
202202
>
203203
Sign New License
204204
</button>
205-
<CreationModal title="Sign Enterprise License".to_string() modal_hidden body action update_text=Some("Create".to_string()) updating_text=Some("Creating".to_string()) create_button_hidden=false />
205+
<CreationModal title="Sign Enterprise License".to_string() modal_hidden body action update_text=Some("Create".to_string()) updating_text=Some("Creating".to_string()) width_class=None create_button_hidden=|| false />
206206
}
207207
}

‎lapdev-dashboard/src/modal.rs

+10-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ pub fn CreationModal<T>(
4646
body: T,
4747
update_text: Option<String>,
4848
updating_text: Option<String>,
49-
create_button_hidden: bool,
49+
create_button_hidden: impl Fn() -> bool + 'static,
50+
width_class: Option<String>,
5051
) -> impl IntoView
5152
where
5253
T: IntoView + 'static,
@@ -73,6 +74,12 @@ where
7374
}
7475
})
7576
});
77+
78+
let width_class = if let Some(width_class) = width_class {
79+
width_class
80+
} else {
81+
"max-w-2xl".to_string()
82+
};
7683
view! {
7784
<div
7885
tabindex="-1"
@@ -81,7 +88,7 @@ where
8188
on:click=move |_| modal_hidden.set(true)
8289
>
8390
<div
84-
class="relative p-4 w-full max-w-2xl max-h-full"
91+
class=format!("relative p-4 w-full {width_class} max-h-full")
8592
on:click=move |e| e.stop_propagation()
8693
>
8794
<div class="relative bg-white rounded-lg shadow">
@@ -120,7 +127,7 @@ where
120127
type="button"
121128
class="mr-3 flex flex-row items-center text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center"
122129
disabled=move || create_pending.get()
123-
class:hidden=move || create_button_hidden
130+
class:hidden=move || create_button_hidden()
124131
on:click=handle_create
125132
>
126133
<svg aria-hidden="true" role="status"

‎lapdev-dashboard/src/organization.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ fn UpdateMemberView(
881881
</div>
882882
};
883883
view! {
884-
<CreationModal title="Update Member".to_string() modal_hidden=update_modal_hidden body action=update_action update_text=None updating_text=None create_button_hidden=false />
884+
<CreationModal title="Update Member".to_string() modal_hidden=update_modal_hidden body action=update_action update_text=None updating_text=None width_class=None create_button_hidden=|| false />
885885
}
886886
}
887887

@@ -1033,6 +1033,6 @@ fn InviteMemberView(invite_member_modal_hidden: RwSignal<bool>) -> impl IntoView
10331033
</div>
10341034
};
10351035
view! {
1036-
<CreationModal title="Invite New Member".to_string() modal_hidden=invite_member_modal_hidden action body update_text=Some("Create".to_string()) updating_text=Some("Creating".to_string()) create_button_hidden=true />
1036+
<CreationModal title="Invite New Member".to_string() modal_hidden=invite_member_modal_hidden action body update_text=Some("Create".to_string()) updating_text=Some("Creating".to_string()) width_class=None create_button_hidden=|| true />
10371037
}
10381038
}

‎lapdev-dashboard/src/project.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ pub fn NewProjectView(new_project_modal_hidden: RwSignal<bool>) -> impl IntoView
7373
<MachineTypeView current_machine_type preferred_machine_type />
7474
};
7575
view! {
76-
<CreationModal title="Create New Project".to_string() modal_hidden=new_project_modal_hidden action body update_text=Some("Create".to_string()) updating_text=Some("Creating".to_string()) create_button_hidden=false />
76+
<CreationModal title="Create New Project".to_string() modal_hidden=new_project_modal_hidden action body update_text=Some("Create".to_string()) updating_text=Some("Creating".to_string()) width_class=None create_button_hidden=|| false />
7777
}
7878
}
7979

‎lapdev-dashboard/src/quota.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,6 @@ fn QuotaItemView(
224224
</div>
225225
</div>
226226
</div>
227-
<CreationModal title=format!("Update {kind} Quota") modal_hidden=update_modal_hidden action=update_action body=update_modal_body update_text=None updating_text=None create_button_hidden=false />
227+
<CreationModal title=format!("Update {kind} Quota") modal_hidden=update_modal_hidden action=update_action body=update_modal_body update_text=None updating_text=None width_class=None create_button_hidden=|| false />
228228
}
229229
}

‎lapdev-dashboard/src/ssh_key.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,6 @@ pub fn NewSshKey(update_counter: RwSignal<i32>) -> impl IntoView {
157157
>
158158
New SSH Key
159159
</button>
160-
<CreationModal title="New SSH Key".to_string() modal_hidden action body update_text=Some("Create".to_string()) updating_text=Some("Creating".to_string()) create_button_hidden=false />
160+
<CreationModal title="New SSH Key".to_string() modal_hidden action body update_text=Some("Create".to_string()) updating_text=Some("Creating".to_string()) width_class=None create_button_hidden=|| false />
161161
}
162162
}

‎lapdev-dashboard/src/workspace.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,8 @@ fn WorkspaceRebuildModal(
598598
body
599599
update_text=Some("Rebuild".to_string())
600600
updating_text=None
601-
create_button_hidden=false
601+
create_button_hidden=|| false
602+
width_class=None
602603
/>
603604
}
604605
}
@@ -1120,7 +1121,7 @@ pub fn NewWorkspaceModal(
11201121
};
11211122

11221123
view! {
1123-
<CreationModal title="Create New Workspace".to_string() modal_hidden action body=create_info_view update_text=Some("Create".to_string()) updating_text=Some("Creating".to_string()) create_button_hidden=false />
1124+
<CreationModal title="Create New Workspace".to_string() modal_hidden action body=create_info_view update_text=Some("Create".to_string()) updating_text=Some("Creating".to_string()) width_class=None create_button_hidden=|| false />
11241125
}
11251126
}
11261127

0 commit comments

Comments
 (0)