Package Zearch Temp Implementation
* Adds Basic form * Adds Unit Classes * Adds API Request option Signed-off-by: Indrajith K L <indrajith@indrajith.dev>
This commit is contained in:
112
backup/main.lfm
Normal file
112
backup/main.lfm
Normal file
@@ -0,0 +1,112 @@
|
||||
object Form1: TForm1
|
||||
Left = 149
|
||||
Height = 296
|
||||
Top = 250
|
||||
Width = 704
|
||||
Caption = 'Package Zerch'
|
||||
ClientHeight = 296
|
||||
ClientWidth = 704
|
||||
ShowInTaskBar = stAlways
|
||||
SnapOptions.SnapToMonitor = True
|
||||
OnCreate = FormCreate
|
||||
object TabControl1: TTabControl
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 296
|
||||
Top = 0
|
||||
Width = 712
|
||||
OnChange = TabControl1Change
|
||||
TabIndex = 0
|
||||
Tabs.Strings = (
|
||||
'Search'
|
||||
'Metadata'
|
||||
'Versions'
|
||||
)
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
TabOrder = 0
|
||||
object lblSearch: TLabel
|
||||
Left = 8
|
||||
Height = 15
|
||||
Top = 32
|
||||
Width = 79
|
||||
Caption = 'Package Name'
|
||||
end
|
||||
object TxtBoxSearch: TEdit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 96
|
||||
Height = 23
|
||||
Top = 32
|
||||
Width = 504
|
||||
TabOrder = 1
|
||||
OnChange = TxtBoxSearchChange
|
||||
end
|
||||
object BtnSearch: TButton
|
||||
Left = 608
|
||||
Height = 26
|
||||
Top = 29
|
||||
Width = 75
|
||||
Caption = 'Search'
|
||||
TabOrder = 2
|
||||
OnClick = BtnSearchClick
|
||||
end
|
||||
object memoTest: TMemo
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 192
|
||||
Top = 96
|
||||
Width = 688
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
ScrollBars = ssAutoVertical
|
||||
TabOrder = 3
|
||||
end
|
||||
object Label1: TLabel
|
||||
Left = 8
|
||||
Height = 15
|
||||
Top = 77
|
||||
Width = 98
|
||||
Caption = 'Debug[Response]'
|
||||
Color = 8388863
|
||||
Font.CharSet = ANSI_CHARSET
|
||||
Font.Color = clFuchsia
|
||||
Font.Pitch = fpVariable
|
||||
Font.Quality = fqDraft
|
||||
Font.Style = [fsBold]
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
end
|
||||
object ExtendedTabControl1: TExtendedTabControl
|
||||
Left = 360
|
||||
Height = 150
|
||||
Top = 104
|
||||
Width = 200
|
||||
TabIndex = 0
|
||||
Tabs.Strings = (
|
||||
'1'
|
||||
'2'
|
||||
'3'
|
||||
)
|
||||
TabOrder = 4
|
||||
ShowToolBar = tsNone
|
||||
object ExtendedTabToolbar1: TExtendedTabToolbar
|
||||
Left = 0
|
||||
Height = 26
|
||||
Top = 0
|
||||
Width = 150
|
||||
Align = alCustom
|
||||
AutoSize = True
|
||||
Caption = 'ExtendedTabToolbar1'
|
||||
TabOrder = 0
|
||||
Visible = False
|
||||
end
|
||||
object Label2: TLabel
|
||||
Left = 102
|
||||
Height = 15
|
||||
Top = 83
|
||||
Width = 34
|
||||
Caption = 'Label2'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
85
backup/main.pas
Normal file
85
backup/main.pas
Normal file
@@ -0,0 +1,85 @@
|
||||
unit main;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls,
|
||||
ComCtrls, ExtendedTabControls, fphttpclient, opensslsockets, fpjson,
|
||||
jsonparser, ThreadUnit;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = class(TForm)
|
||||
BtnSearch: TButton;
|
||||
ExtendedTabControl1: TExtendedTabControl;
|
||||
ExtendedTabToolbar1: TExtendedTabToolbar;
|
||||
Label1: TLabel;
|
||||
Label2: TLabel;
|
||||
memoTest: TMemo;
|
||||
TxtBoxSearch: TEdit;
|
||||
lblSearch: TLabel;
|
||||
TabControl1: TTabControl;
|
||||
procedure BtnSearchClick(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure TabControl1Change(Sender: TObject);
|
||||
procedure TxtBoxSearchChange(Sender: TObject);
|
||||
private
|
||||
|
||||
public
|
||||
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
Client: TFPHTTPClient;
|
||||
Response: string;
|
||||
PackageName: string;
|
||||
jData: TJSONData;
|
||||
packageData: TJSONObject;
|
||||
test1: ThreadClass;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
procedure TForm1.FormCreate(Sender: TObject);
|
||||
begin
|
||||
BtnSearch.Enabled := False;
|
||||
|
||||
end;
|
||||
|
||||
procedure TForm1.BtnSearchClick(Sender: TObject);
|
||||
begin
|
||||
PackageName := TxtBoxSearch.Text;
|
||||
Client := TFPHTTPClient.Create(nil);
|
||||
try
|
||||
test1 := ThreadClass.create();
|
||||
Response := Client.Get(Concat('https://registry.npmjs.org/', PackageName));
|
||||
jData := GetJSON(Response);
|
||||
packageData := jData as TJSONObject;
|
||||
memoTest.Lines.Text := jData.FormatJSON;
|
||||
finally
|
||||
Client.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.TabControl1Change(Sender: TObject);
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
procedure TForm1.TxtBoxSearchChange(Sender: TObject);
|
||||
begin
|
||||
if Length(TxtBoxSearch.Text) > 1 then
|
||||
BtnSearch.Enabled := True
|
||||
else
|
||||
BtnSearch.Enabled := False;
|
||||
end;
|
||||
|
||||
end.
|
||||
86
backup/package_zerch.lpi
Normal file
86
backup/package_zerch.lpi
Normal file
@@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="12"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<Title Value="package_zerch"/>
|
||||
<Scaled Value="True"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<XPManifest>
|
||||
<DpiAware Value="True"/>
|
||||
</XPManifest>
|
||||
<Icon Value="0"/>
|
||||
</General>
|
||||
<BuildModes>
|
||||
<Item Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<UseFileFilters Value="True"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
</RunParams>
|
||||
<RequiredPackages>
|
||||
<Item>
|
||||
<PackageName Value="LazControls"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<PackageName Value="LazControlDsgn"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item>
|
||||
</RequiredPackages>
|
||||
<Units>
|
||||
<Unit>
|
||||
<Filename Value="package_zerch.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit>
|
||||
<Unit>
|
||||
<Filename Value="main.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
</Unit>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="package_zerch"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<DebugInfoType Value="dsDwarf3"/>
|
||||
</Debugging>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions>
|
||||
<Item>
|
||||
<Name Value="EAbort"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
||||
176
backup/package_zerch.lps
Normal file
176
backup/package_zerch.lps
Normal file
@@ -0,0 +1,176 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectSession>
|
||||
<PathDelim Value="\"/>
|
||||
<Version Value="12"/>
|
||||
<BuildModes Active="Default"/>
|
||||
<Units>
|
||||
<Unit>
|
||||
<Filename Value="package_zerch.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<WindowIndex Value="-1"/>
|
||||
<TopLine Value="-1"/>
|
||||
<CursorPos X="-1" Y="-1"/>
|
||||
<UsageCount Value="24"/>
|
||||
</Unit>
|
||||
<Unit>
|
||||
<Filename Value="main.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<TopLine Value="39"/>
|
||||
<CursorPos X="10" Y="43"/>
|
||||
<UsageCount Value="24"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
</Unit>
|
||||
<Unit>
|
||||
<Filename Value="C:\lazarus\lcl\include\control.inc"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<TopLine Value="4000"/>
|
||||
<CursorPos Y="4010"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit>
|
||||
<Unit>
|
||||
<Filename Value="threadunit.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="ThreadUnit"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="11"/>
|
||||
<CursorPos X="40" Y="26"/>
|
||||
<UsageCount Value="21"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit>
|
||||
</Units>
|
||||
<JumpHistory HistoryIndex="29">
|
||||
<Position>
|
||||
<Filename Value="main.pas"/>
|
||||
<Caret Line="9" Column="41"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="main.pas"/>
|
||||
<Caret Line="4" Column="11"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="main.pas"/>
|
||||
<Caret Line="52" Column="84" TopLine="42"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="main.pas"/>
|
||||
<Caret Line="55" Column="30" TopLine="42"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="main.pas"/>
|
||||
<Caret Line="51" Column="57" TopLine="36"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="main.pas"/>
|
||||
<Caret Line="48" TopLine="44"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="main.pas"/>
|
||||
<Caret Line="54" TopLine="44"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="main.pas"/>
|
||||
<Caret Line="61" Column="37" TopLine="46"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="main.pas"/>
|
||||
<Caret Line="55" Column="38" TopLine="44"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="main.pas"/>
|
||||
<Caret Line="57" Column="38" TopLine="46"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="main.pas"/>
|
||||
<Caret Line="66" TopLine="57"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="main.pas"/>
|
||||
<Caret Line="65" TopLine="55"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="main.pas"/>
|
||||
<Caret Line="60" Column="15"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="main.pas"/>
|
||||
<Caret Line="57" TopLine="47"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="main.pas"/>
|
||||
<Caret Line="58" TopLine="48"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="main.pas"/>
|
||||
<Caret Line="57" TopLine="47"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="main.pas"/>
|
||||
<Caret Line="58" TopLine="48"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="main.pas"/>
|
||||
<Caret Line="60" TopLine="50"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="threadunit.pas"/>
|
||||
<Caret Line="16" Column="16"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="threadunit.pas"/>
|
||||
<Caret Line="19" Column="5"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="threadunit.pas"/>
|
||||
<Caret Line="18" Column="26" TopLine="2"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="main.pas"/>
|
||||
<Caret Line="61" Column="34" TopLine="52"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="main.pas"/>
|
||||
<Caret Line="43" Column="21" TopLine="33"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="threadunit.pas"/>
|
||||
<Caret Line="23" Column="3" TopLine="8"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="main.pas"/>
|
||||
<Caret Line="46" Column="35" TopLine="60"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="main.pas"/>
|
||||
<Caret Line="47" Column="29" TopLine="33"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="threadunit.pas"/>
|
||||
<Caret Line="14" Column="25" TopLine="8"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="threadunit.pas"/>
|
||||
<Caret Line="28" TopLine="8"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="main.pas"/>
|
||||
<Caret Line="43" Column="10" TopLine="33"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="threadunit.pas"/>
|
||||
<Caret Line="12" Column="19" TopLine="2"/>
|
||||
</Position>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
<Modes ActiveMode=""/>
|
||||
</RunParams>
|
||||
</ProjectSession>
|
||||
</CONFIG>
|
||||
31
backup/threadunit.pas
Normal file
31
backup/threadunit.pas
Normal file
@@ -0,0 +1,31 @@
|
||||
unit ThreadUnit;
|
||||
|
||||
{$mode ObjFPC}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Dialogs;
|
||||
|
||||
|
||||
|
||||
type
|
||||
|
||||
{ThreadClass}
|
||||
|
||||
ThreadClass = class
|
||||
public
|
||||
constructor create();
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
constructor ThreadClass.create();
|
||||
begin
|
||||
ShowMessage("Hello from Another Unit");
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
|
||||
Reference in New Issue
Block a user