Compare commits
No commits in common. "Angular" and "v0.0.1-alpha.2" have entirely different histories.
Angular
...
v0.0.1-alp
3 changed files with 4 additions and 19 deletions
|
|
@ -58,4 +58,5 @@
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</ngb-panel>
|
</ngb-panel>
|
||||||
</ngb-accordion>
|
</ngb-accordion>
|
||||||
|
<p>{{ cell | json }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,8 @@
|
||||||
<tbody *ngFor="let y of xArray">
|
<tbody *ngFor="let y of xArray">
|
||||||
<tr>
|
<tr>
|
||||||
<th>{{ y }}</th>
|
<th>{{ y }}</th>
|
||||||
<td *ngFor="let x of xArray">
|
<td *ngFor="let x of xArray"><a
|
||||||
<button class="btn btn-sm btn-outline-primary" [routerLink]="['/config','server', serverLookup[x][y]]" *ngIf="serverLookup[x][y] !== undefined">{{ serverLookup[x][y] }}</button>
|
[routerLink]="['/config','server', serverLookup[x][y]]">{{ serverLookup[x][y] }}</a></td>
|
||||||
<button class="btn btn-sm btn-outline-danger" (click)="addNewServer(x, y)" *ngIf="serverLookup[x][y] === undefined">+</button>
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { Server } from "../../../server";
|
import { Server } from "../../../server";
|
||||||
import { ServerGridModel } from "../../../models/serverGrid.model";
|
import { ServerGridModel } from "../../../models/serverGrid.model";
|
||||||
import { ServerModel } from "../../../models/atlasData/server.model";
|
|
||||||
import { Router } from "@angular/router";
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-servers',
|
selector: 'app-servers',
|
||||||
|
|
@ -17,14 +15,10 @@ export class ServersComponent implements OnInit {
|
||||||
private serverLookup: number[][] = [];
|
private serverLookup: number[][] = [];
|
||||||
private unknownServers: number[] = [];
|
private unknownServers: number[] = [];
|
||||||
|
|
||||||
constructor(private server: Server, private router: Router) {
|
constructor(private server: Server) {
|
||||||
this.grid = server.serverGrid;
|
this.grid = server.serverGrid;
|
||||||
this.xArray = Array.from(Array(this.grid.totalGridsX).keys());
|
this.xArray = Array.from(Array(this.grid.totalGridsX).keys());
|
||||||
this.yArray = Array.from(Array(this.grid.totalGridsY).keys());
|
this.yArray = Array.from(Array(this.grid.totalGridsY).keys());
|
||||||
|
|
||||||
// Initialise the serverLookup with x at least
|
|
||||||
this.xArray.forEach(i => this.serverLookup[i] = []);
|
|
||||||
|
|
||||||
this.grid.servers.forEach((i, index) => {
|
this.grid.servers.forEach((i, index) => {
|
||||||
if (i.gridX < this.grid.totalGridsX && i.gridY < this.grid.totalGridsY) {
|
if (i.gridX < this.grid.totalGridsX && i.gridY < this.grid.totalGridsY) {
|
||||||
if (this.serverLookup[i.gridX] === undefined)
|
if (this.serverLookup[i.gridX] === undefined)
|
||||||
|
|
@ -38,12 +32,4 @@ export class ServersComponent implements OnInit {
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private addNewServer(x: number, y: number) {
|
|
||||||
let newServer = new ServerModel();
|
|
||||||
newServer.gridX = x;
|
|
||||||
newServer.gridY = y;
|
|
||||||
const newLength = this.grid.servers.push(newServer);
|
|
||||||
return this.router.navigate(['/config', 'server', newLength - 1]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue