Skip to content

Commit

Permalink
Update components to conform to new structure
Browse files Browse the repository at this point in the history
  • Loading branch information
AlecDusheck committed Mar 3, 2019
1 parent c553d1c commit f879695
Show file tree
Hide file tree
Showing 14 changed files with 97 additions and 84 deletions.
100 changes: 48 additions & 52 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"zxcvbn": "^4.4.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.13.2",
"@angular-devkit/build-angular": "^0.13.4",
"@angular/cli": "^6.2.9",
"@angular/compiler-cli": "^6.1.0",
"@angular/language-service": "^6.1.0",
Expand Down
6 changes: 3 additions & 3 deletions src/app/controllers/main/login/login.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ export class LoginComponent implements OnInit {
this.credentials.email = this.loginForm.controls.email.value;
this.credentials.password = this.loginForm.controls.password.value;

console.log("doing login...");
console.log('doing login...');
try {
await this.auth.authorize(this.credentials);
console.log("authed! cache is being updated");
console.log('authed! cache is being updated');
await this.currentServer.updateCache();
console.log("redir...");
console.log('redir...');
await this.router.navigateByUrl(this.returnUrl);
} catch (e) {
this.error = e;
Expand Down
2 changes: 1 addition & 1 deletion src/app/controllers/main/profile/profile.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ <h2>Your Account</h2>
</div>
<p><b>Simply Servers ID: </b> {{data._id}}</p>
<p><b>Email: </b> {{data.account_info.email}}</p>
<p><b>Group ID: </b> {{data._group._id}}</p>
<p><b>Group: </b> {{data._group.displayName}}</p>
<p><b>Username: </b> {{data.account_info.username}}</p>
<p><b>Balance: </b> {{data.balance}} shards</p>
<p><b>Account verified: </b> {{data.account_info.accountVerify.accountVerified}}</p>
Expand Down
5 changes: 4 additions & 1 deletion src/app/controllers/panel-controller.serverpage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {AuthService} from '../services/auth.service';
import {ServerSocketIOService} from '../services/server-socket-io.service';
import {ActivatedRoute, Router} from '@angular/router';
import {FormBuilder} from '@angular/forms';
import {ServerActionsService} from '../services/server-actions.service';

@Injectable()
export abstract class ResponsiveServerPage {
Expand All @@ -20,6 +21,7 @@ export abstract class ResponsiveServerPage {
public router: Router,
public formBuilder: FormBuilder,
public activatedRoute: ActivatedRoute,
public serverActions: ServerActionsService
) { };

onFirstInit = async (): Promise<void> => {
Expand All @@ -42,7 +44,7 @@ export abstract class ResponsiveServerPage {
};

async ngInit (): Promise<void> {
console.log("works!");
console.log('works!');
// First init
await this.onFirstInit();

Expand All @@ -54,6 +56,7 @@ export abstract class ResponsiveServerPage {

// When the server is changed, refire loadData
this.selectedServerEmitter = this.currentServer.selectedServer.subscribe(() => {
console.log('reloading server data');
if (!this.currentServer.selectedServer.value) { return; }
this.loadData();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {ActivatedRoute, Router} from '@angular/router';
templateUrl: './panel-file-editor.component.html',
styleUrls: ['./panel-file-editor.component.scss']
})
export class PanelFileEditorComponent extends ResponsiveServerPage implements OnInit, OnDestroy{
export class PanelFileEditorComponent extends ResponsiveServerPage implements OnInit, OnDestroy {
loading = false;
blocked = false;
editName: string;
Expand Down Expand Up @@ -38,7 +38,7 @@ export class PanelFileEditorComponent extends ResponsiveServerPage implements On
this.editName = filePath;

try {
this.editForm.controls.content.setValue(await this.currentServer.selectedServer.value.getFileContents(filePath));
this.editForm.controls.content.setValue(await this.serverActions.getFileContents(filePath));
} catch (e) {
if (e === 'File not found.') {
this.newFile = true;
Expand All @@ -62,7 +62,7 @@ export class PanelFileEditorComponent extends ResponsiveServerPage implements On
this.editLoading = true;

try {
await this.currentServer.selectedServer.value.writeContents(this.editName, this.editForm.controls.content.value);
await this.serverActions.writeContents(this.editName, this.editForm.controls.content.value);
this.router.navigateByUrl('/panel/files');
} catch (e) {
this.error = e;
Expand Down
10 changes: 5 additions & 5 deletions src/app/controllers/panel/panel-files/panel-files.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {ActivatedRoute, Router} from '@angular/router';
templateUrl: './panel-files.component.html',
styleUrls: ['./panel-files.component.scss']
})
export class PanelFilesComponent extends ResponsiveServerPage implements OnInit, OnDestroy{
export class PanelFilesComponent extends ResponsiveServerPage implements OnInit, OnDestroy {
@ViewChild('addModal', {read: ElementRef}) addModal: ElementRef;
filesList: any;
currentPath: string;
Expand Down Expand Up @@ -44,7 +44,7 @@ export class PanelFilesComponent extends ResponsiveServerPage implements OnInit,
this.loading = true;

try {
this.filesList = await this.currentServer.selectedServer.value.listDir(this.currentPath);
this.filesList = await this.serverActions.listDir(this.currentPath);
} catch (e) {
this.notify.notify('error', 'Failed to get server files; ' + e);
}
Expand Down Expand Up @@ -78,14 +78,14 @@ export class PanelFilesComponent extends ResponsiveServerPage implements OnInit,
private remove = async (file: FileDetails): Promise<void> => {
if (file.isDir) {
try {
await this.currentServer.selectedServer.value.removeFolder(path.join(this.currentPath, file.name));
await this.serverActions.removeFolder(path.join(this.currentPath, file.name));
await this.updateListing();
} catch (e) {
this.notify.notify('error', 'Failed to remove folder. (is it not empty?)');
}
} else if (file.isFile) {
try {
await this.currentServer.selectedServer.value.removeFile(path.join(this.currentPath, file.name));
await this.serverActions.removeFile(path.join(this.currentPath, file.name));
await this.updateListing();
} catch (e) {
this.notify.notify('error', 'Failed to remove file.');
Expand Down Expand Up @@ -116,7 +116,7 @@ export class PanelFilesComponent extends ResponsiveServerPage implements OnInit,
const targetPath = path.join(this.currentPath, this.addForm.controls.path.value);

try {
const checkOk = await this.currentServer.selectedServer.value.checkAllowed(targetPath);
const checkOk = await this.serverActions.checkAllowed(targetPath);
if (checkOk) {
this.addModal.nativeElement.click();
this.router.navigateByUrl('/panel/files/edit?f=' + targetPath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
class="material-icons switch-arrow">arrow_left</i></button>
<div id="server">
<span id="status"><span class="bold">Status: </span>{{serverSocket.statusSource.value}} <span class='dot'
[ngClass]="{'Starting': 'dot-working', 'Running': 'dot-running', 'Stopping': 'dot-working', 'Stopped':'dot-stopped', 'Crashed':'dot-stopped', 'Loading':'dot-working' }[status]"></span> </span>
[ngClass]="{'Starting': 'dot-working', 'Running': 'dot-running', 'Stopping': 'dot-working', 'Stopped':'dot-stopped', 'Crashed':'dot-stopped', 'Loading':'dot-working' }[serverSocket.statusSource.value]"></span> </span>
</div>
</div>
<notifier-container></notifier-container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {Subscription} from 'rxjs';
templateUrl: './panel-frame.component.html',
styleUrls: ['./panel-frame.component.scss']
})
export class PanelFrameComponent extends ResponsiveServerPage implements OnInit, OnDestroy{
export class PanelFrameComponent extends ResponsiveServerPage implements OnInit, OnDestroy {
loaded = false;
sidebarDisplayed = true;
currentUrl: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</div>
<div class="card-block">
<button (click)="installServer()"
*ngIf="!serverSocket.installed"
*ngIf="!serverSocket.installedSource.value"
[disabled]="serverSocket.blockedSource.value || serverSocket.statusSource.value !== 'Stopped'"
class="btn btn-info btn-lg btn-block server-action"
data-target="#installModal" data-toggle="modal" type="button">
Expand Down
Loading

0 comments on commit f879695

Please sign in to comment.