Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit d423e93
Author: Venryx <venryx@gmail.com>
Date:   Thu May 16 14:55:12 2024 -0700

    * Split the "ngf" tilt-resource into two resources, with new "ngf-early" including the service-account and cluster-role[+binding]. This resolved a tilt-up error I was getting (ngf pod creation failed due to service-account not existing, even after resource redeploy), and also may fix the general issue (#309) of tilt-up stalling on the ngf resource. (we'll see)

commit 3d6dfa8
Author: Venryx <venryx@gmail.com>
Date:   Thu May 16 09:02:28 2024 -0700

    *

commit 798dbcf
Author: Venryx <venryx@gmail.com>
Date:   Tue May 14 01:28:43 2024 -0700

    * MS user can edit the text-negation or  text-question field (in details panel), in any situation where it is non-empty / already set previously.

commit 4b8360c
Merge: d533dd3 a67b55c
Author: Venryx <venryx@gmail.com>
Date:   Mon May 13 12:36:27 2024 -0700

    Merge branch 'main' of https://github.com/debate-map/app

commit d533dd3
Author: Venryx <venryx@gmail.com>
Date:   Mon May 13 12:36:16 2024 -0700

    * MS tilt logs error if the "Dist" folder of the client and/or monitor-client packages are not populated. (improves clarity of the error, for smoother onboarding of new devs, for whom that step can easily be missed)

commit a67b55c
Author: Venryx <venryx@gmail.com>
Date:   Fri May 10 18:13:16 2024 -0700

    * MS claim-gen subtree-importer supports new "counter_claim" field in the claim object/structure.

commit 677363a
Merge: 802960b e55765c
Author: Stephen Wicklund <Venryx@users.noreply.github.com>
Date:   Thu May 9 08:06:46 2024 -0700

    Merge pull request #308 from debate-map/alvinosh/readme-dbeaver-conn

    Added DBeaver connection information

commit e55765c
Author: Alvinosh <alvihysa89@gmail.com>
Date:   Thu May 9 16:24:25 2024 +0200

    * Fixed Typos

commit 62b5400
Author: Alvinosh <alvihysa89@gmail.com>
Date:   Thu May 9 16:13:31 2024 +0200

    * Added DBeaver connection

commit 802960b
Author: Venryx <venryx@gmail.com>
Date:   Thu May 9 06:47:38 2024 -0700

    * Some cleanup of unused node details panels. ("discussion" and "social"; not worth keeping them there if they have no implementation; will just add them from scratch when implemented)
  • Loading branch information
Venryx committed May 16, 2024
1 parent baeddca commit 4300a65
Show file tree
Hide file tree
Showing 13 changed files with 58 additions and 92 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ import {nodeDetailBoxesLayer_container} from "./NodeDetailBoxesLayer.js";
import {NodeUI_LeftBox_width} from "./NodeUI_LeftBox.js";
import {DefinitionsPanel} from "./Panels/DefinitionsPanel.js";
import {DetailsPanel} from "./Panels/DetailsPanel.js";
import {DiscussionPanel} from "./Panels/DiscussionPanel.js";
import {HistoryPanel} from "./Panels/HistoryPanel.js";
import {OthersPanel} from "./Panels/OthersPanel.js";
import {PhrasingsPanel} from "./Panels/PhrasingsPanel.js";
import {RatingsPanel} from "./Panels/RatingsPanel.js";
import {SocialPanel} from "./Panels/SocialPanel.js";
import {TagsPanel} from "./Panels/TagsPanel.js";

//export const nodeBottomPanel_minWidth = 550;
Expand Down Expand Up @@ -148,8 +146,6 @@ export class NodeUI_BottomPanel extends BaseComponentPlus(
RunInAction("NodeBox_onClickTerm", ()=>nodeView.openTermIDs = termIDs);
}}/>)}
{renderPanel("phrasings", show=><PhrasingsPanel {...{show, map, node, path}}/>)}
{renderPanel("discussion", show=><DiscussionPanel {...{show}}/>)}
{renderPanel("social", show=><SocialPanel {...{show}}/>)}
{renderPanel("tags", show=><TagsPanel {...{show, map, node, path}}/>)}
{renderPanel("details", show=><DetailsPanel {...{show, map, node, path}}/>)}
{renderPanel("history", show=><HistoryPanel {...{show, map, node, path}}/>)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,29 +41,15 @@ export class NodeUI_LeftBox extends BaseComponentPlus({panelsPosition: "left"} a
usePortal, nodeUI,
onHoverChange,
} = this.props;
/*const nodeView = GetNodeView(map?.id, path);
const openPanel = local_nodeView?.openPanel || nodeView?.openPanel;*/
const nodeView = local_nodeView ?? GetNodeView(map?.id, path);
const openPanel = nodeView?.openPanel;

const form = GetNodeForm(node, path);
const parentNode = GetParentNodeL3(path);

const nodeReversed = form == ClaimForm.negation;
const nodeTypeInfo = NodeType_Info.for[node.type];

const ratingTypes = GetRatingTypesForNode(node);

if (usePortal) {
/*UseEffect(()=>{
const timer = new Timer(1000 / 60, ()=>{
if (uiRoot == null || nodeUI.root?.DOM == null) return;
const nodeUIRect = nodeUI.root.DOM.getBoundingClientRect();
uiRoot.style.left = `${nodeUIRect.left - 110}px`;
uiRoot.style.top = `${nodeUIRect.top}px`;
}).Start();
return ()=>timer.Stop();
});*/
UseEffect(()=>{
let stop = false;
requestAnimationFrame(update);
Expand Down Expand Up @@ -124,15 +110,10 @@ export class NodeUI_LeftBox extends BaseComponentPlus({panelsPosition: "left"} a
<div style={{
position: "relative", borderRadius: 5, boxShadow: "rgba(0,0,0,1) 0px 0px 2px",
background: backgroundColor.alpha(0.95).css(),
//background: liveSkin.BasePanelBackgroundColor().alpha(.9).css(),
}}>
{ratingTypes.map((ratingInfo, index)=>{
const ratingTypeInfo = GetRatingTypeInfo(ratingInfo.type, node, parentNode, path);
//let ratingSet = ratingsRoot && ratingsRoot[ratingType];

let percentStr = "...";
/*const ratings = GetRatings(nodeForRatingType.id, ratingInfo.type);
const average = GetRatingAverage_AtPath(nodeForRatingType, ratingInfo.type, null, -1);*/
const ratingSummary = GetRatingSummary(node.id, ratingInfo.type);
if (ratingSummary.average != null) {
percentStr = `${ratingSummary.average.RoundTo(1)}%`;
Expand All @@ -150,7 +131,6 @@ export class NodeUI_LeftBox extends BaseComponentPlus({panelsPosition: "left"} a
<Span ml={5} style={{float: "right"}}>
{percentStr}
<sup style={{whiteSpace: "pre", top: -5, marginRight: -3, marginLeft: 1, fontSize: 10}}>
{/* ratingSet ? ratingSet.VKeys().length /*- 1*#/ : 0 */}
{(ratingSummary?.countsByRange ?? []).Sum()}
</sup>
</Span>
Expand All @@ -168,17 +148,13 @@ export class NodeUI_LeftBox extends BaseComponentPlus({panelsPosition: "left"} a
<div style={{
position: "relative", marginTop: 1, borderRadius: 5, boxShadow: "rgba(0,0,0,1) 0px 0px 2px",
background: backgroundColor.alpha(0.95).css(),
//background: liveSkin.BasePanelBackgroundColor().alpha(.9).css(),
}}>
<div style={{
position: "absolute", left: 0, right: 0, top: 0, bottom: 0, borderRadius: 5,
background: backgroundColor.alpha(0.7).css(),
//background: liveSkin.BasePanelBackgroundColor().alpha(.9).css(),
}}/>
{!SLMode_SFI && <PanelButton {...{onPanelButtonHover, onPanelButtonClick, map, path, openPanel}} panel="phrasings" text="Phrasings" style={{marginTop: 0, borderRadius: "5px 5px 0 0"}}/>}
{!SLMode_SFI && <PanelButton {...{onPanelButtonHover, onPanelButtonClick, map, path, openPanel}} panel="definitions" text="Definitions"/>}
{/* <PanelButton {...{ onPanelButtonHover, onPanelButtonClick, map, path, openPanel }} panel="discussion" text="Discussion"/>
<PanelButton {...{onPanelButtonHover, onPanelButtonClick, map, path, openPanel}} panel="social" text="Social"/> */}
<PanelButton {...{onPanelButtonHover, onPanelButtonClick, map, path, openPanel}} panel="details"
text={`Details${IsUserCreatorOrMod(MeID(), node) ? " (edit)" : ""}`}/>
{!SLMode_SFI && <PanelButton {...{onPanelButtonHover, onPanelButtonClick, map, path, openPanel}} panel="history" text="History"/>}
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ import {BaseComponentPlus, GetInnerComp} from "web-vcore/nm/react-vextensions.js
import {ScrollView} from "web-vcore/nm/react-vscrollview.js";
import {DefinitionsPanel} from "./DetailBoxes/Panels/DefinitionsPanel.js";
import {DetailsPanel} from "./DetailBoxes/Panels/DetailsPanel.js";
import {DiscussionPanel} from "./DetailBoxes/Panels/DiscussionPanel.js";
import {OthersPanel} from "./DetailBoxes/Panels/OthersPanel.js";
import {RatingsPanel} from "./DetailBoxes/Panels/RatingsPanel.js";
import {SocialPanel} from "./DetailBoxes/Panels/SocialPanel.js";
import {TagsPanel} from "./DetailBoxes/Panels/TagsPanel.js";
import {NodeBox} from "./NodeBox.js";

Expand Down Expand Up @@ -70,8 +68,6 @@ export class NodeUI_ForBots extends BaseComponentPlus({} as Props, {}) {
})}
{/*<PhrasingsPanel show={true} node={node} path={path}/>*/}
<DefinitionsPanel show={true} map={map} node={node} path={path}/>
<DiscussionPanel show={true}/>
<SocialPanel show={true}/>
<TagsPanel show={true} map={map} node={nodeL3} path={path}/>
<DetailsPanel show={true} map={map} node={nodeL3} path={path}/>
<OthersPanel show={true} map={map} node={nodeL3} path={path}/>
Expand Down
22 changes: 10 additions & 12 deletions Packages/client/Source/UI/Database/Phrasings/PhrasingDetailsUI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,16 @@ class OtherTitles extends BaseComponent<PhrasingDetailsUI_SharedProps, {}> {
const showNarrativeForm = ShouldShowNarrativeFormForEditing(childLayout, node.current.phrasing);
return (
<>
{node.type == NodeType.claim && <>
<RowLR mt={5} splitAt={splitAt} style={{width: "100%"}}>
<Pre>Title (negation): </Pre>
<TitleInput {...OmitRef(this.props)} titleKey="text_negation"/>
</RowLR>
<RowLR mt={5} splitAt={splitAt} style={{width: "100%"}}>
<Pre>Title (question): </Pre>
{/* <TextInput enabled={enabled} style={ES({flex: 1})} required={willUseQuestionTitleHere}
value={newRevisionData.titles["question"]} onChange={val=>Change(newRevisionData.titles["question"] = val)}/> */}
<TitleInput {...OmitRef(this.props)} titleKey="text_question"/>
</RowLR>
</>}
{(node.type == NodeType.claim || (node.current.phrasing.text_negation ?? "").trim().length > 0) &&
<RowLR mt={5} splitAt={splitAt} style={{width: "100%"}}>
<Pre>Title (negation): </Pre>
<TitleInput {...OmitRef(this.props)} titleKey="text_negation"/>
</RowLR>}
{(node.type == NodeType.claim || (node.current.phrasing.text_question ?? "").trim().length > 0) &&
<RowLR mt={5} splitAt={splitAt} style={{width: "100%"}}>
<Pre>Title (question): </Pre>
<TitleInput {...OmitRef(this.props)} titleKey="text_question"/>
</RowLR>}
{showNarrativeForm &&
<RowLR mt={5} splitAt={splitAt} style={{width: "100%"}}>
<Pre>Title (narrative): </Pre>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ export class CG_Claim extends CG_Node {

// v3 (tool extending claim-gen)
arguments?: (string | CG_Argument)[];

// v4
counter_claim?: string;
}
export class CG_Argument extends CG_Node {
argument: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export const GetResourcesInClaim_CG = CreateAccessor((context: ImportContext, cl
const args = [] as CG_Argument[];
if (claim.argument) args.push({argument: claim.argument} as CG_Argument);
if (claim.arguments) args.push(...claim.arguments.map(a=>(IsString(a) ? {argument: a} : a)) as CG_Argument[]);
if (claim.counter_claim) args.push({argument: claim.counter_claim} as CG_Argument);
for (const [i, argument] of args.entries()) {
result.push(NewNodeResource(context, argument, NodeType.claim, path_indexes.concat(i), path_titles.concat(argument.argument), claimResource, ChildGroup.freeform));
}
Expand Down Expand Up @@ -108,16 +109,12 @@ export const NewNodeResource = CreateAccessor((context: ImportContext, data: CG_
displayDetails: undefined,
attachments: CG_Node.GetAttachments(data),
node: node.id,
phrasing: CullNodePhrasingToBeEmbedded(new NodePhrasing({
id: GenerateUUID(),
type: NodePhrasingType.standard,
createdAt: Date.now(),
creator: systemUserID,
node: node.id,
phrasing: {
...(narrativeTitle != null
? {text_base: mainTitle, text_narrative: narrativeTitle}
: {text_base: mainTitle}),
})),
terms: [],
},
});
return new IR_NodeAndRevision({
pathInData: path_indexes,
Expand Down
1 change: 0 additions & 1 deletion Packages/js-common/Source/DB/nodes/$node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,6 @@ export const GetNodeTitleFromPhrasingAndForm = CreateAccessor((phrasing: NodePhr
if (form) {
if (form == ClaimForm.negation) return [phrasing.text_negation, "text_negation", "text_negation", missingTitleStrings[1]];
if (form == ClaimForm.question) {
//return phrasing.text_question || missingTitleStrings[2];
// for now at least, allow fallback to the base title
if (phrasing.text_question != null && phrasing.text_question.trim().length) return [phrasing.text_question, "text_question", "text_question", missingTitleStrings[2]];
return [phrasing.text_base, "text_question", "text_base", missingTitleStrings[2]];
Expand Down
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,9 @@ Prerequisite steps: [setup-k8s](#setup-k8s), [setup-psql](#setup-psql)

Prerequisite steps: [setup-k8s](#setup-k8s)

* 1\) If this is the first run, or if changes were made to the `client` or `monitor-client` web/frontend codebases, run the relevant js-building and js-bundling script(s): [`npm start client.tsc` and `npm start client.build.prodQuick`] and/or [`npm start monitorClient.tsc` and `npm start monitorClient.build.prodQuick`] (has vsc-2 tasks)
* 1\) If this is the first run, or if changes were made to the `client` or `monitor-client` web/frontend codebases, run the relevant js-building and js-bundling script(s):
* 1.1\) `npm start client.tsc_noWatch && npm start client.build.prodQuick` (can skip tsc part if client's tsc is already running)
* 1.2\) `npm start monitorClient.tsc_noWatch && npm start monitorClient.build.prodQuick` (can skip tsc part if monitor-client's tsc is already running)
* 2\) Launch the backend pods necessary for the behavior you want to test:
* 2.1\) Option 1, by launching the entire backend in your local k8s cluster: **(recommended)**
* 2.1.1\) If your docker/kubernetes system is not active yet, start it now. (eg. on Windows, launching Docker Desktop from the start menu)
Expand Down Expand Up @@ -802,6 +804,12 @@ Approach 2: (by using external psql with port-forwarding; requires that PostgreS
* 2\) Run: `npm start "db.psql_k8s [dm-local/dm-ovh]"`
* 3\) The shell should now have you logged in as the `admin` user.

Approach 3: (by using dbeaver)
* 1\) Set up a port-forward from `localhost:[5120/5220]` to your k8s database pod. (see: [port-forwarding](#port-forwarding))
* 2\) Retrieve the data from "debate-map-pguser-admin" for the "dm-local" context by running `npm start db.local_secrets`
* 3\) Enter the data printed in the console to make a new dbeaver connection.


</details>

<!----><a name="k8s-view-pg-config"></a>
Expand Down Expand Up @@ -853,7 +861,9 @@ New steps:

Prerequisite steps: [pulumi-init](#pulumi-init), [ovh-init](#ovh-init)

* 1\) If changes were made to the `client` or `monitor-client` web/frontend codebases (or you've never run these build commands before), run the relevant js-building and js-bundling script(s): [`npm start client.tsc` and `npm start client.build.prodQuick`] and/or [`npm start monitorClient.tsc` and `npm start monitorClient.build.prodQuick`] (has vsc-2 tasks)
* 1\) If this is the first run, or if changes were made to the `client` or `monitor-client` web/frontend codebases, run the relevant js-building and js-bundling script(s):
* 1.1\) `npm start client.tsc_noWatch && npm start client.build.prodQuick` (can skip tsc part if client's tsc is already running)
* 1.2\) `npm start monitorClient.tsc_noWatch && npm start monitorClient.build.prodQuick` (can skip tsc part if monitor-client's tsc is already running)
* 2\) Run: `npm start backend.tiltUp_ovh`
* 3\) Wait till Tilt has finished deploying everything to your local k8s cluster. (to monitor, press space to open the Tilt web-ui, or `s` for an in-terminal display)
* 4\) Verify that the deployment was successful, by visiting the web-server: `http://CLUSTER_URL:5200`. (replace `CLUSTER_URL` with the url listed in the OVH control panel)
Expand Down
7 changes: 6 additions & 1 deletion Tilt/Main.star
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ g = {
"compileWithRelease": compileWithRelease,
}

# some basic validity checks (of environment-variables)
# some basic validity checks (eg. of environment-variables)
# ==========

if ENV not in ("dev", "prod"):
Expand All @@ -121,6 +121,11 @@ if PROD:
if len(os.getenv("CLIENT_SECRET", "")) < 20:
fail("Invalid CLIENT_SECRET env-var value (should be at least 20 chars long): " + os.getenv("CLIENT_SECRET"))

if not os.path.exists("../Packages/client/Dist/app.js"):
fail("File \"./Packages/client/Dist/app.js\" not found. Please build the client first, by running: `npm start client.tsc_noWatch && npm start client.build.prodQuick` (step 1 of readme's \"run-backend-local\" module)")
if not os.path.exists("../Packages/monitor-client/Dist/app.js"):
fail("File \"./Packages/monitor-client/Dist/app.js\" not found. Please build the monitor client first, by running: `npm start monitorClient.tsc_noWatch && npm start monitorClient.build.prodQuick` (step 1 of readme's \"run-backend-local\" module)")

# start specifying resources (to be deployed to k8s soon)
# ==========

Expand Down
13 changes: 10 additions & 3 deletions Tilt/NGINX_Gateway.star
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ def Start_NGINXGateway(g):
#"service.externalIPs={15.204.30.179}",
],
)
NEXT_k8s_resource_batch(g, [
{
"new_name": "ngf-early", "labels": ["gateway"],
"objects": [
"ngf-nginx-gateway-fabric:serviceaccount",
"ngf-nginx-gateway-fabric:clusterrole",
"ngf-nginx-gateway-fabric:clusterrolebinding",
],
},
])
NEXT_k8s_resource_batch(g, [
# we unfortunately can't group these atm; they are added at end of code in helm_remote.star
#{"workload": "nginx-gateway-fabric-crds-install", "labels": ["gateway"]},
Expand All @@ -37,9 +47,6 @@ def Start_NGINXGateway(g):
# commented; had two matches (with same exact id string!) on linux/rancher-desktop (2024-04-27)
#"nginxgateways.gateway.nginx.org:customresourcedefinition",
"nginx:gatewayclass",
"ngf-nginx-gateway-fabric:serviceaccount",
"ngf-nginx-gateway-fabric:clusterrole",
"ngf-nginx-gateway-fabric:clusterrolebinding",
"ngf-config:nginxgateway",
],
# This port-forward is only really necessary on Linux, when using docker-engine. (in other cases, k8s auto-creates PF for the load-balancer -- when accessing on the same machine anyway)
Expand Down
15 changes: 13 additions & 2 deletions package-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ Object.assign(scripts, {

Object.assign(scripts, {
client: {
tsc: `cd Packages/client && ${pathToNPMBin("tsc", 2)} --build --watch`,
tsc: `cd Packages/client && ${pathToNPMBin("tsc", 2)} --build --watch`,
tsc_noWatch: `cd Packages/client && ${pathToNPMBin("tsc", 2)} --build`,
dev: {
//default: `cross-env-shell NODE_ENV=development _USE_TSLOADER=true NODE_OPTIONS="--max-old-space-size=8192 --experimental-modules" "npm start dev-part2"`,
default: GetServeCommand("dev"),
Expand Down Expand Up @@ -68,7 +69,8 @@ Object.assign(scripts, {
});
Object.assign(scripts, {
monitorClient: {
tsc: `cd Packages/monitor-client && ${pathToNPMBin("tsc", 2)} --build --watch`,
tsc: `cd Packages/monitor-client && ${pathToNPMBin("tsc", 2)} --build --watch`,
tsc_noWatch: `cd Packages/monitor-client && ${pathToNPMBin("tsc", 2)} --build`,
dev: {
default: GetServeCommand("dev", "monitor-client"),
part2: JSScript({pkg: _packagesRootStr}, "monitor-client/Scripts/Bin/Server"),
Expand Down Expand Up @@ -558,6 +560,15 @@ Object.assign(scripts, {
console.log("Connecting psql to database:", database);
const psqlProcess = StartPSQLInK8s(K8sContext_Arg(), database, {stdio: "inherit"}, pager);
}),
local_secrets: Dynamic(()=>{
// we only care about local context data here, so no need to pass context to GetK8sPGUserAdminSecretData
const secret = GetK8sPGUserAdminSecretData("dm-local");
console.log("--- Local Secrets ---");
console.log("PORT:", 5120);
console.log("DATABASE:", "debate-map");
console.log("USER:", "admin");
console.log("PASSWORD:", secret.GetField("password").toString());
}),

// db init/seed commands (using psql to run standard .sql files)
buildSeedDBScript: GetBuildSeedDBScriptCommand(),
Expand Down

0 comments on commit 4300a65

Please sign in to comment.