Skip to content

Commit bcf5ec2

Browse files
committed
config-ip: Move login to navbar.
1 parent d3b4ec2 commit bcf5ec2

File tree

2 files changed

+66
-28
lines changed

2 files changed

+66
-28
lines changed

build/app/unisys/component/SessionShell.jsx

Lines changed: 64 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,17 @@ const LABEL_STYLE = {
6666
marginBottom: "0.15rem",
6767
marginTop: "0.15rem"
6868
};
69+
/// Move login to navbar
70+
const NAV_LOGIN_STYLE = {
71+
position: 'fixed',
72+
top: '5px',
73+
right: '20px',
74+
zIndex: '2000'
75+
};
76+
const NAV_LOGIN_FEEDBACK_STYLE = {
77+
position: "absolute",
78+
right: "210px"
79+
};
6980

7081
/// REACT COMPONENT ///////////////////////////////////////////////////////////
7182
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -100,21 +111,35 @@ class SessionShell extends UNISYS.Component {
100111
let gid = `\u00A0${decoded.groupId}`;
101112
let subid = decoded.subId ? `USER\u00A0${decoded.subId}` : "";
102113
return (
103-
<FormGroup row style={GROUP_STYLE}>
104-
<Col sm={3}>
105-
<Label style={LABEL_STYLE} className="small">
106-
GROUP{gid}
107-
<br />
108-
{subid}
109-
</Label>
110-
</Col>
111-
<Col sm={9} className="text-right">
112-
<Label style={LABEL_STYLE} className="small">
113-
{classproj}-<strong>{decoded.hashedId}</strong>
114-
</Label>
115-
</Col>
116-
</FormGroup>
114+
<div row style={NAV_LOGIN_STYLE}>
115+
<Label style={LABEL_STYLE} className="small">
116+
GROUP{gid}:&nbsp;
117+
<br />
118+
{subid}
119+
</Label>
120+
<Label style={LABEL_STYLE} className="small">
121+
{classproj}-<strong>{decoded.hashedId}</strong>
122+
</Label>
123+
</div>
117124
);
125+
126+
// Old Form above NodeSelector
127+
// return (
128+
// <FormGroup row style={GROUP_STYLE} style={{position:'fixed',top:'5px',right:'5px',zIndex:'2000'}}>
129+
// <Col sm={3}>
130+
// <Label style={LABEL_STYLE} className="small">
131+
// GROUP{gid}
132+
// <br />
133+
// {subid}
134+
// </Label>
135+
// </Col>
136+
// <Col sm={9} className="text-right">
137+
// <Label style={LABEL_STYLE} className="small">
138+
// {classproj}-<strong>{decoded.hashedId}</strong>
139+
// </Label>
140+
// </Col>
141+
// </FormGroup>
142+
// );
118143
} else {
119144
return <p>ERROR:renderLoggedIn didn't get valid decoded object</p>;
120145
}
@@ -126,46 +151,59 @@ class SessionShell extends UNISYS.Component {
126151
let { token, classId, projId, groupId, subId, hashedId, isValid } = this.state;
127152
if (token) token = token.toUpperCase();
128153
let formFeedback, tip, input;
129-
tip = "type group ID";
130-
if (classId) tip = "scanning for valid code...";
131-
if (projId) tip = "waiting for valid code...";
132-
if (groupId) tip = "waiting for extra ID...";
154+
tip = "Type group ID";
155+
if (classId) tip = "Scanning for valid code...";
156+
if (projId) tip = "Waiting for valid code...";
157+
if (groupId) tip = "Waiting for extra ID...";
133158
if (hashedId) {
134159
if (hashedId.length >= 3) {
135160
if (!groupId) tip = `'${token}' is an invalid code`;
136161
else {
137-
if (subId) tip = `login in as GROUP ${groupId} ${subId}`;
138-
else tip = `login as GROUP ${groupId} or add -ID<num>`;
162+
if (subId) tip = `Login in as GROUP ${groupId} ${subId}`;
163+
else tip = `Login as GROUP ${groupId} or add -ID<num>`;
139164
}
140165
}
141166
}
142167
if (groupId) {
143168
if (subId===0) {
144169
tip = `e.g. ${classId}-${projId}-${hashedId} followed by -ID<num>`;
145170
input = <Input invalid name="sessionToken" id="sessionToken" bsSize="sm" style={INPUT_STYLE} className="text-right" placeholder="CLASSID-PROJID-CODE" onChange={this.handleChange} />
146-
formFeedback = <FormFeedback className="text-right"><small>{tip}</small></FormFeedback>
171+
formFeedback = <FormFeedback style={NAV_LOGIN_FEEDBACK_STYLE} className="text-right"><small>{tip}</small></FormFeedback>
147172
} else {
148173
input = <Input valid name="sessionToken" id="sessionToken" bsSize="sm" style={INPUT_STYLE} className="text-right" placeholder="CLASSID-PROJID-CODE" onChange={this.handleChange} />
149-
formFeedback = <FormFeedback valid className="text-right"><small>{tip}</small></FormFeedback>
174+
formFeedback = <FormFeedback valid style={NAV_LOGIN_FEEDBACK_STYLE} className="text-right"><small>{tip}</small></FormFeedback>
150175
}
151176
} else {
152177
input = <Input invalid name="sessionToken" id="sessionToken" bsSize="sm" style={INPUT_STYLE} className="text-right" placeholder="CLASSID-PROJID-CODE" onChange={this.handleChange} />
153-
formFeedback = <FormFeedback className="text-right"><small>{tip}</small></FormFeedback>
178+
formFeedback = <FormFeedback style={NAV_LOGIN_FEEDBACK_STYLE} className="text-right"><small>{tip}</small></FormFeedback>
154179
}
155180

156181
return (
157-
<Form onSubmit={this.onSubmit}>
182+
<Form onSubmit={this.onSubmit} style={NAV_LOGIN_STYLE}>
158183
<FormGroup row>
159-
<Col>
160184
<InputGroup>
161185
<InputGroupAddon addonType="prepend"><Button style={{fontSize:'10px'}} color="secondary" size="sm" disabled={!isValid} onSubmit={this.onSubmit}>LOGIN</Button></InputGroupAddon>
162186
{input}
163187
{formFeedback}
164188
</InputGroup>
165-
</Col>
166189
</FormGroup>
167190
</Form>
168191
);
192+
193+
// Old Form above NodeSelector
194+
// return (
195+
// <Form onSubmit={this.onSubmit} style={{position:'fixed',top:'5px',right:'5px',zIndex:'2000'}}>
196+
// <FormGroup row>
197+
// <Col>
198+
// <InputGroup>
199+
// {formFeedback}
200+
// <InputGroupAddon addonType="prepend"><Button style={{fontSize:'10px'}} color="secondary" size="sm" disabled={!isValid} onSubmit={this.onSubmit}>LOGIN</Button></InputGroupAddon>
201+
// {input}
202+
// </InputGroup>
203+
// </Col>
204+
// </FormGroup>
205+
// </Form>
206+
// );
169207
}
170208
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
171209
componentWillMount() {

build/app/view/netcreate/NetCreate.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ const NCLOGIC = require('./nc-logic'); // require to bootstrap data loading
9494
<div>
9595
<div style={{display:'flex', flexFlow:'row nowrap',
9696
width:'100%', height:'100vh',overflow:'hidden'}}>
97-
<div id="left" style={{backgroundColor:'#EEE',flex:'1 1 25%',maxWidth:'400px',padding:'10px',overflow:'scroll',marginTop:'39px'}}>
97+
<div id="left" style={{backgroundColor:'#EEE',flex:'1 1 25%',maxWidth:'400px',padding:'10px',overflow:'scroll',marginTop:'38px'}}>
9898
<div style={{display:'flex',flexFlow:'column nowrap'}}>
9999
<Route path='/edit/:token' exact={true} component={SessionShell}/>
100100
<Route path='/edit' exact={true} component={SessionShell}/>
@@ -103,7 +103,7 @@ const NCLOGIC = require('./nc-logic'); // require to bootstrap data loading
103103
<NodeSelector/>
104104
</div>
105105
</div>
106-
<div id="middle" style={{backgroundColor:'#fcfcfc', flex:'3 0 60%', padding:'10px',marginTop:'39px'}}>
106+
<div id="middle" style={{backgroundColor:'#fcfcfc', flex:'3 0 60%', padding:'10px',marginTop:'38px'}}>
107107
<InfoPanel/>
108108
<NetGraph/>
109109
<div style={{fontSize:'10px',position:'fixed',left:'0px',bottom:'0px',right:'0px',zIndex:'1500',color:'#aaa',backgroundColor:'#eee',padding:'5px 10px'}}>Please contact Professor

0 commit comments

Comments
 (0)